Commit fe52d17c authored by Theodore Ts'o's avatar Theodore Ts'o

jbd2: move superblock checksum calculation to jbd2_write_superblock()

Some of the functions which modify the jbd2 superblock were not
updating the checksum before calling jbd2_write_superblock().  Move
the call to jbd2_superblock_csum_set() to jbd2_write_superblock(), so
that the checksum is calculated consistently.
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
Cc: Darrick J. Wong <darrick.wong@oracle.com>
Cc: stable@vger.kernel.org
parent aeb2817a
...@@ -1335,6 +1335,7 @@ static int journal_reset(journal_t *journal) ...@@ -1335,6 +1335,7 @@ static int journal_reset(journal_t *journal)
static void jbd2_write_superblock(journal_t *journal, int write_op) static void jbd2_write_superblock(journal_t *journal, int write_op)
{ {
struct buffer_head *bh = journal->j_sb_buffer; struct buffer_head *bh = journal->j_sb_buffer;
journal_superblock_t *sb = journal->j_superblock;
int ret; int ret;
trace_jbd2_write_superblock(journal, write_op); trace_jbd2_write_superblock(journal, write_op);
...@@ -1356,6 +1357,7 @@ static void jbd2_write_superblock(journal_t *journal, int write_op) ...@@ -1356,6 +1357,7 @@ static void jbd2_write_superblock(journal_t *journal, int write_op)
clear_buffer_write_io_error(bh); clear_buffer_write_io_error(bh);
set_buffer_uptodate(bh); set_buffer_uptodate(bh);
} }
jbd2_superblock_csum_set(journal, sb);
get_bh(bh); get_bh(bh);
bh->b_end_io = end_buffer_write_sync; bh->b_end_io = end_buffer_write_sync;
ret = submit_bh(write_op, bh); ret = submit_bh(write_op, bh);
...@@ -1452,7 +1454,6 @@ void jbd2_journal_update_sb_errno(journal_t *journal) ...@@ -1452,7 +1454,6 @@ void jbd2_journal_update_sb_errno(journal_t *journal)
jbd_debug(1, "JBD2: updating superblock error (errno %d)\n", jbd_debug(1, "JBD2: updating superblock error (errno %d)\n",
journal->j_errno); journal->j_errno);
sb->s_errno = cpu_to_be32(journal->j_errno); sb->s_errno = cpu_to_be32(journal->j_errno);
jbd2_superblock_csum_set(journal, sb);
read_unlock(&journal->j_state_lock); read_unlock(&journal->j_state_lock);
jbd2_write_superblock(journal, WRITE_SYNC); jbd2_write_superblock(journal, WRITE_SYNC);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment