Skip to contentSkip to conversation

fstests: add fuse.gocryptfs support

PATCH In review Jakob Unterwurzacher 2 participants 2 messages Nov 16, 2025 – Nov 19, 2025 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fstests: add fuse.gocryptfs support

Add instructions for testing gocryptfs, an encrypted overlay filesystem, and a few small changes that were needed for gocryptfs compatibility:

1) _scratch_unmount and _test_unmount now unmount fuse filesystems via mountpoint instead of via device. Unmounting via device fails when the "device" is actually a directory on a different filesystem. Unmounting via mountpoint always works.

2) Add subtype=passthrough_ll to the passthrough_ll mount options. This makes passthrough_ll behave more like most other fuse filesystems which do set a subtype. Example from my Fedora box:

	$ mount | grep -o "type fuse\\..* "
	type fuse.gvfsd-fuse
	type fuse.portal
	type fuse.gocryptfs
	type fuse.encfs
	type fuse.passthrough_ll

With this change, _check_mounted_on can match on $FSTYP$FUSE_SUBTYP for passthrough_ll, which also works for gocryptfs and likely most other fuse filesystems.

Results for passthrough_ll on top of tmpfs:

	Failures: generic/120 generic/125 generic/184 generic/294 generic/306 generic/317 generic/355
	generic/363 generic/426 generic/434 generic/452 generic/467 generic/477 generic/633 generic/647
	generic/653 generic/675 generic/683 generic/684 generic/729 generic/745 generic/751 generic/756
	generic/777
	Failed 24 of 769 tests

Results for gocryptfs on top of tmpfs:

	Failures: generic/020 generic/062 generic/093 generic/099 generic/103 generic/120 generic/125
	generic/184 generic/285 generic/294 generic/306 generic/317 generic/319 generic/426 generic/434
	generic/444 generic/452 generic/467 generic/471 generic/477 generic/633 generic/676 generic/683
	generic/688 generic/696 generic/697 generic/707 generic/756 generic/777
	Failed 29 of 769 tests
---
 README.fuse | 34 ++++++++++++++++++++++++++++++++--
 common/rc   | 11 ++++++++++-
 2 files changed, 42 insertions(+), 3 deletions(-)
README.fuse +32 -2
index 969dbd5d..df248681 100644
@@ -1,3 +1,6 @@
+passthrough_ll
+==============
+
 Here are instructions for testing fuse using the passthrough_ll example
 filesystem provided in the libfuse source tree:
 
@@ -22,5 +25,32 @@ export SCRATCH_DEV=non2
 export SCRATCH_MNT=/mnt/scratch
 export FSTYP=fuse
 export FUSE_SUBTYP=.passthrough_ll
-export MOUNT_OPTIONS="-osource=/home/test/scratch,allow_other,default_permissions"
-export TEST_FS_MOUNT_OPTS="-osource=/home/test/test,allow_other,default_permissions"
+export MOUNT_OPTIONS="-osource=/home/test/scratch,subtype=passthrough_ll,allow_other,default_permissions"
+export TEST_FS_MOUNT_OPTS="-osource=/home/test/test,subtype=passthrough_ll,allow_other,default_permissions"
+
+
+gocryptfs
+=========
+
+Here are the instructions for gocryptfs:
+
+git clone https://github.com/rfjakob/gocryptfs.git
+cd gocryptfs
+./build.bash
+cat << EOF | sudo tee /sbin/mount.fuse.gocryptfs
+#!/bin/bash
+exec $(pwd)/gocryptfs -q -allow_other -acl -extpass "echo test" "\$@"
+EOF
+sudo chmod +x /sbin/mount.fuse.gocryptfs
+mkdir -p /mnt/gocryptfs.test /mnt/gocryptfs.scratch /home/test/gocryptfs.test /home/test/gocryptfs.scratch
+gocryptfs -init -q -scryptn=10 -extpass "echo test" /home/test/gocryptfs.test
+gocryptfs -init -q -scryptn=10 -extpass "echo test" /home/test/gocryptfs.scratch
+
+Use the following local.config file:
+
+export TEST_DEV=/home/test/gocryptfs.test
+export TEST_DIR=/mnt/gocryptfs.test
+export SCRATCH_DEV=/home/test/gocryptfs.scratch
+export SCRATCH_MNT=/mnt/gocryptfs.scratch
+export FSTYP=fuse
+export FUSE_SUBTYP=.gocryptfs
common/rc +10 -1
index 8fd7876a..da8be16e 100644
@@ -512,6 +512,11 @@ _scratch_unmount()
 	tmpfs)
 		_unmount $SCRATCH_MNT
 		;;
+	fuse)
+		# The "source device" can be an arbitrary string for fuse filesystems
+		# and may not be unique. Unmount by mountpoint instead.
+		_unmount $SCRATCH_MNT
+		;;
 	*)
 		_unmount $SCRATCH_DEV
 		;;
@@ -703,6 +708,10 @@ _test_unmount()
 {
 	if [ "$FSTYP" == "overlay" ]; then
 		_overlay_test_unmount
+	elif [ "$FSTYP" == "fuse" ]; then
+		# The "source device" can be an arbitrary string for fuse filesystems
+		# and may not be unique. Unmount by mountpoint instead.
+		_unmount $TEST_DIR
 	else
 		_unmount $TEST_DEV
 	fi
@@ -5021,7 +5030,7 @@ init_rc()
 
 	# Sanity check that TEST partition is not mounted at another mount point
 	# or as another fs type
-	_check_mounted_on TEST_DEV $TEST_DEV TEST_DIR $TEST_DIR $FSTYP || _exit 1
+	_check_mounted_on TEST_DEV $TEST_DEV TEST_DIR $TEST_DIR $FSTYP$FUSE_SUBTYP || exit 1
 	if [ -n "$SCRATCH_DEV" ]; then
 		# Sanity check that SCRATCH partition is not mounted at another
 		# mount point, because it is about to be unmounted and formatted.
Signature · 1 line
2.51.0
#1 lore raw
Quoted 57 lines · Jakob Unterwurzacher

Add instructions for testing gocryptfs, an encrypted overlay filesystem, and a few small changes that were needed for gocryptfs compatibility:

1) _scratch_unmount and _test_unmount now unmount fuse filesystems via mountpoint instead of via device. Unmounting via device fails when the "device" is actually a directory on a different filesystem. Unmounting via mountpoint always works.

2) Add subtype=passthrough_ll to the passthrough_ll mount options. This makes passthrough_ll behave more like most other fuse filesystems which do set a subtype. Example from my Fedora box:

	$ mount | grep -o "type fuse\\..* "
	type fuse.gvfsd-fuse
	type fuse.portal
	type fuse.gocryptfs
	type fuse.encfs
	type fuse.passthrough_ll

With this change, _check_mounted_on can match on $FSTYP$FUSE_SUBTYP for passthrough_ll, which also works for gocryptfs and likely most other fuse filesystems.

Results for passthrough_ll on top of tmpfs:

	Failures: generic/120 generic/125 generic/184 generic/294 generic/306 generic/317 generic/355
	generic/363 generic/426 generic/434 generic/452 generic/467 generic/477 generic/633 generic/647
	generic/653 generic/675 generic/683 generic/684 generic/729 generic/745 generic/751 generic/756
	generic/777
	Failed 24 of 769 tests

Results for gocryptfs on top of tmpfs:

	Failures: generic/020 generic/062 generic/093 generic/099 generic/103 generic/120 generic/125
	generic/184 generic/285 generic/294 generic/306 generic/317 generic/319 generic/426 generic/434
	generic/444 generic/452 generic/467 generic/471 generic/477 generic/633 generic/676 generic/683
	generic/688 generic/696 generic/697 generic/707 generic/756 generic/777
	Failed 29 of 769 tests
---
 README.fuse | 34 ++++++++++++++++++++++++++++++++--
 common/rc   | 11 ++++++++++-
 2 files changed, 42 insertions(+), 3 deletions(-)
README.fuse +3 -0
index 969dbd5d..df248681 100644
@@ -1,3 +1,6 @@
+passthrough_ll
+==============
+
 Here are instructions for testing fuse using the passthrough_ll example
 filesystem provided in the libfuse source tree:
 

README.fuse export SCRATCH_DEV=non2 · line 29

Quoted 7 lines
README.fuse +2 -2
@@ -22,5 +25,32 @@ export SCRATCH_DEV=non2
 export SCRATCH_MNT=/mnt/scratch
 export FSTYP=fuse
 export FUSE_SUBTYP=.passthrough_ll
-export MOUNT_OPTIONS="-osource=/home/test/scratch,allow_other,default_permissions"
-export TEST_FS_MOUNT_OPTS="-osource=/home/test/test,allow_other,default_permissions"
+export MOUNT_OPTIONS="-osource=/home/test/scratch,subtype=passthrough_ll,allow_other,default_permissions"
+export TEST_FS_MOUNT_OPTS="-osource=/home/test/test,subtype=passthrough_ll,allow_other,default_permissions"

This patch changes the required parameter to test FUSE, cc fuse list to get more review.

Quoted 67 lines
README.fuse +27 -0
+
+
+gocryptfs
+=========
+
+Here are the instructions for gocryptfs:
+
+git clone https://github.com/rfjakob/gocryptfs.git
+cd gocryptfs
+./build.bash
+cat << EOF | sudo tee /sbin/mount.fuse.gocryptfs
+#!/bin/bash
+exec $(pwd)/gocryptfs -q -allow_other -acl -extpass "echo test" "\$@"
+EOF
+sudo chmod +x /sbin/mount.fuse.gocryptfs
+mkdir -p /mnt/gocryptfs.test /mnt/gocryptfs.scratch /home/test/gocryptfs.test /home/test/gocryptfs.scratch
+gocryptfs -init -q -scryptn=10 -extpass "echo test" /home/test/gocryptfs.test
+gocryptfs -init -q -scryptn=10 -extpass "echo test" /home/test/gocryptfs.scratch
+
+Use the following local.config file:
+
+export TEST_DEV=/home/test/gocryptfs.test
+export TEST_DIR=/mnt/gocryptfs.test
+export SCRATCH_DEV=/home/test/gocryptfs.scratch
+export SCRATCH_MNT=/mnt/gocryptfs.scratch
+export FSTYP=fuse
+export FUSE_SUBTYP=.gocryptfs
common/rc +10 -1
index 8fd7876a..da8be16e 100644
@@ -512,6 +512,11 @@ _scratch_unmount()
 	tmpfs)
 		_unmount $SCRATCH_MNT
 		;;
+	fuse)
+		# The "source device" can be an arbitrary string for fuse filesystems
+		# and may not be unique. Unmount by mountpoint instead.
+		_unmount $SCRATCH_MNT
+		;;
 	*)
 		_unmount $SCRATCH_DEV
 		;;
@@ -703,6 +708,10 @@ _test_unmount()
 {
 	if [ "$FSTYP" == "overlay" ]; then
 		_overlay_test_unmount
+	elif [ "$FSTYP" == "fuse" ]; then
+		# The "source device" can be an arbitrary string for fuse filesystems
+		# and may not be unique. Unmount by mountpoint instead.
+		_unmount $TEST_DIR
 	else
 		_unmount $TEST_DEV
 	fi
@@ -5021,7 +5030,7 @@ init_rc()
 
 	# Sanity check that TEST partition is not mounted at another mount point
 	# or as another fs type
-	_check_mounted_on TEST_DEV $TEST_DEV TEST_DIR $TEST_DIR $FSTYP || _exit 1
+	_check_mounted_on TEST_DEV $TEST_DEV TEST_DIR $TEST_DIR $FSTYP$FUSE_SUBTYP || exit 1
 	if [ -n "$SCRATCH_DEV" ]; then
 		# Sanity check that SCRATCH partition is not mounted at another
 		# mount point, because it is about to be unmounted and formatted.
Signature · 1 line
2.51.0