Skip to content

Commit fe52d17

Browse files
committed
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: "Theodore Ts'o" <tytso@mit.edu> Cc: Darrick J. Wong <darrick.wong@oracle.com> Cc: stable@vger.kernel.org
1 parent aeb2817 commit fe52d17

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎fs/jbd2/journal.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1335,6 +1335,7 @@ static int journal_reset(journal_t *journal)
13351335
static void jbd2_write_superblock(journal_t *journal, int write_op)
13361336
{
13371337
struct buffer_head *bh = journal->j_sb_buffer;
1338+
journal_superblock_t *sb = journal->j_superblock;
13381339
int ret;
13391340

13401341
trace_jbd2_write_superblock(journal, write_op);
@@ -1356,6 +1357,7 @@ static void jbd2_write_superblock(journal_t *journal, int write_op)
13561357
clear_buffer_write_io_error(bh);
13571358
set_buffer_uptodate(bh);
13581359
}
1360+
jbd2_superblock_csum_set(journal, sb);
13591361
get_bh(bh);
13601362
bh->b_end_io = end_buffer_write_sync;
13611363
ret = submit_bh(write_op, bh);
@@ -1452,7 +1454,6 @@ void jbd2_journal_update_sb_errno(journal_t *journal)
14521454
jbd_debug(1, "JBD2: updating superblock error (errno %d)\n",
14531455
journal->j_errno);
14541456
sb->s_errno = cpu_to_be32(journal->j_errno);
1455-
jbd2_superblock_csum_set(journal, sb);
14561457
read_unlock(&journal->j_state_lock);
14571458

14581459
jbd2_write_superblock(journal, WRITE_SYNC);

0 commit comments

Comments
 (0)