You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I strongly suspect in util-linux.
As outlined in the other ticket IMO the best way forward would be for libmount to only fsconfig() parameters that changed since the last mount.
The most common case ro/rw would not hit the filesystem itself because they are handled by the VFS.
So I navigated the code for the better part of an hour hoping to find a place to put a fix for this. Unfortunately, there doesn't seem to be a single place to put this.
My first idea was to integrate it into configure_superblock but it turns out fsconfig() is missing any read/get functionality.
From the debug trace I think apply_fs() should be the right place, but AIUI we don't know yet that a remount is happening.
Would have loved to come up with a patch, but I guess this is more complex than I anticipated.
I am uncertain if this is an elegant solution for addressing this issue in userspace. The semantics for remounts have been well-defined for years. The interaction of mount(8) with fstab/mountinfo options and options from the command line depends on whether source and target are specified on the command line. Additionally, control can be influenced by the --options-mode flag.
From my perspective, the kernel should silently disregard fsconfig() re-configure requests for mount options that cannot be reconfigured. Maintaining a list of filesystem-specific options that cannot be reconfigured in userspace is impractical.
IMHO the kernel must handle this in a manner that is user-friendly.
I am uncertain if this is an elegant solution for addressing this issue in userspace. The semantics for remounts have been well-defined for years. The interaction of mount(8) with fstab/mountinfo options and options from the command line depends on whether source and target are specified on the command line. Additionally, control can be influenced by the --options-mode flag.
From my perspective, the kernel should silently disregard fsconfig() re-configure requests for mount options that cannot be reconfigured. Maintaining a list of filesystem-specific options that cannot be reconfigured in userspace is impractical.
IMHO the kernel must handle this in a manner that is user-friendly.
So we need both behaviors maybe because it's really a problem for userspace if they set potentially security sensitive options that are then silently ignored. That forces them to recheck whether that mount option has been actually set. And that's also terrible. What we could to is add flags to fsopen() and fspick() that mark the associated fs_context as silently ignoring unknown mount options.
Reporting (as an error) unknown options is not a big problem; the problem is known options that are impossible to re-configure (remount). You can commonly mount FS with some options, but the options cannot be modified later (removed or set to another value).
The classic mount -o remount works as "gather all options from fstab/mountinfo, add new options from the command line and send all the mess to the kernel in the hope that kernel will evaluate it correctly".
One day, I'd like to have something like this:
# mount reconfigure --set <fs-options>
# mount modify --set <vfs-flags> --clear <vfs-flags>
to avoid current remount complexity and to provide a better command line interface to fsconfig() and mount_setattr(). I can imagine also --error-on <unknown,unmodifiable,...>
All of this seems a bit messy, apologies if this comment comes across as a bit incoherent.
The classic mount -o remount works as "gather all options from fstab/mountinfo, add new options from the command line and send all the mess to the kernel in the hope that kernel will evaluate it correctly".
And that behaviour is what systemd-remount-fs wants, its essentially the whole reason for its existence. In some sense it would make sense for either mount(1) or the kernel to ignore/filter out options that are the same as those already configured for the mountpoint. Maybe the kernel as it definitely seems a bit strange that "read options from mountinfo, pass them unmodified to mount(3)" can fail but I don't really know.
But in my case (#2528) there is a call to pivot_root between the mount being set up and the remounting, so a pedantic interpretation about whether the "lowerdir" setting is "the same" would say they are not the same. Just comparing the strings would work fine for my case though.
(I actually wonder if the initramfs script that does all this should just not put an entry for / into fstab at all but that's not really a topic for this bug report...)
Reading the Kernel code, I can't help but think there is some confusing about whether the flags are a patch or the new state.
The overlayfs code linked from #2528 (comment) says (emphasis added)
Give us the freedom to allow changing mount options with the new mount api in the future. So instead of silently ignoring everything we report a proper error. This is only visible for users of the new mount api.
Which to me implies if you want a "plain" remount with no options changed, you are not supposed to send any options at all: just inherit the old state.
Conversely the previous comments mention "gathering up all the flags" in userland -- i.e. assuming the kernel wants the new state from scratch, so userland must compute the old state, apply the delta, and then send the new flag over.
I think I agree with @karelzak that the kernel ought to support both methods (patch, and new state from scratch), but in the meantime, userland util-linux mount, the new linux mount API, and the overlayfs implementation should make sure they agree as to which semantics the new API is suppose to be!
Activity
t-8ch commentedon Nov 9, 2023
This is a duplicate of #2528.
fuse has the same behavior on reconfiguration:
https://github.com/torvalds/linux/blob/6bc986ab839c844e78a2333a02e55f02c9e57935/fs/fuse/inode.c#L697
t-8ch commentedon Nov 9, 2023
I strongly suspect in util-linux.
As outlined in the other ticket IMO the best way forward would be for libmount to only fsconfig() parameters that changed since the last mount.
The most common case ro/rw would not hit the filesystem itself because they are handled by the VFS.
sur5r commentedon Nov 9, 2023
So I navigated the code for the better part of an hour hoping to find a place to put a fix for this. Unfortunately, there doesn't seem to be a single place to put this.
My first idea was to integrate it into
configure_superblockbut it turns outfsconfig()is missing any read/get functionality.From the debug trace I think
apply_fs()should be the right place, but AIUI we don't know yet that a remount is happening.Would have loved to come up with a patch, but I guess this is more complex than I anticipated.
t-8ch commentedon Nov 10, 2023
I looked at this too before and wasn't able to make it work nicely.
I guess I'll try again.
karelzak commentedon Nov 28, 2023
I am uncertain if this is an elegant solution for addressing this issue in userspace. The semantics for remounts have been well-defined for years. The interaction of mount(8) with fstab/mountinfo options and options from the command line depends on whether source and target are specified on the command line. Additionally, control can be influenced by the --options-mode flag.
From my perspective, the kernel should silently disregard fsconfig() re-configure requests for mount options that cannot be reconfigured. Maintaining a list of filesystem-specific options that cannot be reconfigured in userspace is impractical.
IMHO the kernel must handle this in a manner that is user-friendly.
brauner commentedon Nov 28, 2023
So we need both behaviors maybe because it's really a problem for userspace if they set potentially security sensitive options that are then silently ignored. That forces them to recheck whether that mount option has been actually set. And that's also terrible. What we could to is add flags to fsopen() and fspick() that mark the associated fs_context as silently ignoring unknown mount options.
karelzak commentedon Nov 29, 2023
Reporting (as an error) unknown options is not a big problem; the problem is known options that are impossible to re-configure (remount). You can commonly mount FS with some options, but the options cannot be modified later (removed or set to another value).
The classic
mount -o remountworks as "gather all options from fstab/mountinfo, add new options from the command line and send all the mess to the kernel in the hope that kernel will evaluate it correctly".One day, I'd like to have something like this:
to avoid current remount complexity and to provide a better command line interface to fsconfig() and mount_setattr(). I can imagine also
--error-on <unknown,unmodifiable,...>mwhudson commentedon Nov 29, 2023
All of this seems a bit messy, apologies if this comment comes across as a bit incoherent.
And that behaviour is what systemd-remount-fs wants, its essentially the whole reason for its existence. In some sense it would make sense for either mount(1) or the kernel to ignore/filter out options that are the same as those already configured for the mountpoint. Maybe the kernel as it definitely seems a bit strange that "read options from mountinfo, pass them unmodified to mount(3)" can fail but I don't really know.
But in my case (#2528) there is a call to pivot_root between the mount being set up and the remounting, so a pedantic interpretation about whether the "lowerdir" setting is "the same" would say they are not the same. Just comparing the strings would work fine for my case though.
(I actually wonder if the initramfs script that does all this should just not put an entry for / into fstab at all but that's not really a topic for this bug report...)
Ericson2314 commentedon Apr 5, 2024
Reading the Kernel code, I can't help but think there is some confusing about whether the flags are a patch or the new state.
The overlayfs code linked from #2528 (comment) says (emphasis added)
Which to me implies if you want a "plain" remount with no options changed, you are not supposed to send any options at all: just inherit the old state.
Conversely the previous comments mention "gathering up all the flags" in userland -- i.e. assuming the kernel wants the new state from scratch, so userland must compute the old state, apply the delta, and then send the new flag over.
I think I agree with @karelzak that the kernel ought to support both methods (patch, and new state from scratch), but in the meantime, userland util-linux
mount, the new linux mount API, and the overlayfs implementation should make sure they agree as to which semantics the new API is suppose to be!sur5r commentedon Apr 30, 2024
With 2.39, there might be a workaround: Setting
LIBMOUNT_FORCE_MOUNT2=alwayswhen invokingceph-fuse(ormount -t fuse.ceph) works for me.Edit: Related ceph tracker item: https://tracker.ceph.com/issues/62664
Ericson2314 commentedon Apr 30, 2024
https://github.com/NixOS/nix/blob/e18c3d4670f6c329f69fed394691b23d530e50c3/tests/functional/local-overlay-store/common.sh#L24
We are using this also, but this is not a satisfactory permanent solution.
t-8ch commentedon Apr 30, 2024
A slightly less workaroundy way could be:
core-services/03-filesystems.sh: force legacy mount iface for remount
core-services, shutdown.d: force legacy mount iface for remount
core-services, shutdown.d: force legacy mount iface for remount
core-services, shutdown.d: force legacy mount iface for remount