Whamcloud - gitweb
LU-1187 dne: add remote dir check in replay-vbr.
[fs/lustre-release.git] / lustre / tests / replay-vbr.sh
index d6ddb84..af1a196 100644 (file)
@@ -1,4 +1,6 @@
 #!/bin/bash
+# -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*-
+# vim:shiftwidth=4:softtabstop=4:tabstop=4:
 
 set -e
 
@@ -10,6 +12,7 @@ LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
 SETUP=${SETUP:-}
 CLEANUP=${CLEANUP:-}
 MOUNT_2=${MOUNT_2:-"yes"}
+export MULTIOP=${MULTIOP:-multiop}
 . $LUSTRE/tests/test-framework.sh
 init_test_env $@
 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
@@ -55,23 +58,23 @@ rmultiop_start() {
     # /tmp/multiop_bg.pid file
 
     local pid_file=$TMP/multiop_bg.pid.$$
-    do_node $client "MULTIOP_PID_FILE=$pid_file LUSTRE= sh runmultiop_bg_pause $file $cmds" &
+    do_node $client "MULTIOP_PID_FILE=$pid_file LUSTRE= runmultiop_bg_pause $file $cmds" &
     local pid=$!
     sleep 3
     local multiop_pid
     multiop_pid=$(do_node $client cat $pid_file)
     [ -n "$multiop_pid" ] || error "$client : Can not get multiop_pid from $pid_file "
-    eval export $(client_var_name $client)_multiop_pid=$multiop_pid
-    eval export $(client_var_name $client)_do_node_pid=$pid
-    local var=$(client_var_name $client)_multiop_pid
+    eval export $(node_var_name $client)_multiop_pid=$multiop_pid
+    eval export $(node_var_name $client)_do_node_pid=$pid
+    local var=$(node_var_name $client)_multiop_pid
     echo client $client multiop_bg started multiop_pid=${!var}
     return $?
 }
 
 rmultiop_stop() {
     local client=$1
-    local multiop_pid=$(client_var_name $client)_multiop_pid
-    local do_node_pid=$(client_var_name $client)_do_node_pid
+    local multiop_pid=$(node_var_name $client)_multiop_pid
+    local do_node_pid=$(node_var_name $client)_do_node_pid
 
     echo "Stopping multiop_pid=${!multiop_pid} (kill ${!multiop_pid} on $client)"
     do_node $client kill -USR1 ${!multiop_pid}
@@ -86,9 +89,31 @@ get_version() {
     local fid
 
     fid=$(do_node $client $LFS path2fid $file)
-    do_facet $SINGLEMDS $LCTL --device ${!var} getobjversion $fid
+    do_facet $SINGLEMDS $LCTL --device ${!var} getobjversion \\\"$fid\\\"
 }
 
+#save COS setting
+cos_param_file=$TMP/rvbr-cos-params
+save_lustre_params $(comma_list $(mdts_nodes)) "mdt.*.commit_on_sharing" > $cos_param_file
+
+test_0a() {
+        get_version $CLIENT1 $DIR/$tdir/1a || true
+}
+run_test 0a "getversion for non existent file shouldn't cause kernel panic"
+
+test_0b() {
+        local var=${SINGLEMDS}_svc
+        local fid
+        local file=$DIR/$tdir/f
+
+        do_node $CLIENT1 mkdir -p $DIR/$tdir/
+        do_node $CLIENT1 touch $file
+        fid=$(do_node $CLIENT1 $LFS path2fid $file)
+        do_node $CLIENT1 rm -rf $file
+        do_facet $SINGLEMDS $LCTL --device ${!var} getobjversion \\\"$fid\\\" || true
+}
+run_test 0b "getversion for non existent fid shouldn't cause kernel panic"
+
 # test set #1: OPEN
 test_1a() { # former test_0a
     local file=$DIR/$tfile
@@ -107,8 +132,10 @@ run_test 1a "open and close do not change versions"
 
 test_1b() { # former test_0b
     local var=${SINGLEMDS}_svc
+    zconf_mount $CLIENT2 $MOUNT2
 
     do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+    do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
     do_node $CLIENT1 mkdir -p -m 755 $MOUNT/$tdir
 
     replay_barrier $SINGLEMDS
@@ -119,16 +146,18 @@ test_1b() { # former test_0b
 
     client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
     if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
-        error "open succeeded unexpectedly"
+               error_and_remount "open succeeded unexpectedly"
     fi
-    zconf_mount $CLIENT2 $MOUNT2
 }
 run_test 1b "open (O_CREAT) checks version of parent"
 
 test_1c() { # former test_0c
     local var=${SINGLEMDS}_svc
+    zconf_mount $CLIENT2 $MOUNT2
 
     do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+    do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
+
     do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
     do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tdir/$tfile
 
@@ -141,7 +170,6 @@ test_1c() { # former test_0c
 
     client_up $CLIENT1 || error "$CLIENT1 evicted"
     rmultiop_stop $CLIENT1 || error "close failed"
-    zconf_mount $CLIENT2 $MOUNT2
 }
 run_test 1c "open (non O_CREAT) does not checks versions"
 
@@ -183,15 +211,29 @@ test_2a() {  # extended former test_0d
     if (($pre != $post)); then
         error "version was changed: pre $pre, post $post"
     fi
-    do_node $CLIENT1 rm $DIR/$tfile-*
+       # remote directory
+       if [ $MDSCOUNT -ge 2 ]; then
+               #create remote dir
+               local MDT_IDX=1
+               pre=$(get_version $CLIENT1 $DIR)
+               do_node $CLIENT1 $LFS mkdir -i $MDT_IDX $DIR/$tfile-remote_dir
+               post=$(get_version $CLIENT1 $DIR)
+               if (($pre != $post)); then
+                       error "version was changed: pre $pre, post $post"
+               fi
+       fi
+       do_node $CLIENT1 rm -rf $DIR/$tfile-*
 
 }
 run_test 2a "create operations doesn't change version of parent"
 
 test_2b() { # former test_0e
     local var=${SINGLEMDS}_svc
+    zconf_mount $CLIENT2 $MOUNT2
 
     do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+    do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
+
     do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
 
     replay_barrier $SINGLEMDS
@@ -202,9 +244,8 @@ test_2b() { # former test_0e
 
     client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
     if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
-        error "create succeeded unexpectedly"
+               error_and_remount "create succeeded unexpectedly"
     fi
-    zconf_mount $CLIENT2 $MOUNT2
 }
 run_test 2b "create checks version of parent"
 
@@ -219,13 +260,28 @@ test_3a() { # former test_0f
     if (($pre != $post)); then
         error "version was changed: pre $pre, post $post"
     fi
+
+       if [ $MDSCOUNT -ge 2 ]; then
+               #create remote dir
+               local MDT_IDX=1
+               do_node $CLIENT1 $LFS mkdir -i $MDT_IDX $DIR/$tfile-remote_dir
+               pre=$(get_version $CLIENT1 $DIR)
+               do_node $CLIENT1 rmdir $DIR/$tfile-remote_dir
+               post=$(get_version $CLIENT1 $DIR)
+               if (($pre != $post)); then
+                       error "version was changed: pre $pre, post $post"
+               fi
+       fi
 }
 run_test 3a "unlink doesn't change version of parent"
 
 test_3b() { # former test_0g
     local var=${SINGLEMDS}_svc
+    zconf_mount $CLIENT2 $MOUNT2
 
     do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+    do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
+
     do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
     do_node $CLIENT1 mcreate $DIR/$tdir/$tfile
 
@@ -237,9 +293,8 @@ test_3b() { # former test_0g
 
     client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
     if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
-        error "unlink succeeded unexpectedly"
+               error_and_remount "unlink succeeded unexpectedly"
     fi
-    zconf_mount $CLIENT2 $MOUNT2
 }
 run_test 3b "unlink checks version of parent"
 
@@ -250,7 +305,7 @@ test_4a() { # former 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"
@@ -265,7 +320,7 @@ test_4b() { # former 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"
@@ -276,42 +331,46 @@ run_test 4b "setattr of GID changes versions"
 test_4c() { # former test_0j
     local file=$DIR/$tfile
     local var=${SINGLEMDS}_svc
+    zconf_mount $CLIENT2 $MOUNT2
 
     do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+    do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
+
     do_node $CLIENT1 mcreate $file
 
     replay_barrier $SINGLEMDS
-    do_node $CLIENT2 chown :$RUNAS_ID $MOUNT2/$tfile
-    do_node $CLIENT1 chown $RUNAS_ID $file
+    do_node $CLIENT2 chgrp $RUNAS_GID $MOUNT2/$tfile
+    do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $file
     zconf_umount $CLIENT2 $MOUNT2
     facet_failover $SINGLEMDS
 
     client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
     if ! do_node $CLIENT1 $CHECKSTAT -u \\\#$UID $file; then
-        error "setattr of UID succeeded unexpectedly"
+               error_and_remount "setattr of UID succeeded unexpectedly"
     fi
-    zconf_mount $CLIENT2 $MOUNT2
 }
 run_test 4c "setattr of UID checks versions"
 
 test_4d() { # former test_0k
     local file=$DIR/$tfile
     local var=${SINGLEMDS}_svc
+    zconf_mount $CLIENT2 $MOUNT2
 
     do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+    do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
+
     do_node $CLIENT1 mcreate $file
 
     replay_barrier $SINGLEMDS
-    do_node $CLIENT2 chown $RUNAS_ID $MOUNT2/$tfile
-    do_node $CLIENT1 chown :$RUNAS_ID $file
+    do_node $CLIENT2 chown $RUNAS_ID:$RUNAS_GID $MOUNT2/$tfile
+    do_node $CLIENT1 chgrp $RUNAS_GID $file
     zconf_umount $CLIENT2 $MOUNT2
     facet_failover $SINGLEMDS
 
     client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
     if ! do_node $CLIENT1 $CHECKSTAT -g \\\#$UID $file; then
-        error "setattr of GID succeeded unexpectedly"
+               error_and_remount "setattr of GID succeeded unexpectedly"
     fi
-    zconf_mount $CLIENT2 $MOUNT2
 }
 run_test 4d "setattr of GID checks versions"
 
@@ -333,21 +392,23 @@ run_test 4e "setattr of permission changes versions"
 test_4f() { # former test_0m
     local file=$DIR/$tfile
     local var=${SINGLEMDS}_svc
+    zconf_mount $CLIENT2 $MOUNT2
 
     do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+    do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
+
     do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
 
     replay_barrier $SINGLEMDS
-    do_node $CLIENT2 chown :$RUNAS_ID $MOUNT2/$tfile
+    do_node $CLIENT2 chgrp $RUNAS_GID $MOUNT2/$tfile
     do_node $CLIENT1 chmod 666 $file
     zconf_umount $CLIENT2 $MOUNT2
     facet_failover $SINGLEMDS
 
     client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
     if ! do_node $CLIENT1 $CHECKSTAT -p 0644 $file; then
-        error "setattr of permission succeeded unexpectedly"
+               error_and_remount "setattr of permission succeeded unexpectedly"
     fi
-    zconf_mount $CLIENT2 $MOUNT2
 }
 run_test 4f "setattr of permission checks versions"
 
@@ -383,8 +444,11 @@ test_4h() { # former test_0o
     local file=$DIR/$tfile
     local rc
     local var=${SINGLEMDS}_svc
+    zconf_mount $CLIENT2 $MOUNT2
 
     do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+    do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
+
     do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
 
     replay_barrier $SINGLEMDS
@@ -400,7 +464,6 @@ test_4h() { # former test_0o
     if [ $rc -eq 0 ]; then
         error "setattr of flags succeeded unexpectedly"
     fi
-    zconf_mount $CLIENT2 $MOUNT2
 }
 run_test 4h "setattr of flags checks versions"
 
@@ -435,7 +498,7 @@ test_4j() { # former 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"
@@ -449,14 +512,17 @@ test_4k() { # former test_0r
     local mtime_post
     local mtime
     local var=${SINGLEMDS}_svc
+    zconf_mount $CLIENT2 $MOUNT2
 
     do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
     do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.atime_diff=0"
+    do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
+
     do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
 
     replay_barrier $SINGLEMDS
     do_node $CLIENT2 chmod 666 $MOUNT2/$tfile
-    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
@@ -470,13 +536,12 @@ test_4k() { # former test_0r
         error "time not changed: pre $mtime_pre, post $mtime_post"
     fi
     if ! do_node $CLIENT1 $CHECKSTAT -s 1 $file; then
-        error "setattr of size failed"
+               error_and_remount "setattr of size failed"
     fi
     mtime=$(do_node $CLIENT1 stat --format=%Y $file)
     if (($mtime != $mtime_post)); then
         error "setattr of times failed: expected $mtime_post, got $mtime"
     fi
-    zconf_mount $CLIENT2 $MOUNT2
 }
 run_test 4k "setattr of times and size does not check versions"
 
@@ -504,8 +569,11 @@ run_test 5a "link changes versions of source but not target parent"
 
 test_5b() { # former test_0t
     local var=${SINGLEMDS}_svc
+    zconf_mount $CLIENT2 $MOUNT2
 
     do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+    do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
+
     do_node $CLIENT1 mcreate $DIR/$tfile
     do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
 
@@ -517,16 +585,18 @@ test_5b() { # former test_0t
 
     client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
     if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
-        error "link should fail"
+               error_and_remount "link should fail"
     fi
-    zconf_mount $CLIENT2 $MOUNT2
 }
 run_test 5b "link checks version of target parent"
 
 test_5c() { # former test_0u
     local var=${SINGLEMDS}_svc
+    zconf_mount $CLIENT2 $MOUNT2
 
     do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+    do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
+
     do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile
     do_node $CLIENT1 mkdir -p $DIR/$tdir
 
@@ -538,9 +608,8 @@ test_5c() { # former test_0u
 
     client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
     if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
-        error "link should fail"
+               error_and_remount "link should fail"
     fi
-    zconf_mount $CLIENT2 $MOUNT2
 }
 run_test 5c "link checks version of source"
 
@@ -582,8 +651,11 @@ run_test 6b "rename within same dir doesn't change version of parent"
 
 test_6c() { # former test_0x
     local var=${SINGLEMDS}_svc
+    zconf_mount $CLIENT2 $MOUNT2
 
     do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+    do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
+
     do_node $CLIENT1 mcreate $DIR/$tfile
     do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
 
@@ -595,16 +667,18 @@ test_6c() { # former test_0x
 
     client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
     if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tfile; then
-        error "rename should fail"
+               error_and_remount "rename should fail"
     fi
-    zconf_mount $CLIENT2 $MOUNT2
 }
 run_test 6c "rename checks version of source parent"
 
 test_6d() { # former test_0y
     local var=${SINGLEMDS}_svc
+    zconf_mount $CLIENT2 $MOUNT2
 
     do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+    do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
+
     do_node $CLIENT1 mcreate $DIR/$tfile
     do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
 
@@ -616,27 +690,38 @@ test_6d() { # former test_0y
 
     client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
     if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tfile; then
-        error "rename should fail"
+               error_and_remount "rename should fail"
     fi
-    zconf_mount $CLIENT2 $MOUNT2
 }
 run_test 6d "rename checks version of target parent"
 
 # pdirops tests, bug 18143
+cycle=0
 test_7_cycle() {
     local first=$1
     local lost=$2
     local last=$3
     local rc=0
+    local var=${SINGLEMDS}_svc
+    zconf_mount $CLIENT2 $MOUNT2
+    cycle=$((cycle + 1))
+    local cname=$TESTNAME.$cycle
+
+    echo "start cycle: $cname"
+    do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+    do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
 
     do_node $CLIENT1 mkdir -p $DIR/$tdir
     replay_barrier $SINGLEMDS
     # first operation
-    do_node $CLIENT1 $first || error "Cannot do first operation"
+    echo "$cname first: $first"
+    do_node $CLIENT1 $first || error "$cname: Cannot do first operation"
     # client2 operations that will be lost
-    do_node $CLIENT2 $lost || error "Cannot do 'lost' operations"
+    echo "$cname lost: $lost"
+    do_node $CLIENT2 $lost || error "$cname: Cannot do 'lost' operations"
     # second operation
-    do_node $CLIENT1 $last || error "Cannot do last operation"
+    echo "$cname last: $last"
+    do_node $CLIENT1 $last || error "$cname: Cannot do last operation"
     zconf_umount $CLIENT2 $MOUNT2
     facet_failover $SINGLEMDS
     # should fail as conflict expected
@@ -645,9 +730,7 @@ test_7_cycle() {
     wait_recovery_complete $SINGLEMDS
     wait_mds_ost_sync $SINGLEMDS
 
-    zconf_mount $CLIENT2 $MOUNT2
     rm -rf $DIR/$tdir
-
     return $rc
 }
 
@@ -859,6 +942,11 @@ run_test 7i "rename, {lost}, rename"
 # too but not fail on second create due to orphan found.
 
 test_8a() {
+    local var=${SINGLEMDS}_svc
+    zconf_mount $CLIENT2 $MOUNT2
+
+    do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
+
     do_node $CLIENT1 mcreate $DIR/$tfile
     do_node $CLIENT1 mkdir $DIR/$tfile-2
     replay_barrier $SINGLEMDS
@@ -872,12 +960,16 @@ test_8a() {
     client_up $CLIENT1 || return 6
 
     do_node $CLIENT1 rm $DIR/$tfile || error "$tfile doesn't exists"
-    zconf_mount $CLIENT2 $MOUNT2
     return 0
 }
 run_test 8a "create | unlink, create shouldn't fail"
 
 test_8b() {
+    local var=${SINGLEMDS}_svc
+    zconf_mount $CLIENT2 $MOUNT2
+
+    do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
+
     do_node $CLIENT1 touch $DIR/$tfile
     do_node $CLIENT1 mkdir $DIR/$tfile-2
     replay_barrier $SINGLEMDS
@@ -891,12 +983,16 @@ test_8b() {
     client_up $CLIENT1 || return 6
 
     do_node $CLIENT1 rm $MOUNT1/$tfile || error "$tfile doesn't exists"
-    zconf_mount $CLIENT2 $MOUNT2
     return 0
 }
 run_test 8b "create | unlink, create shouldn't fail"
 
 test_8c() {
+    local var=${SINGLEMDS}_svc
+    zconf_mount $CLIENT2 $MOUNT2
+
+    do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
+
     do_node $CLIENT1 touch $DIR/$tfile
     do_node $CLIENT1 mkdir $DIR/$tfile-2
     replay_barrier $SINGLEMDS
@@ -910,13 +1006,10 @@ test_8c() {
     client_up $CLIENT1 || return 6
 
     do_node $CLIENT1 rmdir $MOUNT1/$tfile || error "$tfile doesn't exists"
-    zconf_mount $CLIENT2 $MOUNT2
     return 0
 }
 run_test 8c "create | unlink, create shouldn't fail"
 
-[ "$CLIENTS" ] && zconf_umount_clients $CLIENTS $DIR
-
 #
 # This test uses three Lustre clients on two hosts.
 #
@@ -934,14 +1027,19 @@ test_10b() { # former test_2b
         { skip "Need two or more clients, have $CLIENTCOUNT" && exit 0; }
 
     do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
+    do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
+
+    zconf_mount $CLIENT1 $MOUNT
     zconf_mount $CLIENT2 $MOUNT1
+    zconf_mount $CLIENT2 $MOUNT2
     do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile-a
     do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile-b
 
     #
     # Save an MDT transaction number before recovery.
     #
-    pre=$(get_version $CLIENT1 $DIR/$tfile-a)
+    do_node $CLIENT1 touch $DIR1/$tfile
+    pre=$(get_version $CLIENT1 $DIR/$tfile)
 
     #
     # Comments on the replay sequence state the expected result
@@ -954,11 +1052,11 @@ test_10b() { # former test_2b
     replay_barrier $SINGLEMDS
     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 $SINGLEMDS
 
@@ -969,11 +1067,12 @@ test_10b() { # former test_2b
     # Check the MDT epoch.  $post must be the first transaction
     # number assigned after recovery.
     #
-    do_node $CLIENT2 touch $DIR1/$tfile
+    do_node $CLIENT2 chmod 666 $DIR1/$tfile
     post=$(get_version $CLIENT2 $DIR1/$tfile)
     if (($(($pre >> 32)) == $((post >> 32)))); then
         error "epoch not changed: pre $pre, post $post"
     fi
+
     if (($(($post & 0x00000000ffffffff)) != 1)); then
         error "transno should restart from one: got $post"
     fi
@@ -983,16 +1082,20 @@ test_10b() { # former 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_mount $CLIENT2 $MOUNT2
     zconf_umount $CLIENT2 $MOUNT1
 }
 run_test 10b "3 clients: some, none, and all reqs replayed"
 
 # test set #11: operations in single directory
 test_11a() {
+    local var=${SINGLEMDS}_svc
+    zconf_mount $CLIENT2 $MOUNT2
+
+    do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
+
     replay_barrier $SINGLEMDS
 
     do_node $CLIENT1 createmany -o $DIR/$tfile-1- 100 &
@@ -1007,13 +1110,17 @@ test_11a() {
     # All files from client1 should have been replayed
     do_node $CLIENT1 unlinkmany $DIR/$tfile-1- 100 || return 2
 
-    zconf_mount $CLIENT2 $MOUNT2 || error "mount $CLIENT2 $MOUNT2 fail"
     [ -e $DIR/$tdir/$tfile-2-0 ] && error "$tfile-2-0 exists"
     return 0
 }
 run_test 11a "concurrent creates don't affect each other"
 
 test_11b() {
+    local var=${SINGLEMDS}_svc
+    zconf_mount $CLIENT2 $MOUNT2
+
+    do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
+
     do_node $CLIENT2 createmany -o $MOUNT2/$tfile-2- 100
 
     replay_barrier $SINGLEMDS
@@ -1029,7 +1136,6 @@ test_11b() {
     # All files from client1 should have been replayed
     do_node $CLIENT1 unlinkmany $DIR/$tfile-1- 100 || return 2
 
-    zconf_mount $CLIENT2 $MOUNT2 || error "mount $CLIENT2 $MOUNT2 fail"
     [ -e $DIR/$tdir/$tfile-2-0 ] && error "$tfile-2-0 exists"
     return 0
 }
@@ -1037,6 +1143,11 @@ run_test 11b "concurrent creates and unlinks don't affect each other"
 
 # test set #12: lock replay with VBR, bug 16356
 test_12a() { # former test_2a
+    local var=${SINGLEMDS}_svc
+    zconf_mount $CLIENT2 $MOUNT2
+
+    do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
+
     do_node $CLIENT2 mkdir -p $MOUNT2/$tdir
     replay_barrier $SINGLEMDS
     do_node $CLIENT2 mcreate $MOUNT2/$tdir/$tfile
@@ -1055,13 +1166,16 @@ test_12a() { # former test_2a
     do_node $CLIENT1 unlinkmany $DIR/$tfile-3- 25 || return 3
     do_node $CLIENT1 $CHECKSTAT $DIR/$tdir/$tfile && return 4
 
-    zconf_mount $CLIENT2 $MOUNT2 || error "mount $CLIENT2 $DIR fail"
     return 0
 }
 run_test 12a "lost data due to missed REMOTE client during replay"
 
+#restore COS setting
+restore_lustre_params < $cos_param_file
+rm -f $cos_param_file
+
 [ "$CLIENTS" ] && zconf_mount_clients $CLIENTS $DIR
 
-equals_msg `basename $0`: test complete, cleaning up
+complete $SECONDS
 check_and_cleanup_lustre
-[ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true
+exit_status