add patch disallow-changing-journal-csum-option-during-remount
[ext4-patch-queue.git] / enable-journal-checksum-when-metadata-checksum-feature-enabled
blobd16f4eb4c612f3c5017170938f641b82043f0671
1 ext4: enable journal checksum when metadata checksum feature enabled
3 From: "Darrick J. Wong" <darrick.wong@oracle.com>
5 If metadata checksumming is turned on for the FS, we need to tell the
6 journal to use checksumming too.
8 Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
9 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 Cc: stable@vger.kernel.org
11 ---
12  fs/ext4/super.c |    4 ++++
13  1 file changed, 4 insertions(+)
16 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
17 index 1eda6ab..5c11e21 100644
18 --- a/fs/ext4/super.c
19 +++ b/fs/ext4/super.c
20 @@ -3526,6 +3526,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
21  #ifdef CONFIG_EXT4_FS_POSIX_ACL
22         set_opt(sb, POSIX_ACL);
23  #endif
24 +       /* don't forget to enable journal_csum when metadata_csum is enabled. */
25 +       if (ext4_has_metadata_csum(sb))
26 +               set_opt(sb, JOURNAL_CHECKSUM);
28         if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA)
29                 set_opt(sb, JOURNAL_DATA);
30         else if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_ORDERED)