Skip to content

Commit 51fc7b4

Browse files
YuezhangMonamjaejeon
authored andcommitted
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 between 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. Reported-by: kernel test robot <oliver.sang@intel.com> Closes: https://lore.kernel.org/oe-lkp/202511251637.81670f5c-lkp@intel.com Signed-off-by: Yuezhang Mo <Yuezhang.Mo@sony.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
1 parent d70a580 commit 51fc7b4

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

fs/exfat/super.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -824,10 +824,21 @@ static int exfat_init_fs_context(struct fs_context *fc)
824824
ratelimit_state_init(&sbi->ratelimit, DEFAULT_RATELIMIT_INTERVAL,
825825
DEFAULT_RATELIMIT_BURST);
826826

827-
sbi->options.fs_uid = current_uid();
828-
sbi->options.fs_gid = current_gid();
829-
sbi->options.fs_fmask = current->fs->umask;
830-
sbi->options.fs_dmask = current->fs->umask;
827+
if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE && fc->root) {
828+
struct super_block *sb = fc->root->d_sb;
829+
struct exfat_mount_options *cur_opts = &EXFAT_SB(sb)->options;
830+
831+
sbi->options.fs_uid = cur_opts->fs_uid;
832+
sbi->options.fs_gid = cur_opts->fs_gid;
833+
sbi->options.fs_fmask = cur_opts->fs_fmask;
834+
sbi->options.fs_dmask = cur_opts->fs_dmask;
835+
} else {
836+
sbi->options.fs_uid = current_uid();
837+
sbi->options.fs_gid = current_gid();
838+
sbi->options.fs_fmask = current->fs->umask;
839+
sbi->options.fs_dmask = current->fs->umask;
840+
}
841+
831842
sbi->options.allow_utime = -1;
832843
sbi->options.errors = EXFAT_ERRORS_RO;
833844
exfat_set_iocharset(&sbi->options, exfat_default_iocharset);

0 commit comments

Comments
 (0)