Skip to content

Commit 6ae6514

Browse files
Piotr Sarnatytso
authored andcommitted
ext4: fix mount/remount error messages for incompatible mount options
Commit 5688978 ("ext4: improve handling of conflicting mount options") introduced incorrect messages shown while choosing wrong mount options. First of all, both cases of incorrect mount options, "data=journal,delalloc" and "data=journal,dioread_nolock" result in the same error message. Secondly, the problem above isn't solved for remount option: the mismatched parameter is simply ignored. Moreover, ext4_msg states that remount with options "data=journal,delalloc" succeeded, which is not true. To fix it up, I added a simple check after parse_options() call to ensure that data=journal and delalloc/dioread_nolock parameters are not present at the same time. Signed-off-by: Piotr Sarna <[email protected]> Acked-by: Bartlomiej Zolnierkiewicz <[email protected]> Signed-off-by: Kyungmin Park <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]> Cc: [email protected]
1 parent 59d9fa5 commit 6ae6514

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

fs/ext4/super.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3483,7 +3483,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
34833483
}
34843484
if (test_opt(sb, DIOREAD_NOLOCK)) {
34853485
ext4_msg(sb, KERN_ERR, "can't mount with "
3486-
"both data=journal and delalloc");
3486+
"both data=journal and dioread_nolock");
34873487
goto failed_mount;
34883488
}
34893489
if (test_opt(sb, DELALLOC))
@@ -4727,6 +4727,21 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
47274727
goto restore_opts;
47284728
}
47294729

4730+
if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {
4731+
if (test_opt2(sb, EXPLICIT_DELALLOC)) {
4732+
ext4_msg(sb, KERN_ERR, "can't mount with "
4733+
"both data=journal and delalloc");
4734+
err = -EINVAL;
4735+
goto restore_opts;
4736+
}
4737+
if (test_opt(sb, DIOREAD_NOLOCK)) {
4738+
ext4_msg(sb, KERN_ERR, "can't mount with "
4739+
"both data=journal and dioread_nolock");
4740+
err = -EINVAL;
4741+
goto restore_opts;
4742+
}
4743+
}
4744+
47304745
if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED)
47314746
ext4_abort(sb, "Abort forced by user");
47324747

0 commit comments

Comments
 (0)