Re: [PATCH] erofs: keep the current mount options on remount

From: Gao Xiang

Date: Sat Dec 05 2026 - 17:57:19 EST


On Fri, Dec 04, 2026 at 06:35:57PM -0800, Yifan Feng wrote:
> 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>

Reviewed-by: Gao Xiang <xiang@xxxxxxxxxx>

There was a similar patch but I think your patch is better:
https://lore.kernel.org/r/20261118112523.3824782-1-leeonion.muyu@xxxxxxxxx

I will add a Reported-by credit like:
Reported-by: Ping Li <leeonion.muyu@xxxxxxxxx>

Btw, although it's not perfect as Sashiko's pointed out (racy remount,
but I don't think anyone really cares), a follow-up patch maybe just
introduce a new opt_mask field so that it can mask off unchanged bits
in .reconfigure() when updating.

Thanks,
Gao Xiang