All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hyunchul Lee <hyc.lee@gmail.com>
To: Namjae Jeon <namjae.jeon@samsung.com>,
	Sungjong Seo <sj1557.seo@samsung.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-team@lge.com
Subject: [PATCH 2/2] exfat: allow to change some mount options for remount
Date: Fri, 12 Jun 2020 18:42:50 +0900	[thread overview]
Message-ID: <20200612094250.9347-2-hyc.lee@gmail.com> (raw)
In-Reply-To: <20200612094250.9347-1-hyc.lee@gmail.com>

Allow to change permission masks, allow_utime,
errors. But ignore other options.

Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
---
 fs/exfat/super.c | 40 +++++++++++++++++++++++++++++-----------
 1 file changed, 29 insertions(+), 11 deletions(-)

diff --git a/fs/exfat/super.c b/fs/exfat/super.c
index 61c6cf240c19..3c1d47289ba2 100644
--- a/fs/exfat/super.c
+++ b/fs/exfat/super.c
@@ -696,9 +696,13 @@ static void exfat_free(struct fs_context *fc)
 static int exfat_reconfigure(struct fs_context *fc)
 {
 	struct super_block *sb = fc->root->d_sb;
+	struct exfat_sb_info *sbi = EXFAT_SB(sb);
+	struct exfat_mount_options *new_opts;
 	int ret;
 	bool new_rdonly;
 
+	new_opts = &((struct exfat_sb_info *)fc->s_fs_info)->options;
+
 	new_rdonly = fc->sb_flags & SB_RDONLY;
 	if (new_rdonly != sb_rdonly(sb)) {
 		if (new_rdonly) {
@@ -708,6 +712,12 @@ static int exfat_reconfigure(struct fs_context *fc)
 				return ret;
 		}
 	}
+
+	/* allow to change these options but ignore others */
+	sbi->options.fs_fmask = new_opts->fs_fmask;
+	sbi->options.fs_dmask = new_opts->fs_dmask;
+	sbi->options.allow_utime = new_opts->allow_utime;
+	sbi->options.errors = new_opts->errors;
 	return 0;
 }
 
@@ -726,17 +736,25 @@ static int exfat_init_fs_context(struct fs_context *fc)
 	if (!sbi)
 		return -ENOMEM;
 
-	mutex_init(&sbi->s_lock);
-	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;
-	sbi->options.allow_utime = -1;
-	sbi->options.iocharset = exfat_default_iocharset;
-	sbi->options.errors = EXFAT_ERRORS_RO;
+	if (fc->root) {
+		/* reconfiguration */
+		memcpy(&sbi->options, &EXFAT_SB(fc->root->d_sb)->options,
+			sizeof(struct exfat_mount_options));
+		sbi->options.iocharset = exfat_default_iocharset;
+	} else {
+		mutex_init(&sbi->s_lock);
+		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;
+		sbi->options.allow_utime = -1;
+		sbi->options.iocharset = exfat_default_iocharset;
+		sbi->options.errors = EXFAT_ERRORS_RO;
+	}
 
 	fc->s_fs_info = sbi;
 	fc->ops = &exfat_context_ops;
-- 
2.17.1


  reply	other threads:[~2020-06-12 10:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200612094312epcas1p1d8be51e8ab6e26b622e3c8437a20cfcf@epcas1p1.samsung.com>
2020-06-12  9:42 ` [PATCH 1/2] exfat: call sync_filesystem for read-only remount Hyunchul Lee
2020-06-12  9:42   ` Hyunchul Lee [this message]
2020-06-15  0:18     ` [PATCH 2/2] exfat: allow to change some mount options for remount Namjae Jeon
2020-06-15  2:12       ` Hyunchul Lee
2020-06-15  0:14   ` [PATCH 1/2] exfat: call sync_filesystem for read-only remount Namjae Jeon
2020-06-15  2:10     ` Hyunchul Lee
2020-06-15  2:56       ` Namjae Jeon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200612094250.9347-2-hyc.lee@gmail.com \
    --to=hyc.lee@gmail.com \
    --cc=kernel-team@lge.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namjae.jeon@samsung.com \
    --cc=sj1557.seo@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.