Skip to contentSkip to conversation

Fix commit code to properly abort journal

PATCH In review Jan Kara 1 participant 2 messages Sep 25, 2007 Journalling layer for block devices (JBD2)

lore
Share & tools
lore

Jan Kara

author
#0 lore raw

PATCH 1/1 Fix commit code to properly abort journal

Hi,

attached patch changes JBD commit code to properly record reason for
aborted journal (j_errno) and not just mark the journal as aborted. Andrew, could you please queue the patch? Thanks.

Honza

Signature · 51 lines
Jan Kara <[email protected]>
SUSE Labs, CR

-----

We should really call journal_abort() and not __journal_abort_hard() in case
of errors. The latter call does not record the error in the journal superblock and
thus filesystem won't be marked as with errors later (and user could happily mount
it without any warning).

Signed-off-by: Jan Kara <[email protected]>

diff -rupX /home/jack/.kerndiffexclude linux-2.6.23-rc6/fs/jbd/commit.c linux-2.6.23-rc6-1-jbd_abort_fix/fs/jbd/commit.c
--- linux-2.6.23-rc6/fs/jbd/commit.c	2007-09-18 19:22:28.000000000 +0200
+++ linux-2.6.23-rc6-1-jbd_abort_fix/fs/jbd/commit.c	2007-09-25 15:02:49.000000000 +0200
@@ -466,7 +466,7 @@ void journal_commit_transaction(journal_
 	spin_unlock(&journal->j_list_lock);
 
 	if (err)
-		__journal_abort_hard(journal);
+		journal_abort(journal, err);
 
 	journal_write_revoke_records(journal, commit_transaction);
 
@@ -524,7 +524,7 @@ void journal_commit_transaction(journal_
 
 			descriptor = journal_get_descriptor_buffer(journal);
 			if (!descriptor) {
-				__journal_abort_hard(journal);
+				journal_abort(journal, -EIO);
 				continue;
 			}
 
@@ -557,7 +557,7 @@ void journal_commit_transaction(journal_
 		   and repeat this loop: we'll fall into the
 		   refile-on-abort condition above. */
 		if (err) {
-			__journal_abort_hard(journal);
+			journal_abort(journal, err);
 			continue;
 		}
 
@@ -748,7 +748,7 @@ wait_for_iobuf:
 		err = -EIO;
 
 	if (err)
-		__journal_abort_hard(journal);
+		journal_abort(journal, err);
 
 	/* End of a transaction!  Finally, we can do checkpoint
            processing: any buffers committed as a result of this
author
#1 lore raw

And a similar patch for JBD2...

Honza
-----

We should really call journal_abort() and not __journal_abort_hard() in case of errors. The latter call does not record the error in the journal superblock and thus filesystem won't be marked as with errors later (and user could happily mount it without any warning).

fs/jbd2/commit.c +4 -4
diff -rupX /home/jack/.kerndiffexclude linux-2.6.23-rc6-1-jbd_abort_fix/fs/jbd2/commit.c linux-2.6.23-rc6-2-jbd2_abort_fix/fs/jbd2/commit.c
@@ -475,7 +475,7 @@ void jbd2_journal_commit_transaction(jou
 	spin_unlock(&journal->j_list_lock);
 
 	if (err)
-		__jbd2_journal_abort_hard(journal);
+		jbd2_journal_abort(journal, err);
 
 	jbd2_journal_write_revoke_records(journal, commit_transaction);
 
@@ -533,7 +533,7 @@ void jbd2_journal_commit_transaction(jou
 
 			descriptor = jbd2_journal_get_descriptor_buffer(journal);
 			if (!descriptor) {
-				__jbd2_journal_abort_hard(journal);
+				jbd2_journal_abort(journal, -EIO);
 				continue;
 			}
 
@@ -566,7 +566,7 @@ void jbd2_journal_commit_transaction(jou
 		   and repeat this loop: we'll fall into the
 		   refile-on-abort condition above. */
 		if (err) {
-			__jbd2_journal_abort_hard(journal);
+			jbd2_journal_abort(journal, err);
 			continue;
 		}
 
@@ -757,7 +757,7 @@ wait_for_iobuf:
 		err = -EIO;
 
 	if (err)
-		__jbd2_journal_abort_hard(journal);
+		jbd2_journal_abort(journal, err);
 
 	/* End of a transaction!  Finally, we can do checkpoint
            processing: any buffers committed as a result of this