diff options
author | Eric Sandeen <sandeen@redhat.com> | 2012-08-18 22:29:40 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-13 05:38:39 +0900 |
commit | 0699c6dd66e7083f837cfe620837ddcf10649b89 (patch) | |
tree | 3b0c012f2bbd2e3cbe5fffb1efee75217face715 /fs | |
parent | 66307aef43a3a51cccf03f4ca8063cfce1bd4ac1 (diff) | |
download | linux-3.10-0699c6dd66e7083f837cfe620837ddcf10649b89.tar.gz linux-3.10-0699c6dd66e7083f837cfe620837ddcf10649b89.tar.bz2 linux-3.10-0699c6dd66e7083f837cfe620837ddcf10649b89.zip |
jbd2: don't write superblock when if its empty
commit eeecef0af5ea4efd763c9554cf2bd80fc4a0efd3 upstream.
This sequence:
# truncate --size=1g fsfile
# mkfs.ext4 -F fsfile
# mount -o loop,ro fsfile /mnt
# umount /mnt
# dmesg | tail
results in an IO error when unmounting the RO filesystem:
[ 318.020828] Buffer I/O error on device loop1, logical block 196608
[ 318.027024] lost page write due to I/O error on loop1
[ 318.032088] JBD2: Error -5 detected when updating journal superblock for loop1-8.
This was a regression introduced by commit 24bcc89c7e7c: "jbd2: split
updating of journal superblock and marking journal empty".
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/jbd2/journal.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 9956ac68b72..e5bfb1150cf 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -1317,6 +1317,11 @@ static void jbd2_mark_journal_empty(journal_t *journal) BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex)); read_lock(&journal->j_state_lock); + /* Is it already empty? */ + if (sb->s_start == 0) { + read_unlock(&journal->j_state_lock); + return; + } jbd_debug(1, "JBD2: Marking journal as empty (seq %d)\n", journal->j_tail_sequence); |