Skip to contentSkip to conversation

xfstests: add fuse support

PATCH In review Miklos Szeredi 4 participants 4 messages Jan 8, 2020 – Jan 19, 2023 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfstests: add fuse support

This allows using any fuse filesystem that can be mounted with

mount -t fuse.$SUBTYPE ...

---
 README.fuse   |   28 ++++++++++++++++++++++++++++
 check         |    2 ++
 common/attr   |    4 ++--
 common/config |    8 +++++++-
 common/rc     |   34 ++++++++++++++++++++++++++++------
 5 files changed, 67 insertions(+), 9 deletions(-)
common/config +7 -1
@@ -295,6 +295,9 @@ _mount_opts()
 	9p)
 		export MOUNT_OPTIONS=$PLAN9_MOUNT_OPTIONS
 		;;
+	fuse)
+		export MOUNT_OPTIONS=$FUSE_MOUNT_OPTIONS
+		;;
 	xfs)
 		export MOUNT_OPTIONS=$XFS_MOUNT_OPTIONS
 		;;
@@ -353,6 +356,9 @@ _test_mount_opts()
 	9p)
 		export TEST_FS_MOUNT_OPTS=$PLAN9_MOUNT_OPTIONS
 		;;
+	fuse)
+		export TEST_FS_MOUNT_OPTS=$FUSE_MOUNT_OPTIONS
+		;;
 	cifs)
 		export TEST_FS_MOUNT_OPTS=$CIFS_MOUNT_OPTIONS
 		;;
@@ -485,7 +491,7 @@ _check_device()
 	fi
 
 	case "$FSTYP" in
-	9p|tmpfs|virtiofs)
+	9p|fuse|tmpfs|virtiofs)
 		# 9p and virtiofs mount tags are just plain strings, so anything is allowed
 		# tmpfs doesn't use mount source, ignore
 		;;
common/rc +28 -6
@@ -143,6 +143,8 @@ case "$FSTYP" in
 	 ;;
     9p)
 	 ;;
+    fuse)
+	 ;;
     ceph)
 	 ;;
     glusterfs)
@@ -339,7 +341,7 @@ _try_scratch_mount()
 		_overlay_scratch_mount $*
 		return $?
 	fi
-	_mount -t $FSTYP `_scratch_mount_options $*`
+	_mount -t $FSTYP$SUBTYP `_scratch_mount_options $*`
 }
 
 # mount scratch device with given options and _fail if mount fails
@@ -422,7 +424,7 @@ _test_mount()
         return $?
     fi
     _test_options mount
-    _mount -t $FSTYP $TEST_OPTIONS $TEST_FS_MOUNT_OPTS $SELINUX_MOUNT_OPTIONS $* $TEST_DEV $TEST_DIR
+    _mount -t $FSTYP$SUBTYP $TEST_OPTIONS $TEST_FS_MOUNT_OPTS $SELINUX_MOUNT_OPTIONS $* $TEST_DEV $TEST_DIR
 }
 
 _test_unmount()
@@ -614,6 +616,9 @@ _test_mkfs()
     9p)
 	# do nothing for 9p
 	;;
+    fuse)
+	# do nothing for fuse
+	;;
     virtiofs)
 	# do nothing for virtiofs
 	;;
@@ -654,6 +659,9 @@ _mkfs_dev()
     9p)
 	# do nothing for 9p
 	;;
+    fuse)
+	# do nothing for fuse
+	;;
     virtiofs)
 	# do nothing for virtiofs
 	;;
@@ -705,6 +713,14 @@ _scratch_cleanup_files()
 		_overlay_mkdirs $OVL_BASE_SCRATCH_MNT
 		# leave base fs mouted so tests can setup lower/upper dir files
 		;;
+	fuse)
+		[ -n "$SCRATCH_MNT" ] || return 1
+		_scratch_mount
+		if [ ! -e $SCRATCH_MNT/bin/sh ]; then
+			rm -rf $SCRATCH_MNT/*
+		fi
+		_scratch_unmount
+		;;
 	*)
 		[ -n "$SCRATCH_MNT" ] || return 1
 		_scratch_mount
@@ -721,7 +737,7 @@ _scratch_mkfs()
 	local mkfs_status
 
 	case $FSTYP in
-	nfs*|cifs|ceph|overlay|glusterfs|pvfs2|9p|virtiofs)
+	nfs*|cifs|ceph|overlay|glusterfs|pvfs2|9p|fuse|virtiofs)
 		# unable to re-create this fstyp, just remove all files in
 		# $SCRATCH_MNT to avoid EEXIST caused by the leftover files
 		# created in previous runs
@@ -1495,7 +1511,7 @@ _require_scratch_nocheck()
 			_notrun "this test requires a valid \$SCRATCH_MNT"
 		fi
 		;;
-	9p|virtiofs)
+	9p|fuse|virtiofs)
 		if [ -z "$SCRATCH_DEV" ]; then
 			_notrun "this test requires a valid \$SCRATCH_DEV"
 		fi
@@ -1619,7 +1635,7 @@ _require_test()
 			_notrun "this test requires a valid \$TEST_DIR"
 		fi
 		;;
-	9p|virtiofs)
+	9p|fuse|virtiofs)
 		if [ -z "$TEST_DEV" ]; then
 			_notrun "this test requires a valid \$TEST_DEV"
 		fi
@@ -2599,7 +2615,7 @@ _mount_or_remount_rw()
 
 	if [ $USE_REMOUNT -eq 0 ]; then
 		if [ "$FSTYP" != "overlay" ]; then
-			_mount -t $FSTYP $mount_opts $device $mountpoint
+			_mount -t $FSTYP$SUBTYP $mount_opts $device $mountpoint
 		else
 			_overlay_mount $device $mountpoint
 		fi
@@ -2727,6 +2743,9 @@ _check_test_fs()
     9p)
 	# no way to check consistency for 9p
 	;;
+    fuse)
+	# no way to check consistency for fuse
+	;;
     virtiofs)
 	# no way to check consistency for virtiofs
 	;;
@@ -2788,6 +2807,9 @@ _check_scratch_fs()
     9p)
 	# no way to check consistency for 9p
 	;;
+    fuse)
+	# no way to check consistency for fuse
+	;;
     virtiofs)
 	# no way to check consistency for virtiofs
 	;;
check +2 -0
@@ -56,6 +56,7 @@ check options
     -glusterfs		test GlusterFS
     -cifs		test CIFS
     -9p			test 9p
+    -fuse		test fuse
     -virtiofs		test virtiofs
     -overlay		test overlay
     -pvfs2		test PVFS2
@@ -269,6 +270,7 @@ while [ $# -gt 0 ]; do
 	-glusterfs)	FSTYP=glusterfs ;;
 	-cifs)		FSTYP=cifs ;;
 	-9p)		FSTYP=9p ;;
+	-fuse)		FSTYP=fuse ;;
 	-virtiofs)	FSTYP=virtiofs ;;
 	-overlay)	FSTYP=overlay; export OVERLAY=true ;;
 	-pvfs2)		FSTYP=pvfs2 ;;
common/attr +2 -2
@@ -238,7 +238,7 @@ _getfattr()
 
 # set maximum total attr space based on fs type
 case "$FSTYP" in
-xfs|udf|pvfs2|9p|ceph)
+xfs|udf|pvfs2|9p|ceph|fuse)
 	MAX_ATTRS=1000
 	;;
 *)
@@ -258,7 +258,7 @@ xfs|udf|btrfs)
 pvfs2)
 	MAX_ATTRVAL_SIZE=8192
 	;;
-9p|ceph)
+9p|ceph|fuse)
 	MAX_ATTRVAL_SIZE=65536
 	;;
 *)
README.fuse new file +28 -0
@@ -0,0 +1,28 @@
+Here are instructions for testing fuse using the passthrough_ll example
+filesystem provided in the libfuse source tree:
+
+git clone git://github.com/libfuse/libfuse.git
+cd libfuse
+meson build
+cd build
+ninja
+cp example/passthrough_ll /usr/bin
+cd
+cat << 'EOF' > /sbin/mount.fuse.passthrough_ll
+#!/bin/bash
+ulimit -n 1048576
+exec /usr/bin/passthrough_ll -ofsname="$@"
+EOF
+chmod +x /sbin/mount.fuse.passthrough_ll
+mkdir -p /mnt/test /mnt/scratch /home/test/test /home/test/scratch
+
+Use the following config file:
+
+export TEST_DEV=non1
+export TEST_DIR=/mnt/test
+export SCRATCH_DEV=non2
+export SCRATCH_MNT=/mnt/scratch
+export FSTYP=fuse
+export SUBTYP=.passthrough_ll
+export FUSE_MOUNT_OPTIONS="-osource=/home/test/scratch,allow_other,default_permissions"
+export TEST_FS_MOUNT_OPTS="-osource=/home/test/test,allow_other,default_permissions"
#1 lore raw
Quoted 5 lines · Miklos Szeredi

This allows using any fuse filesystem that can be mounted with

mount -t fuse.$SUBTYPE ...

So sorry for being so late to review..

This patch looks fine to me overall, just some minor comments inline.

Quoted 31 lines
---
 README.fuse   |   28 ++++++++++++++++++++++++++++
 check         |    2 ++
 common/attr   |    4 ++--
 common/config |    8 +++++++-
 common/rc     |   34 ++++++++++++++++++++++++++++------
 5 files changed, 67 insertions(+), 9 deletions(-)
common/config +6 -0
@@ -295,6 +295,9 @@ _mount_opts()
 	9p)
 		export MOUNT_OPTIONS=$PLAN9_MOUNT_OPTIONS
 		;;
+	fuse)
+		export MOUNT_OPTIONS=$FUSE_MOUNT_OPTIONS
+		;;
 	xfs)
 		export MOUNT_OPTIONS=$XFS_MOUNT_OPTIONS
 		;;
@@ -353,6 +356,9 @@ _test_mount_opts()
 	9p)
 		export TEST_FS_MOUNT_OPTS=$PLAN9_MOUNT_OPTIONS
 		;;
+	fuse)
+		export TEST_FS_MOUNT_OPTS=$FUSE_MOUNT_OPTIONS
+		;;
 	cifs)
 		export TEST_FS_MOUNT_OPTS=$CIFS_MOUNT_OPTIONS
 		;;

common/config _check_device() · line 496

Quoted 7 lines
common/config +1 -1
@@ -485,7 +491,7 @@ _check_device()
 	fi
 
 	case "$FSTYP" in
-	9p|tmpfs|virtiofs)
+	9p|fuse|tmpfs|virtiofs)
 		# 9p and virtiofs mount tags are just plain strings, so anything is allowed
 		# tmpfs doesn't use mount source, ignore

Update comment above and mention fuse too?

Quoted 13 lines
common/config +0 -0
 		;;
common/rc +2 -0
@@ -143,6 +143,8 @@ case "$FSTYP" in
 	 ;;
     9p)
 	 ;;
+    fuse)
+	 ;;
     ceph)
 	 ;;
     glusterfs)

common/rc _try_scratch_mount() · line 344

Quoted 5 lines
common/rc +1 -1
@@ -339,7 +341,7 @@ _try_scratch_mount()
 		_overlay_scratch_mount $*
 		return $?
 	fi
-	_mount -t $FSTYP `_scratch_mount_options $*`
+	_mount -t $FSTYP$SUBTYP `_scratch_mount_options $*`

Or make it more explicit and call it $FUSE_SUBTYP ? So we know it's only useful in fuse testing.

Quoted 33 lines
common/rc +7 -1
 }
 
 # mount scratch device with given options and _fail if mount fails
@@ -422,7 +424,7 @@ _test_mount()
         return $?
     fi
     _test_options mount
-    _mount -t $FSTYP $TEST_OPTIONS $TEST_FS_MOUNT_OPTS $SELINUX_MOUNT_OPTIONS $* $TEST_DEV $TEST_DIR
+    _mount -t $FSTYP$SUBTYP $TEST_OPTIONS $TEST_FS_MOUNT_OPTS $SELINUX_MOUNT_OPTIONS $* $TEST_DEV $TEST_DIR
 }
 
 _test_unmount()
@@ -614,6 +616,9 @@ _test_mkfs()
     9p)
 	# do nothing for 9p
 	;;
+    fuse)
+	# do nothing for fuse
+	;;
     virtiofs)
 	# do nothing for virtiofs
 	;;
@@ -654,6 +659,9 @@ _mkfs_dev()
     9p)
 	# do nothing for 9p
 	;;
+    fuse)
+	# do nothing for fuse
+	;;
     virtiofs)
 	# do nothing for virtiofs
 	;;

common/rc _scratch_cleanup_files() · line 719

Quoted 7 lines
common/rc +4 -0
@@ -705,6 +713,14 @@ _scratch_cleanup_files()
 		_overlay_mkdirs $OVL_BASE_SCRATCH_MNT
 		# leave base fs mouted so tests can setup lower/upper dir files
 		;;
+	fuse)
+		[ -n "$SCRATCH_MNT" ] || return 1
+		_scratch_mount
+		if [ ! -e $SCRATCH_MNT/bin/sh ]; then

What's the purpose of this check? Avoid deleting / ? I think that has been done by the $SCRATCH_MNT check.

Quoted 17 lines
common/rc +5 -1
+			rm -rf $SCRATCH_MNT/*
+		fi
+		_scratch_unmount
+		;;
 	*)
 		[ -n "$SCRATCH_MNT" ] || return 1
 		_scratch_mount
@@ -721,7 +737,7 @@ _scratch_mkfs()
 	local mkfs_status
 
 	case $FSTYP in
-	nfs*|cifs|ceph|overlay|glusterfs|pvfs2|9p|virtiofs)
+	nfs*|cifs|ceph|overlay|glusterfs|pvfs2|9p|fuse|virtiofs)
 		# unable to re-create this fstyp, just remove all files in
 		# $SCRATCH_MNT to avoid EEXIST caused by the leftover files
 		# created in previous runs

common/rc _require_scratch_nocheck() · line 1517

Quoted 8 lines
common/rc +1 -1
@@ -1495,7 +1511,7 @@ _require_scratch_nocheck()
 			_notrun "this test requires a valid \$SCRATCH_MNT"
 		fi
 		;;
-	9p|virtiofs)
+	9p|fuse|virtiofs)
 		if [ -z "$SCRATCH_DEV" ]; then
 			_notrun "this test requires a valid \$SCRATCH_DEV"
 		fi

Check for $SCRATCH_MNT as well?

common/rc _require_test() · line 1641

Quoted 9 lines
common/rc +1 -1
@@ -1619,7 +1635,7 @@ _require_test()
 			_notrun "this test requires a valid \$TEST_DIR"
 		fi
 		;;
-	9p|virtiofs)
+	9p|fuse|virtiofs)
 		if [ -z "$TEST_DEV" ]; then
 			_notrun "this test requires a valid \$TEST_DEV"
 		fi

Same here, should check $TEST_DIR too.

Quoted 59 lines
common/rc +7 -1
@@ -2599,7 +2615,7 @@ _mount_or_remount_rw()
 
 	if [ $USE_REMOUNT -eq 0 ]; then
 		if [ "$FSTYP" != "overlay" ]; then
-			_mount -t $FSTYP $mount_opts $device $mountpoint
+			_mount -t $FSTYP$SUBTYP $mount_opts $device $mountpoint
 		else
 			_overlay_mount $device $mountpoint
 		fi
@@ -2727,6 +2743,9 @@ _check_test_fs()
     9p)
 	# no way to check consistency for 9p
 	;;
+    fuse)
+	# no way to check consistency for fuse
+	;;
     virtiofs)
 	# no way to check consistency for virtiofs
 	;;
@@ -2788,6 +2807,9 @@ _check_scratch_fs()
     9p)
 	# no way to check consistency for 9p
 	;;
+    fuse)
+	# no way to check consistency for fuse
+	;;
     virtiofs)
 	# no way to check consistency for virtiofs
 	;;
check +2 -0
@@ -56,6 +56,7 @@ check options
     -glusterfs		test GlusterFS
     -cifs		test CIFS
     -9p			test 9p
+    -fuse		test fuse
     -virtiofs		test virtiofs
     -overlay		test overlay
     -pvfs2		test PVFS2
@@ -269,6 +270,7 @@ while [ $# -gt 0 ]; do
 	-glusterfs)	FSTYP=glusterfs ;;
 	-cifs)		FSTYP=cifs ;;
 	-9p)		FSTYP=9p ;;
+	-fuse)		FSTYP=fuse ;;
 	-virtiofs)	FSTYP=virtiofs ;;
 	-overlay)	FSTYP=overlay; export OVERLAY=true ;;
 	-pvfs2)		FSTYP=pvfs2 ;;
common/attr +1 -1
@@ -238,7 +238,7 @@ _getfattr()
 
 # set maximum total attr space based on fs type
 case "$FSTYP" in
-xfs|udf|pvfs2|9p|ceph)
+xfs|udf|pvfs2|9p|ceph|fuse)
 	MAX_ATTRS=1000
 	;;
 *)

common/attr xfs|udf|btrfs) · line 263

Quoted 7 lines
common/attr +1 -1
@@ -258,7 +258,7 @@ xfs|udf|btrfs)
 pvfs2)
 	MAX_ATTRVAL_SIZE=8192
 	;;
-9p|ceph)
+9p|ceph|fuse)
 	MAX_ATTRVAL_SIZE=65536
 	;;

As you're fuse maintainer, I assume above max attr setting is correct :)

Thanks,
Eryu

Quoted 35 lines
common/attr +0 -0
 *)
README.fuse new file +28 -0
@@ -0,0 +1,28 @@
+Here are instructions for testing fuse using the passthrough_ll example
+filesystem provided in the libfuse source tree:
+
+git clone git://github.com/libfuse/libfuse.git
+cd libfuse
+meson build
+cd build
+ninja
+cp example/passthrough_ll /usr/bin
+cd
+cat << 'EOF' > /sbin/mount.fuse.passthrough_ll
+#!/bin/bash
+ulimit -n 1048576
+exec /usr/bin/passthrough_ll -ofsname="$@"
+EOF
+chmod +x /sbin/mount.fuse.passthrough_ll
+mkdir -p /mnt/test /mnt/scratch /home/test/test /home/test/scratch
+
+Use the following config file:
+
+export TEST_DEV=non1
+export TEST_DIR=/mnt/test
+export SCRATCH_DEV=non2
+export SCRATCH_MNT=/mnt/scratch
+export FSTYP=fuse
+export SUBTYP=.passthrough_ll
+export FUSE_MOUNT_OPTIONS="-osource=/home/test/scratch,allow_other,default_permissions"
+export TEST_FS_MOUNT_OPTS="-osource=/home/test/test,allow_other,default_permissions"
#2 lore raw

PATCH 1/1 xfstests: add fuse support

From: Miklos Szeredi <[email protected]>

This allows using any fuse filesystem that can be mounted with

mount -t fuse.$FUSE_SUBTYP ...

Changelog:

v2: Jan 3, 2022, Jakob Unterwurzacher
* Rebased to master
* Instructions updated
** To not fail with libfuse version mismatch on passthrough_ll exe
on Fedora
** To use sudo
* Review comments from Eryu Guan addressed:
** Comment updated to mention fuse
** Renamed SUBTYP to FUSE_SUBTYP
** Removed $SCRATCH_MNT/bin/sh check before "rm -rf"
** _require_scratch_nocheck for fuse also checks for $SCRATCH_MNT ** _require_test for fuse also checks for $TEST_DIR

v1: Jan 8, 2020, Miklos Szeredi
* Initial submission
* https://patchwork.kernel.org/project/linux-fsdevel/patch/[email protected]/

---
 README.fuse       | 26 ++++++++++++++++++++++++++
 check             |  3 ++-
 common/config     |  9 +++++++--
 common/rc         | 24 ++++++++++++++++++------
 tests/generic/020 |  4 ++--
 5 files changed, 55 insertions(+), 11 deletions(-)
 create mode 100644 README.fuse
README.fuse new file +26 -0
new file mode 100644
index 00000000..35ad9c46
@@ -0,0 +1,26 @@
+Here are instructions for testing fuse using the passthrough_ll example
+filesystem provided in the libfuse source tree:
+
+git clone git://github.com/libfuse/libfuse.git
+cd libfuse
+meson build
+cd build
+ninja
+cat << EOF | sudo tee /sbin/mount.fuse.passthrough_ll
+#!/bin/bash
+ulimit -n 1048576
+exec $(pwd)/example/passthrough_ll -ofsname="\$@"
+EOF
+sudo chmod +x /sbin/mount.fuse.passthrough_ll
+mkdir -p /mnt/test /mnt/scratch /home/test/test /home/test/scratch
+
+Use the following local.config file:
+
+export TEST_DEV=non1
+export TEST_DIR=/mnt/test
+export SCRATCH_DEV=non2
+export SCRATCH_MNT=/mnt/scratch
+export FSTYP=fuse
+export FUSE_SUBTYP=.passthrough_ll
+export FUSE_MOUNT_OPTIONS="-osource=/home/test/scratch,allow_other,default_permissions"
+export TEST_FS_MOUNT_OPTS="-osource=/home/test/test,allow_other,default_permissions"
check +2 -1
index 1ff0f44a..e25037f1 100755
@@ -60,6 +60,7 @@ check options
     -glusterfs		test GlusterFS
     -cifs		test CIFS
     -9p			test 9p
+    -fuse		test fuse
     -virtiofs		test virtiofs
     -overlay		test overlay
     -pvfs2		test PVFS2
@@ -279,7 +280,7 @@ while [ $# -gt 0 ]; do
 	case "$1" in
 	-\? | -h | --help) usage ;;
 
-	-nfs|-glusterfs|-cifs|-9p|-virtiofs|-pvfs2|-tmpfs|-ubifs)
+	-nfs|-glusterfs|-cifs|-9p|-fuse|-virtiofs|-pvfs2|-tmpfs|-ubifs)
 		FSTYP="${1:1}"
 		;;
 	-overlay)
common/config +7 -2
index e2aba5a9..6c8cb3a5 100644
@@ -341,6 +341,9 @@ _common_mount_opts()
 	9p)
 		echo $PLAN9_MOUNT_OPTIONS
 		;;
+	fuse)
+		echo $FUSE_MOUNT_OPTIONS
+		;;
 	xfs)
 		echo $XFS_MOUNT_OPTIONS
 		;;
@@ -511,6 +514,8 @@ _source_specific_fs()
 		;;
 	9p)
 		;;
+	fuse)
+		;;
 	ceph)
 		. ./common/ceph
 		;;
@@ -583,8 +588,8 @@ _check_device()
 	fi
 
 	case "$FSTYP" in
-	9p|tmpfs|virtiofs)
-		# 9p and virtiofs mount tags are just plain strings, so anything is allowed
+	9p|fuse|tmpfs|virtiofs)
+		# 9p, fuse and virtiofs mount tags are just plain strings, so anything is allowed
 		# tmpfs doesn't use mount source, ignore
 		;;
 	ceph)
common/rc +18 -6
index 23530413..c17e3f6e 100644
@@ -274,7 +274,7 @@ _try_scratch_mount()
 		_overlay_scratch_mount $*
 		return $?
 	fi
-	_mount -t $FSTYP `_scratch_mount_options $*`
+	_mount -t $FSTYP$FUSE_SUBTYP `_scratch_mount_options $*`
 	mount_ret=$?
 	[ $mount_ret -ne 0 ] && return $mount_ret
 	_idmapped_mount $SCRATCH_DEV $SCRATCH_MNT
@@ -458,7 +458,7 @@ _test_mount()
     fi
 
     _test_options mount
-    _mount -t $FSTYP $TEST_OPTIONS $TEST_FS_MOUNT_OPTS $SELINUX_MOUNT_OPTIONS $* $TEST_DEV $TEST_DIR
+    _mount -t $FSTYP$FUSE_SUBTYP $TEST_OPTIONS $TEST_FS_MOUNT_OPTS $SELINUX_MOUNT_OPTIONS $* $TEST_DEV $TEST_DIR
     mount_ret=$?
     [ $mount_ret -ne 0 ] && return $mount_ret
     _idmapped_mount $TEST_DEV $TEST_DIR
@@ -584,6 +584,9 @@ _test_mkfs()
     9p)
 	# do nothing for 9p
 	;;
+    fuse)
+	# do nothing for fuse
+	;;
     virtiofs)
 	# do nothing for virtiofs
 	;;
@@ -624,6 +627,9 @@ _mkfs_dev()
     9p)
 	# do nothing for 9p
 	;;
+    fuse)
+	# do nothing for fuse
+	;;
     virtiofs)
 	# do nothing for virtiofs
 	;;
@@ -691,7 +697,7 @@ _scratch_mkfs()
 	local mkfs_status
 
 	case $FSTYP in
-	nfs*|cifs|ceph|overlay|glusterfs|pvfs2|9p|virtiofs)
+	nfs*|cifs|ceph|overlay|glusterfs|pvfs2|9p|fuse|virtiofs)
 		# unable to re-create this fstyp, just remove all files in
 		# $SCRATCH_MNT to avoid EEXIST caused by the leftover files
 		# created in previous runs
@@ -1587,7 +1593,7 @@ _require_scratch_nocheck()
 			_notrun "this test requires a valid \$SCRATCH_MNT"
 		fi
 		;;
-	9p|virtiofs)
+	9p|fuse|virtiofs)
 		if [ -z "$SCRATCH_DEV" ]; then
 			_notrun "this test requires a valid \$SCRATCH_DEV"
 		fi
@@ -1787,7 +1793,7 @@ _require_test()
 			_notrun "this test requires a valid \$TEST_DIR"
 		fi
 		;;
-	9p|virtiofs)
+	9p|fuse|virtiofs)
 		if [ -z "$TEST_DEV" ]; then
 			_notrun "this test requires a valid \$TEST_DEV"
 		fi
@@ -2986,7 +2992,7 @@ _mount_or_remount_rw()
 
 	if [ $USE_REMOUNT -eq 0 ]; then
 		if [ "$FSTYP" != "overlay" ]; then
-			_mount -t $FSTYP $mount_opts $device $mountpoint
+			_mount -t $FSTYP$FUSE_SUBTYP $mount_opts $device $mountpoint
 			_idmapped_mount $device $mountpoint
 		else
 			_overlay_mount $device $mountpoint
@@ -3124,6 +3130,9 @@ _check_test_fs()
     9p)
 	# no way to check consistency for 9p
 	;;
+    fuse)
+	# no way to check consistency for fuse
+	;;
     virtiofs)
 	# no way to check consistency for virtiofs
 	;;
@@ -3185,6 +3194,9 @@ _check_scratch_fs()
     9p)
 	# no way to check consistency for 9p
 	;;
+    fuse)
+	# no way to check consistency for fuse
+	;;
     virtiofs)
 	# no way to check consistency for virtiofs
 	;;
tests/generic/020 +2 -2
index b91bca34..be5cecad 100755
@@ -56,7 +56,7 @@ _attr_get_max()
 {
 	# set maximum total attr space based on fs type
 	case "$FSTYP" in
-	xfs|udf|pvfs2|9p|ceph|nfs)
+	xfs|udf|pvfs2|9p|ceph|fuse|nfs)
 		max_attrs=1000
 		;;
 	ext2|ext3|ext4)
@@ -134,7 +134,7 @@ _attr_get_maxval_size()
 	pvfs2)
 		max_attrval_size=8192
 		;;
-	xfs|udf|9p)
+	xfs|udf|9p|fuse)
 		max_attrval_size=65536
 		;;
 	bcachefs)
Signature · 1 line
2.38.1
#3 lore raw
Quoted 58 lines · Jakob Unterwurzacher

From: Miklos Szeredi <[email protected]>

This allows using any fuse filesystem that can be mounted with

mount -t fuse.$FUSE_SUBTYP ...

Changelog:

v2: Jan 3, 2022, Jakob Unterwurzacher
* Rebased to master
* Instructions updated
** To not fail with libfuse version mismatch on passthrough_ll exe
on Fedora
** To use sudo
* Review comments from Eryu Guan addressed:
** Comment updated to mention fuse
** Renamed SUBTYP to FUSE_SUBTYP
** Removed $SCRATCH_MNT/bin/sh check before "rm -rf"
** _require_scratch_nocheck for fuse also checks for $SCRATCH_MNT ** _require_test for fuse also checks for $TEST_DIR

v1: Jan 8, 2020, Miklos Szeredi
* Initial submission
* https://patchwork.kernel.org/project/linux-fsdevel/patch/[email protected]/

---
 README.fuse       | 26 ++++++++++++++++++++++++++
 check             |  3 ++-
 common/config     |  9 +++++++--
 common/rc         | 24 ++++++++++++++++++------
 tests/generic/020 |  4 ++--
 5 files changed, 55 insertions(+), 11 deletions(-)
 create mode 100644 README.fuse
README.fuse new file +16 -0
new file mode 100644
index 00000000..35ad9c46
@@ -0,0 +1,26 @@
+Here are instructions for testing fuse using the passthrough_ll example
+filesystem provided in the libfuse source tree:
+
+git clone git://github.com/libfuse/libfuse.git
+cd libfuse
+meson build
+cd build
+ninja
+cat << EOF | sudo tee /sbin/mount.fuse.passthrough_ll
+#!/bin/bash
+ulimit -n 1048576
+exec $(pwd)/example/passthrough_ll -ofsname="\$@"
+EOF
+sudo chmod +x /sbin/mount.fuse.passthrough_ll
+mkdir -p /mnt/test /mnt/scratch /home/test/test /home/test/scratch
+

README.fuse line 26

Quoted 10 lines
README.fuse new file +10 -0
+Use the following local.config file:
+
+export TEST_DEV=non1
+export TEST_DIR=/mnt/test
+export SCRATCH_DEV=non2
+export SCRATCH_MNT=/mnt/scratch
+export FSTYP=fuse
+export FUSE_SUBTYP=.passthrough_ll
+export FUSE_MOUNT_OPTIONS="-osource=/home/test/scratch,allow_other,default_permissions"
+export TEST_FS_MOUNT_OPTS="-osource=/home/test/test,allow_other,default_permissions"

Hi,

Long time ago I added glusterfs supporting, for testing kernel fuse module. Now we'll have general fuse supporting, that's good news. More and more things start to use fuse, I'm glad to see fstests support the fuse test :)

This version looks good to me, just a tiny problem on the README.fuse. Generally if we want to set mount options for both TEST_DEV and SCRATCH_DEV, we use the the parameter likes FUSE_MOUNT_OPTIONS (refer to _mount_opts(), _test_mount_opts() and _common_mount_opts()). If you just want to set mount options for SCRATCH_DEV particularly, you might want:

export MOUNT_OPTIONS="-osource=/home/test/scratch,allow_other,default_permissions" export TEST_FS_MOUNT_OPTS="-osource=/home/test/test,allow_other,default_permissions"

Others looks good to me, I'll give it a little testing, and merge it if can't find any issue.

Thanks,
Zorro

Quoted 178 lines
check +2 -1
index 1ff0f44a..e25037f1 100755
@@ -60,6 +60,7 @@ check options
     -glusterfs		test GlusterFS
     -cifs		test CIFS
     -9p			test 9p
+    -fuse		test fuse
     -virtiofs		test virtiofs
     -overlay		test overlay
     -pvfs2		test PVFS2
@@ -279,7 +280,7 @@ while [ $# -gt 0 ]; do
 	case "$1" in
 	-\? | -h | --help) usage ;;
 
-	-nfs|-glusterfs|-cifs|-9p|-virtiofs|-pvfs2|-tmpfs|-ubifs)
+	-nfs|-glusterfs|-cifs|-9p|-fuse|-virtiofs|-pvfs2|-tmpfs|-ubifs)
 		FSTYP="${1:1}"
 		;;
 	-overlay)
common/config +7 -2
index e2aba5a9..6c8cb3a5 100644
@@ -341,6 +341,9 @@ _common_mount_opts()
 	9p)
 		echo $PLAN9_MOUNT_OPTIONS
 		;;
+	fuse)
+		echo $FUSE_MOUNT_OPTIONS
+		;;
 	xfs)
 		echo $XFS_MOUNT_OPTIONS
 		;;
@@ -511,6 +514,8 @@ _source_specific_fs()
 		;;
 	9p)
 		;;
+	fuse)
+		;;
 	ceph)
 		. ./common/ceph
 		;;
@@ -583,8 +588,8 @@ _check_device()
 	fi
 
 	case "$FSTYP" in
-	9p|tmpfs|virtiofs)
-		# 9p and virtiofs mount tags are just plain strings, so anything is allowed
+	9p|fuse|tmpfs|virtiofs)
+		# 9p, fuse and virtiofs mount tags are just plain strings, so anything is allowed
 		# tmpfs doesn't use mount source, ignore
 		;;
 	ceph)
common/rc +18 -6
index 23530413..c17e3f6e 100644
@@ -274,7 +274,7 @@ _try_scratch_mount()
 		_overlay_scratch_mount $*
 		return $?
 	fi
-	_mount -t $FSTYP `_scratch_mount_options $*`
+	_mount -t $FSTYP$FUSE_SUBTYP `_scratch_mount_options $*`
 	mount_ret=$?
 	[ $mount_ret -ne 0 ] && return $mount_ret
 	_idmapped_mount $SCRATCH_DEV $SCRATCH_MNT
@@ -458,7 +458,7 @@ _test_mount()
     fi
 
     _test_options mount
-    _mount -t $FSTYP $TEST_OPTIONS $TEST_FS_MOUNT_OPTS $SELINUX_MOUNT_OPTIONS $* $TEST_DEV $TEST_DIR
+    _mount -t $FSTYP$FUSE_SUBTYP $TEST_OPTIONS $TEST_FS_MOUNT_OPTS $SELINUX_MOUNT_OPTIONS $* $TEST_DEV $TEST_DIR
     mount_ret=$?
     [ $mount_ret -ne 0 ] && return $mount_ret
     _idmapped_mount $TEST_DEV $TEST_DIR
@@ -584,6 +584,9 @@ _test_mkfs()
     9p)
 	# do nothing for 9p
 	;;
+    fuse)
+	# do nothing for fuse
+	;;
     virtiofs)
 	# do nothing for virtiofs
 	;;
@@ -624,6 +627,9 @@ _mkfs_dev()
     9p)
 	# do nothing for 9p
 	;;
+    fuse)
+	# do nothing for fuse
+	;;
     virtiofs)
 	# do nothing for virtiofs
 	;;
@@ -691,7 +697,7 @@ _scratch_mkfs()
 	local mkfs_status
 
 	case $FSTYP in
-	nfs*|cifs|ceph|overlay|glusterfs|pvfs2|9p|virtiofs)
+	nfs*|cifs|ceph|overlay|glusterfs|pvfs2|9p|fuse|virtiofs)
 		# unable to re-create this fstyp, just remove all files in
 		# $SCRATCH_MNT to avoid EEXIST caused by the leftover files
 		# created in previous runs
@@ -1587,7 +1593,7 @@ _require_scratch_nocheck()
 			_notrun "this test requires a valid \$SCRATCH_MNT"
 		fi
 		;;
-	9p|virtiofs)
+	9p|fuse|virtiofs)
 		if [ -z "$SCRATCH_DEV" ]; then
 			_notrun "this test requires a valid \$SCRATCH_DEV"
 		fi
@@ -1787,7 +1793,7 @@ _require_test()
 			_notrun "this test requires a valid \$TEST_DIR"
 		fi
 		;;
-	9p|virtiofs)
+	9p|fuse|virtiofs)
 		if [ -z "$TEST_DEV" ]; then
 			_notrun "this test requires a valid \$TEST_DEV"
 		fi
@@ -2986,7 +2992,7 @@ _mount_or_remount_rw()
 
 	if [ $USE_REMOUNT -eq 0 ]; then
 		if [ "$FSTYP" != "overlay" ]; then
-			_mount -t $FSTYP $mount_opts $device $mountpoint
+			_mount -t $FSTYP$FUSE_SUBTYP $mount_opts $device $mountpoint
 			_idmapped_mount $device $mountpoint
 		else
 			_overlay_mount $device $mountpoint
@@ -3124,6 +3130,9 @@ _check_test_fs()
     9p)
 	# no way to check consistency for 9p
 	;;
+    fuse)
+	# no way to check consistency for fuse
+	;;
     virtiofs)
 	# no way to check consistency for virtiofs
 	;;
@@ -3185,6 +3194,9 @@ _check_scratch_fs()
     9p)
 	# no way to check consistency for 9p
 	;;
+    fuse)
+	# no way to check consistency for fuse
+	;;
     virtiofs)
 	# no way to check consistency for virtiofs
 	;;
tests/generic/020 +2 -2
index b91bca34..be5cecad 100755
@@ -56,7 +56,7 @@ _attr_get_max()
 {
 	# set maximum total attr space based on fs type
 	case "$FSTYP" in
-	xfs|udf|pvfs2|9p|ceph|nfs)
+	xfs|udf|pvfs2|9p|ceph|fuse|nfs)
 		max_attrs=1000
 		;;
 	ext2|ext3|ext4)
@@ -134,7 +134,7 @@ _attr_get_maxval_size()
 	pvfs2)
 		max_attrval_size=8192
 		;;
-	xfs|udf|9p)
+	xfs|udf|9p|fuse)
 		max_attrval_size=65536
 		;;
 	bcachefs)
Signature · 1 line
2.38.1