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 . $LUSTRE/tests/test-framework.sh
17 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
20 remote_mds_nodsh && log "SKIP: remote MDS with nodsh" && exit 0
22 [ "$SLOW" = "no" ] && EXCEPT_SLOW="7"
26 check_and_setup_lustre
29 rm -rf $DIR/[df][0-9]*
31 [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
33 # if there is no CLIENT1 defined, some tests can be ran on localhost
34 CLIENT1=${CLIENT1:-$HOSTNAME}
35 # if CLIENT2 doesn't exist then use CLIENT1 instead
36 # All tests should use CLIENT2 with MOUNT2 only therefore it will work if
38 # Exception is the test which need two separate nodes
39 CLIENT2=${CLIENT2:-$CLIENT1}
41 is_mounted $MOUNT2 || error "MOUNT2 is not mounted"
48 # We need to run do_node in bg, because pdsh does not exit
49 # if child process of run script exists.
50 # I.e. pdsh does not exit when runmultiop_bg_pause exited,
51 # because of multiop_bg_pause -> $MULTIOP_PROG &
52 # By the same reason we need sleep a bit after do_nodes starts
53 # to let runmultiop_bg_pause start muliop and
54 # update /tmp/multiop_bg.pid ;
55 # The rm /tmp/multiop_bg.pid guarantees here that
56 # we have the updated by runmultiop_bg_pause
57 # /tmp/multiop_bg.pid file
59 local pid_file=$TMP/multiop_bg.pid.$$
60 do_node $client "MULTIOP_PID_FILE=$pid_file LUSTRE= sh runmultiop_bg_pause $file $cmds" &
64 multiop_pid=$(do_node $client cat $pid_file)
65 [ -n "$multiop_pid" ] || error "$client : Can not get multiop_pid from $pid_file "
66 eval export $(node_var_name $client)_multiop_pid=$multiop_pid
67 eval export $(node_var_name $client)_do_node_pid=$pid
68 local var=$(node_var_name $client)_multiop_pid
69 echo client $client multiop_bg started multiop_pid=${!var}
75 local multiop_pid=$(node_var_name $client)_multiop_pid
76 local do_node_pid=$(node_var_name $client)_do_node_pid
78 echo "Stopping multiop_pid=${!multiop_pid} (kill ${!multiop_pid} on $client)"
79 do_node $client kill -USR1 ${!multiop_pid}
85 local var=${SINGLEMDS}_svc
90 fid=$(do_node $client $LFS path2fid $file)
91 do_facet $SINGLEMDS $LCTL --device ${!var} getobjversion \\\"$fid\\\"
95 cos_param_file=$TMP/rvbr-cos-params
96 save_lustre_params $(comma_list $(mdts_nodes)) "mdt.*.commit_on_sharing" > $cos_param_file
99 get_version $CLIENT1 $DIR/$tdir/1a || true
101 run_test 0a "getversion for non existent file shouldn't cause kernel panic"
104 local var=${SINGLEMDS}_svc
106 local file=$DIR/$tdir/f
108 do_node $CLIENT1 mkdir -p $DIR/$tdir/
109 do_node $CLIENT1 touch $file
110 fid=$(do_node $CLIENT1 $LFS path2fid $file)
111 do_node $CLIENT1 rm -rf $file
112 do_facet $SINGLEMDS $LCTL --device ${!var} getobjversion \\\"$fid\\\" || true
114 run_test 0b "getversion for non existent fid shouldn't cause kernel panic"
117 test_1a() { # former test_0a
118 local file=$DIR/$tfile
122 do_node $CLIENT1 mcreate $file
123 pre=$(get_version $CLIENT1 $file)
124 do_node $CLIENT1 openfile -f O_RDWR $file
125 post=$(get_version $CLIENT1 $file)
126 if (($pre != $post)); then
127 error "version changed unexpectedly: pre $pre, post $post"
130 run_test 1a "open and close do not change versions"
132 test_1b() { # former test_0b
133 local var=${SINGLEMDS}_svc
134 zconf_mount $CLIENT2 $MOUNT2
136 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
137 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
138 do_node $CLIENT1 mkdir -p -m 755 $MOUNT/$tdir
140 replay_barrier $SINGLEMDS
141 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
142 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT $MOUNT/$tdir/$tfile
143 zconf_umount $CLIENT2 $MOUNT2
144 facet_failover $SINGLEMDS
146 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
147 if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
148 error "open succeeded unexpectedly"
151 run_test 1b "open (O_CREAT) checks version of parent"
153 test_1c() { # former test_0c
154 local var=${SINGLEMDS}_svc
155 zconf_mount $CLIENT2 $MOUNT2
157 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
158 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
160 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
161 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tdir/$tfile
163 replay_barrier $SINGLEMDS
164 do_node $CLIENT2 chmod 0777 $MOUNT2/$tdir
165 do_node $CLIENT2 chmod 0666 $MOUNT2/$tdir/$tfile
166 rmultiop_start $CLIENT1 $DIR/$tdir/$tfile o_c
167 zconf_umount $CLIENT2 $MOUNT2
168 facet_failover $SINGLEMDS
170 client_up $CLIENT1 || error "$CLIENT1 evicted"
171 rmultiop_stop $CLIENT1 || error "close failed"
173 run_test 1c "open (non O_CREAT) does not checks versions"
175 # test set #2: CREAT (not open)
176 # - version of parent is not changed but checked
177 # - pre-version should be -1
178 # - post-version should be valid
179 test_2a() { # extended former test_0d
184 pre=$(get_version $CLIENT1 $DIR)
185 do_node $CLIENT1 mkfifo $DIR/$tfile-fifo
186 post=$(get_version $CLIENT1 $DIR)
187 if (($pre != $post)); then
188 error "version was changed: pre $pre, post $post"
191 pre=$(get_version $CLIENT1 $DIR)
192 do_node $CLIENT1 mkdir $DIR/$tfile-dir
193 post=$(get_version $CLIENT1 $DIR)
194 if (($pre != $post)); then
195 error "version was changed: pre $pre, post $post"
197 do_node $CLIENT1 rmdir $DIR/$tfile-dir
200 pre=$(get_version $CLIENT1 $DIR)
201 do_node $CLIENT1 mkfifo $DIR/$tfile-nod
202 post=$(get_version $CLIENT1 $DIR)
203 if (($pre != $post)); then
204 error "version was changed: pre $pre, post $post"
207 pre=$(get_version $CLIENT1 $DIR)
208 do_node $CLIENT1 mkfifo $DIR/$tfile-symlink
209 post=$(get_version $CLIENT1 $DIR)
210 if (($pre != $post)); then
211 error "version was changed: pre $pre, post $post"
213 do_node $CLIENT1 rm $DIR/$tfile-*
216 run_test 2a "create operations doesn't change version of parent"
218 test_2b() { # former test_0e
219 local var=${SINGLEMDS}_svc
220 zconf_mount $CLIENT2 $MOUNT2
222 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
223 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
225 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
227 replay_barrier $SINGLEMDS
228 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
229 do_node $CLIENT1 mkfifo $DIR/$tdir/$tfile
230 zconf_umount $CLIENT2 $MOUNT2
231 facet_failover $SINGLEMDS
233 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
234 if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
235 error "create succeeded unexpectedly"
238 run_test 2b "create checks version of parent"
240 test_3a() { # former test_0f
244 do_node $CLIENT1 mcreate $DIR/$tfile
245 pre=$(get_version $CLIENT1 $DIR)
246 do_node $CLIENT1 rm $DIR/$tfile
247 post=$(get_version $CLIENT1 $DIR)
248 if (($pre != $post)); then
249 error "version was changed: pre $pre, post $post"
252 run_test 3a "unlink doesn't change version of parent"
254 test_3b() { # former test_0g
255 local var=${SINGLEMDS}_svc
256 zconf_mount $CLIENT2 $MOUNT2
258 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
259 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
261 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
262 do_node $CLIENT1 mcreate $DIR/$tdir/$tfile
264 replay_barrier $SINGLEMDS
265 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
266 do_node $CLIENT1 rm $DIR/$tdir/$tfile
267 zconf_umount $CLIENT2 $MOUNT2
268 facet_failover $SINGLEMDS
270 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
271 if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
272 error "unlink succeeded unexpectedly"
275 run_test 3b "unlink checks version of parent"
277 test_4a() { # former test_0h
278 local file=$DIR/$tfile
282 do_node $CLIENT1 mcreate $file
283 pre=$(get_version $CLIENT1 $file)
284 do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $file
285 post=$(get_version $CLIENT1 $file)
286 if (($pre == $post)); then
287 error "version not changed: pre $pre, post $post"
290 run_test 4a "setattr of UID changes versions"
292 test_4b() { # former test_0i
293 local file=$DIR/$tfile
297 do_node $CLIENT1 mcreate $file
298 pre=$(get_version $CLIENT1 $file)
299 do_node $CLIENT1 chgrp $RUNAS_GID $file
300 post=$(get_version $CLIENT1 $file)
301 if (($pre == $post)); then
302 error "version not changed: pre $pre, post $post"
305 run_test 4b "setattr of GID changes versions"
307 test_4c() { # former test_0j
308 local file=$DIR/$tfile
309 local var=${SINGLEMDS}_svc
310 zconf_mount $CLIENT2 $MOUNT2
312 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
313 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
315 do_node $CLIENT1 mcreate $file
317 replay_barrier $SINGLEMDS
318 do_node $CLIENT2 chgrp $RUNAS_GID $MOUNT2/$tfile
319 do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $file
320 zconf_umount $CLIENT2 $MOUNT2
321 facet_failover $SINGLEMDS
323 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
324 if ! do_node $CLIENT1 $CHECKSTAT -u \\\#$UID $file; then
325 error "setattr of UID succeeded unexpectedly"
328 run_test 4c "setattr of UID checks versions"
330 test_4d() { # former test_0k
331 local file=$DIR/$tfile
332 local var=${SINGLEMDS}_svc
333 zconf_mount $CLIENT2 $MOUNT2
335 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
336 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
338 do_node $CLIENT1 mcreate $file
340 replay_barrier $SINGLEMDS
341 do_node $CLIENT2 chown $RUNAS_ID:$RUNAS_GID $MOUNT2/$tfile
342 do_node $CLIENT1 chgrp $RUNAS_GID $file
343 zconf_umount $CLIENT2 $MOUNT2
344 facet_failover $SINGLEMDS
346 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
347 if ! do_node $CLIENT1 $CHECKSTAT -g \\\#$UID $file; then
348 error "setattr of GID succeeded unexpectedly"
351 run_test 4d "setattr of GID checks versions"
353 test_4e() { # former test_0l
354 local file=$DIR/$tfile
358 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
359 pre=$(get_version $CLIENT1 $file)
360 do_node $CLIENT1 chmod 666 $file
361 post=$(get_version $CLIENT1 $file)
362 if (($pre == $post)); then
363 error "version not changed: pre $pre, post $post"
366 run_test 4e "setattr of permission changes versions"
368 test_4f() { # former test_0m
369 local file=$DIR/$tfile
370 local var=${SINGLEMDS}_svc
371 zconf_mount $CLIENT2 $MOUNT2
373 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
374 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
376 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
378 replay_barrier $SINGLEMDS
379 do_node $CLIENT2 chgrp $RUNAS_GID $MOUNT2/$tfile
380 do_node $CLIENT1 chmod 666 $file
381 zconf_umount $CLIENT2 $MOUNT2
382 facet_failover $SINGLEMDS
384 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
385 if ! do_node $CLIENT1 $CHECKSTAT -p 0644 $file; then
386 error "setattr of permission succeeded unexpectedly"
389 run_test 4f "setattr of permission checks versions"
391 test_4g() { # former test_0n
392 local file=$DIR/$tfile
396 do_node $CLIENT1 mcreate $file
397 pre=$(get_version $CLIENT1 $file)
398 do_node $CLIENT1 chattr +i $file
399 post=$(get_version $CLIENT1 $file)
400 do_node $CLIENT1 chattr -i $file
401 if (($pre == $post)); then
402 error "version not changed: pre $pre, post $post"
405 run_test 4g "setattr of flags changes versions"
413 if ((${#attr} != 1)); then
414 error "checking multiple attributes not implemented yet"
416 do_node $client lsattr $file | cut -d ' ' -f 1 | grep -q $attr
419 test_4h() { # former test_0o
420 local file=$DIR/$tfile
422 local var=${SINGLEMDS}_svc
423 zconf_mount $CLIENT2 $MOUNT2
425 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
426 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
428 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
430 replay_barrier $SINGLEMDS
431 do_node $CLIENT2 chmod 666 $MOUNT2/$tfile
432 do_node $CLIENT1 chattr +i $file
433 zconf_umount $CLIENT2 $MOUNT2
434 facet_failover $SINGLEMDS
436 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
437 checkattr $CLIENT1 i $file
439 do_node $CLIENT1 chattr -i $file
440 if [ $rc -eq 0 ]; then
441 error "setattr of flags succeeded unexpectedly"
444 run_test 4h "setattr of flags checks versions"
446 test_4i() { # former test_0p
447 local file=$DIR/$tfile
451 local var=${SINGLEMDS}_svc
453 ad_orig=$(do_facet $SINGLEMDS "$LCTL get_param mdd.${!var}.atime_diff")
454 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.atime_diff=0"
455 do_node $CLIENT1 mcreate $file
456 pre=$(get_version $CLIENT1 $file)
457 do_node $CLIENT1 touch $file
458 post=$(get_version $CLIENT1 $file)
460 # We don't fail MDS in this test. atime_diff shall be
461 # restored to its original value.
463 do_facet $SINGLEMDS "$LCTL set_param $ad_orig"
464 if (($pre != $post)); then
465 error "version changed unexpectedly: pre $pre, post $post"
468 run_test 4i "setattr of times does not change versions"
470 test_4j() { # former test_0q
471 local file=$DIR/$tfile
475 do_node $CLIENT1 mcreate $file
476 pre=$(get_version $CLIENT1 $file)
477 do_node $CLIENT1 $TRUNCATE $file 1
478 post=$(get_version $CLIENT1 $file)
479 if (($pre != $post)); then
480 error "version changed unexpectedly: pre $pre, post $post"
483 run_test 4j "setattr of size does not change versions"
485 test_4k() { # former test_0r
486 local file=$DIR/$tfile
490 local var=${SINGLEMDS}_svc
491 zconf_mount $CLIENT2 $MOUNT2
493 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
494 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.atime_diff=0"
495 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
497 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
499 replay_barrier $SINGLEMDS
500 do_node $CLIENT2 chmod 666 $MOUNT2/$tfile
501 do_node $CLIENT1 $TRUNCATE $file 1
503 mtime_pre=$(do_node $CLIENT1 stat --format=%Y $file)
504 do_node $CLIENT1 touch $file
505 sleep 1 # avoid stat caching
506 mtime_post=$(do_node $CLIENT1 stat --format=%Y $file)
507 zconf_umount $CLIENT2 $MOUNT2
508 facet_failover $SINGLEMDS
510 client_up $CLIENT1 || error "$CLIENT1 evicted"
511 if (($mtime_pre >= $mtime_post)); then
512 error "time not changed: pre $mtime_pre, post $mtime_post"
514 if ! do_node $CLIENT1 $CHECKSTAT -s 1 $file; then
515 error "setattr of size failed"
517 mtime=$(do_node $CLIENT1 stat --format=%Y $file)
518 if (($mtime != $mtime_post)); then
519 error "setattr of times failed: expected $mtime_post, got $mtime"
522 run_test 4k "setattr of times and size does not check versions"
524 test_5a() { # former test_0s
530 do_node $CLIENT1 mcreate $DIR/$tfile
531 do_node $CLIENT1 mkdir -p $DIR/$tdir
532 pre=$(get_version $CLIENT1 $DIR/$tfile)
533 tp_pre=$(get_version $CLIENT1 $DIR/$tdir)
534 do_node $CLIENT1 link $DIR/$tfile $DIR/$tdir/$tfile
535 post=$(get_version $CLIENT1 $DIR/$tfile)
536 tp_post=$(get_version $CLIENT1 $DIR/$tdir)
537 if (($pre == $post)); then
538 error "version of source not changed: pre $pre, post $post"
540 if (($tp_pre != $tp_post)); then
541 error "version of target parent was changed: pre $tp_pre, post $tp_post"
544 run_test 5a "link changes versions of source but not target parent"
546 test_5b() { # former test_0t
547 local var=${SINGLEMDS}_svc
548 zconf_mount $CLIENT2 $MOUNT2
550 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
551 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
553 do_node $CLIENT1 mcreate $DIR/$tfile
554 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
556 replay_barrier $SINGLEMDS
557 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
558 do_node $CLIENT1 link $DIR/$tfile $DIR/$tdir/$tfile
559 zconf_umount $CLIENT2 $MOUNT2
560 facet_failover $SINGLEMDS
562 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
563 if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
564 error "link should fail"
567 run_test 5b "link checks version of target parent"
569 test_5c() { # former test_0u
570 local var=${SINGLEMDS}_svc
571 zconf_mount $CLIENT2 $MOUNT2
573 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
574 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
576 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile
577 do_node $CLIENT1 mkdir -p $DIR/$tdir
579 replay_barrier $SINGLEMDS
580 do_node $CLIENT2 chmod 666 $MOUNT2/$tfile
581 do_node $CLIENT1 link $DIR/$tfile $DIR/$tdir/$tfile
582 zconf_umount $CLIENT2 $MOUNT2
583 facet_failover $SINGLEMDS
585 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
586 if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
587 error "link should fail"
590 run_test 5c "link checks version of source"
592 test_6a() { # former test_0v
598 do_node $CLIENT1 mcreate $DIR/$tfile
599 do_node $CLIENT1 mkdir -p $DIR/$tdir
600 sp_pre=$(get_version $CLIENT1 $DIR)
601 tp_pre=$(get_version $CLIENT1 $DIR/$tdir)
602 do_node $CLIENT1 mv $DIR/$tfile $DIR/$tdir/$tfile
603 sp_post=$(get_version $CLIENT1 $DIR)
604 tp_post=$(get_version $CLIENT1 $DIR/$tdir)
605 if (($sp_pre != $sp_post)); then
606 error "version of source parent was changed: pre $sp_pre, post $sp_post"
608 if (($tp_pre != $tp_post)); then
609 error "version of target parent was changed: pre $tp_pre, post $tp_post"
612 run_test 6a "rename doesn't change versions of source parent and target parent"
614 test_6b() { # former test_0w
618 do_node $CLIENT1 mcreate $DIR/$tfile
619 pre=$(get_version $CLIENT1 $DIR)
620 do_node $CLIENT1 mv $DIR/$tfile $DIR/$tfile-new
621 post=$(get_version $CLIENT1 $DIR)
622 if (($pre != $post)); then
623 error "version of parent was changed: pre $pre, post $post"
626 run_test 6b "rename within same dir doesn't change version of parent"
628 test_6c() { # former test_0x
629 local var=${SINGLEMDS}_svc
630 zconf_mount $CLIENT2 $MOUNT2
632 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
633 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
635 do_node $CLIENT1 mcreate $DIR/$tfile
636 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
638 replay_barrier $SINGLEMDS
639 do_node $CLIENT2 chmod 777 $MOUNT2
640 do_node $CLIENT1 mv $DIR/$tfile $DIR/$tdir/$tfile
641 zconf_umount $CLIENT2 $MOUNT2
642 facet_failover $SINGLEMDS
644 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
645 if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tfile; then
646 error "rename should fail"
649 run_test 6c "rename checks version of source parent"
651 test_6d() { # former test_0y
652 local var=${SINGLEMDS}_svc
653 zconf_mount $CLIENT2 $MOUNT2
655 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
656 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
658 do_node $CLIENT1 mcreate $DIR/$tfile
659 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
661 replay_barrier $SINGLEMDS
662 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
663 do_node $CLIENT1 mv $DIR/$tfile $DIR/$tdir/$tfile
664 zconf_umount $CLIENT2 $MOUNT2
665 facet_failover $SINGLEMDS
667 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
668 if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tfile; then
669 error "rename should fail"
672 run_test 6d "rename checks version of target parent"
674 # pdirops tests, bug 18143
681 local var=${SINGLEMDS}_svc
682 zconf_mount $CLIENT2 $MOUNT2
684 local cname=$TESTNAME.$cycle
686 echo "start cycle: $cname"
687 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
688 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
690 do_node $CLIENT1 mkdir -p $DIR/$tdir
691 replay_barrier $SINGLEMDS
693 echo "$cname first: $first"
694 do_node $CLIENT1 $first || error "$cname: Cannot do first operation"
695 # client2 operations that will be lost
696 echo "$cname lost: $lost"
697 do_node $CLIENT2 $lost || error "$cname: Cannot do 'lost' operations"
699 echo "$cname last: $last"
700 do_node $CLIENT1 $last || error "$cname: Cannot do last operation"
701 zconf_umount $CLIENT2 $MOUNT2
702 facet_failover $SINGLEMDS
703 # should fail as conflict expected
704 client_evicted $CLIENT1 || rc=1
706 wait_recovery_complete $SINGLEMDS
707 wait_mds_ost_sync $SINGLEMDS
714 first="createmany -o $DIR/$tdir/$tfile- 1"
715 lost="rm $MOUNT2/$tdir/$tfile-0"
716 last="createmany -o $DIR/$tdir/$tfile- 1"
717 test_7_cycle "$first" "$lost" "$last" || error "Test 7a.1 failed"
719 first="createmany -o $DIR/$tdir/$tfile- 1"
720 lost="rm $MOUNT2/$tdir/$tfile-0"
721 last="mkdir $DIR/$tdir/$tfile-0"
722 test_7_cycle "$first" "$lost" "$last" || error "Test 7a.2 failed"
724 first="mkdir $DIR/$tdir/$tfile-0"
725 lost="mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile-1"
726 last="createmany -o $DIR/$tdir/$tfile- 1"
727 test_7_cycle "$first" "$lost" "$last" || error "Test 7a.3 failed"
730 run_test 7a "create, {lost}, create"
733 first="createmany -o $DIR/$tdir/$tfile- 1"
734 lost="rm $MOUNT2/$tdir/$tfile-0; createmany -o $MOUNT2/$tdir/$tfile- 1"
735 last="rm $DIR/$tdir/$tfile-0"
736 test_7_cycle "$first" "$lost" "$last" || error "Test 7b.1 failed"
738 first="createmany -o $DIR/$tdir/$tfile- 1"
739 lost="touch $MOUNT2/$tdir/$tfile; mv $MOUNT2/$tdir/$tfile $MOUNT2/$tdir/$tfile-0"
740 last="rm $DIR/$tdir/$tfile-0"
741 test_7_cycle "$first" "$lost" "$last" || error "Test 7b.2 failed"
743 first="createmany -o $DIR/$tdir/$tfile- 1"
744 lost="rm $MOUNT2/$tdir/$tfile-0; mkdir $MOUNT2/$tdir/$tfile-0"
745 last="rmdir $DIR/$tdir/$tfile-0"
746 test_7_cycle "$first" "$lost" "$last" || error "Test 7b.3 failed"
749 run_test 7b "create, {lost}, unlink"
752 first="createmany -o $DIR/$tdir/$tfile- 1"
753 lost="rm $MOUNT2/$tdir/$tfile-0; createmany -o $MOUNT2/$tdir/$tfile- 1"
754 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
755 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.1 failed"
757 first="createmany -o $DIR/$tdir/$tfile- 2"
758 lost="rm $MOUNT2/$tdir/$tfile-0; mkdir $MOUNT2/$tdir/$tfile-0"
759 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
760 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.2 failed"
762 first="createmany -o $DIR/$tdir/$tfile- 1; mkdir $DIR/$tdir/$tfile-1-0"
763 lost="rmdir $MOUNT2/$tdir/$tfile-1-0; createmany -o $MOUNT2/$tdir/$tfile-1- 1"
764 last="mv $DIR/$tdir/$tfile-1-0 $DIR/$tdir/$tfile-0"
765 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.3 failed"
767 first="createmany -o $DIR/$tdir/$tfile- 1"
768 lost="mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile"
769 last="mv $DIR/$tdir/$tfile $DIR/$tdir/$tfile-0"
770 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.4 failed"
773 run_test 7c "create, {lost}, rename"
776 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
777 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0"
778 last="createmany -o $DIR/$tdir/$tfile- 1"
779 test_7_cycle "$first" "$lost" "$last" && error "Test 7d.1 failed"
781 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
782 lost="mkdir $MOUNT2/$tdir/$tfile-0; rmdir $MOUNT2/$tdir/$tfile-0"
783 last="mkdir $DIR/$tdir/$tfile-0"
784 test_7_cycle "$first" "$lost" "$last" && error "Test 7d.2 failed"
786 first="mkdir $DIR/$tdir/$tfile-0; rmdir $DIR/$tdir/$tfile-0"
787 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile-1"
788 last="createmany -o $DIR/$tdir/$tfile- 1"
789 test_7_cycle "$first" "$lost" "$last" && error "Test 7d.3 failed"
792 run_test 7d "unlink, {lost}, create"
795 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
796 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0;createmany -o $MOUNT2/$tdir/$tfile- 1"
797 last="rm $DIR/$tdir/$tfile-0"
798 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.1 failed"
800 first="mkdir $DIR/$tdir/$tfile-0; rmdir $DIR/$tdir/$tfile-0"
801 lost="mkdir $MOUNT2/$tdir/$tfile-0; rmdir $MOUNT2/$tdir/$tfile-0; mkdir $MOUNT2/$tdir/$tfile-0"
802 last="rmdir $DIR/$tdir/$tfile-0"
803 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.2 failed"
805 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
806 lost="mkdir $MOUNT2/$tdir/$tfile-0"
807 last="rmdir $DIR/$tdir/$tfile-0"
808 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.3 failed"
810 first="mkdir $DIR/$tdir/$tfile-0; rmdir $DIR/$tdir/$tfile-0"
811 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
812 last="rm $DIR/$tdir/$tfile-0"
813 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.4 failed"
815 first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
816 lost="mv $MOUNT2/$tdir/$tfile-1 $MOUNT2/$tdir/$tfile-0"
817 last="rm $DIR/$tdir/$tfile-0"
818 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.5 failed"
821 run_test 7e "unlink, {lost}, unlink"
824 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
825 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
826 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
827 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.1 failed"
829 first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
830 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
831 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
832 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.2 failed"
834 first="mkdir $DIR/$tdir/$tfile; createmany -o $DIR/$tdir/$tfile- 1; rmdir $DIR/$tdir/$tfile"
835 lost="mkdir $MOUNT2/$tdir/$tfile"
836 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
837 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.3 failed"
839 first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
840 lost="mv $MOUNT2/$tdir/$tfile-1 $MOUNT2/$tdir/$tfile-0"
841 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
842 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.4 failed"
844 first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
845 lost="mkdir $MOUNT2/$tdir/$tfile-0"
846 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
847 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.5 failed"
850 run_test 7f "unlink, {lost}, rename"
853 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
854 lost="mkdir $MOUNT2/$tdir/$tfile-0;rmdir $MOUNT2/$tdir/$tfile-0"
855 last="createmany -o $DIR/$tdir/$tfile- 1"
856 test_7_cycle "$first" "$lost" "$last" && error "Test 7g.1 failed"
858 first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
859 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0"
860 last="mkdir $DIR/$tdir/$tfile-0"
861 test_7_cycle "$first" "$lost" "$last" && error "Test 7g.2 failed"
863 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
864 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
865 last="link $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
866 test_7_cycle "$first" "$lost" "$last" || error "Test 7g.3 failed"
869 run_test 7g "rename, {lost}, create"
872 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
873 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
874 last="rm $DIR/$tdir/$tfile-0"
875 test_7_cycle "$first" "$lost" "$last" || error "Test 7h.1 failed"
877 first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
878 lost="rm $MOUNT2/$tdir/$tfile-0; createmany -o $MOUNT2/$tdir/$tfile- 1"
879 last="rm $DIR/$tdir/$tfile-0"
880 test_7_cycle "$first" "$lost" "$last" || error "Test 7h.2 failed"
882 first="createmany -o $DIR/$tdir/$tfile- 1; mkdir $DIR/$tdir/$tfile; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
883 lost="rm $MOUNT2/$tdir/$tfile/$tfile-0"
884 last="rmdir $DIR/$tdir/$tfile"
885 #test_7_cycle "$first" "$lost" "$last" || error "Test 7h.3 failed"
888 run_test 7h "rename, {lost}, unlink"
891 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
892 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
893 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
894 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.1 failed"
896 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
897 lost="mkdir $MOUNT2/$tdir/$tfile-0"
898 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
899 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.1 failed"
901 first="createmany -o $DIR/$tdir/$tfile- 3; mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
902 lost="mv $MOUNT2/$tdir/$tfile-2 $MOUNT2/$tdir/$tfile-0"
903 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-2"
904 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.3 failed"
906 first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
907 lost="rm $MOUNT2/$tdir/$tfile-1"
908 last="mv $DIR/$tdir/$tfile $DIR/$tdir/$tfile-1"
909 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.4 failed"
912 run_test 7i "rename, {lost}, rename"
914 # test set #8: orphan handling bug 15392.
915 # Unlink during recovery creates orphan always just in case some late open may
916 # arrive. These orphans will be removed after recovery anyway.
917 # Tests check that valid create,unlink,create sequence will work in this case
918 # too but not fail on second create due to orphan found.
921 local var=${SINGLEMDS}_svc
922 zconf_mount $CLIENT2 $MOUNT2
924 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
926 do_node $CLIENT1 mcreate $DIR/$tfile
927 do_node $CLIENT1 mkdir $DIR/$tfile-2
928 replay_barrier $SINGLEMDS
929 # missed replay from client2 will lead to recovery by versions
930 do_node $CLIENT2 touch $MOUNT2/$tfile-2/$tfile
931 do_node $CLIENT1 rm $DIR/$tfile || return 1
932 do_node $CLIENT1 touch $DIR/$tfile || return 2
934 zconf_umount $CLIENT2 $MOUNT2
935 facet_failover $SINGLEMDS
936 client_up $CLIENT1 || return 6
938 do_node $CLIENT1 rm $DIR/$tfile || error "$tfile doesn't exists"
941 run_test 8a "create | unlink, create shouldn't fail"
944 local var=${SINGLEMDS}_svc
945 zconf_mount $CLIENT2 $MOUNT2
947 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
949 do_node $CLIENT1 touch $DIR/$tfile
950 do_node $CLIENT1 mkdir $DIR/$tfile-2
951 replay_barrier $SINGLEMDS
952 # missed replay from client2 will lead to recovery by versions
953 do_node $CLIENT2 touch $MOUNT2/$tfile-2/$tfile
954 do_node $CLIENT1 rm -f $MOUNT1/$tfile || return 1
955 do_node $CLIENT1 mcreate $MOUNT1/$tfile || return 2
957 zconf_umount $CLIENT2 $MOUNT2
958 facet_failover $SINGLEMDS
959 client_up $CLIENT1 || return 6
961 do_node $CLIENT1 rm $MOUNT1/$tfile || error "$tfile doesn't exists"
964 run_test 8b "create | unlink, create shouldn't fail"
967 local var=${SINGLEMDS}_svc
968 zconf_mount $CLIENT2 $MOUNT2
970 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
972 do_node $CLIENT1 touch $DIR/$tfile
973 do_node $CLIENT1 mkdir $DIR/$tfile-2
974 replay_barrier $SINGLEMDS
975 # missed replay from client2 will lead to recovery by versions
976 do_node $CLIENT2 touch $MOUNT2/$tfile-2/$tfile
977 do_node $CLIENT1 rm -f $MOUNT1/$tfile || return 1
978 do_node $CLIENT1 mkdir $MOUNT1/$tfile || return 2
980 zconf_umount $CLIENT2 $MOUNT2
981 facet_failover $SINGLEMDS
982 client_up $CLIENT1 || return 6
984 do_node $CLIENT1 rmdir $MOUNT1/$tfile || error "$tfile doesn't exists"
987 run_test 8c "create | unlink, create shouldn't fail"
990 # This test uses three Lustre clients on two hosts.
992 # Lustre Client 1: $CLIENT1:$MOUNT ($DIR)
993 # Lustre Client 2: $CLIENT2:$MOUNT2 ($DIR2)
994 # Lustre Client 3: $CLIENT2:$MOUNT1 ($DIR1)
996 test_10b() { # former test_2b
999 local var=${SINGLEMDS}_svc
1001 [ -n "$CLIENTS" ] || { skip "Need two or more clients" && exit 0; }
1002 [ $CLIENTCOUNT -ge 2 ] || \
1003 { skip "Need two or more clients, have $CLIENTCOUNT" && exit 0; }
1005 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
1006 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1008 zconf_mount $CLIENT1 $MOUNT
1009 zconf_mount $CLIENT2 $MOUNT1
1010 zconf_mount $CLIENT2 $MOUNT2
1011 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile-a
1012 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile-b
1015 # Save an MDT transaction number before recovery.
1017 do_node $CLIENT1 touch $DIR1/$tfile
1018 pre=$(get_version $CLIENT1 $DIR/$tfile)
1021 # Comments on the replay sequence state the expected result
1025 # "U" Unable to replay.
1028 replay_barrier $SINGLEMDS
1029 do_node $CLIENT1 chmod 666 $DIR/$tfile-a # R
1030 do_node $CLIENT2 chmod 666 $DIR1/$tfile-b # R
1031 do_node $CLIENT2 chgrp $RUNAS_GID $DIR2/$tfile-a # U
1032 do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile-a # J
1033 do_node $CLIENT2 $TRUNCATE $DIR2/$tfile-b 1 # U
1034 do_node $CLIENT2 chgrp $RUNAS_GID $DIR1/$tfile-b # R
1035 do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile-b # R
1036 zconf_umount $CLIENT2 $MOUNT2
1037 facet_failover $SINGLEMDS
1039 client_evicted $CLIENT1 || error "$CLIENT1:$MOUNT not evicted"
1040 client_up $CLIENT2 || error "$CLIENT2:$MOUNT1 evicted"
1043 # Check the MDT epoch. $post must be the first transaction
1044 # number assigned after recovery.
1046 do_node $CLIENT2 chmod 666 $DIR1/$tfile
1047 post=$(get_version $CLIENT2 $DIR1/$tfile)
1048 if (($(($pre >> 32)) == $((post >> 32)))); then
1049 error "epoch not changed: pre $pre, post $post"
1052 if (($(($post & 0x00000000ffffffff)) != 1)); then
1053 error "transno should restart from one: got $post"
1056 do_node $CLIENT2 stat $DIR1/$tfile-a
1057 do_node $CLIENT2 stat $DIR1/$tfile-b
1059 do_node $CLIENT2 $CHECKSTAT -p 0666 -u \\\#$UID -g \\\#$UID \
1060 $DIR1/$tfile-a || error "$DIR/$tfile-a: unexpected state"
1061 do_node $CLIENT2 $CHECKSTAT -p 0666 -u \\\#$RUNAS_ID -g \\\#$RUNAS_GID \
1062 $DIR1/$tfile-b || error "$DIR/$tfile-b: unexpected state"
1064 zconf_umount $CLIENT2 $MOUNT1
1066 run_test 10b "3 clients: some, none, and all reqs replayed"
1068 # test set #11: operations in single directory
1070 local var=${SINGLEMDS}_svc
1071 zconf_mount $CLIENT2 $MOUNT2
1073 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1075 replay_barrier $SINGLEMDS
1077 do_node $CLIENT1 createmany -o $DIR/$tfile-1- 100 &
1079 do_node $CLIENT2 createmany -o $MOUNT2/$tfile-2- 100
1080 zconf_umount $CLIENT2 $MOUNT2
1083 facet_failover $SINGLEMDS
1084 # recovery shouldn't fail due to missing client 2
1085 client_up $CLIENT1 || return 1
1086 # All files from client1 should have been replayed
1087 do_node $CLIENT1 unlinkmany $DIR/$tfile-1- 100 || return 2
1089 [ -e $DIR/$tdir/$tfile-2-0 ] && error "$tfile-2-0 exists"
1092 run_test 11a "concurrent creates don't affect each other"
1095 local var=${SINGLEMDS}_svc
1096 zconf_mount $CLIENT2 $MOUNT2
1098 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1100 do_node $CLIENT2 createmany -o $MOUNT2/$tfile-2- 100
1102 replay_barrier $SINGLEMDS
1103 do_node $CLIENT1 createmany -o $DIR/$tfile-1- 100 &
1105 do_node $CLIENT2 unlinkmany -o $MOUNT2/$tfile-2- 100
1106 zconf_umount $CLIENT2 $MOUNT2
1109 facet_failover $SINGLEMDS
1110 # recovery shouldn't fail due to missing client 2
1111 client_up $CLIENT1 || return 1
1112 # All files from client1 should have been replayed
1113 do_node $CLIENT1 unlinkmany $DIR/$tfile-1- 100 || return 2
1115 [ -e $DIR/$tdir/$tfile-2-0 ] && error "$tfile-2-0 exists"
1118 run_test 11b "concurrent creates and unlinks don't affect each other"
1120 # test set #12: lock replay with VBR, bug 16356
1121 test_12a() { # former test_2a
1122 local var=${SINGLEMDS}_svc
1123 zconf_mount $CLIENT2 $MOUNT2
1125 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1127 do_node $CLIENT2 mkdir -p $MOUNT2/$tdir
1128 replay_barrier $SINGLEMDS
1129 do_node $CLIENT2 mcreate $MOUNT2/$tdir/$tfile
1130 do_node $CLIENT1 createmany -o $DIR/$tfile- 25
1131 #client1 read data from client2 which will be lost
1132 do_node $CLIENT1 $CHECKSTAT $DIR/$tdir/$tfile
1133 do_node $CLIENT1 createmany -o $DIR/$tfile-3- 25
1134 zconf_umount $CLIENT2 $MOUNT2
1136 facet_failover $SINGLEMDS
1137 # recovery shouldn't fail due to missing client 2
1138 client_up $CLIENT1 || return 1
1140 # All 50 files should have been replayed
1141 do_node $CLIENT1 unlinkmany $DIR/$tfile- 25 || return 2
1142 do_node $CLIENT1 unlinkmany $DIR/$tfile-3- 25 || return 3
1143 do_node $CLIENT1 $CHECKSTAT $DIR/$tdir/$tfile && return 4
1147 run_test 12a "lost data due to missed REMOTE client during replay"
1149 #restore COS setting
1150 restore_lustre_params < $cos_param_file
1151 rm -f $cos_param_file
1153 [ "$CLIENTS" ] && zconf_mount_clients $CLIENTS $DIR
1155 complete $(basename $0) $SECONDS
1156 check_and_cleanup_lustre