From 8b8bc6eee05758cec346f1f9aeed92f3334d8cf3 Mon Sep 17 00:00:00 2001 From: Ashish Purkar Date: Thu, 25 Feb 2016 20:55:47 -0800 Subject: [PATCH] LU-7819 tests: fix checkfiemap for stripecount > 1 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 Change-Id: If62370fbcfd586607e0f0da2b348070641bed0d1 Reviewed-by: Artem Blagodarenko Reviewed-by: Ujjwal Lanjewar Tested-by: Parinay Vijayprakash Kondekar Reviewed-on: https://review.whamcloud.com/18679 Reviewed-by: Andreas Dilger Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bobi Jam --- lustre/tests/checkfiemap.c | 10 ++++------ lustre/tests/sanityn.sh | 32 +++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/lustre/tests/checkfiemap.c b/lustre/tests/checkfiemap.c index 925c4b2..e8e2ff3 100644 --- a/lustre/tests/checkfiemap.c +++ b/lustre/tests/checkfiemap.c @@ -38,11 +38,9 @@ #include #include #include - -#ifndef HAVE_FIEMAP -# include -# include -#endif +#include +#include +#include #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; diff --git a/lustre/tests/sanityn.sh b/lustre/tests/sanityn.sh index a2e9202..dc5f7ca 100644 --- a/lustre/tests/sanityn.sh +++ b/lustre/tests/sanityn.sh @@ -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" -- 1.8.3.1