2 # -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*-
3 # vim:shiftwidth=4:softtabstop=4:tabstop=4:
8 ALWAYS_EXCEPT="12a $REPLAY_VBR_EXCEPT"
11 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
14 MOUNT_2=${MOUNT_2:-"yes"}
15 export MULTIOP=${MULTIOP:-multiop}
16 . $LUSTRE/tests/test-framework.sh
18 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
21 remote_mds_nodsh && log "SKIP: remote MDS with nodsh" && exit 0
23 [ "$SLOW" = "no" ] && EXCEPT_SLOW="7"
27 check_and_setup_lustre
30 rm -rf $DIR/[df][0-9]*
32 [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
34 # if there is no CLIENT1 defined, some tests can be ran on localhost
35 CLIENT1=${CLIENT1:-$HOSTNAME}
36 # if CLIENT2 doesn't exist then use CLIENT1 instead
37 # All tests should use CLIENT2 with MOUNT2 only therefore it will work if
39 # Exception is the test which need two separate nodes
40 CLIENT2=${CLIENT2:-$CLIENT1}
42 is_mounted $MOUNT2 || error "MOUNT2 is not mounted"
49 # We need to run do_node in bg, because pdsh does not exit
50 # if child process of run script exists.
51 # I.e. pdsh does not exit when runmultiop_bg_pause exited,
52 # because of multiop_bg_pause -> $MULTIOP_PROG &
53 # By the same reason we need sleep a bit after do_nodes starts
54 # to let runmultiop_bg_pause start muliop and
55 # update /tmp/multiop_bg.pid ;
56 # The rm /tmp/multiop_bg.pid guarantees here that
57 # we have the updated by runmultiop_bg_pause
58 # /tmp/multiop_bg.pid file
60 local pid_file=$TMP/multiop_bg.pid.$$
61 do_node $client "MULTIOP_PID_FILE=$pid_file LUSTRE= runmultiop_bg_pause $file $cmds" &
65 multiop_pid=$(do_node $client cat $pid_file)
66 [ -n "$multiop_pid" ] || error "$client : Can not get multiop_pid from $pid_file "
67 eval export $(node_var_name $client)_multiop_pid=$multiop_pid
68 eval export $(node_var_name $client)_do_node_pid=$pid
69 local var=$(node_var_name $client)_multiop_pid
70 echo client $client multiop_bg started multiop_pid=${!var}
76 local multiop_pid=$(node_var_name $client)_multiop_pid
77 local do_node_pid=$(node_var_name $client)_do_node_pid
79 echo "Stopping multiop_pid=${!multiop_pid} (kill ${!multiop_pid} on $client)"
80 do_node $client kill -USR1 ${!multiop_pid}
86 local var=${SINGLEMDS}_svc
91 fid=$(do_node $client $LFS path2fid $file)
92 do_facet $SINGLEMDS $LCTL --device ${!var} getobjversion \\\"$fid\\\"
96 cos_param_file=$TMP/rvbr-cos-params
97 save_lustre_params $(comma_list $(mdts_nodes)) "mdt.*.commit_on_sharing" > $cos_param_file
100 get_version $CLIENT1 $DIR/$tdir/1a || true
102 run_test 0a "getversion for non existent file shouldn't cause kernel panic"
105 local var=${SINGLEMDS}_svc
107 local file=$DIR/$tdir/f
109 do_node $CLIENT1 mkdir -p $DIR/$tdir/
110 do_node $CLIENT1 touch $file
111 fid=$(do_node $CLIENT1 $LFS path2fid $file)
112 do_node $CLIENT1 rm -rf $file
113 do_facet $SINGLEMDS $LCTL --device ${!var} getobjversion \\\"$fid\\\" || true
115 run_test 0b "getversion for non existent fid shouldn't cause kernel panic"
118 test_1a() { # former test_0a
119 local file=$DIR/$tfile
123 do_node $CLIENT1 mcreate $file
124 pre=$(get_version $CLIENT1 $file)
125 do_node $CLIENT1 openfile -f O_RDWR $file
126 post=$(get_version $CLIENT1 $file)
127 if (($pre != $post)); then
128 error "version changed unexpectedly: pre $pre, post $post"
131 run_test 1a "open and close do not change versions"
133 test_1b() { # former test_0b
134 local var=${SINGLEMDS}_svc
135 zconf_mount $CLIENT2 $MOUNT2
137 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
138 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
139 do_node $CLIENT1 mkdir -p -m 755 $MOUNT/$tdir
141 replay_barrier $SINGLEMDS
142 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
143 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT $MOUNT/$tdir/$tfile
144 zconf_umount $CLIENT2 $MOUNT2
145 facet_failover $SINGLEMDS
147 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
148 if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
149 error_and_remount "open succeeded unexpectedly"
152 run_test 1b "open (O_CREAT) checks version of parent"
154 test_1c() { # former test_0c
155 local var=${SINGLEMDS}_svc
156 zconf_mount $CLIENT2 $MOUNT2
158 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
159 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
161 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
162 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tdir/$tfile
164 replay_barrier $SINGLEMDS
165 do_node $CLIENT2 chmod 0777 $MOUNT2/$tdir
166 do_node $CLIENT2 chmod 0666 $MOUNT2/$tdir/$tfile
167 rmultiop_start $CLIENT1 $DIR/$tdir/$tfile o_c
168 zconf_umount $CLIENT2 $MOUNT2
169 facet_failover $SINGLEMDS
171 client_up $CLIENT1 || error "$CLIENT1 evicted"
172 rmultiop_stop $CLIENT1 || error "close failed"
174 run_test 1c "open (non O_CREAT) does not checks versions"
176 # test set #2: CREAT (not open)
177 # - version of parent is not changed but checked
178 # - pre-version should be -1
179 # - post-version should be valid
180 test_2a() { # extended former test_0d
185 pre=$(get_version $CLIENT1 $DIR)
186 do_node $CLIENT1 mkfifo $DIR/$tfile-fifo
187 post=$(get_version $CLIENT1 $DIR)
188 if (($pre != $post)); then
189 error "version was changed: pre $pre, post $post"
192 pre=$(get_version $CLIENT1 $DIR)
193 do_node $CLIENT1 mkdir $DIR/$tfile-dir
194 post=$(get_version $CLIENT1 $DIR)
195 if (($pre != $post)); then
196 error "version was changed: pre $pre, post $post"
198 do_node $CLIENT1 rmdir $DIR/$tfile-dir
201 pre=$(get_version $CLIENT1 $DIR)
202 do_node $CLIENT1 mkfifo $DIR/$tfile-nod
203 post=$(get_version $CLIENT1 $DIR)
204 if (($pre != $post)); then
205 error "version was changed: pre $pre, post $post"
208 pre=$(get_version $CLIENT1 $DIR)
209 do_node $CLIENT1 mkfifo $DIR/$tfile-symlink
210 post=$(get_version $CLIENT1 $DIR)
211 if (($pre != $post)); then
212 error "version was changed: pre $pre, post $post"
214 do_node $CLIENT1 rm $DIR/$tfile-*
217 run_test 2a "create operations doesn't change version of parent"
219 test_2b() { # former test_0e
220 local var=${SINGLEMDS}_svc
221 zconf_mount $CLIENT2 $MOUNT2
223 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
224 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
226 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
228 replay_barrier $SINGLEMDS
229 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
230 do_node $CLIENT1 mkfifo $DIR/$tdir/$tfile
231 zconf_umount $CLIENT2 $MOUNT2
232 facet_failover $SINGLEMDS
234 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
235 if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
236 error_and_remount "create succeeded unexpectedly"
239 run_test 2b "create checks version of parent"
241 test_3a() { # former test_0f
245 do_node $CLIENT1 mcreate $DIR/$tfile
246 pre=$(get_version $CLIENT1 $DIR)
247 do_node $CLIENT1 rm $DIR/$tfile
248 post=$(get_version $CLIENT1 $DIR)
249 if (($pre != $post)); then
250 error "version was changed: pre $pre, post $post"
253 run_test 3a "unlink doesn't change version of parent"
255 test_3b() { # former test_0g
256 local var=${SINGLEMDS}_svc
257 zconf_mount $CLIENT2 $MOUNT2
259 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
260 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
262 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
263 do_node $CLIENT1 mcreate $DIR/$tdir/$tfile
265 replay_barrier $SINGLEMDS
266 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
267 do_node $CLIENT1 rm $DIR/$tdir/$tfile
268 zconf_umount $CLIENT2 $MOUNT2
269 facet_failover $SINGLEMDS
271 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
272 if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
273 error_and_remount "unlink succeeded unexpectedly"
276 run_test 3b "unlink checks version of parent"
278 test_4a() { # former test_0h
279 local file=$DIR/$tfile
283 do_node $CLIENT1 mcreate $file
284 pre=$(get_version $CLIENT1 $file)
285 do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $file
286 post=$(get_version $CLIENT1 $file)
287 if (($pre == $post)); then
288 error "version not changed: pre $pre, post $post"
291 run_test 4a "setattr of UID changes versions"
293 test_4b() { # former test_0i
294 local file=$DIR/$tfile
298 do_node $CLIENT1 mcreate $file
299 pre=$(get_version $CLIENT1 $file)
300 do_node $CLIENT1 chgrp $RUNAS_GID $file
301 post=$(get_version $CLIENT1 $file)
302 if (($pre == $post)); then
303 error "version not changed: pre $pre, post $post"
306 run_test 4b "setattr of GID changes versions"
308 test_4c() { # former test_0j
309 local file=$DIR/$tfile
310 local var=${SINGLEMDS}_svc
311 zconf_mount $CLIENT2 $MOUNT2
313 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
314 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
316 do_node $CLIENT1 mcreate $file
318 replay_barrier $SINGLEMDS
319 do_node $CLIENT2 chgrp $RUNAS_GID $MOUNT2/$tfile
320 do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $file
321 zconf_umount $CLIENT2 $MOUNT2
322 facet_failover $SINGLEMDS
324 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
325 if ! do_node $CLIENT1 $CHECKSTAT -u \\\#$UID $file; then
326 error_and_remount "setattr of UID succeeded unexpectedly"
329 run_test 4c "setattr of UID checks versions"
331 test_4d() { # former test_0k
332 local file=$DIR/$tfile
333 local var=${SINGLEMDS}_svc
334 zconf_mount $CLIENT2 $MOUNT2
336 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
337 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
339 do_node $CLIENT1 mcreate $file
341 replay_barrier $SINGLEMDS
342 do_node $CLIENT2 chown $RUNAS_ID:$RUNAS_GID $MOUNT2/$tfile
343 do_node $CLIENT1 chgrp $RUNAS_GID $file
344 zconf_umount $CLIENT2 $MOUNT2
345 facet_failover $SINGLEMDS
347 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
348 if ! do_node $CLIENT1 $CHECKSTAT -g \\\#$UID $file; then
349 error_and_remount "setattr of GID succeeded unexpectedly"
352 run_test 4d "setattr of GID checks versions"
354 test_4e() { # former test_0l
355 local file=$DIR/$tfile
359 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
360 pre=$(get_version $CLIENT1 $file)
361 do_node $CLIENT1 chmod 666 $file
362 post=$(get_version $CLIENT1 $file)
363 if (($pre == $post)); then
364 error "version not changed: pre $pre, post $post"
367 run_test 4e "setattr of permission changes versions"
369 test_4f() { # former test_0m
370 local file=$DIR/$tfile
371 local var=${SINGLEMDS}_svc
372 zconf_mount $CLIENT2 $MOUNT2
374 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
375 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
377 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
379 replay_barrier $SINGLEMDS
380 do_node $CLIENT2 chgrp $RUNAS_GID $MOUNT2/$tfile
381 do_node $CLIENT1 chmod 666 $file
382 zconf_umount $CLIENT2 $MOUNT2
383 facet_failover $SINGLEMDS
385 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
386 if ! do_node $CLIENT1 $CHECKSTAT -p 0644 $file; then
387 error_and_remount "setattr of permission succeeded unexpectedly"
390 run_test 4f "setattr of permission checks versions"
392 test_4g() { # former test_0n
393 local file=$DIR/$tfile
397 do_node $CLIENT1 mcreate $file
398 pre=$(get_version $CLIENT1 $file)
399 do_node $CLIENT1 chattr +i $file
400 post=$(get_version $CLIENT1 $file)
401 do_node $CLIENT1 chattr -i $file
402 if (($pre == $post)); then
403 error "version not changed: pre $pre, post $post"
406 run_test 4g "setattr of flags changes versions"
414 if ((${#attr} != 1)); then
415 error "checking multiple attributes not implemented yet"
417 do_node $client lsattr $file | cut -d ' ' -f 1 | grep -q $attr
420 test_4h() { # former test_0o
421 local file=$DIR/$tfile
423 local var=${SINGLEMDS}_svc
424 zconf_mount $CLIENT2 $MOUNT2
426 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
427 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
429 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
431 replay_barrier $SINGLEMDS
432 do_node $CLIENT2 chmod 666 $MOUNT2/$tfile
433 do_node $CLIENT1 chattr +i $file
434 zconf_umount $CLIENT2 $MOUNT2
435 facet_failover $SINGLEMDS
437 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
438 checkattr $CLIENT1 i $file
440 do_node $CLIENT1 chattr -i $file
441 if [ $rc -eq 0 ]; then
442 error "setattr of flags succeeded unexpectedly"
445 run_test 4h "setattr of flags checks versions"
447 test_4i() { # former test_0p
448 local file=$DIR/$tfile
452 local var=${SINGLEMDS}_svc
454 ad_orig=$(do_facet $SINGLEMDS "$LCTL get_param mdd.${!var}.atime_diff")
455 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.atime_diff=0"
456 do_node $CLIENT1 mcreate $file
457 pre=$(get_version $CLIENT1 $file)
458 do_node $CLIENT1 touch $file
459 post=$(get_version $CLIENT1 $file)
461 # We don't fail MDS in this test. atime_diff shall be
462 # restored to its original value.
464 do_facet $SINGLEMDS "$LCTL set_param $ad_orig"
465 if (($pre != $post)); then
466 error "version changed unexpectedly: pre $pre, post $post"
469 run_test 4i "setattr of times does not change versions"
471 test_4j() { # former test_0q
472 local file=$DIR/$tfile
476 do_node $CLIENT1 mcreate $file
477 pre=$(get_version $CLIENT1 $file)
478 do_node $CLIENT1 $TRUNCATE $file 1
479 post=$(get_version $CLIENT1 $file)
480 if (($pre != $post)); then
481 error "version changed unexpectedly: pre $pre, post $post"
484 run_test 4j "setattr of size does not change versions"
486 test_4k() { # former test_0r
487 local file=$DIR/$tfile
491 local var=${SINGLEMDS}_svc
492 zconf_mount $CLIENT2 $MOUNT2
494 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
495 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.atime_diff=0"
496 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
498 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
500 replay_barrier $SINGLEMDS
501 do_node $CLIENT2 chmod 666 $MOUNT2/$tfile
502 do_node $CLIENT1 $TRUNCATE $file 1
504 mtime_pre=$(do_node $CLIENT1 stat --format=%Y $file)
505 do_node $CLIENT1 touch $file
506 sleep 1 # avoid stat caching
507 mtime_post=$(do_node $CLIENT1 stat --format=%Y $file)
508 zconf_umount $CLIENT2 $MOUNT2
509 facet_failover $SINGLEMDS
511 client_up $CLIENT1 || error "$CLIENT1 evicted"
512 if (($mtime_pre >= $mtime_post)); then
513 error "time not changed: pre $mtime_pre, post $mtime_post"
515 if ! do_node $CLIENT1 $CHECKSTAT -s 1 $file; then
516 error_and_remount "setattr of size failed"
518 mtime=$(do_node $CLIENT1 stat --format=%Y $file)
519 if (($mtime != $mtime_post)); then
520 error "setattr of times failed: expected $mtime_post, got $mtime"
523 run_test 4k "setattr of times and size does not check versions"
525 test_5a() { # former test_0s
531 do_node $CLIENT1 mcreate $DIR/$tfile
532 do_node $CLIENT1 mkdir -p $DIR/$tdir
533 pre=$(get_version $CLIENT1 $DIR/$tfile)
534 tp_pre=$(get_version $CLIENT1 $DIR/$tdir)
535 do_node $CLIENT1 link $DIR/$tfile $DIR/$tdir/$tfile
536 post=$(get_version $CLIENT1 $DIR/$tfile)
537 tp_post=$(get_version $CLIENT1 $DIR/$tdir)
538 if (($pre == $post)); then
539 error "version of source not changed: pre $pre, post $post"
541 if (($tp_pre != $tp_post)); then
542 error "version of target parent was changed: pre $tp_pre, post $tp_post"
545 run_test 5a "link changes versions of source but not target parent"
547 test_5b() { # former test_0t
548 local var=${SINGLEMDS}_svc
549 zconf_mount $CLIENT2 $MOUNT2
551 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
552 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
554 do_node $CLIENT1 mcreate $DIR/$tfile
555 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
557 replay_barrier $SINGLEMDS
558 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
559 do_node $CLIENT1 link $DIR/$tfile $DIR/$tdir/$tfile
560 zconf_umount $CLIENT2 $MOUNT2
561 facet_failover $SINGLEMDS
563 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
564 if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
565 error_and_remount "link should fail"
568 run_test 5b "link checks version of target parent"
570 test_5c() { # former test_0u
571 local var=${SINGLEMDS}_svc
572 zconf_mount $CLIENT2 $MOUNT2
574 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
575 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
577 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile
578 do_node $CLIENT1 mkdir -p $DIR/$tdir
580 replay_barrier $SINGLEMDS
581 do_node $CLIENT2 chmod 666 $MOUNT2/$tfile
582 do_node $CLIENT1 link $DIR/$tfile $DIR/$tdir/$tfile
583 zconf_umount $CLIENT2 $MOUNT2
584 facet_failover $SINGLEMDS
586 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
587 if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
588 error_and_remount "link should fail"
591 run_test 5c "link checks version of source"
593 test_6a() { # former test_0v
599 do_node $CLIENT1 mcreate $DIR/$tfile
600 do_node $CLIENT1 mkdir -p $DIR/$tdir
601 sp_pre=$(get_version $CLIENT1 $DIR)
602 tp_pre=$(get_version $CLIENT1 $DIR/$tdir)
603 do_node $CLIENT1 mv $DIR/$tfile $DIR/$tdir/$tfile
604 sp_post=$(get_version $CLIENT1 $DIR)
605 tp_post=$(get_version $CLIENT1 $DIR/$tdir)
606 if (($sp_pre != $sp_post)); then
607 error "version of source parent was changed: pre $sp_pre, post $sp_post"
609 if (($tp_pre != $tp_post)); then
610 error "version of target parent was changed: pre $tp_pre, post $tp_post"
613 run_test 6a "rename doesn't change versions of source parent and target parent"
615 test_6b() { # former test_0w
619 do_node $CLIENT1 mcreate $DIR/$tfile
620 pre=$(get_version $CLIENT1 $DIR)
621 do_node $CLIENT1 mv $DIR/$tfile $DIR/$tfile-new
622 post=$(get_version $CLIENT1 $DIR)
623 if (($pre != $post)); then
624 error "version of parent was changed: pre $pre, post $post"
627 run_test 6b "rename within same dir doesn't change version of parent"
629 test_6c() { # former test_0x
630 local var=${SINGLEMDS}_svc
631 zconf_mount $CLIENT2 $MOUNT2
633 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
634 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
636 do_node $CLIENT1 mcreate $DIR/$tfile
637 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
639 replay_barrier $SINGLEMDS
640 do_node $CLIENT2 chmod 777 $MOUNT2
641 do_node $CLIENT1 mv $DIR/$tfile $DIR/$tdir/$tfile
642 zconf_umount $CLIENT2 $MOUNT2
643 facet_failover $SINGLEMDS
645 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
646 if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tfile; then
647 error_and_remount "rename should fail"
650 run_test 6c "rename checks version of source parent"
652 test_6d() { # former test_0y
653 local var=${SINGLEMDS}_svc
654 zconf_mount $CLIENT2 $MOUNT2
656 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
657 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
659 do_node $CLIENT1 mcreate $DIR/$tfile
660 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
662 replay_barrier $SINGLEMDS
663 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
664 do_node $CLIENT1 mv $DIR/$tfile $DIR/$tdir/$tfile
665 zconf_umount $CLIENT2 $MOUNT2
666 facet_failover $SINGLEMDS
668 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
669 if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tfile; then
670 error_and_remount "rename should fail"
673 run_test 6d "rename checks version of target parent"
675 # pdirops tests, bug 18143
682 local var=${SINGLEMDS}_svc
683 zconf_mount $CLIENT2 $MOUNT2
685 local cname=$TESTNAME.$cycle
687 echo "start cycle: $cname"
688 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
689 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
691 do_node $CLIENT1 mkdir -p $DIR/$tdir
692 replay_barrier $SINGLEMDS
694 echo "$cname first: $first"
695 do_node $CLIENT1 $first || error "$cname: Cannot do first operation"
696 # client2 operations that will be lost
697 echo "$cname lost: $lost"
698 do_node $CLIENT2 $lost || error "$cname: Cannot do 'lost' operations"
700 echo "$cname last: $last"
701 do_node $CLIENT1 $last || error "$cname: Cannot do last operation"
702 zconf_umount $CLIENT2 $MOUNT2
703 facet_failover $SINGLEMDS
704 # should fail as conflict expected
705 client_evicted $CLIENT1 || rc=1
707 wait_recovery_complete $SINGLEMDS
708 wait_mds_ost_sync $SINGLEMDS
715 first="createmany -o $DIR/$tdir/$tfile- 1"
716 lost="rm $MOUNT2/$tdir/$tfile-0"
717 last="createmany -o $DIR/$tdir/$tfile- 1"
718 test_7_cycle "$first" "$lost" "$last" || error "Test 7a.1 failed"
720 first="createmany -o $DIR/$tdir/$tfile- 1"
721 lost="rm $MOUNT2/$tdir/$tfile-0"
722 last="mkdir $DIR/$tdir/$tfile-0"
723 test_7_cycle "$first" "$lost" "$last" || error "Test 7a.2 failed"
725 first="mkdir $DIR/$tdir/$tfile-0"
726 lost="mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile-1"
727 last="createmany -o $DIR/$tdir/$tfile- 1"
728 test_7_cycle "$first" "$lost" "$last" || error "Test 7a.3 failed"
731 run_test 7a "create, {lost}, create"
734 first="createmany -o $DIR/$tdir/$tfile- 1"
735 lost="rm $MOUNT2/$tdir/$tfile-0; createmany -o $MOUNT2/$tdir/$tfile- 1"
736 last="rm $DIR/$tdir/$tfile-0"
737 test_7_cycle "$first" "$lost" "$last" || error "Test 7b.1 failed"
739 first="createmany -o $DIR/$tdir/$tfile- 1"
740 lost="touch $MOUNT2/$tdir/$tfile; mv $MOUNT2/$tdir/$tfile $MOUNT2/$tdir/$tfile-0"
741 last="rm $DIR/$tdir/$tfile-0"
742 test_7_cycle "$first" "$lost" "$last" || error "Test 7b.2 failed"
744 first="createmany -o $DIR/$tdir/$tfile- 1"
745 lost="rm $MOUNT2/$tdir/$tfile-0; mkdir $MOUNT2/$tdir/$tfile-0"
746 last="rmdir $DIR/$tdir/$tfile-0"
747 test_7_cycle "$first" "$lost" "$last" || error "Test 7b.3 failed"
750 run_test 7b "create, {lost}, unlink"
753 first="createmany -o $DIR/$tdir/$tfile- 1"
754 lost="rm $MOUNT2/$tdir/$tfile-0; createmany -o $MOUNT2/$tdir/$tfile- 1"
755 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
756 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.1 failed"
758 first="createmany -o $DIR/$tdir/$tfile- 2"
759 lost="rm $MOUNT2/$tdir/$tfile-0; mkdir $MOUNT2/$tdir/$tfile-0"
760 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
761 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.2 failed"
763 first="createmany -o $DIR/$tdir/$tfile- 1; mkdir $DIR/$tdir/$tfile-1-0"
764 lost="rmdir $MOUNT2/$tdir/$tfile-1-0; createmany -o $MOUNT2/$tdir/$tfile-1- 1"
765 last="mv $DIR/$tdir/$tfile-1-0 $DIR/$tdir/$tfile-0"
766 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.3 failed"
768 first="createmany -o $DIR/$tdir/$tfile- 1"
769 lost="mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile"
770 last="mv $DIR/$tdir/$tfile $DIR/$tdir/$tfile-0"
771 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.4 failed"
774 run_test 7c "create, {lost}, rename"
777 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
778 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0"
779 last="createmany -o $DIR/$tdir/$tfile- 1"
780 test_7_cycle "$first" "$lost" "$last" && error "Test 7d.1 failed"
782 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
783 lost="mkdir $MOUNT2/$tdir/$tfile-0; rmdir $MOUNT2/$tdir/$tfile-0"
784 last="mkdir $DIR/$tdir/$tfile-0"
785 test_7_cycle "$first" "$lost" "$last" && error "Test 7d.2 failed"
787 first="mkdir $DIR/$tdir/$tfile-0; rmdir $DIR/$tdir/$tfile-0"
788 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile-1"
789 last="createmany -o $DIR/$tdir/$tfile- 1"
790 test_7_cycle "$first" "$lost" "$last" && error "Test 7d.3 failed"
793 run_test 7d "unlink, {lost}, create"
796 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
797 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0;createmany -o $MOUNT2/$tdir/$tfile- 1"
798 last="rm $DIR/$tdir/$tfile-0"
799 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.1 failed"
801 first="mkdir $DIR/$tdir/$tfile-0; rmdir $DIR/$tdir/$tfile-0"
802 lost="mkdir $MOUNT2/$tdir/$tfile-0; rmdir $MOUNT2/$tdir/$tfile-0; mkdir $MOUNT2/$tdir/$tfile-0"
803 last="rmdir $DIR/$tdir/$tfile-0"
804 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.2 failed"
806 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
807 lost="mkdir $MOUNT2/$tdir/$tfile-0"
808 last="rmdir $DIR/$tdir/$tfile-0"
809 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.3 failed"
811 first="mkdir $DIR/$tdir/$tfile-0; rmdir $DIR/$tdir/$tfile-0"
812 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
813 last="rm $DIR/$tdir/$tfile-0"
814 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.4 failed"
816 first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
817 lost="mv $MOUNT2/$tdir/$tfile-1 $MOUNT2/$tdir/$tfile-0"
818 last="rm $DIR/$tdir/$tfile-0"
819 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.5 failed"
822 run_test 7e "unlink, {lost}, unlink"
825 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
826 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
827 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
828 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.1 failed"
830 first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
831 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
832 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
833 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.2 failed"
835 first="mkdir $DIR/$tdir/$tfile; createmany -o $DIR/$tdir/$tfile- 1; rmdir $DIR/$tdir/$tfile"
836 lost="mkdir $MOUNT2/$tdir/$tfile"
837 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
838 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.3 failed"
840 first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
841 lost="mv $MOUNT2/$tdir/$tfile-1 $MOUNT2/$tdir/$tfile-0"
842 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
843 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.4 failed"
845 first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
846 lost="mkdir $MOUNT2/$tdir/$tfile-0"
847 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
848 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.5 failed"
851 run_test 7f "unlink, {lost}, rename"
854 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
855 lost="mkdir $MOUNT2/$tdir/$tfile-0;rmdir $MOUNT2/$tdir/$tfile-0"
856 last="createmany -o $DIR/$tdir/$tfile- 1"
857 test_7_cycle "$first" "$lost" "$last" && error "Test 7g.1 failed"
859 first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
860 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0"
861 last="mkdir $DIR/$tdir/$tfile-0"
862 test_7_cycle "$first" "$lost" "$last" && error "Test 7g.2 failed"
864 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
865 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
866 last="link $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
867 test_7_cycle "$first" "$lost" "$last" || error "Test 7g.3 failed"
870 run_test 7g "rename, {lost}, create"
873 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
874 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
875 last="rm $DIR/$tdir/$tfile-0"
876 test_7_cycle "$first" "$lost" "$last" || error "Test 7h.1 failed"
878 first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
879 lost="rm $MOUNT2/$tdir/$tfile-0; createmany -o $MOUNT2/$tdir/$tfile- 1"
880 last="rm $DIR/$tdir/$tfile-0"
881 test_7_cycle "$first" "$lost" "$last" || error "Test 7h.2 failed"
883 first="createmany -o $DIR/$tdir/$tfile- 1; mkdir $DIR/$tdir/$tfile; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
884 lost="rm $MOUNT2/$tdir/$tfile/$tfile-0"
885 last="rmdir $DIR/$tdir/$tfile"
886 #test_7_cycle "$first" "$lost" "$last" || error "Test 7h.3 failed"
889 run_test 7h "rename, {lost}, unlink"
892 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
893 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
894 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
895 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.1 failed"
897 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
898 lost="mkdir $MOUNT2/$tdir/$tfile-0"
899 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
900 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.1 failed"
902 first="createmany -o $DIR/$tdir/$tfile- 3; mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
903 lost="mv $MOUNT2/$tdir/$tfile-2 $MOUNT2/$tdir/$tfile-0"
904 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-2"
905 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.3 failed"
907 first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
908 lost="rm $MOUNT2/$tdir/$tfile-1"
909 last="mv $DIR/$tdir/$tfile $DIR/$tdir/$tfile-1"
910 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.4 failed"
913 run_test 7i "rename, {lost}, rename"
915 # test set #8: orphan handling bug 15392.
916 # Unlink during recovery creates orphan always just in case some late open may
917 # arrive. These orphans will be removed after recovery anyway.
918 # Tests check that valid create,unlink,create sequence will work in this case
919 # too but not fail on second create due to orphan found.
922 local var=${SINGLEMDS}_svc
923 zconf_mount $CLIENT2 $MOUNT2
925 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
927 do_node $CLIENT1 mcreate $DIR/$tfile
928 do_node $CLIENT1 mkdir $DIR/$tfile-2
929 replay_barrier $SINGLEMDS
930 # missed replay from client2 will lead to recovery by versions
931 do_node $CLIENT2 touch $MOUNT2/$tfile-2/$tfile
932 do_node $CLIENT1 rm $DIR/$tfile || return 1
933 do_node $CLIENT1 touch $DIR/$tfile || return 2
935 zconf_umount $CLIENT2 $MOUNT2
936 facet_failover $SINGLEMDS
937 client_up $CLIENT1 || return 6
939 do_node $CLIENT1 rm $DIR/$tfile || error "$tfile doesn't exists"
942 run_test 8a "create | unlink, create shouldn't fail"
945 local var=${SINGLEMDS}_svc
946 zconf_mount $CLIENT2 $MOUNT2
948 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
950 do_node $CLIENT1 touch $DIR/$tfile
951 do_node $CLIENT1 mkdir $DIR/$tfile-2
952 replay_barrier $SINGLEMDS
953 # missed replay from client2 will lead to recovery by versions
954 do_node $CLIENT2 touch $MOUNT2/$tfile-2/$tfile
955 do_node $CLIENT1 rm -f $MOUNT1/$tfile || return 1
956 do_node $CLIENT1 mcreate $MOUNT1/$tfile || return 2
958 zconf_umount $CLIENT2 $MOUNT2
959 facet_failover $SINGLEMDS
960 client_up $CLIENT1 || return 6
962 do_node $CLIENT1 rm $MOUNT1/$tfile || error "$tfile doesn't exists"
965 run_test 8b "create | unlink, create shouldn't fail"
968 local var=${SINGLEMDS}_svc
969 zconf_mount $CLIENT2 $MOUNT2
971 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
973 do_node $CLIENT1 touch $DIR/$tfile
974 do_node $CLIENT1 mkdir $DIR/$tfile-2
975 replay_barrier $SINGLEMDS
976 # missed replay from client2 will lead to recovery by versions
977 do_node $CLIENT2 touch $MOUNT2/$tfile-2/$tfile
978 do_node $CLIENT1 rm -f $MOUNT1/$tfile || return 1
979 do_node $CLIENT1 mkdir $MOUNT1/$tfile || return 2
981 zconf_umount $CLIENT2 $MOUNT2
982 facet_failover $SINGLEMDS
983 client_up $CLIENT1 || return 6
985 do_node $CLIENT1 rmdir $MOUNT1/$tfile || error "$tfile doesn't exists"
988 run_test 8c "create | unlink, create shouldn't fail"
991 # This test uses three Lustre clients on two hosts.
993 # Lustre Client 1: $CLIENT1:$MOUNT ($DIR)
994 # Lustre Client 2: $CLIENT2:$MOUNT2 ($DIR2)
995 # Lustre Client 3: $CLIENT2:$MOUNT1 ($DIR1)
997 test_10b() { # former test_2b
1000 local var=${SINGLEMDS}_svc
1002 [ -n "$CLIENTS" ] || { skip "Need two or more clients" && exit 0; }
1003 [ $CLIENTCOUNT -ge 2 ] || \
1004 { skip "Need two or more clients, have $CLIENTCOUNT" && exit 0; }
1006 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
1007 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1009 zconf_mount $CLIENT1 $MOUNT
1010 zconf_mount $CLIENT2 $MOUNT1
1011 zconf_mount $CLIENT2 $MOUNT2
1012 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile-a
1013 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile-b
1016 # Save an MDT transaction number before recovery.
1018 do_node $CLIENT1 touch $DIR1/$tfile
1019 pre=$(get_version $CLIENT1 $DIR/$tfile)
1022 # Comments on the replay sequence state the expected result
1026 # "U" Unable to replay.
1029 replay_barrier $SINGLEMDS
1030 do_node $CLIENT1 chmod 666 $DIR/$tfile-a # R
1031 do_node $CLIENT2 chmod 666 $DIR1/$tfile-b # R
1032 do_node $CLIENT2 chgrp $RUNAS_GID $DIR2/$tfile-a # U
1033 do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile-a # J
1034 do_node $CLIENT2 $TRUNCATE $DIR2/$tfile-b 1 # U
1035 do_node $CLIENT2 chgrp $RUNAS_GID $DIR1/$tfile-b # R
1036 do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile-b # R
1037 zconf_umount $CLIENT2 $MOUNT2
1038 facet_failover $SINGLEMDS
1040 client_evicted $CLIENT1 || error "$CLIENT1:$MOUNT not evicted"
1041 client_up $CLIENT2 || error "$CLIENT2:$MOUNT1 evicted"
1044 # Check the MDT epoch. $post must be the first transaction
1045 # number assigned after recovery.
1047 do_node $CLIENT2 chmod 666 $DIR1/$tfile
1048 post=$(get_version $CLIENT2 $DIR1/$tfile)
1049 if (($(($pre >> 32)) == $((post >> 32)))); then
1050 error "epoch not changed: pre $pre, post $post"
1053 if (($(($post & 0x00000000ffffffff)) != 1)); then
1054 error "transno should restart from one: got $post"
1057 do_node $CLIENT2 stat $DIR1/$tfile-a
1058 do_node $CLIENT2 stat $DIR1/$tfile-b
1060 do_node $CLIENT2 $CHECKSTAT -p 0666 -u \\\#$UID -g \\\#$UID \
1061 $DIR1/$tfile-a || error "$DIR/$tfile-a: unexpected state"
1062 do_node $CLIENT2 $CHECKSTAT -p 0666 -u \\\#$RUNAS_ID -g \\\#$RUNAS_GID \
1063 $DIR1/$tfile-b || error "$DIR/$tfile-b: unexpected state"
1065 zconf_umount $CLIENT2 $MOUNT1
1067 run_test 10b "3 clients: some, none, and all reqs replayed"
1069 # test set #11: operations in single directory
1071 local var=${SINGLEMDS}_svc
1072 zconf_mount $CLIENT2 $MOUNT2
1074 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1076 replay_barrier $SINGLEMDS
1078 do_node $CLIENT1 createmany -o $DIR/$tfile-1- 100 &
1080 do_node $CLIENT2 createmany -o $MOUNT2/$tfile-2- 100
1081 zconf_umount $CLIENT2 $MOUNT2
1084 facet_failover $SINGLEMDS
1085 # recovery shouldn't fail due to missing client 2
1086 client_up $CLIENT1 || return 1
1087 # All files from client1 should have been replayed
1088 do_node $CLIENT1 unlinkmany $DIR/$tfile-1- 100 || return 2
1090 [ -e $DIR/$tdir/$tfile-2-0 ] && error "$tfile-2-0 exists"
1093 run_test 11a "concurrent creates don't affect each other"
1096 local var=${SINGLEMDS}_svc
1097 zconf_mount $CLIENT2 $MOUNT2
1099 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1101 do_node $CLIENT2 createmany -o $MOUNT2/$tfile-2- 100
1103 replay_barrier $SINGLEMDS
1104 do_node $CLIENT1 createmany -o $DIR/$tfile-1- 100 &
1106 do_node $CLIENT2 unlinkmany -o $MOUNT2/$tfile-2- 100
1107 zconf_umount $CLIENT2 $MOUNT2
1110 facet_failover $SINGLEMDS
1111 # recovery shouldn't fail due to missing client 2
1112 client_up $CLIENT1 || return 1
1113 # All files from client1 should have been replayed
1114 do_node $CLIENT1 unlinkmany $DIR/$tfile-1- 100 || return 2
1116 [ -e $DIR/$tdir/$tfile-2-0 ] && error "$tfile-2-0 exists"
1119 run_test 11b "concurrent creates and unlinks don't affect each other"
1121 # test set #12: lock replay with VBR, bug 16356
1122 test_12a() { # former test_2a
1123 local var=${SINGLEMDS}_svc
1124 zconf_mount $CLIENT2 $MOUNT2
1126 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1128 do_node $CLIENT2 mkdir -p $MOUNT2/$tdir
1129 replay_barrier $SINGLEMDS
1130 do_node $CLIENT2 mcreate $MOUNT2/$tdir/$tfile
1131 do_node $CLIENT1 createmany -o $DIR/$tfile- 25
1132 #client1 read data from client2 which will be lost
1133 do_node $CLIENT1 $CHECKSTAT $DIR/$tdir/$tfile
1134 do_node $CLIENT1 createmany -o $DIR/$tfile-3- 25
1135 zconf_umount $CLIENT2 $MOUNT2
1137 facet_failover $SINGLEMDS
1138 # recovery shouldn't fail due to missing client 2
1139 client_up $CLIENT1 || return 1
1141 # All 50 files should have been replayed
1142 do_node $CLIENT1 unlinkmany $DIR/$tfile- 25 || return 2
1143 do_node $CLIENT1 unlinkmany $DIR/$tfile-3- 25 || return 3
1144 do_node $CLIENT1 $CHECKSTAT $DIR/$tdir/$tfile && return 4
1148 run_test 12a "lost data due to missed REMOTE client during replay"
1150 #restore COS setting
1151 restore_lustre_params < $cos_param_file
1152 rm -f $cos_param_file
1154 [ "$CLIENTS" ] && zconf_mount_clients $CLIENTS $DIR
1157 check_and_cleanup_lustre