aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2016-12-03 16:20:53 -0500
committerTheodore Ts'o <tytso@mit.edu>2016-12-03 16:20:53 -0500
commitab04df78181b271dca096a8050877469889e3c8c (patch)
tree3c01b24ba4a381b4de9c6189fa66e4a43e512df9
parentb649668c0bb3f54523cd932490a3f637859fdeb0 (diff)
ext4: fix checks for data=ordered and journal_async_commit options
Combination of data=ordered mode and journal_async_commit mount option is invalid. However the check in parse_options() fails to detect the case where we simply end up defaulting to data=ordered mode and we detect the problem only on remount which triggers hard to understand failure to remount the filesystem. Fix the checking of mount options to take into account also the default mode by moving the check somewhat later in the mount sequence. Reported-by: Wolfgang Walter <linux@stwm.de> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--fs/ext4/super.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 32c0debbaa92..f185b9a5a024 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1901,12 +1901,6 @@ static int parse_options(char *options, struct super_block *sb,
1901 return 0; 1901 return 0;
1902 } 1902 }
1903 } 1903 }
1904 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA &&
1905 test_opt(sb, JOURNAL_ASYNC_COMMIT)) {
1906 ext4_msg(sb, KERN_ERR, "can't mount with journal_async_commit "
1907 "in data=ordered mode");
1908 return 0;
1909 }
1910 return 1; 1904 return 1;
1911} 1905}
1912 1906
@@ -4004,6 +3998,14 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
4004 default: 3998 default:
4005 break; 3999 break;
4006 } 4000 }
4001
4002 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA &&
4003 test_opt(sb, JOURNAL_ASYNC_COMMIT)) {
4004 ext4_msg(sb, KERN_ERR, "can't mount with "
4005 "journal_async_commit in data=ordered mode");
4006 goto failed_mount_wq;
4007 }
4008
4007 set_task_ioprio(sbi->s_journal->j_task, journal_ioprio); 4009 set_task_ioprio(sbi->s_journal->j_task, journal_ioprio);
4008 4010
4009 sbi->s_journal->j_commit_callback = ext4_journal_commit_callback; 4011 sbi->s_journal->j_commit_callback = ext4_journal_commit_callback;
@@ -4897,6 +4899,13 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
4897 err = -EINVAL; 4899 err = -EINVAL;
4898 goto restore_opts; 4900 goto restore_opts;
4899 } 4901 }
4902 } else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA) {
4903 if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) {
4904 ext4_msg(sb, KERN_ERR, "can't mount with "
4905 "journal_async_commit in data=ordered mode");
4906 err = -EINVAL;
4907 goto restore_opts;
4908 }
4900 } 4909 }
4901 4910
4902 if ((sbi->s_mount_opt ^ old_opts.s_mount_opt) & EXT4_MOUNT_DAX) { 4911 if ((sbi->s_mount_opt ^ old_opts.s_mount_opt) & EXT4_MOUNT_DAX) {