diff options
author | Theodore Ts'o <tytso@mit.edu> | 2013-07-01 08:12:38 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-21 21:21:22 -0400 |
commit | 5f81e313889bcaf53faec9c05a4c92e0b43823f4 (patch) | |
tree | e52b166d3e6ce270e1e9daa80aeb6416d9b86c1c /fs/jbd2 | |
parent | 9e8e8fdf3d60235954e1452283b21e955e574b98 (diff) |
jbd2: move superblock checksum calculation to jbd2_write_superblock()
commit fe52d17cdd343ac43c85cf72940a58865b9d3bfb upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/jbd2')
-rw-r--r-- | fs/jbd2/journal.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 95457576e434..aaa1a3f33b0e 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c | |||
@@ -1318,6 +1318,7 @@ static int journal_reset(journal_t *journal) | |||
1318 | static void jbd2_write_superblock(journal_t *journal, int write_op) | 1318 | static void jbd2_write_superblock(journal_t *journal, int write_op) |
1319 | { | 1319 | { |
1320 | struct buffer_head *bh = journal->j_sb_buffer; | 1320 | struct buffer_head *bh = journal->j_sb_buffer; |
1321 | journal_superblock_t *sb = journal->j_superblock; | ||
1321 | int ret; | 1322 | int ret; |
1322 | 1323 | ||
1323 | trace_jbd2_write_superblock(journal, write_op); | 1324 | trace_jbd2_write_superblock(journal, write_op); |
@@ -1339,6 +1340,7 @@ static void jbd2_write_superblock(journal_t *journal, int write_op) | |||
1339 | clear_buffer_write_io_error(bh); | 1340 | clear_buffer_write_io_error(bh); |
1340 | set_buffer_uptodate(bh); | 1341 | set_buffer_uptodate(bh); |
1341 | } | 1342 | } |
1343 | jbd2_superblock_csum_set(journal, sb); | ||
1342 | get_bh(bh); | 1344 | get_bh(bh); |
1343 | bh->b_end_io = end_buffer_write_sync; | 1345 | bh->b_end_io = end_buffer_write_sync; |
1344 | ret = submit_bh(write_op, bh); | 1346 | ret = submit_bh(write_op, bh); |
@@ -1435,7 +1437,6 @@ void jbd2_journal_update_sb_errno(journal_t *journal) | |||
1435 | jbd_debug(1, "JBD2: updating superblock error (errno %d)\n", | 1437 | jbd_debug(1, "JBD2: updating superblock error (errno %d)\n", |
1436 | journal->j_errno); | 1438 | journal->j_errno); |
1437 | sb->s_errno = cpu_to_be32(journal->j_errno); | 1439 | sb->s_errno = cpu_to_be32(journal->j_errno); |
1438 | jbd2_superblock_csum_set(journal, sb); | ||
1439 | read_unlock(&journal->j_state_lock); | 1440 | read_unlock(&journal->j_state_lock); |
1440 | 1441 | ||
1441 | jbd2_write_superblock(journal, WRITE_SYNC); | 1442 | jbd2_write_superblock(journal, WRITE_SYNC); |