Whamcloud - gitweb
b=24360 fix NULL pointer deref in mds_verify_child() when ll_lookup_one_len() fails
[fs/lustre-release.git] / lustre / tests / replay-vbr.sh
index 5a1fc79..3cd1511 100644 (file)
@@ -84,6 +84,12 @@ get_version() {
     do_facet mds $LCTL --device $mds_svc getobjversion $fid
 }
 
+# interop 18 <-> 20
+lustre_version=$(get_lustre_version mds)
+if [[ $lustre_version != 1.8* ]]; then
+    mds20="yes"
+fi
+
 test_0a() {
     local file=$DIR/$tfile
     local pre
@@ -143,7 +149,7 @@ test_0d() {
     do_node $CLIENT1 mkfifo $DIR/$tfile
     post=$(get_version $CLIENT1 $DIR)
     if (($pre == $post)); then
-        error "version not changed: pre $pre, post $post"
+        [ -n "$mds20" ] || error "version not changed: pre $pre, post $post"
     fi
 }
 run_test 0d "VBR: create changes version of parent"
@@ -175,7 +181,7 @@ test_0f() {
     do_node $CLIENT1 rm $DIR/$tfile
     post=$(get_version $CLIENT1 $DIR)
     if (($pre == $post)); then
-        error "version not changed: pre $pre, post $post"
+        [ -n "$mds20" ] || error "version not changed: pre $pre, post $post"
     fi
 }
 run_test 0f "VBR: unlink changes version of parent"
@@ -206,7 +212,7 @@ test_0h() {
 
     do_node $CLIENT1 mcreate $file
     pre=$(get_version $CLIENT1 $file)
-    do_node $CLIENT1 chown $RUNAS_ID $file
+    do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $file
     post=$(get_version $CLIENT1 $file)
     if (($pre == $post)); then
         error "version not changed: pre $pre, post $post"
@@ -221,7 +227,7 @@ test_0i() {
 
     do_node $CLIENT1 mcreate $file
     pre=$(get_version $CLIENT1 $file)
-    do_node $CLIENT1 chown :$RUNAS_ID $file
+    do_node $CLIENT1 chgrp $RUNAS_GID $file
     post=$(get_version $CLIENT1 $file)
     if (($pre == $post)); then
         error "version not changed: pre $pre, post $post"
@@ -236,8 +242,8 @@ test_0j() {
     do_node $CLIENT1 mcreate $file
 
     replay_barrier mds
-    do_node $CLIENT2 chown :$RUNAS_ID $file
-    do_node $CLIENT1 chown $RUNAS_ID $file
+    do_node $CLIENT2 chgrp $RUNAS_GID $file
+    do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $file
     zconf_umount $CLIENT2 $MOUNT
     facet_failover mds
 
@@ -256,8 +262,8 @@ test_0k() {
     do_node $CLIENT1 mcreate $file
 
     replay_barrier mds
-    do_node $CLIENT2 chown $RUNAS_ID $file
-    do_node $CLIENT1 chown :$RUNAS_ID $file
+    do_node $CLIENT2 chown $RUNAS_ID:$RUNAS_GID $file
+    do_node $CLIENT1 chgrp $RUNAS_GID $file
     zconf_umount $CLIENT2 $MOUNT
     facet_failover mds
 
@@ -291,7 +297,7 @@ test_0m() {
     do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
 
     replay_barrier mds
-    do_node $CLIENT2 chown :$RUNAS_ID $file
+    do_node $CLIENT2 chgrp $RUNAS_GID $file
     do_node $CLIENT1 chmod 666 $file
     zconf_umount $CLIENT2 $MOUNT
     facet_failover mds
@@ -386,7 +392,7 @@ test_0q() {
 
     do_node $CLIENT1 mcreate $file
     pre=$(get_version $CLIENT1 $file)
-    do_node $CLIENT1 truncate $file 1
+    do_node $CLIENT1 $TRUNCATE $file 1
     post=$(get_version $CLIENT1 $file)
     if (($pre != $post)); then
         error "version changed unexpectedly: pre $pre, post $post"
@@ -406,7 +412,7 @@ test_0r() {
 
     replay_barrier mds
     do_node $CLIENT2 chmod 666 $file
-    do_node $CLIENT1 truncate $file 1
+    do_node $CLIENT1 $TRUNCATE $file 1
     sleep 1
     mtime_pre=$(do_node $CLIENT1 stat --format=%Y $file)
     do_node $CLIENT1 touch $file
@@ -446,7 +452,8 @@ test_0s() {
         error "version of source not changed: pre $pre, post $post"
     fi
     if (($tp_pre == $tp_post)); then
-        error "version of target parent not changed: pre $tp_pre, post $tp_post"
+        [ -n "$mds20" ] || \
+            error "version of target parent not changed: pre $tp_pre, post $tp_post"
     fi
 }
 run_test 0s "VBR: link changes versions of source and target parent"
@@ -503,10 +510,12 @@ test_0v() {
     sp_post=$(get_version $CLIENT1 $DIR)
     tp_post=$(get_version $CLIENT1 $DIR/$tdir)
     if (($sp_pre == $sp_post)); then
-        error "version of source parent not changed: pre $sp_pre, post $sp_post"
+        [ -n "$mds20" ] || \
+            error "version of source parent not changed: pre $sp_pre, post $sp_post"
     fi
     if (($tp_pre == $tp_post)); then
-        error "version of target parent not changed: pre $tp_pre, post $tp_post"
+        [ -n "$mds20" ] || \
+            error "version of target parent not changed: pre $tp_pre, post $tp_post"
     fi
 }
 run_test 0v "VBR: rename changes versions of source parent and target parent"
@@ -520,7 +529,8 @@ test_0w() {
     do_node $CLIENT1 mv $DIR/$tfile $DIR/$tfile-new
     post=$(get_version $CLIENT1 $DIR)
     if (($pre == $post)); then
-        error "version of parent not changed: pre $pre, post $post"
+        [ -n "$mds20" ] || \
+            error "version of parent not changed: pre $pre, post $post"
     fi
 }
 run_test 0w "VBR: rename within same dir changes version of parent"
@@ -659,11 +669,11 @@ test_2b() {
     replay_barrier mds
     do_node $CLIENT1 chmod 666 $DIR/$tfile-a            # R
     do_node $CLIENT2 chmod 666 $DIR1/$tfile-b           # R
-    do_node $CLIENT2 chown :$RUNAS_ID $DIR2/$tfile-a    # U
-    do_node $CLIENT1 chown $RUNAS_ID $DIR/$tfile-a      # J
-    do_node $CLIENT2 truncate $DIR2/$tfile-b 1          # U
-    do_node $CLIENT2 chown :$RUNAS_ID $DIR1/$tfile-b    # R
-    do_node $CLIENT1 chown $RUNAS_ID $DIR/$tfile-b      # R
+    do_node $CLIENT2 chgrp $RUNAS_GID $DIR2/$tfile-a    # U
+    do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile-a      # J
+    do_node $CLIENT2 $TRUNCATE $DIR2/$tfile-b 1          # U
+    do_node $CLIENT2 chgrp $RUNAS_GID $DIR1/$tfile-b    # R
+    do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile-b      # R
     zconf_umount $CLIENT2 $MOUNT2
     facet_failover mds
 
@@ -688,7 +698,7 @@ test_2b() {
 
     do_node $CLIENT2 $CHECKSTAT -p 0666 -u \\\#$UID -g \\\#$UID \
             $DIR1/$tfile-a || error "$DIR/$tfile-a: unexpected state"
-    do_node $CLIENT2 $CHECKSTAT -p 0666 -u \\\#$RUNAS_ID -g \\\#$RUNAS_ID \
+    do_node $CLIENT2 $CHECKSTAT -p 0666 -u \\\#$RUNAS_ID -g \\\#$RUNAS_GID \
             $DIR1/$tfile-b || error "$DIR/$tfile-b: unexpected state"
 
     zconf_umount $CLIENT2 $MOUNT1
@@ -1278,8 +1288,6 @@ run_test 10 "mds version recovery; $CLIENTCOUNT clients"
 
 [ "$CLIENTS" ] && zconf_mount_clients $CLIENTS $DIR
 
-equals_msg `basename $0`: test complete, cleaning up
-#SLEEP=$((`date +%s` - $NOW))
-#[ $SLEEP -lt $TIMEOUT ] && sleep $SLEEP
+complete $(basename $0) $SECONDS
 check_and_cleanup_lustre
-[ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true
+exit_status