packages (LINUX_2_6_38): kernel/kernel-small_fixes.patch, kernel/kernel.spe...

arekm arekm at pld-linux.org
Wed Sep 7 18:38:28 CEST 2011


Author: arekm                        Date: Wed Sep  7 16:38:28 2011 GMT
Module: packages                      Tag: LINUX_2_6_38
---- Log message:
- rel 5; fix hang problems when ulinking big number of files

---- Files affected:
packages/kernel:
   kernel-small_fixes.patch (1.25.2.5 -> 1.25.2.6) , kernel.spec (1.924.2.8 -> 1.924.2.9) 

---- Diffs:

================================================================
Index: packages/kernel/kernel-small_fixes.patch
diff -u packages/kernel/kernel-small_fixes.patch:1.25.2.5 packages/kernel/kernel-small_fixes.patch:1.25.2.6
--- packages/kernel/kernel-small_fixes.patch:1.25.2.5	Mon Jul 11 17:20:14 2011
+++ packages/kernel/kernel-small_fixes.patch	Wed Sep  7 18:38:23 2011
@@ -269,3 +269,112 @@
  	/*
  	 * Blow away any referenced inode in the filestreams cache.
 
+commit 1316d4da3f632d5843d5a446203e73067dc40f09
+Author: Dave Chinner <dchinner at redhat.com>
+Date:   Mon Jul 4 05:27:36 2011 +0000
+
+    xfs: unpin stale inodes directly in IOP_COMMITTED
+    
+    When inodes are marked stale in a transaction, they are treated
+    specially when the inode log item is being inserted into the AIL.
+    It tries to avoid moving the log item forward in the AIL due to a
+    race condition with the writing the underlying buffer back to disk.
+    The was "fixed" in commit de25c18 ("xfs: avoid moving stale inodes
+    in the AIL").
+    
+    To avoid moving the item forward, we return a LSN smaller than the
+    commit_lsn of the completing transaction, thereby trying to trick
+    the commit code into not moving the inode forward at all. I'm not
+    sure this ever worked as intended - it assumes the inode is already
+    in the AIL, but I don't think the returned LSN would have been small
+    enough to prevent moving the inode. It appears that the reason it
+    worked is that the lower LSN of the inodes meant they were inserted
+    into the AIL and flushed before the inode buffer (which was moved to
+    the commit_lsn of the transaction).
+    
+    The big problem is that with delayed logging, the returning of the
+    different LSN means insertion takes the slow, non-bulk path.  Worse
+    yet is that insertion is to a position -before- the commit_lsn so it
+    is doing a AIL traversal on every insertion, and has to walk over
+    all the items that have already been inserted into the AIL. It's
+    expensive.
+    
+    To compound the matter further, with delayed logging inodes are
+    likely to go from clean to stale in a single checkpoint, which means
+    they aren't even in the AIL at all when we come across them at AIL
+    insertion time. Hence these were all getting inserted into the AIL
+    when they simply do not need to be as inodes marked XFS_ISTALE are
+    never written back.
+    
+    Transactional/recovery integrity is maintained in this case by the
+    other items in the unlink transaction that were modified (e.g. the
+    AGI btree blocks) and committed in the same checkpoint.
+    
+    So to fix this, simply unpin the stale inodes directly in
+    xfs_inode_item_committed() and return -1 to indicate that the AIL
+    insertion code does not need to do any further processing of these
+    inodes.
+    
+    Signed-off-by: Dave Chinner <dchinner at redhat.com>
+    Reviewed-by: Christoph Hellwig <hch at lst.de>
+    Signed-off-by: Alex Elder <aelder at sgi.com>
+
+diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
+index 09983a3..b1e88d5 100644
+--- a/fs/xfs/xfs_inode_item.c
++++ b/fs/xfs/xfs_inode_item.c
+@@ -681,15 +681,15 @@ xfs_inode_item_unlock(
+  * where the cluster buffer may be unpinned before the inode is inserted into
+  * the AIL during transaction committed processing. If the buffer is unpinned
+  * before the inode item has been committed and inserted, then it is possible
+- * for the buffer to be written and IO completions before the inode is inserted
++ * for the buffer to be written and IO completes before the inode is inserted
+  * into the AIL. In that case, we'd be inserting a clean, stale inode into the
+  * AIL which will never get removed. It will, however, get reclaimed which
+  * triggers an assert in xfs_inode_free() complaining about freein an inode
+  * still in the AIL.
+  *
+- * To avoid this, return a lower LSN than the one passed in so that the
+- * transaction committed code will not move the inode forward in the AIL but
+- * will still unpin it properly.
++ * To avoid this, just unpin the inode directly and return a LSN of -1 so the
++ * transaction committed code knows that it does not need to do any further
++ * processing on the item.
+  */
+ STATIC xfs_lsn_t
+ xfs_inode_item_committed(
+@@ -699,8 +699,10 @@ xfs_inode_item_committed(
+ 	struct xfs_inode_log_item *iip = INODE_ITEM(lip);
+ 	struct xfs_inode	*ip = iip->ili_inode;
+ 
+-	if (xfs_iflags_test(ip, XFS_ISTALE))
+-		return lsn - 1;
++	if (xfs_iflags_test(ip, XFS_ISTALE)) {
++		xfs_inode_item_unpin(lip, 0);
++		return -1;
++	}
+ 	return lsn;
+ }
+ 
+diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
+index 7c7bc2b..c83f63b 100644
+--- a/fs/xfs/xfs_trans.c
++++ b/fs/xfs/xfs_trans.c
+@@ -1361,7 +1361,7 @@ xfs_trans_item_committed(
+ 		lip->li_flags |= XFS_LI_ABORTED;
+ 	item_lsn = IOP_COMMITTED(lip, commit_lsn);
+ 
+-	/* If the committed routine returns -1, item has been freed. */
++	/* item_lsn of -1 means the item needs no further processing */
+ 	if (XFS_LSN_CMP(item_lsn, (xfs_lsn_t)-1) == 0)
+ 		return;
+ 
+@@ -1474,7 +1474,7 @@ xfs_trans_committed_bulk(
+ 			lip->li_flags |= XFS_LI_ABORTED;
+ 		item_lsn = IOP_COMMITTED(lip, commit_lsn);
+ 
+-		/* item_lsn of -1 means the item was freed */
++		/* item_lsn of -1 means the item needs no further processing */
+ 		if (XFS_LSN_CMP(item_lsn, (xfs_lsn_t)-1) == 0)
+ 			continue;
+ 

================================================================
Index: packages/kernel/kernel.spec
diff -u packages/kernel/kernel.spec:1.924.2.8 packages/kernel/kernel.spec:1.924.2.9
--- packages/kernel/kernel.spec:1.924.2.8	Sat Aug 13 21:04:03 2011
+++ packages/kernel/kernel.spec	Wed Sep  7 18:38:23 2011
@@ -95,7 +95,7 @@
 
 %define		basever		2.6.38
 %define		postver		.8
-%define		rel		4
+%define		rel		5
 
 %define		_enable_debug_packages			0
 
@@ -1577,6 +1577,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.924.2.9  2011/09/07 16:38:23  arekm
+- rel 5; fix hang problems when ulinking big number of files
+
 Revision 1.924.2.8  2011/08/13 19:04:03  glen
 - linuxant patch
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/kernel/kernel-small_fixes.patch?r1=1.25.2.5&r2=1.25.2.6&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/kernel/kernel.spec?r1=1.924.2.8&r2=1.924.2.9&f=u



More information about the pld-cvs-commit mailing list