Skip to contentSkip to conversation

generic/571: skip test on filesystems that don't support F_SETLEASE fcntl

PATCH Superseded Scott Mayhew 2 participants 2 messages Mar 31, 2020 – Apr 1, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 generic/571: skip test on filesystems that don't support F_SETLEASE fcntl

nfs and gfs2 (without localflocks) both use simple_nosetlease() for their setlease f_op, so skip this test on those filesystem types.

---
 common/rc         | 13 +++++++++++++
 tests/generic/571 |  1 +
 2 files changed, 14 insertions(+)
common/rc +13 -0
index 454f5ccf..ea0fd67f 100644
@@ -3501,6 +3501,19 @@ _require_test_fcntl_advisory_locks()
 		_notrun "Require fcntl advisory locks support"
 }
 
+_require_test_fcntl_setlease()
+{
+	case $FSTYP in
+	nfs)
+		_notrun "Setting leases not supported on $FSTYP"
+		;;
+	gfs2)
+		grep $TEST_DEV /proc/mounts | grep gfs2 | grep -q "localflocks" || \
+			_notrun "Setting leases not supported on $FSTYP without localflocks"
+		;;
+	esac
+}
+
 _require_ofd_locks()
 {
 	# Give a test run by getlk wrlck on testfile.
tests/generic/571 +1 -0
index 68c8a604..599e3e68 100755
@@ -26,6 +26,7 @@ _supported_fs generic
 _supported_os Linux
 _require_test
 _require_test_fcntl_advisory_locks
+_require_test_fcntl_setlease
 
 _run_leasetest
 
Signature · 1 line
2.18.2
#1 lore raw
Quoted 4 lines · Scott Mayhew

nfs and gfs2 (without localflocks) both use simple_nosetlease() for their setlease f_op, so skip this test on those filesystem types.

I think we need to check for an EINVAL return instead of hard coding file system names.