rpms/kernel/F-10 jbd-fix-return-value-of-journal-start-commit.patch, NONE, 1.1.2.1 kernel.spec, 1.1206.2.103, 1.1206.2.104

Chuck Ebbert cebbert at fedoraproject.org
Tue Oct 13 01:19:22 UTC 2009


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv21621

Modified Files:
      Tag: private-fedora-10-2_6_27
	kernel.spec 
Added Files:
      Tag: private-fedora-10-2_6_27
	jbd-fix-return-value-of-journal-start-commit.patch 
Log Message:
Add jbd fix for file corruption (the jbd2 version is already in.)

jbd-fix-return-value-of-journal-start-commit.patch:
 journal.c |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

--- NEW FILE jbd-fix-return-value-of-journal-start-commit.patch ---
From: Jan Kara <jack at suse.cz>
Date: Wed, 11 Feb 2009 21:04:25 +0000 (-0800)
Subject: jbd: fix return value of journal_start_commit()
X-Git-Tag: v2.6.29-rc5~24
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=8fe4cd0dc5ea43760c59eb256404188272cc95dd

jbd: fix return value of journal_start_commit()

journal_start_commit() returns 1 if either a transaction is committing or
the function has queued a transaction commit.  But it returns 0 if we
raced with somebody queueing the transaction commit as well.  This
resulted in ext3_sync_fs() not functioning correctly (description from
Arthur Jones): In the case of a data=ordered umount with pending long
symlinks which are delayed due to a long list of other I/O on the backing
block device, this causes the buffer associated with the long symlinks to
not be moved to the inode dirty list in the second phase of fsync_super.
Then, before they can be dirtied again, kjournald exits, seeing the UMOUNT
flag and the dirty pages are never written to the backing block device,
causing long symlink corruption and exposing new or previously freed block
data to userspace.

This can be reproduced with a script created by Eric Sandeen
<sandeen at redhat.com>:

        #!/bin/bash

        umount /mnt/test2
        mount /dev/sdb4 /mnt/test2
        rm -f /mnt/test2/*
        dd if=/dev/zero of=/mnt/test2/bigfile bs=1M count=512
        touch /mnt/test2/thisisveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryverylongfilename
        ln -s /mnt/test2/thisisveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryverylongfilename
        /mnt/test2/link
        umount /mnt/test2
        mount /dev/sdb4 /mnt/test2
        ls /mnt/test2/

This patch fixes journal_start_commit() to always return 1 when there's
a transaction committing or queued for commit.

Cc: Eric Sandeen <sandeen at redhat.com>
Cc: Mike Snitzer <snitzer at gmail.com>
Cc: <linux-ext4 at vger.kernel.org>
Signed-off-by: Jan Kara <jack at suse.cz>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---

diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
index 9e4fa52..e79c078 100644
--- a/fs/jbd/journal.c
+++ b/fs/jbd/journal.c
@@ -427,7 +427,7 @@ int __log_space_left(journal_t *journal)
 }
 
 /*
- * Called under j_state_lock.  Returns true if a transaction was started.
+ * Called under j_state_lock.  Returns true if a transaction commit was started.
  */
 int __log_start_commit(journal_t *journal, tid_t target)
 {
@@ -495,7 +495,8 @@ int journal_force_commit_nested(journal_t *journal)
 
 /*
  * Start a commit of the current running transaction (if any).  Returns true
- * if a transaction was started, and fills its tid in at *ptid
+ * if a transaction is going to be committed (or is currently already
+ * committing), and fills its tid in at *ptid
  */
 int journal_start_commit(journal_t *journal, tid_t *ptid)
 {
@@ -505,15 +506,19 @@ int journal_start_commit(journal_t *journal, tid_t *ptid)
 	if (journal->j_running_transaction) {
 		tid_t tid = journal->j_running_transaction->t_tid;
 
-		ret = __log_start_commit(journal, tid);
-		if (ret && ptid)
+		__log_start_commit(journal, tid);
+		/* There's a running transaction and we've just made sure
+		 * it's commit has been scheduled. */
+		if (ptid)
 			*ptid = tid;
-	} else if (journal->j_committing_transaction && ptid) {
+		ret = 1;
+	} else if (journal->j_committing_transaction) {
 		/*
 		 * If ext3_write_super() recently started a commit, then we
 		 * have to wait for completion of that transaction
 		 */
-		*ptid = journal->j_committing_transaction->t_tid;
+		if (ptid)
+			*ptid = journal->j_committing_transaction->t_tid;
 		ret = 1;
 	}
 	spin_unlock(&journal->j_state_lock);


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-10/kernel.spec,v
retrieving revision 1.1206.2.103
retrieving revision 1.1206.2.104
diff -u -p -r1.1206.2.103 -r1.1206.2.104
--- kernel.spec	13 Oct 2009 00:36:57 -0000	1.1206.2.103
+++ kernel.spec	13 Oct 2009 01:19:20 -0000	1.1206.2.104
@@ -797,6 +797,9 @@ Patch15250: x86-fix-csum_ipv6_magic-asm-
 # Fix broken IrDA stack in 2.6.27 (#508874)
 Patch15300: irda-add-irda-skb-cb-qdisc-related-padding.patch
 
+# Fix ext3 file corruption in some cases
+Patch15400: jbd-fix-return-value-of-journal-start-commit.patch
+
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1443,6 +1446,9 @@ ApplyPatch x86-fix-csum_ipv6_magic-asm-m
 # Fix broken IrDA stack in 2.6.27 (#508874)
 ApplyPatch irda-add-irda-skb-cb-qdisc-related-padding.patch
 
+# Fix ext3 file corruption in some cases
+ApplyPatch jbd-fix-return-value-of-journal-start-commit.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -2018,6 +2024,9 @@ fi
 %kernel_variant_files -k vmlinux %{with_kdump} kdump
 
 %changelog
+* Mon Oct 12 2009  Chuck Ebbert <cebbert at redhat.com>  2.6.27.37-170.2.104
+- Add jbd fix for file corruption (the jbd2 version is already in.)
+
 * Mon Oct 12 2009  Chuck Ebbert <cebbert at redhat.com>  2.6.27.37-170.2.103
 - Linux 2.6.27.37
 




More information about the fedora-extras-commits mailing list