]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ext4, jbd2: ensure entering into panic after recording an error in superblock
authorDaeho Jeong <daeho.jeong@samsung.com>
Sun, 18 Oct 2015 21:02:56 +0000 (17:02 -0400)
committerChuck Anderson <chuck.anderson@oracle.com>
Fri, 5 Feb 2016 03:33:21 +0000 (19:33 -0800)
commitc96d4d838a2708f61efc5da8a042822685b1b4db
treeb88193ced165bcc53e5060a949d0f8193c16d273
parentaf7da607ba94589d4f68989b8a0b2cec2e0ba8c6
ext4, jbd2: ensure entering into panic after recording an error in superblock

Orabug: 22623871

commit 4327ba52afd03fc4b5afa0ee1d774c9c5b0e85c5 upstream.

If a EXT4 filesystem utilizes JBD2 journaling and an error occurs, the
journaling will be aborted first and the error number will be recorded
into JBD2 superblock and, finally, the system will enter into the
panic state in "errors=panic" option.  But, in the rare case, this
sequence is little twisted like the below figure and it will happen
that the system enters into panic state, which means the system reset
in mobile environment, before completion of recording an error in the
journal superblock. In this case, e2fsck cannot recognize that the
filesystem failure occurred in the previous run and the corruption
wouldn't be fixed.

Task A                        Task B
ext4_handle_error()
-> jbd2_journal_abort()
  -> __journal_abort_soft()
    -> __jbd2_journal_abort_hard()
    | -> journal->j_flags |= JBD2_ABORT;
    |
    |                         __ext4_abort()
    |                         -> jbd2_journal_abort()
    |                         | -> __journal_abort_soft()
    |                         |   -> if (journal->j_flags & JBD2_ABORT)
    |                         |           return;
    |                         -> panic()
    |
    -> jbd2_journal_update_sb_errno()

Tested-by: Hobin Woo <hobin.woo@samsung.com>
Signed-off-by: Daeho Jeong <daeho.jeong@samsung.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 3e447b618b9d6f486ab441bc4bd4507628318209)
Signed-off-by: Dan Duval <dan.duval@oracle.com>
fs/ext4/super.c
fs/jbd2/journal.c
include/linux/jbd2.h