Skip to contentSkip to conversation

exfat: fix remount failure in different process environments

PATCH Applied Yuezhang Mo 2 participants 2 messages Nov 28, 2025

Subsystems (2)
lore
Share & tools
lore

Yuezhang Mo

author reviewer
#0 lore raw

PATCH 1/1 exfat: fix remount failure in different process environments

The kernel test robot reported that the exFAT remount operation failed. The reason for the failure was that the process's umask is different betweem mount and remount, causing fs_fmask and fs_dmask are changed.

Potentially, both gid and uid may also be changed. Therefore, when initializing fs_context for remount, inherit these mount options from the options used during mount.

---
 fs/exfat/super.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
fs/exfat/super.c +15 -4
index 7f9592856bf78..4dcbd889f8b2c 100644
@@ -810,10 +810,21 @@ static int exfat_init_fs_context(struct fs_context *fc)
 	ratelimit_state_init(&sbi->ratelimit, DEFAULT_RATELIMIT_INTERVAL,
 			DEFAULT_RATELIMIT_BURST);
 
-	sbi->options.fs_uid = current_uid();
-	sbi->options.fs_gid = current_gid();
-	sbi->options.fs_fmask = current->fs->umask;
-	sbi->options.fs_dmask = current->fs->umask;
+	if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE && fc->root) {
+		struct super_block *sb = fc->root->d_sb;
+		struct exfat_mount_options *cur_opts = &EXFAT_SB(sb)->options;
+
+		sbi->options.fs_uid = cur_opts->fs_uid;
+		sbi->options.fs_gid = cur_opts->fs_gid;
+		sbi->options.fs_fmask = cur_opts->fs_fmask;
+		sbi->options.fs_dmask = cur_opts->fs_dmask;
+	} else {
+		sbi->options.fs_uid = current_uid();
+		sbi->options.fs_gid = current_gid();
+		sbi->options.fs_fmask = current->fs->umask;
+		sbi->options.fs_dmask = current->fs->umask;
+	}
+
 	sbi->options.allow_utime = -1;
 	sbi->options.errors = EXFAT_ERRORS_RO;
 	exfat_set_iocharset(&sbi->options, exfat_default_iocharset);
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 4 lines · Yuezhang Mo

The kernel test robot reported that the exFAT remount operation failed. The reason for the failure was that the process's umask is different betweem mount and remount, causing fs_fmask and

I have directly fixed typo.(between)

Quoted 9 lines

fs_dmask are changed.

Potentially, both gid and uid may also be changed. Therefore, when initializing fs_context for remount, inherit these mount options from the options used during mount.

Applied it to #dev.
Thanks!