ext4: misc 3.18-rc2 bugfixes
cover ext4: misc 3.18-rc2 bugfixes
Hi all,
Here are three patches against 3.18-rc2 to fix some problems that I found in ext4. The first fix turns on journal checksumming whenever metadata checksumming is enabled; the second prohibits changing the journal_checksumming feature during a remount; and the third fixes a resource leak in extent status procfs files when the journal load fails.
Comments and questions are, as always, welcome. I'm done sending patches for now. Hopefully.
--D
PATCH 1/3 ext4: enable journal checksum when metadata checksum feature enabled
If metadata checksumming is turned on for the FS, we need to tell the journal to use checksumming too.
--- fs/ext4/super.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/ext4/super.c +4 -0
@@ -3526,6 +3526,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)#ifdef CONFIG_EXT4_FS_POSIX_ACL set_opt (sb,POSIX_ACL );#endif +/* don't forget to enable journal_csum when metadata_csum is enabled. */ +if (ext4_has_metadata_csum (sb)) +set_opt (sb,JOURNAL_CHECKSUM ); +if ((def_mount_opts &EXT4_DEFM_JMODE ) ==EXT4_DEFM_JMODE_DATA )set_opt (sb,JOURNAL_DATA );else if ((def_mount_opts &EXT4_DEFM_JMODE ) ==EXT4_DEFM_JMODE_ORDERED )
PATCH 2/3 Subject: [PATCH] ext4: disallow changing journal_csum option during remount
In reply to Darrick J. Wongext4 does not permit changing the metadata or journal checksum feature flag while mounted. Until we decide to support that, don't allow a remount to change the journal_csum flag (right now we silently fail to change anything).
--- fs/ext4/super.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/ext4/super.c +8 -0
@@ -4845,6 +4845,14 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) goto restore_opts; } +if ((old_opts.s_mount_opt &EXT4_MOUNT_JOURNAL_CHECKSUM ) ^ +test_opt (sb,JOURNAL_CHECKSUM )) { +ext4_msg (sb,KERN_ERR ,"changing journal_checksum " +"during remount not supported" ); + err = -EINVAL ; + goto restore_opts; + } +if (test_opt (sb,DATA_FLAGS ) ==EXT4_MOUNT_JOURNAL_DATA ) {if (test_opt2 (sb,EXPLICIT_DELALLOC )) { ext4_msg(sb, KERN_ERR, "can't mount with "
PATCH 3/3 ext4: remove extent status procfs files if journal load fails
In reply to Darrick J. WongIf we can't load the journal, remove the procfs files for the extent status information file to avoid leaking resources.
--- fs/ext4/super.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/ext4/super.c +3 -2
@@ -3947,7 +3947,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)if (EXT4_HAS_INCOMPAT_FEATURE (sb,EXT4_FEATURE_INCOMPAT_MMP ) && !(sb->s_flags &MS_RDONLY ))if (ext4_multi_mount_protect (sb,le64_to_cpu (es->s_mmp_block))) - goto failed_mount3; + goto failed_mount3a;/* * The first inode we look at is the journal inode. Don't try
@@ -3956,7 +3956,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)if (!test_opt (sb,NOLOAD ) &&EXT4_HAS_COMPAT_FEATURE (sb,EXT4_FEATURE_COMPAT_HAS_JOURNAL )) {if (ext4_load_journal (sb, es, journal_devnum)) - goto failed_mount3; + goto failed_mount3a; }else if (test_opt (sb,NOLOAD ) && !(sb->s_flags &MS_RDONLY ) &&EXT4_HAS_INCOMPAT_FEATURE (sb,EXT4_FEATURE_INCOMPAT_RECOVER )) { ext4_msg(sb, KERN_ERR, "required journal recovery "
@@ -4244,6 +4244,7 @@ failed_mount_wq:jbd2_journal_destroy (sbi->s_journal); sbi->s_journal =NULL ; } +failed_mount3a:ext4_es_unregister_shrinker (sbi); failed_mount3:del_timer_sync (&sbi->s_err_report);
Re: [PATCH 1/3] ext4: enable journal checksum when metadata checksum feature enabled
In reply to Darrick J. WongQuoted 4 lines · Darrick J. Wong
If metadata checksumming is turned on for the FS, we need to tell the journal to use checksumming too.
Signed-off-by Darrick J. Wong <[email protected]>
Applied, thanks.
- Ted
Re: [PATCH 2/3] Subject: [PATCH] ext4: disallow changing journal_csum option during remount
In reply to Darrick J. WongQuoted 6 lines · Darrick J. Wong
ext4 does not permit changing the metadata or journal checksum feature flag while mounted. Until we decide to support that, don't allow a remount to change the
journal_csumflag (right now we silently fail to change anything).Signed-off-by Darrick J. Wong <[email protected]>
Thanks, applied.
- Ted
Re: [PATCH 3/3] ext4: remove extent status procfs files if journal load fails
In reply to Darrick J. WongQuoted 4 lines · Darrick J. Wong
If we can't load the journal, remove the procfs files for the extent status information file to avoid leaking resources.
Signed-off-by Darrick J. Wong <[email protected]>
Thanks, applied.
- Ted