X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Ftests%2Freplay-vbr.sh;h=7955f4c0d36069f864fcfc3c3d31732c5a054f36;hp=af1a196e12f800f57b8263045dfbf645e1fe2a0f;hb=a4fbe7341b;hpb=96a0f6eef77190d166de0ecc7a66ae2ac2b6ae53 diff --git a/lustre/tests/replay-vbr.sh b/lustre/tests/replay-vbr.sh old mode 100644 new mode 100755 index af1a196..7955f4c --- a/lustre/tests/replay-vbr.sh +++ b/lustre/tests/replay-vbr.sh @@ -1,26 +1,20 @@ #!/bin/bash -# -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*- -# vim:shiftwidth=4:softtabstop=4:tabstop=4: set -e -# bug number: 16356 -ALWAYS_EXCEPT="12a $REPLAY_VBR_EXCEPT" - -SAVE_PWD=$PWD -LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)} -SETUP=${SETUP:-} -CLEANUP=${CLEANUP:-} MOUNT_2=${MOUNT_2:-"yes"} -export MULTIOP=${MULTIOP:-multiop} + +LUSTRE=${LUSTRE:-$(dirname $0)/..} . $LUSTRE/tests/test-framework.sh init_test_env $@ -. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} init_logging remote_mds_nodsh && log "SKIP: remote MDS with nodsh" && exit 0 -[ "$SLOW" = "no" ] && EXCEPT_SLOW="7" +ALWAYS_EXCEPT=" $REPLAY_VBR_EXCEPT" + +# ~6 (min)" +[ "$SLOW" = "no" ] && EXCEPT_SLOW="7 " build_test_filter @@ -41,63 +35,47 @@ CLIENT2=${CLIENT2:-$CLIENT1} is_mounted $MOUNT2 || error "MOUNT2 is not mounted" -rmultiop_start() { - local client=$1 - local file=$2 - local cmds=$3 - - # We need to run do_node in bg, because pdsh does not exit - # if child process of run script exists. - # I.e. pdsh does not exit when runmultiop_bg_pause exited, - # because of multiop_bg_pause -> $MULTIOP_PROG & - # By the same reason we need sleep a bit after do_nodes starts - # to let runmultiop_bg_pause start muliop and - # update /tmp/multiop_bg.pid ; - # The rm /tmp/multiop_bg.pid guarantees here that - # we have the updated by runmultiop_bg_pause - # /tmp/multiop_bg.pid file - - local pid_file=$TMP/multiop_bg.pid.$$ - 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 $(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 $? +# +# get_version(): Gets the version of an object on servers +# Parameter1: Client/Machine Name +# Parameter2: File Path +# Returns: Objectversion Or -1 if getobjversion fails. +# +get_version() { + local var=${SINGLEMDS}_svc + local client=$1 + local file=$2 + local fid=$(do_node $client $LFS path2fid $file) + local objver=$(do_facet $SINGLEMDS $LCTL --device ${!var} \ + getobjversion \\\"$fid\\\") + + [[ -z $objver ]] && objver=-1 + echo $objver } -rmultiop_stop() { - local client=$1 - 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} +# +# chk_get_version(): Wrapper to get_version(). +# Parameter1: Client/Machine Name +# Parameter2: File Path +# Returns: Objectversion Or Exit with error in case objver is -1. +# +chk_get_version() { + local objver=$(get_version $1 $2) - wait ${!do_node_pid} + [[ "$objver" == "-1" ]] && error "object version is empty." + echo $objver } -get_version() { - local var=${SINGLEMDS}_svc - local client=$1 - local file=$2 - local fid - - fid=$(do_node $client $LFS path2fid $file) - 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 +save_lustre_params $(get_facets MDS) "mdt.*.commit_on_sharing" > $cos_param_file test_0a() { - get_version $CLIENT1 $DIR/$tdir/1a || true + local ver=$(get_version $CLIENT1 $DIR/$tdir/1a) + + [[ "$ver" == "-1" ]] && return 0 + return 1 } run_test 0a "getversion for non existent file shouldn't cause kernel panic" @@ -116,17 +94,17 @@ 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 - local pre - local post - - do_node $CLIENT1 mcreate $file - pre=$(get_version $CLIENT1 $file) - do_node $CLIENT1 openfile -f O_RDWR $file - post=$(get_version $CLIENT1 $file) - if (($pre != $post)); then - error "version changed unexpectedly: pre $pre, post $post" - fi + local file=$DIR/$tfile + local pre + local post + + do_node $CLIENT1 mcreate $file + pre=$(chk_get_version $CLIENT1 $file) + do_node $CLIENT1 openfile -f O_RDWR $file + post=$(chk_get_version $CLIENT1 $file) + if (($pre != $post)); then + error "version changed unexpectedly: pre $pre, post $post" + fi } run_test 1a "open and close do not change versions" @@ -136,7 +114,7 @@ test_1b() { # former test_0b 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 + do_node $CLIENT1 $LFS mkdir -i 0 -c 1 $MOUNT/$tdir replay_barrier $SINGLEMDS do_node $CLIENT2 chmod 777 $MOUNT2/$tdir @@ -178,46 +156,46 @@ run_test 1c "open (non O_CREAT) does not checks versions" # - pre-version should be -1 # - post-version should be valid test_2a() { # extended former test_0d - local pre - local post - - # fifo - pre=$(get_version $CLIENT1 $DIR) - do_node $CLIENT1 mkfifo $DIR/$tfile-fifo - post=$(get_version $CLIENT1 $DIR) - if (($pre != $post)); then - error "version was changed: pre $pre, post $post" - fi - # mkdir - pre=$(get_version $CLIENT1 $DIR) - do_node $CLIENT1 mkdir $DIR/$tfile-dir - post=$(get_version $CLIENT1 $DIR) - if (($pre != $post)); then - error "version was changed: pre $pre, post $post" - fi - do_node $CLIENT1 rmdir $DIR/$tfile-dir - - # mknod - pre=$(get_version $CLIENT1 $DIR) - do_node $CLIENT1 mkfifo $DIR/$tfile-nod - post=$(get_version $CLIENT1 $DIR) - if (($pre != $post)); then - error "version was changed: pre $pre, post $post" - fi - # symlink - pre=$(get_version $CLIENT1 $DIR) - do_node $CLIENT1 mkfifo $DIR/$tfile-symlink - post=$(get_version $CLIENT1 $DIR) - if (($pre != $post)); then - error "version was changed: pre $pre, post $post" - fi + local pre + local post + + # fifo + pre=$(chk_get_version $CLIENT1 $DIR) + do_node $CLIENT1 mkfifo $DIR/$tfile-fifo + post=$(chk_get_version $CLIENT1 $DIR) + if (($pre != $post)); then + error "version was changed: pre $pre, post $post" + fi + # mkdir + pre=$(chk_get_version $CLIENT1 $DIR) + do_node $CLIENT1 mkdir $DIR/$tfile-dir + post=$(chk_get_version $CLIENT1 $DIR) + if (($pre != $post)); then + error "version was changed: pre $pre, post $post" + fi + do_node $CLIENT1 rmdir $DIR/$tfile-dir + + # mknod + pre=$(chk_get_version $CLIENT1 $DIR) + do_node $CLIENT1 mkfifo $DIR/$tfile-nod + post=$(chk_get_version $CLIENT1 $DIR) + if (($pre != $post)); then + error "version was changed: pre $pre, post $post" + fi + # symlink + pre=$(chk_get_version $CLIENT1 $DIR) + do_node $CLIENT1 mkfifo $DIR/$tfile-symlink + post=$(chk_get_version $CLIENT1 $DIR) + if (($pre != $post)); then + error "version was changed: pre $pre, post $post" + fi # remote directory if [ $MDSCOUNT -ge 2 ]; then #create remote dir local MDT_IDX=1 - pre=$(get_version $CLIENT1 $DIR) + pre=$(chk_get_version $CLIENT1 $DIR) do_node $CLIENT1 $LFS mkdir -i $MDT_IDX $DIR/$tfile-remote_dir - post=$(get_version $CLIENT1 $DIR) + post=$(chk_get_version $CLIENT1 $DIR) if (($pre != $post)); then error "version was changed: pre $pre, post $post" fi @@ -234,7 +212,7 @@ test_2b() { # former test_0e 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 $LFS mkdir -i 0 -c 1 $MOUNT/$tdir replay_barrier $SINGLEMDS do_node $CLIENT2 chmod 777 $MOUNT2/$tdir @@ -250,24 +228,24 @@ test_2b() { # former test_0e run_test 2b "create checks version of parent" test_3a() { # former test_0f - local pre - local post - - do_node $CLIENT1 mcreate $DIR/$tfile - pre=$(get_version $CLIENT1 $DIR) - do_node $CLIENT1 rm $DIR/$tfile - post=$(get_version $CLIENT1 $DIR) - if (($pre != $post)); then - error "version was changed: pre $pre, post $post" - fi + local pre + local post + + do_node $CLIENT1 mcreate $DIR/$tfile + pre=$(chk_get_version $CLIENT1 $DIR) + do_node $CLIENT1 rm $DIR/$tfile + post=$(chk_get_version $CLIENT1 $DIR) + 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) + pre=$(chk_get_version $CLIENT1 $DIR) do_node $CLIENT1 rmdir $DIR/$tfile-remote_dir - post=$(get_version $CLIENT1 $DIR) + post=$(chk_get_version $CLIENT1 $DIR) if (($pre != $post)); then error "version was changed: pre $pre, post $post" fi @@ -282,7 +260,7 @@ test_3b() { # former test_0g 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 $LFS mkdir -i 0 -c 1 $MOUNT/$tdir do_node $CLIENT1 mcreate $DIR/$tdir/$tfile replay_barrier $SINGLEMDS @@ -299,32 +277,32 @@ test_3b() { # former test_0g run_test 3b "unlink checks version of parent" test_4a() { # former test_0h - local file=$DIR/$tfile - local pre - local post - - do_node $CLIENT1 mcreate $file - pre=$(get_version $CLIENT1 $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" - fi + local file=$DIR/$tfile + local pre + local post + + do_node $CLIENT1 mcreate $file + pre=$(chk_get_version $CLIENT1 $file) + do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $file + post=$(chk_get_version $CLIENT1 $file) + if (($pre == $post)); then + error "version not changed: pre $pre, post $post" + fi } run_test 4a "setattr of UID changes versions" test_4b() { # former test_0i - local file=$DIR/$tfile - local pre - local post - - do_node $CLIENT1 mcreate $file - pre=$(get_version $CLIENT1 $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" - fi + local file=$DIR/$tfile + local pre + local post + + do_node $CLIENT1 mcreate $file + pre=$(chk_get_version $CLIENT1 $file) + do_node $CLIENT1 chgrp $RUNAS_GID $file + post=$(chk_get_version $CLIENT1 $file) + if (($pre == $post)); then + error "version not changed: pre $pre, post $post" + fi } run_test 4b "setattr of GID changes versions" @@ -375,17 +353,17 @@ test_4d() { # former test_0k run_test 4d "setattr of GID checks versions" test_4e() { # former test_0l - local file=$DIR/$tfile - local pre - local post - - do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file - pre=$(get_version $CLIENT1 $file) - do_node $CLIENT1 chmod 666 $file - post=$(get_version $CLIENT1 $file) - if (($pre == $post)); then - error "version not changed: pre $pre, post $post" - fi + local file=$DIR/$tfile + local pre + local post + + do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file + pre=$(chk_get_version $CLIENT1 $file) + do_node $CLIENT1 chmod 666 $file + post=$(chk_get_version $CLIENT1 $file) + if (($pre == $post)); then + error "version not changed: pre $pre, post $post" + fi } run_test 4e "setattr of permission changes versions" @@ -413,18 +391,18 @@ test_4f() { # former test_0m run_test 4f "setattr of permission checks versions" test_4g() { # former test_0n - local file=$DIR/$tfile - local pre - local post - - do_node $CLIENT1 mcreate $file - pre=$(get_version $CLIENT1 $file) - do_node $CLIENT1 chattr +i $file - post=$(get_version $CLIENT1 $file) - do_node $CLIENT1 chattr -i $file - if (($pre == $post)); then - error "version not changed: pre $pre, post $post" - fi + local file=$DIR/$tfile + local pre + local post + + do_node $CLIENT1 mcreate $file + pre=$(chk_get_version $CLIENT1 $file) + do_node $CLIENT1 chattr +i $file + post=$(chk_get_version $CLIENT1 $file) + do_node $CLIENT1 chattr -i $file + if (($pre == $post)); then + error "version not changed: pre $pre, post $post" + fi } run_test 4g "setattr of flags changes versions" @@ -468,41 +446,41 @@ test_4h() { # former test_0o run_test 4h "setattr of flags checks versions" test_4i() { # former test_0p - local file=$DIR/$tfile - local pre - local post - local ad_orig - local var=${SINGLEMDS}_svc - - ad_orig=$(do_facet $SINGLEMDS "$LCTL get_param mdd.${!var}.atime_diff") - do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.atime_diff=0" - do_node $CLIENT1 mcreate $file - pre=$(get_version $CLIENT1 $file) - do_node $CLIENT1 touch $file - post=$(get_version $CLIENT1 $file) - # - # We don't fail MDS in this test. atime_diff shall be - # restored to its original value. - # - do_facet $SINGLEMDS "$LCTL set_param $ad_orig" - if (($pre != $post)); then - error "version changed unexpectedly: pre $pre, post $post" - fi + local file=$DIR/$tfile + local pre + local post + local ad_orig + local var=${SINGLEMDS}_svc + + ad_orig=$(do_facet $SINGLEMDS "$LCTL get_param mdd.${!var}.atime_diff") + do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.atime_diff=0" + do_node $CLIENT1 mcreate $file + pre=$(chk_get_version $CLIENT1 $file) + do_node $CLIENT1 touch $file + post=$(chk_get_version $CLIENT1 $file) + # + # We don't fail MDS in this test. atime_diff shall be + # restored to its original value. + # + do_facet $SINGLEMDS "$LCTL set_param $ad_orig" + if (($pre != $post)); then + error "version changed unexpectedly: pre $pre, post $post" + fi } run_test 4i "setattr of times does not change versions" test_4j() { # former test_0q - local file=$DIR/$tfile - local pre - local post - - do_node $CLIENT1 mcreate $file - pre=$(get_version $CLIENT1 $file) - do_node $CLIENT1 $TRUNCATE $file 1 - post=$(get_version $CLIENT1 $file) - if (($pre != $post)); then - error "version changed unexpectedly: pre $pre, post $post" - fi + local file=$DIR/$tfile + local pre + local post + + do_node $CLIENT1 mcreate $file + pre=$(chk_get_version $CLIENT1 $file) + do_node $CLIENT1 $TRUNCATE $file 1 + post=$(chk_get_version $CLIENT1 $file) + if (($pre != $post)); then + error "version changed unexpectedly: pre $pre, post $post" + fi } run_test 4j "setattr of size does not change versions" @@ -546,24 +524,25 @@ test_4k() { # former test_0r run_test 4k "setattr of times and size does not check versions" test_5a() { # former test_0s - local pre - local post - local tp_pre - local tp_post - - do_node $CLIENT1 mcreate $DIR/$tfile - do_node $CLIENT1 mkdir -p $DIR/$tdir - pre=$(get_version $CLIENT1 $DIR/$tfile) - tp_pre=$(get_version $CLIENT1 $DIR/$tdir) - do_node $CLIENT1 link $DIR/$tfile $DIR/$tdir/$tfile - post=$(get_version $CLIENT1 $DIR/$tfile) - tp_post=$(get_version $CLIENT1 $DIR/$tdir) - if (($pre == $post)); then - error "version of source not changed: pre $pre, post $post" - fi - if (($tp_pre != $tp_post)); then - error "version of target parent was changed: pre $tp_pre, post $tp_post" - fi + local pre + local post + local tp_pre + local tp_post + + do_node $CLIENT1 mcreate $DIR/$tfile + do_node $CLIENT1 $LFS mkdir -i 0 -c 1 $DIR/$tdir + pre=$(chk_get_version $CLIENT1 $DIR/$tfile) + tp_pre=$(chk_get_version $CLIENT1 $DIR/$tdir) + do_node $CLIENT1 link $DIR/$tfile $DIR/$tdir/$tfile + post=$(chk_get_version $CLIENT1 $DIR/$tfile) + tp_post=$(chk_get_version $CLIENT1 $DIR/$tdir) + if (($pre == $post)); then + error "version of source not changed: pre $pre, post $post" + fi + if (($tp_pre != $tp_post)); then + error "version of target parent was changed:"\ + "pre $tp_pre, post $tp_post" + fi } run_test 5a "link changes versions of source but not target parent" @@ -575,7 +554,7 @@ test_5b() { # former test_0t 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 + do_node $CLIENT1 $LFS mkdir -i 0 -c 1 $MOUNT/$tdir replay_barrier $SINGLEMDS do_node $CLIENT2 chmod 777 $MOUNT2/$tdir @@ -598,7 +577,7 @@ test_5c() { # former test_0u 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 + do_node $CLIENT1 $LFS mkdir -i 0 -c 1 $MOUNT/$tdir replay_barrier $SINGLEMDS do_node $CLIENT2 chmod 666 $MOUNT2/$tfile @@ -614,38 +593,40 @@ test_5c() { # former test_0u run_test 5c "link checks version of source" test_6a() { # former test_0v - local sp_pre - local tp_pre - local sp_post - local tp_post - - do_node $CLIENT1 mcreate $DIR/$tfile - do_node $CLIENT1 mkdir -p $DIR/$tdir - sp_pre=$(get_version $CLIENT1 $DIR) - tp_pre=$(get_version $CLIENT1 $DIR/$tdir) - do_node $CLIENT1 mv $DIR/$tfile $DIR/$tdir/$tfile - sp_post=$(get_version $CLIENT1 $DIR) - tp_post=$(get_version $CLIENT1 $DIR/$tdir) - if (($sp_pre != $sp_post)); then - error "version of source parent was changed: pre $sp_pre, post $sp_post" - fi - if (($tp_pre != $tp_post)); then - error "version of target parent was changed: pre $tp_pre, post $tp_post" - fi + local sp_pre + local tp_pre + local sp_post + local tp_post + + do_node $CLIENT1 mcreate $DIR/$tfile + do_node $CLIENT1 $LFS mkdir -i 0 -c 1 $MOUNT/$tdir + sp_pre=$(chk_get_version $CLIENT1 $DIR) + tp_pre=$(chk_get_version $CLIENT1 $DIR/$tdir) + do_node $CLIENT1 mv $DIR/$tfile $DIR/$tdir/$tfile + sp_post=$(chk_get_version $CLIENT1 $DIR) + tp_post=$(chk_get_version $CLIENT1 $DIR/$tdir) + if (($sp_pre != $sp_post)); then + error "version of source parent was changed:" \ + "pre $sp_pre, post $sp_post" + fi + if (($tp_pre != $tp_post)); then + error "version of target parent was changed:" \ + "pre $tp_pre, post $tp_post" + fi } run_test 6a "rename doesn't change versions of source parent and target parent" test_6b() { # former test_0w - local pre - local post - - do_node $CLIENT1 mcreate $DIR/$tfile - pre=$(get_version $CLIENT1 $DIR) - do_node $CLIENT1 mv $DIR/$tfile $DIR/$tfile-new - post=$(get_version $CLIENT1 $DIR) - if (($pre != $post)); then - error "version of parent was changed: pre $pre, post $post" - fi + local pre + local post + + do_node $CLIENT1 mcreate $DIR/$tfile + pre=$(chk_get_version $CLIENT1 $DIR) + do_node $CLIENT1 mv $DIR/$tfile $DIR/$tfile-new + post=$(chk_get_version $CLIENT1 $DIR) + if (($pre != $post)); then + error "version of parent was changed: pre $pre, post $post" + fi } run_test 6b "rename within same dir doesn't change version of parent" @@ -657,7 +638,7 @@ test_6c() { # former test_0x 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 + do_node $CLIENT1 $LFS mkdir -i 0 -c 1 $MOUNT/$tdir replay_barrier $SINGLEMDS do_node $CLIENT2 chmod 777 $MOUNT2 @@ -680,7 +661,7 @@ test_6d() { # former test_0y 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 + do_node $CLIENT1 $LFS mkdir -i 0 -c 1 $MOUNT/$tdir replay_barrier $SINGLEMDS do_node $CLIENT2 chmod 777 $MOUNT2/$tdir @@ -711,7 +692,7 @@ test_7_cycle() { 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 + do_node $CLIENT1 $LFS mkdir -i 0 -c 1 $MOUNT/$tdir replay_barrier $SINGLEMDS # first operation echo "$cname first: $first" @@ -727,11 +708,11 @@ test_7_cycle() { # should fail as conflict expected client_evicted $CLIENT1 || rc=1 - wait_recovery_complete $SINGLEMDS - wait_mds_ost_sync $SINGLEMDS + wait_recovery_complete $SINGLEMDS + wait_mds_ost_sync || error "wait_mds_ost_sync failed" - rm -rf $DIR/$tdir - return $rc + rm -rf $DIR/$tdir + return $rc } test_7a() { @@ -874,20 +855,26 @@ test_7f() { run_test 7f "unlink, {lost}, rename" test_7g() { - first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1" - lost="mkdir $MOUNT2/$tdir/$tfile-0;rmdir $MOUNT2/$tdir/$tfile-0" - last="createmany -o $DIR/$tdir/$tfile- 1" - test_7_cycle "$first" "$lost" "$last" && error "Test 7g.1 failed" - - first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1" - lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0" - last="mkdir $DIR/$tdir/$tfile-0" - test_7_cycle "$first" "$lost" "$last" && error "Test 7g.2 failed" - - first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile" - lost="createmany -o $MOUNT2/$tdir/$tfile- 1" - last="link $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1" - test_7_cycle "$first" "$lost" "$last" || error "Test 7g.3 failed" + first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1" + lost="mkdir $MOUNT2/$tdir/$tfile-0;rmdir $MOUNT2/$tdir/$tfile-0" + last="createmany -o $DIR/$tdir/$tfile- 1" + test_7_cycle "$first" "$lost" "$last" && error "Test 7g.1 failed" + + first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1" + lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0" + last="mkdir $DIR/$tdir/$tfile-0" + test_7_cycle "$first" "$lost" "$last" && error "Test 7g.2 failed" + + first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile" + lost="createmany -o $MOUNT2/$tdir/$tfile- 1" + last="link $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1" + if [ "$MDS1_VERSION" -lt $(version_code 2.5.1) ]; then + test_7_cycle "$first" "$lost" "$last" || + error "Test 7g.3 failed" + else #LU-4442 LU-3528 + test_7_cycle "$first" "$lost" "$last" && + error "Test 7g.3 failed" + fi return 0 } run_test 7g "rename, {lost}, create" @@ -1018,74 +1005,75 @@ run_test 8c "create | unlink, create shouldn't fail" # Lustre Client 3: $CLIENT2:$MOUNT1 ($DIR1) # test_10b() { # former test_2b - local pre - local post - local var=${SINGLEMDS}_svc - - [ -n "$CLIENTS" ] || { skip "Need two or more clients" && exit 0; } - [ $CLIENTCOUNT -ge 2 ] || \ - { 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. - # - do_node $CLIENT1 touch $DIR1/$tfile - pre=$(get_version $CLIENT1 $DIR/$tfile) - - # - # Comments on the replay sequence state the expected result - # of each request. - # - # "R" Replayed. - # "U" Unable to replay. - # "J" Rejected. - # - replay_barrier $SINGLEMDS - do_node $CLIENT1 chmod 666 $DIR/$tfile-a # R - do_node $CLIENT2 chmod 666 $DIR1/$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 - - client_evicted $CLIENT1 || error "$CLIENT1:$MOUNT not evicted" - client_up $CLIENT2 || error "$CLIENT2:$MOUNT1 evicted" - - # - # Check the MDT epoch. $post must be the first transaction - # number assigned after recovery. - # - 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 + local pre + local post + local var=${SINGLEMDS}_svc + + [ -n "$CLIENTS" ] || { skip "Need two or more clients" && exit 0; } + [ $CLIENTCOUNT -ge 2 ] || \ + { 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. + # + do_node $CLIENT1 touch $DIR1/$tfile + pre=$(chk_get_version $CLIENT1 $DIR/$tfile) + + # + # Comments on the replay sequence state the expected result + # of each request. + # + # "R" Replayed. + # "U" Unable to replay. + # "J" Rejected. + # + replay_barrier $SINGLEMDS + do_node $CLIENT1 chmod 666 $DIR/$tfile-a # R + do_node $CLIENT2 chmod 666 $DIR1/$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 + + client_evicted $CLIENT1 || error "$CLIENT1:$MOUNT not evicted" + client_up $CLIENT2 || error "$CLIENT2:$MOUNT1 evicted" + + # + # Check the MDT epoch. $post must be the first transaction + # number assigned after recovery. + # + do_node $CLIENT2 chmod 666 $DIR1/$tfile + post=$(chk_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 + if (($(($post & 0x00000000ffffffff)) != 1)); then + error "transno should restart from one: got $post" + fi - do_node $CLIENT2 stat $DIR1/$tfile-a - do_node $CLIENT2 stat $DIR1/$tfile-b + do_node $CLIENT2 stat $DIR1/$tfile-a + do_node $CLIENT2 stat $DIR1/$tfile-b - 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_GID \ - $DIR1/$tfile-b || error "$DIR/$tfile-b: unexpected state" + 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_GID \ + $DIR1/$tfile-b || error "$DIR/$tfile-b: unexpected state" - zconf_umount $CLIENT2 $MOUNT1 + zconf_umount $CLIENT2 $MOUNT1 } run_test 10b "3 clients: some, none, and all reqs replayed" @@ -1170,6 +1158,48 @@ test_12a() { # former test_2a } run_test 12a "lost data due to missed REMOTE client during replay" +test_13() { # LU-8826 + local var=${SINGLEMDS}_svc + + if combined_mgs_mds ; then + skip "Needs separate MGS to enable IR" + return 0 + fi + + 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 $CLIENT2 $MOUNT2 + do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile + + # set ir_timeout to a reasonable small value + local ir_timeout=$(do_facet mgs $LCTL get_param -n mgs.*.ir_timeout) + do_facet mgs $LCTL set_param mgs.*.ir_timeout=5 + # make sure IR functional + sleep 5 + + replay_barrier $SINGLEMDS + do_node $CLIENT1 chmod 666 $DIR/$tfile + do_node $CLIENT2 chmod 777 $DIR2/$tfile + + # make sure client data of $CLIENT2:$MOUNT2 is remained + # define OBD_FAIL_TGT_CLIENT_DEL 0x718 + do_facet $SINGLEMDS $LCTL set_param fail_loc=0x718 + zconf_umount $CLIENT2 $MOUNT2 + # define OBD_FAIL_TGT_SLUGGISH_NET 0x719 + do_facet $SINGLEMDS $LCTL set_param fail_loc=0x719 + facet_failover $SINGLEMDS + + client_up $CLIENT1 || error "$CLIENT1 evicted" + + do_facet $SINGLEMDS $LCTL set_param fail_loc=0 + do_facet mgs $LCTL set_param mgs.*.ir_timeout=$ir_timeout + + do_node $CLIENT1 $CHECKSTAT -p 0666 $DIR/$tfile || + error "$DIR/$tfile-a: unexpected state" +} +run_test 13 "Shouldn't give up VBR easily on sluggish network" + #restore COS setting restore_lustre_params < $cos_param_file rm -f $cos_param_file