]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Disable nbmand tests on kernels w/o support
authorGiuseppe Di Natale <dinatale2@users.noreply.github.com>
Mon, 24 Jul 2017 18:03:50 +0000 (11:03 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 24 Jul 2017 18:03:50 +0000 (11:03 -0700)
This change allows mountpoint_003_pos and send-c_props
to run on Linux kernels that do not support mandatory
locking. Linux kernel versions greater than or equal to
4.4 no longer support mandatory locking and the test
suite will now account for that.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Closes #6346
Closes #6347
Closes #6362

tests/zfs-tests/include/libtest.shlib
tests/zfs-tests/include/properties.shlib
tests/zfs-tests/tests/functional/cli_root/zfs_set/mountpoint_003_pos.ksh

index 1d1c57e7a4cfb65fa83b3d94e3a77abc504a7fc3..88594c20109c9960d92aee1d5eb1b788cc4c0052 100644 (file)
@@ -40,6 +40,29 @@ if [ -n "$STF_PATH" ]; then
        PATH="$STF_PATH"
 fi
 
+# Linux kernel version comparison function
+#
+# $1 Linux version ("4.10", "2.6.32") or blank for installed Linux version
+#
+# Used for comparison: if [ $(linux_version) -ge $(linux_version "2.6.32") ]
+#
+function linux_version
+{
+       typeset ver="$1"
+
+       [[ -z "$ver" ]] && ver=$(uname -r | grep -Eo "^[0-9]+\.[0-9]+\.[0-9]+")
+
+       typeset version=$(echo $ver | cut -d '.' -f 1)
+       typeset major=$(echo $ver | cut -d '.' -f 2)
+       typeset minor=$(echo $ver | cut -d '.' -f 3)
+
+       [[ -z "$version" ]] && version=0
+       [[ -z "$major" ]] && major=0
+       [[ -z "$minor" ]] && minor=0
+
+       echo $((version * 10000 + major * 100 + minor))
+}
+
 # Determine if this is a Linux test system
 #
 # Return 0 if platform Linux, 1 if otherwise
index 6a3a0e1ce84efc070b7ec886fd16d9db4ee34f0b..25a9846ddd936486d1435222fe713528a1280eed 100644 (file)
@@ -91,8 +91,17 @@ function get_rand_large_recsize
 #
 # Functions to toggle on/off properties
 #
-typeset -a binary_props=('atime' 'devices' 'exec' 'nbmand' 'readonly' 'setuid'
-    'xattr' 'zoned')
+typeset -a binary_props=('atime' 'devices' 'exec' 'readonly' 'setuid' 'xattr'
+    'zoned')
+
+if is_linux; then
+       # Only older kernels support non-blocking mandatory locks
+       if [[ $(linux_version) -lt $(linux_version "4.4") ]]; then
+               binary_props+=('nbmand')
+       fi
+else
+       binary_props+=('nbmand')
+fi
 
 function toggle_prop
 {
index dcba41919e9783a74cfd9884f5017c3ab7639f08..9bbb480ae73c890206f9a7bd5015cd62e64a5206 100755 (executable)
@@ -67,11 +67,15 @@ if is_linux; then
        set -A args \
        "nodev"         "dev"   \
        "noexec"        "exec"  \
-       "mand"          "nomand"        \
        "ro"            "rw"    \
        "nosuid"        "suid"  \
        "xattr"         "noxattr"       \
        "atime"         "noatime"
+
+       # Only older kernels support non-blocking mandatory locks
+       if [[ $(linux_version) -lt $(linux_version "4.4") ]]; then
+               args+=("mand" "nomand")
+       fi
 else
        set -A args \
        "devices"       "/devices/"     "nodevices"     "/nodevices/"   \