]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
jbd: don't write superblock when unmounting an ro filesystem
authorJan Kara <jack@suse.cz>
Wed, 15 Aug 2012 11:50:27 +0000 (13:50 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Sep 2012 16:59:37 +0000 (09:59 -0700)
commit 2e84f2641ea91a730642ead558a4ee3bd52310c9 upstream.

This sequence:

results in an IO error when unmounting the RO filesystem. The bug was
introduced by:

commit 9754e39c7bc51328f145e933bfb0df47cd67b6e9
Author: Jan Kara <jack@suse.cz>
Date:   Sat Apr 7 12:33:03 2012 +0200

    jbd: Split updating of journal superblock and marking journal empty

which lost some of the magic in journal_update_superblock() which
used to test for a journal with no outstanding transactions.

This is a port of a jbd2 fix by Eric Sandeen.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/jbd/journal.c

index 425c2f2cf1700a3f5d9db8fc4e93dcde0450d998..410142243c20cc104d320da678aa50024bafc348 100644 (file)
@@ -1113,6 +1113,11 @@ static void mark_journal_empty(journal_t *journal)
 
        BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex));
        spin_lock(&journal->j_state_lock);
+       /* Is it already empty? */
+       if (sb->s_start == 0) {
+               spin_unlock(&journal->j_state_lock);
+               return;
+       }
        jbd_debug(1, "JBD: Marking journal as empty (seq %d)\n",
                  journal->j_tail_sequence);