From: Theodore Ts'o Date: Mon, 19 Feb 2018 17:22:53 +0000 (-0500) Subject: jbd2: if the journal is aborted then don't allow update of the log tail X-Git-Tag: v4.1.52~117 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63df8d82efef1be1d8f6c55d8582e4aeaf7ab800;p=thirdparty%2Fkernel%2Fstable.git jbd2: if the journal is aborted then don't allow update of the log tail [ Upstream commit 85e0c4e89c1b864e763c4e3bb15d0b6d501ad5d9 ] This updates the jbd2 superblock unnecessarily, and on an abort we shouldn't truncate the log. Signed-off-by: Theodore Ts'o Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin --- diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index e4d224315a1f6..97f29405e5c6b 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -923,7 +923,7 @@ out: } /* - * This is a variaon of __jbd2_update_log_tail which checks for validity of + * This is a variation of __jbd2_update_log_tail which checks for validity of * provided log tail and locks j_checkpoint_mutex. So it is safe against races * with other threads updating log tail. */ @@ -1399,6 +1399,9 @@ int jbd2_journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid, journal_superblock_t *sb = journal->j_superblock; int ret; + if (is_journal_aborted(journal)) + return -EIO; + BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex)); jbd_debug(1, "JBD2: updating superblock (start %lu, seq %u)\n", tail_block, tail_tid);