Skip to contentSkip to conversation

ext4: misc 3.18-rc2 bugfixes

PATCH Applied Darrick J. Wong 2 participants 7 messages Oct 28, 2014 – Oct 29, 2014 ext4 file system

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw

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
index 1eda6ab..5c11e21 100644
@@ -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)
maintainer Applied
#2 lore raw

Re: [PATCH 1/3] ext4: enable journal checksum when metadata checksum feature enabled

Quoted 4 lines · Darrick J. Wong

If metadata checksumming is turned on for the FS, we need to tell the journal to use checksumming too.

Applied, thanks.

- Ted

#3 lore raw

PATCH 2/3 Subject: [PATCH] ext4: disallow changing journal_csum option during remount

In reply to 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_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
index 5c11e21..96059e0 100644
@@ -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 "
maintainer Applied
#4 lore raw

Re: [PATCH 2/3] Subject: [PATCH] ext4: disallow changing journal_csum option during remount

Quoted 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_csum flag (right now we silently fail to change anything).

Thanks, applied.

- Ted

#5 lore raw

PATCH 3/3 ext4: remove extent status procfs files if journal load fails

In reply to Darrick J. Wong

If 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
index 96059e0..2c9e686 100644
@@ -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);
maintainer Applied
#6 lore raw

Re: [PATCH 3/3] ext4: remove extent status procfs files if journal load fails

Quoted 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.

Thanks, applied.

- Ted