From: Yifan Feng <evanfengff@gmail.com>
To: Gao Xiang <xiang@kernel.org>, Chao Yu <chao@kernel.org>
Cc: Yue Hu <zbestahu@gmail.com>, Jingbo Xu <jefflexu@163.com>,
Sandeep Dhavale <dhavale@google.com>,
Hongbo Li <hongbohbli@tencent.com>,
Chunhai Guo <guochunhai@vivo.com>,
linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org,
Yifan Feng <evanfengff@gmail.com>
Subject: [PATCH] erofs: keep the current mount options on remount
Date: Fri, 4 Dec 2026 18:35:57 -0800 [thread overview]
Message-ID: <20261205023557.74104-1-evanfengff@gmail.com> (raw)
erofs_init_fs_context() fills every new context with the default
options, and erofs_fc_reconfigure() installs them as they are. So a
remount that does not repeat nouser_xattr, noacl, cache_strategy= and
the other options kept in struct erofs_mount_opts resets them, and the
user xattrs that nouser_xattr hid can be read again:
# mount -t erofs -o nouser_xattr,cache_strategy=disabled /dev/vda /mnt
# findmnt -no OPTIONS /mnt
ro,relatime,nouser_xattr,acl,cache_strategy=disabled
# mount -o remount,noatime /dev/vda /mnt
# findmnt -no OPTIONS /mnt
ro,noatime,user_xattr,acl,cache_strategy=readaround
mount(8) hides this when it is given the mount point only, because it
then passes the current options again. Before the conversion to the
mount API a remount changed only the options that it named.
For a remount, start from the options in use.
Fixes: f57a3fe44995 ("erofs: convert to use the new mount fs_context api")
Signed-off-by: Yifan Feng <evanfengff@gmail.com>
---
On the fixes branch of erofs.git. Tested in QEMU with mount(2), mount(8) and fspick()/fsconfig(), on a compressed image and on a file-backed mount.
Found and written with the help of an AI coding assistant.
fs/erofs/super.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index 01439e748617..80e8e49bbcb5 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -999,7 +999,10 @@ static int erofs_init_fs_context(struct fs_context *fc)
idr_init(&sbi->devs->tree);
init_rwsem(&sbi->devs->rwsem);
- erofs_default_options(sbi);
+ if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE)
+ sbi->opt = EROFS_SB(fc->root->d_sb)->opt;
+ else
+ erofs_default_options(sbi);
fc->ops = &erofs_context_ops;
return 0;
}
base-commit: bb6713757f26cb11a12723b7a8ae0ec6e7200eeb
--
2.39.3 (Apple Git-146)
reply other threads:[~2026-12-05 2:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261205023557.74104-1-evanfengff@gmail.com \
--to=evanfengff@gmail.com \
--cc=chao@kernel.org \
--cc=dhavale@google.com \
--cc=guochunhai@vivo.com \
--cc=hongbohbli@tencent.com \
--cc=jefflexu@163.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xiang@kernel.org \
--cc=zbestahu@gmail.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.