Skip to content

remounting of FUSE fails #2576

Open
Open

Description

@sur5r

(This is similar/related to #2528)

The change in 602c1c5 broke internal-only remounting of FUSE filesystems.

I stumbled across this as ceph-fuse stopped working on machines having util-linux 2.39 installed.

The mount looks like this:

ceph-fuse on /ceph type fuse.ceph-fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)

While trying to remount, this results failures of either:

  • fsconfig(name=allow_other,value=(null))
  • fsconfig(name=user_id,value=0)

I also tried this with a FUSE mount of a borg repository, which fails the same way. That's why I think it will affect all fuse mounts.

v2.38 (or even just c15b21c) work fine in this case, so I assume this is a regression.

Activity

  1. t-8ch commented on Nov 9, 2023

    @t-8ch
    Member

    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.

  2. sur5r commented on Nov 9, 2023

    @sur5r
    Author

    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.

  3. t-8ch commented on Nov 10, 2023

    @t-8ch
    Member

    I looked at this too before and wasn't able to make it work nicely.
    I guess I'll try again.

  4. karelzak commented on Nov 28, 2023

    @karelzak
    Collaborator

    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.

  5. brauner commented on Nov 28, 2023

    @brauner
    Contributor

    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.

  6. karelzak commented on Nov 29, 2023

    @karelzak
    Collaborator

    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,...>

  7. mwhudson commented on Nov 29, 2023

    @mwhudson

    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...)

  8. Ericson2314 commented on Apr 5, 2024

    @Ericson2314

    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!

  9. sur5r commented on Apr 30, 2024

    @sur5r
    Author

    With 2.39, there might be a workaround: Setting LIBMOUNT_FORCE_MOUNT2=always when invoking ceph-fuse (or mount -t fuse.ceph) works for me.

    Edit: Related ceph tracker item: https://tracker.ceph.com/issues/62664

  10. t-8ch commented on Apr 30, 2024

    @t-8ch
    Member

    A slightly less workaroundy way could be:

    # mount -o remount,ro none /overlayfs
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions