Skip to content

Commit

Permalink
ext4: don't fail remount if journalling mode didn't change
Browse files Browse the repository at this point in the history
Switching to the new mount api introduced inconsistency in how the
journalling mode mount option (data=) is handled during a remount.

Ext4 always prevented changing the journalling mode during the remount,
however the new code always fails the remount when the journalling mode
is specified, even if it remains unchanged. Fix it.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reported-by: Heiner Kallweit <hkallweit1@gmail.com>
Fixes: cebe85d ("ext4: switch to the new mount api")
Link: https://lore.kernel.org/r/20211220152657.101599-1-lczerner@redhat.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
  • Loading branch information
Lukas Czerner authored and Theodore Ts'o committed Dec 23, 2021
1 parent ba2e524 commit 4c24672
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions fs/ext4/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -2155,19 +2155,22 @@ static int unnote_qf_name(struct fs_context *fc, int qtype)
#endif

#define EXT4_SET_CTX(name) \
static inline void ctx_set_##name(struct ext4_fs_context *ctx, int flag)\
static inline void ctx_set_##name(struct ext4_fs_context *ctx, \
unsigned long flag) \
{ \
ctx->mask_s_##name |= flag; \
ctx->vals_s_##name |= flag; \
} \
static inline void ctx_clear_##name(struct ext4_fs_context *ctx, int flag)\
static inline void ctx_clear_##name(struct ext4_fs_context *ctx, \
unsigned long flag) \
{ \
ctx->mask_s_##name |= flag; \
ctx->vals_s_##name &= ~flag; \
} \
static inline bool ctx_test_##name(struct ext4_fs_context *ctx, int flag)\
static inline unsigned long \
ctx_test_##name(struct ext4_fs_context *ctx, unsigned long flag) \
{ \
return ((ctx->vals_s_##name & flag) != 0); \
return (ctx->vals_s_##name & flag); \
} \

EXT4_SET_CTX(flags);
Expand Down Expand Up @@ -2828,7 +2831,8 @@ static int ext4_check_opt_consistency(struct fs_context *fc,
"Remounting file system with no journal "
"so ignoring journalled data option");
ctx_clear_mount_opt(ctx, EXT4_MOUNT_DATA_FLAGS);
} else if (ctx->mask_s_mount_opt & EXT4_MOUNT_DATA_FLAGS) {
} else if (ctx_test_mount_opt(ctx, EXT4_MOUNT_DATA_FLAGS) !=
test_opt(sb, DATA_FLAGS)) {
ext4_msg(NULL, KERN_ERR, "Cannot change data mode "
"on remount");
return -EINVAL;
Expand Down

0 comments on commit 4c24672

Please sign in to comment.