Whamcloud - gitweb
LU-14692 tests: allow FID_SEQ_NORMAL for MDT0000 93/46293/27
authorLi Dongyang <dongyangli@ddn.com>
Tue, 25 Jan 2022 00:53:33 +0000 (11:53 +1100)
committerOleg Drokin <green@whamcloud.com>
Thu, 19 Jan 2023 15:29:13 +0000 (15:29 +0000)
Fix the tests asssuming objects created for MDT0000
always have a seq number of 0, to prepare for
deprecating IDIF sequence.

Fix sanity test_312 on ZFS to properly identify which
OST the object was created on, and re-enable it.

Test-Parameters: testlist=sanity env=ONLY="39r 312"
Test-Parameters: testlist=sanity-scrub env=ONLY=19
Test-Parameters: testlist=sanity-sec env=ONLY=37
Change-Id: I4bffabe25a6f84cdba760aabea1da3429715a283
Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/46293
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity-scrub.sh
lustre/tests/sanity-sec.sh
lustre/tests/sanity.sh

index f01e450..5d0d8fe 100644 (file)
@@ -1339,11 +1339,19 @@ test_18() {
 run_test 18 "test mount -o resetoi to recreate OI files"
 
 test_19() {
-       local rcmd="do_facet ost${ost}"
-
        check_mount_and_prep
        $LFS setstripe -c 1 -i 0 $DIR/$tdir
-       createmany -o $DIR/$tdir/f 64 || error "(0) Fail to create 32 files."
+       createmany -o $DIR/$tdir/f 64 || error "(0) Fail to create 64 files."
+       local fid=($($LFS getstripe $DIR/$tdir/f0 | grep 0x))
+       local seq=${fid[3]#0x}
+       local oid=${fid[1]}
+       local oid_hex
+
+       if [ $seq = 0 ] || [ "$ost1_FSTYPE" == "zfs" ]; then
+               oid_hex=${fid[1]}
+       else
+               oid_hex=${fid[2]#0x}
+       fi
 
        echo "stopall"
        stopall > /dev/null
@@ -1352,12 +1360,12 @@ test_19() {
        mount_fstype ost1 || error "(1) Fail to mount ost1"
        mntpt=$(facet_mntpt ost1)
 
-       local path=$mntpt/O/0/d2
-       local file=$(${rcmd} ls $path | awk '{print $0; exit}')
+       local path="$mntpt/O/$seq/d$(($oid % 32))"
 
        # create link to the first file
-       echo "link $path/1 to $path/$file"
-       ${rcmd} ln $path/$file $path/1
+       echo "link $path/$(($oid + 1)) to $path/$oid_hex"
+       do_facet ost1 ln $path/$oid_hex $path/$(($oid + 1)) ||
+               { do_facet ost1 "ls -l $path"; error "(1b) link error"; }
        unmount_fstype ost1 || error "(2) Fail to umount ost1"
 
        start ost1 $(ostdevname 1) $MOUNT_OPTS_NOSCRUB > /dev/null ||
@@ -1371,8 +1379,9 @@ test_19() {
                error "(4) Expected '$expected' on ost1"
 
        stop ost1
-       mount_fstype ost1 || error "(5) Fail to mount ost1"
-       links=$(do_facet ost1 "stat $path/$file" | awk '/Links:/ { print $6 }')
+       mount_fstype ost1 || error "(5) Fail to mount ost1 again"
+       do_facet ost1 "stat $path/$oid_hex" || do_facet ost1 "ls -l $path"
+       links=$(do_facet ost1 "stat $path/$oid_hex" | awk '/Links:/ { print $6 }')
        unmount_fstype ost1 || error "(6) Fail to umount ost1"
 
        start ost1 $(ostdevname 1) $MOUNT_OPTS_NOSCRUB > /dev/null ||
index cd0a596..b0e74db 100755 (executable)
@@ -2864,7 +2864,6 @@ test_37() {
        local testfile=$DIR/$tdir/$tfile
        local tmpfile=$TMP/abc
        local objdump=$TMP/objdump
-       local objid
 
        $LCTL get_param mdc.*.import | grep -q client_encryption ||
                skip "client encryption not supported"
@@ -2884,8 +2883,17 @@ test_37() {
        do_facet ost1 "sync; sync"
 
        # check that content on ost is encrypted
-       objid=$($LFS getstripe $testfile | awk '/obdidx/{getline; print $2}')
-       do_facet ost1 "$DEBUGFS -c -R 'cat O/0/d$(($objid % 32))/$objid' \
+       local fid=($($LFS getstripe $testfile | grep 0x))
+       local seq=${fid[3]#0x}
+       local oid=${fid[1]}
+       local oid_hex
+
+       if [ $seq == 0 ]; then
+               oid_hex=${fid[1]}
+       else
+               oid_hex=${fid[2]#0x}
+       fi
+       do_facet ost1 "$DEBUGFS -c -R 'cat O/$seq/d$(($oid % 32))/$oid_hex' \
                 $(ostdevname 1)" > $objdump
        cmp -s $objdump $tmpfile &&
                error "file $testfile is not encrypted on ost"
index 25762f1..7cb7657 100755 (executable)
@@ -41,7 +41,6 @@ ALWAYS_EXCEPT="$SANITY_EXCEPT "
 always_except LU-9693  42a 42c
 always_except LU-6493  42b
 always_except LU-14541 277
-always_except LU-9054  312
 always_except LU-8411  407
 
 if $SHARED_KEY; then
@@ -5190,9 +5189,17 @@ test_39r() {
        sleep 5
 
        local ostdev=$(ostdevname 1)
-       local fid=($(lfs getstripe -y $DIR/$tfile |
-                       awk '/l_fid:/ { print $2 }' | tr ':' ' '))
-       local objpath="O/0/d$((${fid[1]} % 32))/$((${fid[1]}))"
+       local fid=($($LFS getstripe $DIR/$tfile | grep 0x))
+       local seq=${fid[3]#0x}
+       local oid=${fid[1]}
+       local oid_hex
+
+       if [ $seq == 0 ]; then
+               oid_hex=${fid[1]}
+       else
+               oid_hex=${fid[2]#0x}
+       fi
+       local objpath="O/$seq/d$(($oid % 32))/$oid_hex"
        local cmd="debugfs -c -R \\\"stat $objpath\\\" $ostdev"
 
        echo "OST atime: $(do_facet ost1 "$cmd" |& grep atime)"
@@ -24678,15 +24685,18 @@ test_311() {
 }
 run_test 311 "disable OSP precreate, and unlink should destroy objs"
 
-zfs_oid_to_objid()
+zfs_get_objid()
 {
        local ost=$1
-       local objid=$2
+       local tf=$2
+       local fid=($($LFS getstripe $tf | grep 0x))
+       local seq=${fid[3]#0x}
+       local objid=${fid[1]}
 
        local vdevdir=$(dirname $(facet_vdevice $ost))
        local cmd="$ZDB -e -p $vdevdir -ddddd $(facet_device $ost)"
        local zfs_zapid=$(do_facet $ost $cmd |
-                         grep -w "/O/0/d$((objid%32))" -C 5 |
+                         grep -w "/O/$seq/d$((objid%32))" -C 5 |
                          awk '/Object/{getline; print $1}')
        local zfs_objid=$(do_facet $ost $cmd $zfs_zapid |
                          awk "/$objid = /"'{printf $3}')
@@ -24720,62 +24730,60 @@ test_312() { # LU-4856
        local max_blksz=$(do_facet ost1 \
                          $ZFS get -p recordsize $(facet_device ost1) |
                          awk '!/VALUE/{print $3}')
+       local tf=$DIR/$tfile
 
-       # to make life a little bit easier
-       $LFS mkdir -c 1 -i 0 $DIR/$tdir
-       $LFS setstripe -c 1 -i 0 $DIR/$tdir
-
-       local tf=$DIR/$tdir/$tfile
-       touch $tf
-       local oid=$($LFS getstripe $tf | awk '/obdidx/{getline; print $2}')
+       $LFS setstripe -c1 $tf
+       local facet="ost$(($($LFS getstripe -i $tf) + 1))"
 
        # Get ZFS object id
-       local zfs_objid=$(zfs_oid_to_objid ost1 $oid)
+       local zfs_objid=$(zfs_get_objid $facet $tf)
        # block size change by sequential overwrite
        local bs
 
        for ((bs=$PAGE_SIZE; bs <= max_blksz; bs *= 4)) ; do
                dd if=/dev/zero of=$tf bs=$bs count=1 oflag=sync conv=notrunc
 
-               local blksz=$(zfs_object_blksz ost1 $zfs_objid)
-               [ $blksz -eq $bs ] || error "blksz error: $blksz, expected: $bs"
+               local blksz=$(zfs_object_blksz $facet $zfs_objid)
+               [[ $blksz -eq $bs ]] || error "blksz error: $blksz, expected: $bs"
        done
        rm -f $tf
 
+       $LFS setstripe -c1 $tf
+       facet="ost$(($($LFS getstripe -i $tf) + 1))"
+
        # block size change by sequential append write
        dd if=/dev/zero of=$tf bs=$PAGE_SIZE count=1 oflag=sync conv=notrunc
-       oid=$($LFS getstripe $tf | awk '/obdidx/{getline; print $2}')
-       zfs_objid=$(zfs_oid_to_objid ost1 $oid)
+       zfs_objid=$(zfs_get_objid $facet $tf)
        local count
 
        for ((count = 1; count < $((max_blksz / PAGE_SIZE)); count *= 2)); do
                dd if=/dev/zero of=$tf bs=$PAGE_SIZE count=$count seek=$count \
                        oflag=sync conv=notrunc
 
-               blksz=$(zfs_object_blksz ost1 $zfs_objid)
-               [ $blksz -eq $((2 * count * PAGE_SIZE)) ] ||
+               blksz=$(zfs_object_blksz $facet $zfs_objid)
+               (( $blksz == 2 * count * PAGE_SIZE )) ||
                        error "blksz error, actual $blksz, " \
                                "expected: 2 * $count * $PAGE_SIZE"
        done
        rm -f $tf
 
        # random write
-       touch $tf
-       oid=$($LFS getstripe $tf | awk '/obdidx/{getline; print $2}')
-       zfs_objid=$(zfs_oid_to_objid ost1 $oid)
+       $LFS setstripe -c1 $tf
+       facet="ost$(($($LFS getstripe -i $tf) + 1))"
+       zfs_objid=$(zfs_get_objid $facet $tf)
 
        dd if=/dev/zero of=$tf bs=1K count=1 oflag=sync conv=notrunc
-       blksz=$(zfs_object_blksz ost1 $zfs_objid)
-       [ $blksz -eq $PAGE_SIZE ] ||
+       blksz=$(zfs_object_blksz $facet $zfs_objid)
+       (( blksz == PAGE_SIZE )) ||
                error "blksz error: $blksz, expected: $PAGE_SIZE"
 
        dd if=/dev/zero of=$tf bs=64K count=1 oflag=sync conv=notrunc seek=128
-       blksz=$(zfs_object_blksz ost1 $zfs_objid)
-       [ $blksz -eq 65536 ] || error "blksz error: $blksz, expected: 64k"
+       blksz=$(zfs_object_blksz $facet $zfs_objid)
+       (( blksz == 65536 )) || error "blksz error: $blksz, expected: 64k"
 
        dd if=/dev/zero of=$tf bs=1M count=1 oflag=sync conv=notrunc
-       blksz=$(zfs_object_blksz ost1 $zfs_objid)
-       [ $blksz -eq 65536 ] || error "rewrite error: $blksz, expected: 64k"
+       blksz=$(zfs_object_blksz $facet $zfs_objid)
+       (( blksz == 65536 )) || error "rewrite error: $blksz, expected: 64k"
 }
 run_test 312 "make sure ZFS adjusts its block size by write pattern"