Whamcloud - gitweb
EX-4572 tests: fix setfattr stack_trap in init_hot_pools_env()
authorJian Yu <yujian@whamcloud.com>
Tue, 1 Mar 2022 09:28:42 +0000 (01:28 -0800)
committerAndreas Dilger <adilger@whamcloud.com>
Wed, 9 Mar 2022 17:13:32 +0000 (17:13 +0000)
This patch fixes setfattr stack_trap in init_hot_pools_env() to
resolve the following error:

/usr/lib64/lustre/tests/test-framework.sh: line 2:
trusted.dmv=0xd00c......: command not found

Test-Parameters: trivial testlist=hot-pools
Test-Parameters: trivial mdscount=2 mdtcount=4 testlist=hot-pools

Fixes: 7ff7b9d8cf0 ("EX-3640 test: mkdir on MDT0 in hot-pools.sh")
Change-Id: Ia406a066455bd83c2199f96507a11b36aa80fea2
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/46662
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alexandre Ioffe <aioffe@ddn.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/tests/hot-pools.sh

index 6af2243..cf9a754 100755 (executable)
@@ -185,10 +185,12 @@ init_hot_pools_env() {
        init_lpurge_vars
 
        # disable filesystem-wide default LMV to mkdir on MDT0 by default
-       local dmv=$(getfattr -d -m trusted.dmv -e hex --absolute-names $MOUNT)
-
-       (( $? == 0 )) && $LFS setdirstripe -D -i 0 --max-inherit 1 $MOUNT &&
-               stack_trap "echo $dmv | setfattr --restore=-"
+       local tmp=$(mktemp $TMP/setfattr.XXXXXXXXXX)
+       getfattr -d -m trusted.dmv -e hex --absolute-names $MOUNT > $tmp
+       if (( $? == 0 )); then
+               ! $LFS setdirstripe -D -i 0 --max-inherit 1 $MOUNT ||
+                       stack_trap "setfattr --restore $tmp; rm -f $tmp"
+       fi
 }
 
 hot_pools_logfile() {