X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Fsanity.sh;h=b39948ba633ae9aecbcb349e1fb73fb74fcdcc5a;hb=fdad38781ccc;hp=4befadb30756c3ba86aea595d8e6c5f44e1bf6a1;hpb=6a20bdcc608bc2b933774b9f34ec25395e920a54;p=fs%2Flustre-release.git diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 4befadb..b39948b 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -2455,7 +2455,7 @@ test_27J() { $LFS getstripe -v $DIR/$tdir/${tfile}2 | grep "lfm_flags:.*0x0000DA08" || error "$DIR/$tdir/${tfile}2: invalid LOV EA foreign flags" - $LFS getstripe -v $DIR/$tdir/${tfile}2 | + $LFS getstripe $DIR/$tdir/${tfile}2 | grep "lfm_value:.*${uuid1}@${uuid2}" || error "$DIR/$tdir/${tfile}2: invalid LOV EA foreign value" @@ -2500,6 +2500,87 @@ test_27J() { } run_test 27J "basic ops on file with foreign LOV" +test_27K() { + [[ $(lustre_version_code $SINGLEMDS) -le $(version_code 2.12.49) ]] && + skip "Need MDS version newer than 2.12.49" + + test_mkdir $DIR/$tdir + local uuid1=$(cat /proc/sys/kernel/random/uuid) + local uuid2=$(cat /proc/sys/kernel/random/uuid) + + # create foreign dir (raw way) + create_foreign_dir -d $DIR/$tdir/$tdir -x "${uuid1}@${uuid2}" -t 1 || + error "create_foreign_dir FAILED" + + # verify foreign dir (raw way) + parse_foreign_dir -d $DIR/$tdir/$tdir | + grep "lmv_foreign_magic:.*0xcd50cd0" || + error "$DIR/$tdir/$tfile: invalid LMV EA magic" + parse_foreign_dir -d $DIR/$tdir/$tdir | grep "lmv_xattr_size:.*89$" || + error "$DIR/$tdir/$tdir: invalid LMV EA size" + parse_foreign_dir -d $DIR/$tdir/$tdir | grep "lmv_foreign_type: 1$" || + error "$DIR/$tdir/$tdir: invalid LMV EA type" + parse_foreign_dir -d $DIR/$tdir/$tdir | grep "lmv_foreign_flags: 0$" || + error "$DIR/$tdir/$tdir: invalid LMV EA flags" + local lmv=$(parse_foreign_dir -d $DIR/$tdir/$tdir | + grep "lmv_foreign_value: 0x" | + sed 's/lmv_foreign_value: 0x//') + local lmv2=$(echo -n "${uuid1}@${uuid2}" | od -A n -t x1 -w160 | + sed 's/ //g') + [[ $lmv == $lmv2 ]] || error "$DIR/$tdir/$tdir: invalid LMV EA value" + + # create foreign dir (lfs + API) + $LFS mkdir --foreign=daos --xattr="${uuid1}@${uuid2}" --flags=0xda05 \ + $DIR/$tdir/${tdir}2 || + error "$DIR/$tdir/${tdir}2: create failed" + + $LFS getdirstripe -v $DIR/$tdir/${tdir}2 | + grep "lfm_magic:.*0x0CD50CD0" || + error "$DIR/$tdir/${tdir}2: invalid LMV EA magic" + # lfm_length is LMV EA size - sizeof(lfm_magic) - sizeof(lfm_length) + # - sizeof(lfm_type) - sizeof(lfm_flags) + $LFS getdirstripe -v $DIR/$tdir/${tdir}2 | grep "lfm_length:.*73" || + error "$DIR/$tdir/${tdir}2: invalid LMV EA size" + $LFS getdirstripe -v $DIR/$tdir/${tdir}2 | grep "lfm_type:.*daos" || + error "$DIR/$tdir/${tdir}2: invalid LMV EA type" + $LFS getdirstripe -v $DIR/$tdir/${tdir}2 | + grep "lfm_flags:.*0x0000DA05" || + error "$DIR/$tdir/${tdir}2: invalid LMV EA flags" + $LFS getdirstripe $DIR/$tdir/${tdir}2 | + grep "lfm_value.*${uuid1}@${uuid2}" || + error "$DIR/$tdir/${tdir}2: invalid LMV EA value" + + # file create in dir should fail + touch $DIR/$tdir/$tdir/$tfile && "$DIR/$tdir: file create should fail" + touch $DIR/$tdir/${tdir}2/$tfile && + "$DIR/${tdir}2: file create should fail" + + # chmod should work + chmod 777 $DIR/$tdir/$tdir || + error "$DIR/$tdir: chmod failed" + chmod 777 $DIR/$tdir/${tdir}2 || + error "$DIR/${tdir}2: chmod failed" + + # chown should work + chown $RUNAS_ID:$RUNAS_GID $DIR/$tdir/$tdir || + error "$DIR/$tdir: chown failed" + chown $RUNAS_ID:$RUNAS_GID $DIR/$tdir/${tdir}2 || + error "$DIR/${tdir}2: chown failed" + + # rename should work + mv $DIR/$tdir/$tdir $DIR/$tdir/${tdir}.new || + error "$DIR/$tdir/$tdir: rename of foreign dir has failed" + mv $DIR/$tdir/${tdir}2 $DIR/$tdir/${tdir}2.new || + error "$DIR/$tdir/${tdir}2: rename of foreign dir has failed" + + #remove foreign dir + rmdir $DIR/$tdir/${tdir}.new || + error "$DIR/$tdir/${tdir}.new: remove of foreign dir has failed" + rmdir $DIR/$tdir/${tdir}2.new || + error "$DIR/$tdir/${tdir}2.new: remove of foreign dir has failed" +} +run_test 27K "basic ops on dir with foreign LMV" + # createtest also checks that device nodes are created and # then visible correctly (#2091) test_28() { # bug 2091