ext4: make sure the journal sb is written in ext4_clear_journal_err()
authorTheodore Ts'o <tytso@mit.edu>
Sun, 5 Aug 2012 23:04:57 +0000 (19:04 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 26 Aug 2012 22:00:42 +0000 (15:00 -0700)
commit8b9f3861678e35b18cef66728d0fa896bbda65b6
tree99a1336ea8e0dcc55d1c7f2a61f21526cfcf2f88
parent75a757189880a31759ed25c23229f085890cddb1
ext4: make sure the journal sb is written in ext4_clear_journal_err()

commit d796c52ef0b71a988364f6109aeb63d79c5b116b upstream.

After we transfer set the EXT4_ERROR_FS bit in the file system
superblock, it's not enough to call jbd2_journal_clear_err() to clear
the error indication from journal superblock --- we need to call
jbd2_journal_update_sb_errno() as well.  Otherwise, when the root file
system is mounted read-only, the journal is replayed, and the error
indicator is transferred to the superblock --- but the s_errno field
in the jbd2 superblock is left set (since although we cleared it in
memory, we never flushed it out to disk).

This can end up confusing e2fsck.  We should make e2fsck more robust
in this case, but the kernel shouldn't be leaving things in this
confused state, either.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/super.c
fs/jbd2/journal.c
include/linux/jbd2.h