[PATCH] erofs: keep the current mount options on remount
From: Yifan Feng
Date: Fri Dec 04 2026 - 21:36:06 EST
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@xxxxxxxxx>
---
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)