Re: [PATCH 23/33] generic/{409,410,411,589}: check for stacking mount support

Darrick J. Wong
2025-11-05T22:58:56Z

On Thu, Oct 30, 2025 at 11:25:12AM +0100, Amir Goldstein wrote:
> On Wed, Oct 29, 2025 at 2:29 AM Darrick J. Wong <djwong@kernel.org> wrote:
> >
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > _get_mount depends on the ability for commands such as "mount /dev/sda
> > /a/second/mountpoint -o per_mount_opts" to succeed when /dev/sda is
> > already mounted elsewhere.
> >
> > The kernel isn't going to notice that /dev/sda is already mounted, so
> > the mount(8) call won't do the right thing even if per_mount_opts match
> > the existing mount options.
> >
> > If per_mount_opts doesn't match, we'd have to convey the new per-mount
> > options to the kernel. In theory we could make the fuse2fs argument
> > parsing even more complex to support this use case, but for now fuse2fs
> > doesn't know how to do that.
> >
> > Until that happens, let's _notrun these tests.
> >
> > Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> > ---
> > common/rc | 24 ++++++++++++++++++++++++
> > tests/generic/409 | 1 +
> > tests/generic/410 | 1 +
> > tests/generic/411 | 1 +
> > tests/generic/589 | 1 +
> > 5 files changed, 28 insertions(+)
> >
> >
> > diff --git a/common/rc b/common/rc
> > index f5b10a280adec9..b6e76c03a12445 100644
> > --- a/common/rc
> > +++ b/common/rc
> > @@ -364,6 +364,30 @@ _clear_mount_stack()
> > MOUNTED_POINT_STACK=""
> > }
> >
> > +# Check that this filesystem supports stack mounts
> > +_require_mount_stack()
> > +{
> > + case "$FSTYP" in
> > + fuse.ext[234])
> > + # _get_mount depends on the ability for commands such as
> > + # "mount /dev/sda /a/second/mountpoint -o per_mount_opts" to
> > + # succeed when /dev/sda is already mounted elsewhere.
> > + #
> > + # The kernel isn't going to notice that /dev/sda is already
> > + # mounted, so the mount(8) call won't do the right thing even
> > + # if per_mount_opts match the existing mount options.
> > + #
> > + # If per_mount_opts doesn't match, we'd have to convey the new
> > + # per-mount options to the kernel. In theory we could make the
> > + # fuse2fs argument parsing even more complex to support this
> > + # use case, but for now fuse2fs doesn't know how to do that.
> > + _notrun "fuse2fs servers do not support stacking mounts"
> > + ;;
>
> I believe this is true for fuse* in general. no?

I think it's actually true any time mount shells out to a mount helper
because you gave it a -t FOO and there happens to be a mount.FOO in
$PATH. Though I wonder if I could/should just bloat up fuse4fs to
detect when the device is already open to the same mountpoint, and just
call mount(8) back with --internal?

--D

> Thanks,
> Amir.
>