Whamcloud - gitweb
LU-16125 tests: make sanity-sec more robust with SSK 86/48386/4
authorSebastien Buisson <sbuisson@ddn.com>
Tue, 30 Aug 2022 09:22:34 +0000 (11:22 +0200)
committerOleg Drokin <green@whamcloud.com>
Tue, 4 Oct 2022 19:35:36 +0000 (19:35 +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.

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

index c25ef3c..d4d7c30 100755 (executable)
@@ -2733,6 +2733,18 @@ remove_enc_key() {
        fi
 }
 
+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
+}
+
 remount_client_normally() {
        # remount client without dummy encryption key
        if is_mounted $MOUNT; then
@@ -2750,6 +2762,7 @@ remount_client_normally() {
        fi
 
        remove_enc_key
+       wait_ssk
 }
 
 remount_client_dummykey() {
@@ -2761,6 +2774,8 @@ remount_client_dummykey() {
        fi
        mount_client $MOUNT ${MOUNT_OPTS},test_dummy_encryption ||
                error "remount failed"
+
+       wait_ssk
 }
 
 setup_for_enc_tests() {
@@ -2771,6 +2786,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
 }
@@ -2803,6 +2820,7 @@ cleanup_nodemap_after_enc_tests() {
        wait_nm_sync active
 
        mount_client $MOUNT ${MOUNT_OPTS} || error "re-mount failed"
+       wait_ssk
 }
 
 test_36() {
@@ -4439,6 +4457,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
@@ -4489,6 +4508,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"
@@ -4505,6 +4525,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"
@@ -4566,6 +4587,7 @@ cleanup_55() {
        if [ "$MOUNT_2" ]; then
                mount_client $MOUNT2 ${MOUNT_OPTS} || error "remount failed"
        fi
+       wait_ssk
 }
 
 test_55() {
@@ -4629,6 +4651,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
 }
@@ -5014,6 +5037,7 @@ test_60() {
        if [ "$MOUNT_2" ]; then
                mount_client $MOUNT2 ${MOUNT_OPTS} || error "remount failed"
        fi
+       wait_ssk
 
        ls -Rl $DIR || error "ls -Rl $DIR failed (1)"
 
@@ -5057,6 +5081,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"
@@ -5071,6 +5096,7 @@ test_61() {
                error "mount '-o rw' should have failed"
        mount_client $MOUNT ${MOUNT_OPTS},ro ||
                error "mount '-o ro' failed"
+       wait_ssk
        cat $testfile || error "read $testfile failed"
        echo b > $testfile && error "write $testfile should fail"
        umount_client $MOUNT || error "umount $MOUNT failed (3)"