Whamcloud - gitweb
LU-7819 tests: fix checkfiemap for stripecount > 1 79/18679/9
authorAshish Purkar <ashish.purkar@seagate.com>
Fri, 26 Feb 2016 04:55:47 +0000 (20:55 -0800)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 19 Apr 2017 04:45:34 +0000 (04:45 +0000)
If sanityn test_71 is ran with stripecount > 1, it fails
with "error while ioctl 95" i.e. EOPNOTSUPP.

FIEMAP_FLAG_DEVICE_ORDER flag must be set while issuing
FS_IOC_FIEMAP ioctl.

New test case 71b to check fiemap for stripe count > 1
Renamed original test_71 to 71a

Test-Parameters: trivial testlist=sanityn envdefinitions=ONLY=71
Seagate-bug-id: MRP-2858
Signed-off-by: Ashish Purkar <ashish.purkar@seagate.com>
Change-Id: If62370fbcfd586607e0f0da2b348070641bed0d1
Reviewed-by: Artem Blagodarenko <artem.blagodarenko@seagate.com>
Reviewed-by: Ujjwal Lanjewar <ujjwal.lanjewar@seagate.com>
Tested-by: Parinay Vijayprakash Kondekar <parinay.kondekar@seagate.com>
Reviewed-on: https://review.whamcloud.com/18679
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
lustre/tests/checkfiemap.c
lustre/tests/sanityn.sh

index 925c4b2..e8e2ff3 100644 (file)
 #include <errno.h>
 #include <unistd.h>
 #include <getopt.h>
-
-#ifndef HAVE_FIEMAP
-# include <linux/types.h>
-# include <linux/fiemap.h>
-#endif
+#include <linux/types.h>
+#include <linux/fs.h>
+#include <lustre/lustre_user.h>
 
 #ifndef FS_IOC_FIEMAP
 # define FS_IOC_FIEMAP (_IOWR('f', 11, struct fiemap))
@@ -67,7 +65,7 @@ int check_fiemap(int fd, long long orig_size)
        memset(&fiemap_buf, 0, sizeof(fiemap_buf));
 
        fiemap->fm_start = 0;
-       fiemap->fm_flags = FIEMAP_FLAG_SYNC;
+       fiemap->fm_flags = (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_DEVICE_ORDER);
        fiemap->fm_extent_count = count;
        fiemap->fm_length = FIEMAP_MAX_OFFSET;
 
index a2e9202..dc5f7ca 100644 (file)
@@ -2766,7 +2766,7 @@ test_70b() { # LU-2781
 }
 run_test 70b "remove files after calling rm_entry"
 
-test_71() {
+test_71a() {
        local server_version=$(lustre_version_code $SINGLEMDS)
 
        [[ $server_version -lt $(version_code 2.1.6) ]] &&
@@ -2775,7 +2775,8 @@ test_71() {
        # Patch not applied to 2.2 and 2.3 branches
        [[ $server_version -ge $(version_code 2.2.0) ]] &&
        [[ $server_version -lt $(version_code 2.4.0) ]] &&
-               skip "Need MDS version at least 2.4.0" && return
+               skip "Need MDS version earlier than 2.2.0 or at least 2.4.0" &&
+                       return
 
        checkfiemap --test ||
                { skip "checkfiemap not runnable: $?" && return; }
@@ -2807,7 +2808,32 @@ test_71() {
        echo $can2
        [ $can3 -eq $can4 ] || error $((can2-can1)) "cancel RPC occured."
 }
-run_test 71 "correct file map just after write operation is finished"
+run_test 71a "correct file map just after write operation is finished"
+
+test_71b() {
+       local server_version=$(lustre_version_code $SINGLEMDS)
+
+       [[ $server_version -lt $(version_code 2.1.6) ]] &&
+               skip "Need MDS version at least 2.1.6" && return
+
+       # Patch not applied to 2.2 and 2.3 branches
+       [[ $server_version -ge $(version_code 2.2.0) ]] &&
+       [[ $server_version -lt $(version_code 2.4.0) ]] &&
+               skip "Need MDS version earlier than 2.2.0 or at least 2.4.0" &&
+                       return
+       [[ $OSTCOUNT -ge 2 ]] || { skip "need at least 2 osts"; return; }
+
+       checkfiemap --test ||
+               { skip "error $?: checkfiemap failed" && return; }
+
+       $LFS setstripe -c -1 $DIR1 || error "setstripe failed"
+       dd if=/dev/urandom of=$DIR1/$tfile bs=40K count=1
+       [ "$(facet_fstype ost$(($($GETSTRIPE -i $DIR1/$tfile) + 1)))" = \
+               "zfs" ] &&
+               skip "ORI-366/LU-1941: FIEMAP unimplemented on ZFS" && return 0
+       checkfiemap $DIR1/$tfile 40960 || error "checkfiemap failed"
+}
+run_test 71b "check fiemap support for stripecount > 1"
 
 test_72() {
        local p="$TMP/sanityN-$TESTNAME.parameters"