r2992 - in trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian: . patches patches/series

maximilian attems maks-guest@costa.debian.org
Thu, 21 Apr 2005 10:14:49 +0000


Author: maks-guest
Date: 2005-04-21 10:14:48 +0000 (Thu, 21 Apr 2005)
New Revision: 2992

Added:
   trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/fs-jdb-slow-leak.dpatch
Modified:
   trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/changelog
   trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/series/2.6.8-16
Log:
fix bad jdb leak got fixed in 2.6.12-rc3, existed since 2.6.6


Modified: trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/changelog
===================================================================
--- trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/changelog	2005-04-18 20:36:08 UTC (rev 2991)
+++ trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/changelog	2005-04-21 10:14:48 UTC (rev 2992)
@@ -120,6 +120,9 @@
     by using interupd disabling spin locks.
     (Simon Horman)
 
+  * fs-jdb-slow-leak.dpatch
+    Fix longstanding jdb commit leak - since 2.6.6. (Maximilian Attems)
+
  -- Simon Horman <horms@debian.org>  Wed, 13 Apr 2005 17:23:38 +0900
 
 kernel-source-2.6.8 (2.6.8-15) unstable; urgency=high

Added: trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/fs-jdb-slow-leak.dpatch
===================================================================
--- trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/fs-jdb-slow-leak.dpatch	2005-04-18 20:36:08 UTC (rev 2991)
+++ trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/fs-jdb-slow-leak.dpatch	2005-04-21 10:14:48 UTC (rev 2992)
@@ -0,0 +1,78 @@
+tree 9531a56973381aa48a10fbc7073d1109f380d550
+parent 19272d4385126c2ac369c9f6137a27a08aee50d1
+author akpm@osdl.org <akpm@osdl.org> Sun, 17 Apr 2005 05:26:36 -0700
+committer Linus Torvalds <torvalds@ppc970.osdl.org> Sun, 17 Apr 2005 05:26:36 -0700
+
+[PATCH] jbd dirty buffer leak fix
+
+This fixes the lots-of-fsx-linux-instances-cause-a-slow-leak bug.
+
+It's been there since 2.6.6, caused by:
+
+ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.5/2.6.5-mm4/broken-out/jbd-move-locked-buffers.patch
+
+That patch moves under-writeout ordered-data buffers onto a separate journal
+list during commit.  It took out the old code which was based on a single
+list.
+
+The old code (necessarily) had logic which would restart I/O against buffers
+which had been redirtied while they were on the committing transaction's
+t_sync_datalist list.  The new code only writes buffers once, ignoring
+redirtyings by a later transaction, which is good.
+
+But over on the truncate side of things, in journal_unmap_buffer(), we're
+treating buffers on the t_locked_list as inviolable things which belong to the
+committing transaction, and we just leave them alone during concurrent
+truncate-vs-commit.
+
+The net effect is that when truncate tries to invalidate a page whose buffers
+are on t_locked_list and have been redirtied, journal_unmap_buffer() just
+leaves those buffers alone.  truncate will remove the page from its mapping
+and we end up with an anonymous clean page with dirty buffers, which is an
+illegal state for a page.  The JBD commit will not clean those buffers as they
+are removed from t_locked_list.  The VM (try_to_free_buffers) cannot reclaim
+these pages.
+
+The patch teaches journal_unmap_buffer() about buffers which are on the
+committing transaction's t_locked_list.  These buffers have been written and
+I/O has completed.  We can take them off the transaction and undirty them
+within the context of journal_invalidatepage()->journal_unmap_buffer().
+
+Acked-by: "Stephen C. Tweedie" <sct@redhat.com>
+Signed-off-by: Andrew Morton <akpm@osdl.org>
+Signed-off-by: Linus Torvalds <torvalds@osdl.org>
+
+ jbd/transaction.c |   13 +++++++++++--
+ 1 files changed, 11 insertions(+), 2 deletions(-)
+
+Index: fs/jbd/transaction.c
+===================================================================
+--- 5f2ddb00d8ecf6b55bdb74366f2c9427691aa57c/fs/jbd/transaction.c  (mode:100644 sha1:932e7c1ef4a1c0eeb0867dc20a560524e8bd7834)
++++ 9531a56973381aa48a10fbc7073d1109f380d550/fs/jbd/transaction.c  (mode:100644 sha1:77b7662b840b480f681c8cc889c5689d2b60f253)
+@@ -1831,7 +1831,17 @@
+ 			}
+ 		}
+ 	} else if (transaction == journal->j_committing_transaction) {
+-		/* If it is committing, we simply cannot touch it.  We
++		if (jh->b_jlist == BJ_Locked) {
++			/*
++			 * The buffer is on the committing transaction's locked
++			 * list.  We have the buffer locked, so I/O has
++			 * completed.  So we can nail the buffer now.
++			 */
++			may_free = __dispose_buffer(jh, transaction);
++			goto zap_buffer;
++		}
++		/*
++		 * If it is committing, we simply cannot touch it.  We
+ 		 * can remove it's next_transaction pointer from the
+ 		 * running transaction if that is set, but nothing
+ 		 * else. */
+@@ -1906,7 +1916,6 @@
+ 		unsigned int next_off = curr_off + bh->b_size;
+ 		next = bh->b_this_page;
+ 
+-		/* AKPM: doing lock_buffer here may be overly paranoid */
+ 		if (offset <= curr_off) {
+ 		 	/* This block is wholly outside the truncation point */
+ 			lock_buffer(bh);

Modified: trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/series/2.6.8-16
===================================================================
--- trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/series/2.6.8-16	2005-04-18 20:36:08 UTC (rev 2991)
+++ trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/series/2.6.8-16	2005-04-21 10:14:48 UTC (rev 2992)
@@ -27,3 +27,4 @@
 + drivers-i2c-chips-eprom.dpatch
 + lib-rwsem-spinlock.dpatch
 + sparc64-sigpoll-2.6.8.dpatch
++ fs-jdb-slow-leak.dpatch