Skip to content

Commit e4e58e5

Browse files
OjaswinMtytso
authored andcommitted
ext4: fix journal_ioprio mount option handling
In __ext4_super() we always overwrote the user specified journal_ioprio value with a default value, expecting parse_apply_sb_mount_options() to later correctly set ctx->journal_ioprio to the user specified value. However, if parse_apply_sb_mount_options() returned early because of empty sbi->es_s->s_mount_opts, the correct journal_ioprio value was never set. This patch fixes __ext4_super() to only use the default value if the user has not specified any value for journal_ioprio. Similarly, the remount behavior was to either use journal_ioprio value specified during initial mount, or use the default value irrespective of the journal_ioprio value specified during remount. This patch modifies this to first check if a new value for ioprio has been passed during remount and apply it. If no new value is passed, use the value specified during initial mount. Signed-off-by: Ojaswin Mujoo <[email protected]> Reviewed-by: Ritesh Harjani <[email protected]> Tested-by: Ritesh Harjani <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]> Cc: [email protected]
1 parent d63c00e commit e4e58e5

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

fs/ext4/super.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4411,7 +4411,8 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
44114411
int silent = fc->sb_flags & SB_SILENT;
44124412

44134413
/* Set defaults for the variables that will be set during parsing */
4414-
ctx->journal_ioprio = DEFAULT_JOURNAL_IOPRIO;
4414+
if (!(ctx->spec & EXT4_SPEC_JOURNAL_IOPRIO))
4415+
ctx->journal_ioprio = DEFAULT_JOURNAL_IOPRIO;
44154416

44164417
sbi->s_inode_readahead_blks = EXT4_DEF_INODE_READAHEAD_BLKS;
44174418
sbi->s_sectors_written_start =
@@ -6278,7 +6279,6 @@ static int __ext4_remount(struct fs_context *fc, struct super_block *sb)
62786279
char *to_free[EXT4_MAXQUOTAS];
62796280
#endif
62806281

6281-
ctx->journal_ioprio = DEFAULT_JOURNAL_IOPRIO;
62826282

62836283
/* Store the original options */
62846284
old_sb_flags = sb->s_flags;
@@ -6304,9 +6304,14 @@ static int __ext4_remount(struct fs_context *fc, struct super_block *sb)
63046304
} else
63056305
old_opts.s_qf_names[i] = NULL;
63066306
#endif
6307-
if (sbi->s_journal && sbi->s_journal->j_task->io_context)
6308-
ctx->journal_ioprio =
6309-
sbi->s_journal->j_task->io_context->ioprio;
6307+
if (!(ctx->spec & EXT4_SPEC_JOURNAL_IOPRIO)) {
6308+
if (sbi->s_journal && sbi->s_journal->j_task->io_context)
6309+
ctx->journal_ioprio =
6310+
sbi->s_journal->j_task->io_context->ioprio;
6311+
else
6312+
ctx->journal_ioprio = DEFAULT_JOURNAL_IOPRIO;
6313+
6314+
}
63106315

63116316
ext4_apply_options(fc, sb);
63126317

0 commit comments

Comments
 (0)