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

Darrick J. Wong
2025-10-29T01:26:25Z

_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"
+ ;;
+ *)
+ ;;
+ esac
+}
+
_scratch_options()
{
SCRATCH_OPTIONS=""
diff --git a/tests/generic/409 b/tests/generic/409
index eff7c3584b413b..cbd59b0162da2c 100755
--- a/tests/generic/409
+++ b/tests/generic/409
@@ -39,6 +39,7 @@ _cleanup()
_require_test
_require_scratch
_require_local_device $SCRATCH_DEV
+_require_mount_stack

fs_stress()
{
diff --git a/tests/generic/410 b/tests/generic/410
index 69f9dbe97f182d..d5686ddbc64091 100755
--- a/tests/generic/410
+++ b/tests/generic/410
@@ -47,6 +47,7 @@ _cleanup()
_require_test
_require_scratch
_require_local_device $SCRATCH_DEV
+_require_mount_stack

fs_stress()
{
diff --git a/tests/generic/411 b/tests/generic/411
index b099940f3fa704..1538ed7071781a 100755
--- a/tests/generic/411
+++ b/tests/generic/411
@@ -28,6 +28,7 @@ _cleanup()
_require_test
_require_scratch
_require_local_device $SCRATCH_DEV
+_require_mount_stack

fs_stress()
{
diff --git a/tests/generic/589 b/tests/generic/589
index e7627f26c75996..13fde16505b7ab 100755
--- a/tests/generic/589
+++ b/tests/generic/589
@@ -42,6 +42,7 @@ _cleanup()
_require_test
_require_scratch
_require_local_device $SCRATCH_DEV
+_require_mount_stack

fs_stress()
{