Skip to content

Commit 4c24672

Browse files
Lukas Czernertytso
authored andcommitted
ext4: don't fail remount if journalling mode didn't change
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 <[email protected]> Reported-by: Heiner Kallweit <[email protected]> Fixes: cebe85d ("ext4: switch to the new mount api") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent ba2e524 commit 4c24672

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

fs/ext4/super.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2155,19 +2155,22 @@ static int unnote_qf_name(struct fs_context *fc, int qtype)
21552155
#endif
21562156

21572157
#define EXT4_SET_CTX(name) \
2158-
static inline void ctx_set_##name(struct ext4_fs_context *ctx, int flag)\
2158+
static inline void ctx_set_##name(struct ext4_fs_context *ctx, \
2159+
unsigned long flag) \
21592160
{ \
21602161
ctx->mask_s_##name |= flag; \
21612162
ctx->vals_s_##name |= flag; \
21622163
} \
2163-
static inline void ctx_clear_##name(struct ext4_fs_context *ctx, int flag)\
2164+
static inline void ctx_clear_##name(struct ext4_fs_context *ctx, \
2165+
unsigned long flag) \
21642166
{ \
21652167
ctx->mask_s_##name |= flag; \
21662168
ctx->vals_s_##name &= ~flag; \
21672169
} \
2168-
static inline bool ctx_test_##name(struct ext4_fs_context *ctx, int flag)\
2170+
static inline unsigned long \
2171+
ctx_test_##name(struct ext4_fs_context *ctx, unsigned long flag) \
21692172
{ \
2170-
return ((ctx->vals_s_##name & flag) != 0); \
2173+
return (ctx->vals_s_##name & flag); \
21712174
} \
21722175

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

0 commit comments

Comments
 (0)