packages (LINUX_3_0): kernel/kernel-small_fixes.patch - avoid 30s xfs hangs

arekm arekm at pld-linux.org
Fri Dec 2 20:46:29 CET 2011


Author: arekm                        Date: Fri Dec  2 19:46:29 2011 GMT
Module: packages                      Tag: LINUX_3_0
---- Log message:
- avoid 30s xfs hangs

---- Files affected:
packages/kernel:
   kernel-small_fixes.patch (1.43.2.9 -> 1.43.2.10) 

---- Diffs:

================================================================
Index: packages/kernel/kernel-small_fixes.patch
diff -u packages/kernel/kernel-small_fixes.patch:1.43.2.9 packages/kernel/kernel-small_fixes.patch:1.43.2.10
--- packages/kernel/kernel-small_fixes.patch:1.43.2.9	Sun Nov 27 15:14:00 2011
+++ packages/kernel/kernel-small_fixes.patch	Fri Dec  2 20:46:24 2011
@@ -1077,3 +1077,90 @@
 -- 
 1.7.4.1
 
+From: Christoph Hellwig <hch at lst.de>
+Date: Tue, 29 Nov 2011 18:06:14 +0000 (-0600)
+Subject: xfs: force buffer writeback before blocking on the ilock in inode reclaim
+X-Git-Url: http://oss.sgi.com/cgi-bin/gitweb.cgi?p=xfs%2Fxfs.git;a=commitdiff_plain;h=4dd2cb4a28b7ab1f37163a4eba280926a13a8749
+
+xfs: force buffer writeback before blocking on the ilock in inode reclaim
+
+If we are doing synchronous inode reclaim we block the VM from making
+progress in memory reclaim.  So if we encouter a flush locked inode
+promote it in the delwri list and wake up xfsbufd to write it out now.
+Without this we can get hangs of up to 30 seconds during workloads hitting
+synchronous inode reclaim.
+
+The scheme is copied from what we do for dquot reclaims.
+
+Reported-by: Simon Kirby <sim at hostway.ca>
+Signed-off-by: Christoph Hellwig <hch at lst.de>
+Tested-by: Simon Kirby <sim at hostway.ca>
+Signed-off-by: Ben Myers <bpm at sgi.com>
+---
+
+diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
+index c0237c6..755ee81 100644
+--- a/fs/xfs/xfs_inode.c
++++ b/fs/xfs/xfs_inode.c
+@@ -2835,6 +2835,27 @@ corrupt_out:
+ 	return XFS_ERROR(EFSCORRUPTED);
+ }
+ 
++void
++xfs_promote_inode(
++	struct xfs_inode	*ip)
++{
++	struct xfs_buf		*bp;
++
++	ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED));
++
++	bp = xfs_incore(ip->i_mount->m_ddev_targp, ip->i_imap.im_blkno,
++			ip->i_imap.im_len, XBF_TRYLOCK);
++	if (!bp)
++		return;
++
++	if (XFS_BUF_ISDELAYWRITE(bp)) {
++		xfs_buf_delwri_promote(bp);
++		wake_up_process(ip->i_mount->m_ddev_targp->bt_task);
++	}
++
++	xfs_buf_relse(bp);
++}
++
+ /*
+  * Return a pointer to the extent record at file index idx.
+  */
+diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
+index 760140d..b4cd473 100644
+--- a/fs/xfs/xfs_inode.h
++++ b/fs/xfs/xfs_inode.h
+@@ -498,6 +498,7 @@ int		xfs_iunlink(struct xfs_trans *, xfs_inode_t *);
+ void		xfs_iext_realloc(xfs_inode_t *, int, int);
+ void		xfs_iunpin_wait(xfs_inode_t *);
+ int		xfs_iflush(xfs_inode_t *, uint);
++void		xfs_promote_inode(struct xfs_inode *);
+ void		xfs_lock_inodes(xfs_inode_t **, int, uint);
+ void		xfs_lock_two_inodes(xfs_inode_t *, xfs_inode_t *, uint);
+ 
+diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c
+index aa3dc1a..be5c51d 100644
+--- a/fs/xfs/linux-2.6/xfs_sync.c
++++ b/fs/xfs/linux-2.6/xfs_sync.c
+@@ -770,6 +770,17 @@ restart:
+ 	if (!xfs_iflock_nowait(ip)) {
+ 		if (!(sync_mode & SYNC_WAIT))
+ 			goto out;
++
++		/*
++		 * If we only have a single dirty inode in a cluster there is
++		 * a fair chance that the AIL push may have pushed it into
++		 * the buffer, but xfsbufd won't touch it until 30 seconds
++		 * from now, and thus we will lock up here.
++		 *
++		 * Promote the inode buffer to the front of the delwri list
++		 * and wake up xfsbufd now.
++		 */
++		xfs_promote_inode(ip);
+ 		xfs_iflock(ip);
+ 	}
+ 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/kernel/kernel-small_fixes.patch?r1=1.43.2.9&r2=1.43.2.10&f=u



More information about the pld-cvs-commit mailing list