Commit 51f57b01 authored by zhangyi (F)'s avatar zhangyi (F) Committed by Theodore Ts'o
Browse files

ext4, jbd2: ensure panic when aborting with zero errno



JBD2_REC_ERR flag used to indicate the errno has been updated when jbd2
aborted, and then __ext4_abort() and ext4_handle_error() can invoke
panic if ERRORS_PANIC is specified. But if the journal has been aborted
with zero errno, jbd2_journal_abort() didn't set this flag so we can
no longer panic. Fix this by always record the proper errno in the
journal superblock.

Fixes: 4327ba52 ("ext4, jbd2: ensure entering into panic after recording an error in superblock")
Signed-off-by: default avatarzhangyi (F) <yi.zhang@huawei.com>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20191204124614.45424-3-yi.zhang@huawei.com


Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent d0a186e0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -164,7 +164,7 @@ void __jbd2_log_wait_for_space(journal_t *journal)
				       "journal space in %s\n", __func__,
				       journal->j_devname);
				WARN_ON(1);
				jbd2_journal_abort(journal, 0);
				jbd2_journal_abort(journal, -EIO);
			}
			write_lock(&journal->j_state_lock);
		} else {
+4 −11
Original line number Diff line number Diff line
@@ -2156,13 +2156,11 @@ static void __journal_abort_soft (journal_t *journal, int errno)

	__jbd2_journal_abort_hard(journal);

	if (errno) {
	jbd2_journal_update_sb_errno(journal);
	write_lock(&journal->j_state_lock);
	journal->j_flags |= JBD2_REC_ERR;
	write_unlock(&journal->j_state_lock);
}
}

/**
 * void jbd2_journal_abort () - Shutdown the journal immediately.
@@ -2203,11 +2201,6 @@ static void __journal_abort_soft (journal_t *journal, int errno)
 * failure to disk.  ext3_error, for example, now uses this
 * functionality.
 *
 * Errors which originate from within the journaling layer will NOT
 * supply an errno; a null errno implies that absolutely no further
 * writes are done to the journal (unless there are any already in
 * progress).
 *
 */

void jbd2_journal_abort(journal_t *journal, int errno)