aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2014-12-01 19:22:23 -0500
committerTheodore Ts'o <tytso@mit.edu>2014-12-01 21:57:06 -0500
commit32f3869184d498850d36b7e6aa3b9f5260ea648a (patch)
treeae0c664340718615b9c8470605a8f7c3fbe884fa /fs
parent0df1f2487d2f0d04703f142813d53615d62a1da4 (diff)
jbd2: fix regression where we fail to initialize checksum seed when loading
When we're enabling journal features, we cannot use the predicate jbd2_journal_has_csum_v2or3() because we haven't yet set the sb feature flag fields! Moreover, we just finished loading the shash driver, so the test is unnecessary; calculate the seed always. Without this patch, we fail to initialize the checksum seed the first time we turn on journal_checksum, which means that all journal blocks written during that first mount are corrupt. Transactions written after the second mount will be fine, since the feature flag will be set in the journal superblock. xfstests generic/{034,321,322} are the regression tests. (This is important for 3.18.) Signed-off-by: Darrick J. Wong <darrick.wong@oracle.coM> Reported-by: Eric Whitney <enwlinux@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r--fs/jbd2/journal.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index e4dc74713a43..1df94fabe4eb 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -1853,13 +1853,12 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat,
1853 journal->j_chksum_driver = NULL; 1853 journal->j_chksum_driver = NULL;
1854 return 0; 1854 return 0;
1855 } 1855 }
1856 }
1857 1856
1858 /* Precompute checksum seed for all metadata */ 1857 /* Precompute checksum seed for all metadata */
1859 if (jbd2_journal_has_csum_v2or3(journal))
1860 journal->j_csum_seed = jbd2_chksum(journal, ~0, 1858 journal->j_csum_seed = jbd2_chksum(journal, ~0,
1861 sb->s_uuid, 1859 sb->s_uuid,
1862 sizeof(sb->s_uuid)); 1860 sizeof(sb->s_uuid));
1861 }
1863 } 1862 }
1864 1863
1865 /* If enabling v1 checksums, downgrade superblock */ 1864 /* If enabling v1 checksums, downgrade superblock */