Whamcloud - gitweb
LU-16125 tests: make sanity-sec more robust with SSK
authorSebastien Buisson <sbuisson@ddn.com>
Tue, 30 Aug 2022 09:22:34 +0000 (11:22 +0200)
committerAndreas Dilger <adilger@whamcloud.com>
Wed, 8 Feb 2023 05:48:22 +0000 (05:48 +0000)
Encryption related tests in sanity-sec carry out unmount and mount of
clients in order to exercise code with and without the encryption key.
In case SSK is in use, we need to make sure flavors are properly
applied before carrying on.

Lustre-change: https://review.whamcloud.com/48386
Lustre-commit: bee889e87584aa3bd2e6819db73d6adf129460ee

Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: I92e85dc6dcef43f70a7fe05db94cd18fe66a3a24
Reviewed-by: Zhenyu Xu <bobijam@hotmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/49892
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/tests/sanity-sec.sh

index f12f5d0..e03e770 100755 (executable)
@@ -2736,6 +2736,18 @@ remove_enc_key() {
        keyctl reap
 }
 
+wait_ssk() {
+       # wait for SSK flavor to be applied if necessary
+       if $GSS_SK; then
+               if $SK_S2S; then
+                       wait_flavor all2all $SK_FLAVOR
+               else
+                       wait_flavor cli2mdt $SK_FLAVOR
+                       wait_flavor cli2ost $SK_FLAVOR
+               fi
+       fi
+}
+
 setup_for_enc_tests() {
        # remount client with test_dummy_encryption option
        if is_mounted $MOUNT; then
@@ -2744,6 +2756,8 @@ setup_for_enc_tests() {
        mount_client $MOUNT ${MOUNT_OPTS},test_dummy_encryption ||
                error "mount with '-o test_dummy_encryption' failed"
 
+       wait_ssk
+
        # this directory will be encrypted, because of dummy mode
        mkdir $DIR/$tdir
 }
@@ -2798,6 +2812,7 @@ cleanup_nodemap_after_enc_tests() {
        wait_nm_sync active
 
        mount_client $MOUNT ${MOUNT_OPTS} || error "re-mount failed"
+       wait_ssk
 }
 
 test_36() {
@@ -4451,6 +4466,7 @@ test_54() {
        export FILESET=/$tdir
        mount_client $MOUNT ${MOUNT_OPTS} || error "remount failed (1)"
        export FILESET=""
+       wait_ssk
 
        # setup encryption from inside this subdir mount
        # the .fscrypt directory is going to be created at the real fs root
@@ -4501,6 +4517,7 @@ test_54() {
        export FILESET=/$tdir/vault
        mount_client $MOUNT ${MOUNT_OPTS} || error "remount failed (2)"
        export FILESET=""
+       wait_ssk
        ls -laR $MOUNT
        fid2=$(path2fid $MOUNT/.fscrypt)
        echo "With FILESET $tdir/vault, .fscrypt FID is $fid2"
@@ -4517,6 +4534,7 @@ test_54() {
        # remount client without subdir mount
        umount_client $MOUNT || error "umount $MOUNT failed (3)"
        mount_client $MOUNT ${MOUNT_OPTS} || error "remount failed (3)"
+       wait_ssk
        ls -laR $MOUNT
        fid2=$(path2fid $MOUNT/.fscrypt)
        echo "Without FILESET, .fscrypt FID is $fid2"
@@ -4578,6 +4596,7 @@ cleanup_55() {
        if [ "$MOUNT_2" ]; then
                mount_client $MOUNT2 ${MOUNT_OPTS} || error "remount failed"
        fi
+       wait_ssk
 }
 
 test_55() {
@@ -4641,6 +4660,7 @@ test_55() {
        zconf_mount_clients $HOSTNAME $MOUNT $MOUNT_OPTS ||
                error "remount failed"
        unset FILESET
+       wait_ssk
 
        euid_access $USER0 $DIR/$tdir/$USER0/testdir_groups/file
 }
@@ -5022,6 +5042,7 @@ test_60() {
                mount_client $MOUNT2 ${MOUNT_OPTS} || error "remount failed"
        fi
        export FILESET=""
+       wait_ssk
 
        ls -Rl $DIR || error "ls -Rl $DIR failed (1)"
 
@@ -5064,6 +5085,7 @@ test_61() {
 
        mount_client $MOUNT ${MOUNT_OPTS},rw ||
                error "mount '-o rw' failed with default"
+       wait_ssk
        findmnt $MOUNT --output=options -n -f | grep -q "rw," ||
                error "should be rw mount"
        mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir failed"
@@ -5090,6 +5112,7 @@ test_61() {
        umount_client $MOUNT || error "umount $MOUNT failed (4)"
        mount_client $MOUNT ${MOUNT_OPTS},ro ||
                error "mount '-o ro' failed"
+       wait_ssk
        cat $testfile || error "read $testfile failed (3)"
        echo b > $testfile && error "write $testfile should fail (3)"
        umount_client $MOUNT || error "umount $MOUNT failed (5)"