diff mbox series

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

Message ID 20200331145135.136672-1-smayhew@redhat.com (mailing list archive)
State New, archived
Headers show
Series generic/571: skip test on filesystems that don't support F_SETLEASE fcntl | expand

Commit Message

Scott Mayhew March 31, 2020, 2:51 p.m. UTC
nfs and gfs2 (without localflocks) both use simple_nosetlease() for
their setlease f_op, so skip this test on those filesystem types.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
 common/rc         | 13 +++++++++++++
 tests/generic/571 |  1 +
 2 files changed, 14 insertions(+)

Comments

Christoph Hellwig April 1, 2020, 7:31 a.m. UTC | #1
On Tue, Mar 31, 2020 at 10:51:35AM -0400, Scott Mayhew wrote:
> nfs and gfs2 (without localflocks) both use simple_nosetlease() for
> their setlease f_op, so skip this test on those filesystem types.
> 
> Signed-off-by: Scott Mayhew <smayhew@redhat.com>

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

Patch

diff --git a/common/rc b/common/rc
index 454f5ccf..ea0fd67f 100644
--- a/common/rc
+++ b/common/rc
@@ -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.
diff --git a/tests/generic/571 b/tests/generic/571
index 68c8a604..599e3e68 100755
--- a/tests/generic/571
+++ b/tests/generic/571
@@ -26,6 +26,7 @@  _supported_fs generic
 _supported_os Linux
 _require_test
 _require_test_fcntl_advisory_locks
+_require_test_fcntl_setlease
 
 _run_leasetest