6 ALWAYS_EXCEPT="12a $REPLAY_VBR_EXCEPT"
9 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
12 MOUNT_2=${MOUNT_2:-"yes"}
13 . $LUSTRE/tests/test-framework.sh
15 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
18 remote_mds_nodsh && log "SKIP: remote MDS with nodsh" && exit 0
20 [ "$SLOW" = "no" ] && EXCEPT_SLOW="7"
24 check_and_setup_lustre
27 rm -rf $DIR/[df][0-9]*
29 [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
31 # if there is no CLIENT1 defined, some tests can be ran on localhost
32 CLIENT1=${CLIENT1:-$HOSTNAME}
33 # if CLIENT2 doesn't exist then use CLIENT1 instead
34 # All tests should use CLIENT2 with MOUNT2 only therefore it will work if
36 # Exception is the test which need two separate nodes
37 CLIENT2=${CLIENT2:-$CLIENT1}
39 is_mounted $MOUNT2 || error "MOUNT2 is not mounted"
46 # We need to run do_node in bg, because pdsh does not exit
47 # if child process of run script exists.
48 # I.e. pdsh does not exit when runmultiop_bg_pause exited,
49 # because of multiop_bg_pause -> $MULTIOP_PROG &
50 # By the same reason we need sleep a bit after do_nodes starts
51 # to let runmultiop_bg_pause start muliop and
52 # update /tmp/multiop_bg.pid ;
53 # The rm /tmp/multiop_bg.pid guarantees here that
54 # we have the updated by runmultiop_bg_pause
55 # /tmp/multiop_bg.pid file
57 local pid_file=$TMP/multiop_bg.pid.$$
58 do_node $client "MULTIOP_PID_FILE=$pid_file LUSTRE= sh runmultiop_bg_pause $file $cmds" &
62 multiop_pid=$(do_node $client cat $pid_file)
63 [ -n "$multiop_pid" ] || error "$client : Can not get multiop_pid from $pid_file "
64 eval export $(node_var_name $client)_multiop_pid=$multiop_pid
65 eval export $(node_var_name $client)_do_node_pid=$pid
66 local var=$(node_var_name $client)_multiop_pid
67 echo client $client multiop_bg started multiop_pid=${!var}
73 local multiop_pid=$(node_var_name $client)_multiop_pid
74 local do_node_pid=$(node_var_name $client)_do_node_pid
76 echo "Stopping multiop_pid=${!multiop_pid} (kill ${!multiop_pid} on $client)"
77 do_node $client kill -USR1 ${!multiop_pid}
83 local var=${SINGLEMDS}_svc
88 fid=$(do_node $client $LFS path2fid $file)
89 do_facet $SINGLEMDS $LCTL --device ${!var} getobjversion \\\"$fid\\\"
93 cos_param_file=$TMP/rvbr-cos-params
94 save_lustre_params $(comma_list $(mdts_nodes)) "mdt.*.commit_on_sharing" > $cos_param_file
97 get_version $CLIENT1 $DIR/$tdir/1a || true
99 run_test 0a "getversion for non existent file shouldn't cause kernel panic"
102 local var=${SINGLEMDS}_svc
104 local file=$DIR/$tdir/f
106 do_node $CLIENT1 mkdir -p $DIR/$tdir/
107 do_node $CLIENT1 touch $file
108 fid=$(do_node $CLIENT1 $LFS path2fid $file)
109 do_node $CLIENT1 rm -rf $file
110 do_facet $SINGLEMDS $LCTL --device ${!var} getobjversion \\\"$fid\\\" || true
112 run_test 0b "getversion for non existent fid shouldn't cause kernel panic"
115 test_1a() { # former test_0a
116 local file=$DIR/$tfile
120 do_node $CLIENT1 mcreate $file
121 pre=$(get_version $CLIENT1 $file)
122 do_node $CLIENT1 openfile -f O_RDWR $file
123 post=$(get_version $CLIENT1 $file)
124 if (($pre != $post)); then
125 error "version changed unexpectedly: pre $pre, post $post"
128 run_test 1a "open and close do not change versions"
130 test_1b() { # former test_0b
131 local var=${SINGLEMDS}_svc
132 zconf_mount $CLIENT2 $MOUNT2
134 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
135 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
136 do_node $CLIENT1 mkdir -p -m 755 $MOUNT/$tdir
138 replay_barrier $SINGLEMDS
139 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
140 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT $MOUNT/$tdir/$tfile
141 zconf_umount $CLIENT2 $MOUNT2
142 facet_failover $SINGLEMDS
144 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
145 if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
146 error "open succeeded unexpectedly"
149 run_test 1b "open (O_CREAT) checks version of parent"
151 test_1c() { # former test_0c
152 local var=${SINGLEMDS}_svc
153 zconf_mount $CLIENT2 $MOUNT2
155 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
156 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
158 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
159 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tdir/$tfile
161 replay_barrier $SINGLEMDS
162 do_node $CLIENT2 chmod 0777 $MOUNT2/$tdir
163 do_node $CLIENT2 chmod 0666 $MOUNT2/$tdir/$tfile
164 rmultiop_start $CLIENT1 $DIR/$tdir/$tfile o_c
165 zconf_umount $CLIENT2 $MOUNT2
166 facet_failover $SINGLEMDS
168 client_up $CLIENT1 || error "$CLIENT1 evicted"
169 rmultiop_stop $CLIENT1 || error "close failed"
171 run_test 1c "open (non O_CREAT) does not checks versions"
173 # test set #2: CREAT (not open)
174 # - version of parent is not changed but checked
175 # - pre-version should be -1
176 # - post-version should be valid
177 test_2a() { # extended former test_0d
182 pre=$(get_version $CLIENT1 $DIR)
183 do_node $CLIENT1 mkfifo $DIR/$tfile-fifo
184 post=$(get_version $CLIENT1 $DIR)
185 if (($pre != $post)); then
186 error "version was changed: pre $pre, post $post"
189 pre=$(get_version $CLIENT1 $DIR)
190 do_node $CLIENT1 mkdir $DIR/$tfile-dir
191 post=$(get_version $CLIENT1 $DIR)
192 if (($pre != $post)); then
193 error "version was changed: pre $pre, post $post"
195 do_node $CLIENT1 rmdir $DIR/$tfile-dir
198 pre=$(get_version $CLIENT1 $DIR)
199 do_node $CLIENT1 mkfifo $DIR/$tfile-nod
200 post=$(get_version $CLIENT1 $DIR)
201 if (($pre != $post)); then
202 error "version was changed: pre $pre, post $post"
205 pre=$(get_version $CLIENT1 $DIR)
206 do_node $CLIENT1 mkfifo $DIR/$tfile-symlink
207 post=$(get_version $CLIENT1 $DIR)
208 if (($pre != $post)); then
209 error "version was changed: pre $pre, post $post"
211 do_node $CLIENT1 rm $DIR/$tfile-*
214 run_test 2a "create operations doesn't change version of parent"
216 test_2b() { # former test_0e
217 local var=${SINGLEMDS}_svc
218 zconf_mount $CLIENT2 $MOUNT2
220 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
221 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
223 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
225 replay_barrier $SINGLEMDS
226 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
227 do_node $CLIENT1 mkfifo $DIR/$tdir/$tfile
228 zconf_umount $CLIENT2 $MOUNT2
229 facet_failover $SINGLEMDS
231 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
232 if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
233 error "create succeeded unexpectedly"
236 run_test 2b "create checks version of parent"
238 test_3a() { # former test_0f
242 do_node $CLIENT1 mcreate $DIR/$tfile
243 pre=$(get_version $CLIENT1 $DIR)
244 do_node $CLIENT1 rm $DIR/$tfile
245 post=$(get_version $CLIENT1 $DIR)
246 if (($pre != $post)); then
247 error "version was changed: pre $pre, post $post"
250 run_test 3a "unlink doesn't change version of parent"
252 test_3b() { # former test_0g
253 local var=${SINGLEMDS}_svc
254 zconf_mount $CLIENT2 $MOUNT2
256 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
257 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
259 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
260 do_node $CLIENT1 mcreate $DIR/$tdir/$tfile
262 replay_barrier $SINGLEMDS
263 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
264 do_node $CLIENT1 rm $DIR/$tdir/$tfile
265 zconf_umount $CLIENT2 $MOUNT2
266 facet_failover $SINGLEMDS
268 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
269 if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
270 error "unlink succeeded unexpectedly"
273 run_test 3b "unlink checks version of parent"
275 test_4a() { # former test_0h
276 local file=$DIR/$tfile
280 do_node $CLIENT1 mcreate $file
281 pre=$(get_version $CLIENT1 $file)
282 do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $file
283 post=$(get_version $CLIENT1 $file)
284 if (($pre == $post)); then
285 error "version not changed: pre $pre, post $post"
288 run_test 4a "setattr of UID changes versions"
290 test_4b() { # former test_0i
291 local file=$DIR/$tfile
295 do_node $CLIENT1 mcreate $file
296 pre=$(get_version $CLIENT1 $file)
297 do_node $CLIENT1 chgrp $RUNAS_GID $file
298 post=$(get_version $CLIENT1 $file)
299 if (($pre == $post)); then
300 error "version not changed: pre $pre, post $post"
303 run_test 4b "setattr of GID changes versions"
305 test_4c() { # former test_0j
306 local file=$DIR/$tfile
307 local var=${SINGLEMDS}_svc
308 zconf_mount $CLIENT2 $MOUNT2
310 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
311 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
313 do_node $CLIENT1 mcreate $file
315 replay_barrier $SINGLEMDS
316 do_node $CLIENT2 chgrp $RUNAS_GID $MOUNT2/$tfile
317 do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $file
318 zconf_umount $CLIENT2 $MOUNT2
319 facet_failover $SINGLEMDS
321 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
322 if ! do_node $CLIENT1 $CHECKSTAT -u \\\#$UID $file; then
323 error "setattr of UID succeeded unexpectedly"
326 run_test 4c "setattr of UID checks versions"
328 test_4d() { # former test_0k
329 local file=$DIR/$tfile
330 local var=${SINGLEMDS}_svc
331 zconf_mount $CLIENT2 $MOUNT2
333 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
334 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
336 do_node $CLIENT1 mcreate $file
338 replay_barrier $SINGLEMDS
339 do_node $CLIENT2 chown $RUNAS_ID:$RUNAS_GID $MOUNT2/$tfile
340 do_node $CLIENT1 chgrp $RUNAS_GID $file
341 zconf_umount $CLIENT2 $MOUNT2
342 facet_failover $SINGLEMDS
344 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
345 if ! do_node $CLIENT1 $CHECKSTAT -g \\\#$UID $file; then
346 error "setattr of GID succeeded unexpectedly"
349 run_test 4d "setattr of GID checks versions"
351 test_4e() { # former test_0l
352 local file=$DIR/$tfile
356 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
357 pre=$(get_version $CLIENT1 $file)
358 do_node $CLIENT1 chmod 666 $file
359 post=$(get_version $CLIENT1 $file)
360 if (($pre == $post)); then
361 error "version not changed: pre $pre, post $post"
364 run_test 4e "setattr of permission changes versions"
366 test_4f() { # former test_0m
367 local file=$DIR/$tfile
368 local var=${SINGLEMDS}_svc
369 zconf_mount $CLIENT2 $MOUNT2
371 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
372 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
374 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
376 replay_barrier $SINGLEMDS
377 do_node $CLIENT2 chgrp $RUNAS_GID $MOUNT2/$tfile
378 do_node $CLIENT1 chmod 666 $file
379 zconf_umount $CLIENT2 $MOUNT2
380 facet_failover $SINGLEMDS
382 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
383 if ! do_node $CLIENT1 $CHECKSTAT -p 0644 $file; then
384 error "setattr of permission succeeded unexpectedly"
387 run_test 4f "setattr of permission checks versions"
389 test_4g() { # former test_0n
390 local file=$DIR/$tfile
394 do_node $CLIENT1 mcreate $file
395 pre=$(get_version $CLIENT1 $file)
396 do_node $CLIENT1 chattr +i $file
397 post=$(get_version $CLIENT1 $file)
398 do_node $CLIENT1 chattr -i $file
399 if (($pre == $post)); then
400 error "version not changed: pre $pre, post $post"
403 run_test 4g "setattr of flags changes versions"
411 if ((${#attr} != 1)); then
412 error "checking multiple attributes not implemented yet"
414 do_node $client lsattr $file | cut -d ' ' -f 1 | grep -q $attr
417 test_4h() { # former test_0o
418 local file=$DIR/$tfile
420 local var=${SINGLEMDS}_svc
421 zconf_mount $CLIENT2 $MOUNT2
423 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
424 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
426 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
428 replay_barrier $SINGLEMDS
429 do_node $CLIENT2 chmod 666 $MOUNT2/$tfile
430 do_node $CLIENT1 chattr +i $file
431 zconf_umount $CLIENT2 $MOUNT2
432 facet_failover $SINGLEMDS
434 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
435 checkattr $CLIENT1 i $file
437 do_node $CLIENT1 chattr -i $file
438 if [ $rc -eq 0 ]; then
439 error "setattr of flags succeeded unexpectedly"
442 run_test 4h "setattr of flags checks versions"
444 test_4i() { # former test_0p
445 local file=$DIR/$tfile
449 local var=${SINGLEMDS}_svc
451 ad_orig=$(do_facet $SINGLEMDS "$LCTL get_param mdd.${!var}.atime_diff")
452 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.atime_diff=0"
453 do_node $CLIENT1 mcreate $file
454 pre=$(get_version $CLIENT1 $file)
455 do_node $CLIENT1 touch $file
456 post=$(get_version $CLIENT1 $file)
458 # We don't fail MDS in this test. atime_diff shall be
459 # restored to its original value.
461 do_facet $SINGLEMDS "$LCTL set_param $ad_orig"
462 if (($pre != $post)); then
463 error "version changed unexpectedly: pre $pre, post $post"
466 run_test 4i "setattr of times does not change versions"
468 test_4j() { # former test_0q
469 local file=$DIR/$tfile
473 do_node $CLIENT1 mcreate $file
474 pre=$(get_version $CLIENT1 $file)
475 do_node $CLIENT1 $TRUNCATE $file 1
476 post=$(get_version $CLIENT1 $file)
477 if (($pre != $post)); then
478 error "version changed unexpectedly: pre $pre, post $post"
481 run_test 4j "setattr of size does not change versions"
483 test_4k() { # former test_0r
484 local file=$DIR/$tfile
488 local var=${SINGLEMDS}_svc
489 zconf_mount $CLIENT2 $MOUNT2
491 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
492 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.atime_diff=0"
493 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
495 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
497 replay_barrier $SINGLEMDS
498 do_node $CLIENT2 chmod 666 $MOUNT2/$tfile
499 do_node $CLIENT1 $TRUNCATE $file 1
501 mtime_pre=$(do_node $CLIENT1 stat --format=%Y $file)
502 do_node $CLIENT1 touch $file
503 sleep 1 # avoid stat caching
504 mtime_post=$(do_node $CLIENT1 stat --format=%Y $file)
505 zconf_umount $CLIENT2 $MOUNT2
506 facet_failover $SINGLEMDS
508 client_up $CLIENT1 || error "$CLIENT1 evicted"
509 if (($mtime_pre >= $mtime_post)); then
510 error "time not changed: pre $mtime_pre, post $mtime_post"
512 if ! do_node $CLIENT1 $CHECKSTAT -s 1 $file; then
513 error "setattr of size failed"
515 mtime=$(do_node $CLIENT1 stat --format=%Y $file)
516 if (($mtime != $mtime_post)); then
517 error "setattr of times failed: expected $mtime_post, got $mtime"
520 run_test 4k "setattr of times and size does not check versions"
522 test_5a() { # former test_0s
528 do_node $CLIENT1 mcreate $DIR/$tfile
529 do_node $CLIENT1 mkdir -p $DIR/$tdir
530 pre=$(get_version $CLIENT1 $DIR/$tfile)
531 tp_pre=$(get_version $CLIENT1 $DIR/$tdir)
532 do_node $CLIENT1 link $DIR/$tfile $DIR/$tdir/$tfile
533 post=$(get_version $CLIENT1 $DIR/$tfile)
534 tp_post=$(get_version $CLIENT1 $DIR/$tdir)
535 if (($pre == $post)); then
536 error "version of source not changed: pre $pre, post $post"
538 if (($tp_pre != $tp_post)); then
539 error "version of target parent was changed: pre $tp_pre, post $tp_post"
542 run_test 5a "link changes versions of source but not target parent"
544 test_5b() { # former test_0t
545 local var=${SINGLEMDS}_svc
546 zconf_mount $CLIENT2 $MOUNT2
548 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
549 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
551 do_node $CLIENT1 mcreate $DIR/$tfile
552 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
554 replay_barrier $SINGLEMDS
555 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
556 do_node $CLIENT1 link $DIR/$tfile $DIR/$tdir/$tfile
557 zconf_umount $CLIENT2 $MOUNT2
558 facet_failover $SINGLEMDS
560 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
561 if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
562 error "link should fail"
565 run_test 5b "link checks version of target parent"
567 test_5c() { # former test_0u
568 local var=${SINGLEMDS}_svc
569 zconf_mount $CLIENT2 $MOUNT2
571 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
572 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
574 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile
575 do_node $CLIENT1 mkdir -p $DIR/$tdir
577 replay_barrier $SINGLEMDS
578 do_node $CLIENT2 chmod 666 $MOUNT2/$tfile
579 do_node $CLIENT1 link $DIR/$tfile $DIR/$tdir/$tfile
580 zconf_umount $CLIENT2 $MOUNT2
581 facet_failover $SINGLEMDS
583 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
584 if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
585 error "link should fail"
588 run_test 5c "link checks version of source"
590 test_6a() { # former test_0v
596 do_node $CLIENT1 mcreate $DIR/$tfile
597 do_node $CLIENT1 mkdir -p $DIR/$tdir
598 sp_pre=$(get_version $CLIENT1 $DIR)
599 tp_pre=$(get_version $CLIENT1 $DIR/$tdir)
600 do_node $CLIENT1 mv $DIR/$tfile $DIR/$tdir/$tfile
601 sp_post=$(get_version $CLIENT1 $DIR)
602 tp_post=$(get_version $CLIENT1 $DIR/$tdir)
603 if (($sp_pre != $sp_post)); then
604 error "version of source parent was changed: pre $sp_pre, post $sp_post"
606 if (($tp_pre != $tp_post)); then
607 error "version of target parent was changed: pre $tp_pre, post $tp_post"
610 run_test 6a "rename doesn't change versions of source parent and target parent"
612 test_6b() { # former test_0w
616 do_node $CLIENT1 mcreate $DIR/$tfile
617 pre=$(get_version $CLIENT1 $DIR)
618 do_node $CLIENT1 mv $DIR/$tfile $DIR/$tfile-new
619 post=$(get_version $CLIENT1 $DIR)
620 if (($pre != $post)); then
621 error "version of parent was changed: pre $pre, post $post"
624 run_test 6b "rename within same dir doesn't change version of parent"
626 test_6c() { # former test_0x
627 local var=${SINGLEMDS}_svc
628 zconf_mount $CLIENT2 $MOUNT2
630 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
631 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
633 do_node $CLIENT1 mcreate $DIR/$tfile
634 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
636 replay_barrier $SINGLEMDS
637 do_node $CLIENT2 chmod 777 $MOUNT2
638 do_node $CLIENT1 mv $DIR/$tfile $DIR/$tdir/$tfile
639 zconf_umount $CLIENT2 $MOUNT2
640 facet_failover $SINGLEMDS
642 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
643 if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tfile; then
644 error "rename should fail"
647 run_test 6c "rename checks version of source parent"
649 test_6d() { # former test_0y
650 local var=${SINGLEMDS}_svc
651 zconf_mount $CLIENT2 $MOUNT2
653 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
654 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
656 do_node $CLIENT1 mcreate $DIR/$tfile
657 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
659 replay_barrier $SINGLEMDS
660 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
661 do_node $CLIENT1 mv $DIR/$tfile $DIR/$tdir/$tfile
662 zconf_umount $CLIENT2 $MOUNT2
663 facet_failover $SINGLEMDS
665 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
666 if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tfile; then
667 error "rename should fail"
670 run_test 6d "rename checks version of target parent"
672 # pdirops tests, bug 18143
679 local var=${SINGLEMDS}_svc
680 zconf_mount $CLIENT2 $MOUNT2
682 local cname=$TESTNAME.$cycle
684 echo "start cycle: $cname"
685 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
686 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
688 do_node $CLIENT1 mkdir -p $DIR/$tdir
689 replay_barrier $SINGLEMDS
691 echo "$cname first: $first"
692 do_node $CLIENT1 $first || error "$cname: Cannot do first operation"
693 # client2 operations that will be lost
694 echo "$cname lost: $lost"
695 do_node $CLIENT2 $lost || error "$cname: Cannot do 'lost' operations"
697 echo "$cname last: $last"
698 do_node $CLIENT1 $last || error "$cname: Cannot do last operation"
699 zconf_umount $CLIENT2 $MOUNT2
700 facet_failover $SINGLEMDS
701 # should fail as conflict expected
702 client_evicted $CLIENT1 || rc=1
704 wait_recovery_complete $SINGLEMDS
705 wait_mds_ost_sync $SINGLEMDS
712 first="createmany -o $DIR/$tdir/$tfile- 1"
713 lost="rm $MOUNT2/$tdir/$tfile-0"
714 last="createmany -o $DIR/$tdir/$tfile- 1"
715 test_7_cycle "$first" "$lost" "$last" || error "Test 7a.1 failed"
717 first="createmany -o $DIR/$tdir/$tfile- 1"
718 lost="rm $MOUNT2/$tdir/$tfile-0"
719 last="mkdir $DIR/$tdir/$tfile-0"
720 test_7_cycle "$first" "$lost" "$last" || error "Test 7a.2 failed"
722 first="mkdir $DIR/$tdir/$tfile-0"
723 lost="mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile-1"
724 last="createmany -o $DIR/$tdir/$tfile- 1"
725 test_7_cycle "$first" "$lost" "$last" || error "Test 7a.3 failed"
728 run_test 7a "create, {lost}, create"
731 first="createmany -o $DIR/$tdir/$tfile- 1"
732 lost="rm $MOUNT2/$tdir/$tfile-0; createmany -o $MOUNT2/$tdir/$tfile- 1"
733 last="rm $DIR/$tdir/$tfile-0"
734 test_7_cycle "$first" "$lost" "$last" || error "Test 7b.1 failed"
736 first="createmany -o $DIR/$tdir/$tfile- 1"
737 lost="touch $MOUNT2/$tdir/$tfile; mv $MOUNT2/$tdir/$tfile $MOUNT2/$tdir/$tfile-0"
738 last="rm $DIR/$tdir/$tfile-0"
739 test_7_cycle "$first" "$lost" "$last" || error "Test 7b.2 failed"
741 first="createmany -o $DIR/$tdir/$tfile- 1"
742 lost="rm $MOUNT2/$tdir/$tfile-0; mkdir $MOUNT2/$tdir/$tfile-0"
743 last="rmdir $DIR/$tdir/$tfile-0"
744 test_7_cycle "$first" "$lost" "$last" || error "Test 7b.3 failed"
747 run_test 7b "create, {lost}, unlink"
750 first="createmany -o $DIR/$tdir/$tfile- 1"
751 lost="rm $MOUNT2/$tdir/$tfile-0; createmany -o $MOUNT2/$tdir/$tfile- 1"
752 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
753 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.1 failed"
755 first="createmany -o $DIR/$tdir/$tfile- 2"
756 lost="rm $MOUNT2/$tdir/$tfile-0; mkdir $MOUNT2/$tdir/$tfile-0"
757 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
758 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.2 failed"
760 first="createmany -o $DIR/$tdir/$tfile- 1; mkdir $DIR/$tdir/$tfile-1-0"
761 lost="rmdir $MOUNT2/$tdir/$tfile-1-0; createmany -o $MOUNT2/$tdir/$tfile-1- 1"
762 last="mv $DIR/$tdir/$tfile-1-0 $DIR/$tdir/$tfile-0"
763 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.3 failed"
765 first="createmany -o $DIR/$tdir/$tfile- 1"
766 lost="mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile"
767 last="mv $DIR/$tdir/$tfile $DIR/$tdir/$tfile-0"
768 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.4 failed"
771 run_test 7c "create, {lost}, rename"
774 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
775 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0"
776 last="createmany -o $DIR/$tdir/$tfile- 1"
777 test_7_cycle "$first" "$lost" "$last" && error "Test 7d.1 failed"
779 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
780 lost="mkdir $MOUNT2/$tdir/$tfile-0; rmdir $MOUNT2/$tdir/$tfile-0"
781 last="mkdir $DIR/$tdir/$tfile-0"
782 test_7_cycle "$first" "$lost" "$last" && error "Test 7d.2 failed"
784 first="mkdir $DIR/$tdir/$tfile-0; rmdir $DIR/$tdir/$tfile-0"
785 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile-1"
786 last="createmany -o $DIR/$tdir/$tfile- 1"
787 test_7_cycle "$first" "$lost" "$last" && error "Test 7d.3 failed"
790 run_test 7d "unlink, {lost}, create"
793 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
794 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0;createmany -o $MOUNT2/$tdir/$tfile- 1"
795 last="rm $DIR/$tdir/$tfile-0"
796 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.1 failed"
798 first="mkdir $DIR/$tdir/$tfile-0; rmdir $DIR/$tdir/$tfile-0"
799 lost="mkdir $MOUNT2/$tdir/$tfile-0; rmdir $MOUNT2/$tdir/$tfile-0; mkdir $MOUNT2/$tdir/$tfile-0"
800 last="rmdir $DIR/$tdir/$tfile-0"
801 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.2 failed"
803 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
804 lost="mkdir $MOUNT2/$tdir/$tfile-0"
805 last="rmdir $DIR/$tdir/$tfile-0"
806 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.3 failed"
808 first="mkdir $DIR/$tdir/$tfile-0; rmdir $DIR/$tdir/$tfile-0"
809 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
810 last="rm $DIR/$tdir/$tfile-0"
811 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.4 failed"
813 first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
814 lost="mv $MOUNT2/$tdir/$tfile-1 $MOUNT2/$tdir/$tfile-0"
815 last="rm $DIR/$tdir/$tfile-0"
816 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.5 failed"
819 run_test 7e "unlink, {lost}, unlink"
822 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
823 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
824 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
825 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.1 failed"
827 first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
828 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
829 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
830 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.2 failed"
832 first="mkdir $DIR/$tdir/$tfile; createmany -o $DIR/$tdir/$tfile- 1; rmdir $DIR/$tdir/$tfile"
833 lost="mkdir $MOUNT2/$tdir/$tfile"
834 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
835 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.3 failed"
837 first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
838 lost="mv $MOUNT2/$tdir/$tfile-1 $MOUNT2/$tdir/$tfile-0"
839 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
840 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.4 failed"
842 first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
843 lost="mkdir $MOUNT2/$tdir/$tfile-0"
844 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
845 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.5 failed"
848 run_test 7f "unlink, {lost}, rename"
851 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
852 lost="mkdir $MOUNT2/$tdir/$tfile-0;rmdir $MOUNT2/$tdir/$tfile-0"
853 last="createmany -o $DIR/$tdir/$tfile- 1"
854 test_7_cycle "$first" "$lost" "$last" && error "Test 7g.1 failed"
856 first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
857 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0"
858 last="mkdir $DIR/$tdir/$tfile-0"
859 test_7_cycle "$first" "$lost" "$last" && error "Test 7g.2 failed"
861 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
862 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
863 last="link $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
864 test_7_cycle "$first" "$lost" "$last" || error "Test 7g.3 failed"
867 run_test 7g "rename, {lost}, create"
870 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
871 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
872 last="rm $DIR/$tdir/$tfile-0"
873 test_7_cycle "$first" "$lost" "$last" || error "Test 7h.1 failed"
875 first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
876 lost="rm $MOUNT2/$tdir/$tfile-0; createmany -o $MOUNT2/$tdir/$tfile- 1"
877 last="rm $DIR/$tdir/$tfile-0"
878 test_7_cycle "$first" "$lost" "$last" || error "Test 7h.2 failed"
880 first="createmany -o $DIR/$tdir/$tfile- 1; mkdir $DIR/$tdir/$tfile; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
881 lost="rm $MOUNT2/$tdir/$tfile/$tfile-0"
882 last="rmdir $DIR/$tdir/$tfile"
883 #test_7_cycle "$first" "$lost" "$last" || error "Test 7h.3 failed"
886 run_test 7h "rename, {lost}, unlink"
889 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
890 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
891 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
892 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.1 failed"
894 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
895 lost="mkdir $MOUNT2/$tdir/$tfile-0"
896 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
897 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.1 failed"
899 first="createmany -o $DIR/$tdir/$tfile- 3; mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
900 lost="mv $MOUNT2/$tdir/$tfile-2 $MOUNT2/$tdir/$tfile-0"
901 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-2"
902 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.3 failed"
904 first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
905 lost="rm $MOUNT2/$tdir/$tfile-1"
906 last="mv $DIR/$tdir/$tfile $DIR/$tdir/$tfile-1"
907 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.4 failed"
910 run_test 7i "rename, {lost}, rename"
912 # test set #8: orphan handling bug 15392.
913 # Unlink during recovery creates orphan always just in case some late open may
914 # arrive. These orphans will be removed after recovery anyway.
915 # Tests check that valid create,unlink,create sequence will work in this case
916 # too but not fail on second create due to orphan found.
919 local var=${SINGLEMDS}_svc
920 zconf_mount $CLIENT2 $MOUNT2
922 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
924 do_node $CLIENT1 mcreate $DIR/$tfile
925 do_node $CLIENT1 mkdir $DIR/$tfile-2
926 replay_barrier $SINGLEMDS
927 # missed replay from client2 will lead to recovery by versions
928 do_node $CLIENT2 touch $MOUNT2/$tfile-2/$tfile
929 do_node $CLIENT1 rm $DIR/$tfile || return 1
930 do_node $CLIENT1 touch $DIR/$tfile || return 2
932 zconf_umount $CLIENT2 $MOUNT2
933 facet_failover $SINGLEMDS
934 client_up $CLIENT1 || return 6
936 do_node $CLIENT1 rm $DIR/$tfile || error "$tfile doesn't exists"
939 run_test 8a "create | unlink, create shouldn't fail"
942 local var=${SINGLEMDS}_svc
943 zconf_mount $CLIENT2 $MOUNT2
945 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
947 do_node $CLIENT1 touch $DIR/$tfile
948 do_node $CLIENT1 mkdir $DIR/$tfile-2
949 replay_barrier $SINGLEMDS
950 # missed replay from client2 will lead to recovery by versions
951 do_node $CLIENT2 touch $MOUNT2/$tfile-2/$tfile
952 do_node $CLIENT1 rm -f $MOUNT1/$tfile || return 1
953 do_node $CLIENT1 mcreate $MOUNT1/$tfile || return 2
955 zconf_umount $CLIENT2 $MOUNT2
956 facet_failover $SINGLEMDS
957 client_up $CLIENT1 || return 6
959 do_node $CLIENT1 rm $MOUNT1/$tfile || error "$tfile doesn't exists"
962 run_test 8b "create | unlink, create shouldn't fail"
965 local var=${SINGLEMDS}_svc
966 zconf_mount $CLIENT2 $MOUNT2
968 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
970 do_node $CLIENT1 touch $DIR/$tfile
971 do_node $CLIENT1 mkdir $DIR/$tfile-2
972 replay_barrier $SINGLEMDS
973 # missed replay from client2 will lead to recovery by versions
974 do_node $CLIENT2 touch $MOUNT2/$tfile-2/$tfile
975 do_node $CLIENT1 rm -f $MOUNT1/$tfile || return 1
976 do_node $CLIENT1 mkdir $MOUNT1/$tfile || return 2
978 zconf_umount $CLIENT2 $MOUNT2
979 facet_failover $SINGLEMDS
980 client_up $CLIENT1 || return 6
982 do_node $CLIENT1 rmdir $MOUNT1/$tfile || error "$tfile doesn't exists"
985 run_test 8c "create | unlink, create shouldn't fail"
988 # This test uses three Lustre clients on two hosts.
990 # Lustre Client 1: $CLIENT1:$MOUNT ($DIR)
991 # Lustre Client 2: $CLIENT2:$MOUNT2 ($DIR2)
992 # Lustre Client 3: $CLIENT2:$MOUNT1 ($DIR1)
994 test_10b() { # former test_2b
997 local var=${SINGLEMDS}_svc
999 [ -n "$CLIENTS" ] || { skip "Need two or more clients" && exit 0; }
1000 [ $CLIENTCOUNT -ge 2 ] || \
1001 { skip "Need two or more clients, have $CLIENTCOUNT" && exit 0; }
1003 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
1004 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1006 zconf_mount $CLIENT1 $MOUNT
1007 zconf_mount $CLIENT2 $MOUNT1
1008 zconf_mount $CLIENT2 $MOUNT2
1009 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile-a
1010 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile-b
1013 # Save an MDT transaction number before recovery.
1015 do_node $CLIENT1 touch $DIR1/$tfile
1016 pre=$(get_version $CLIENT1 $DIR/$tfile)
1019 # Comments on the replay sequence state the expected result
1023 # "U" Unable to replay.
1026 replay_barrier $SINGLEMDS
1027 do_node $CLIENT1 chmod 666 $DIR/$tfile-a # R
1028 do_node $CLIENT2 chmod 666 $DIR1/$tfile-b # R
1029 do_node $CLIENT2 chgrp $RUNAS_GID $DIR2/$tfile-a # U
1030 do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile-a # J
1031 do_node $CLIENT2 $TRUNCATE $DIR2/$tfile-b 1 # U
1032 do_node $CLIENT2 chgrp $RUNAS_GID $DIR1/$tfile-b # R
1033 do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile-b # R
1034 zconf_umount $CLIENT2 $MOUNT2
1035 facet_failover $SINGLEMDS
1037 client_evicted $CLIENT1 || error "$CLIENT1:$MOUNT not evicted"
1038 client_up $CLIENT2 || error "$CLIENT2:$MOUNT1 evicted"
1041 # Check the MDT epoch. $post must be the first transaction
1042 # number assigned after recovery.
1044 do_node $CLIENT2 chmod 666 $DIR1/$tfile
1045 post=$(get_version $CLIENT2 $DIR1/$tfile)
1046 if (($(($pre >> 32)) == $((post >> 32)))); then
1047 error "epoch not changed: pre $pre, post $post"
1050 if (($(($post & 0x00000000ffffffff)) != 1)); then
1051 error "transno should restart from one: got $post"
1054 do_node $CLIENT2 stat $DIR1/$tfile-a
1055 do_node $CLIENT2 stat $DIR1/$tfile-b
1057 do_node $CLIENT2 $CHECKSTAT -p 0666 -u \\\#$UID -g \\\#$UID \
1058 $DIR1/$tfile-a || error "$DIR/$tfile-a: unexpected state"
1059 do_node $CLIENT2 $CHECKSTAT -p 0666 -u \\\#$RUNAS_ID -g \\\#$RUNAS_GID \
1060 $DIR1/$tfile-b || error "$DIR/$tfile-b: unexpected state"
1062 zconf_umount $CLIENT2 $MOUNT1
1064 run_test 10b "3 clients: some, none, and all reqs replayed"
1066 # test set #11: operations in single directory
1068 local var=${SINGLEMDS}_svc
1069 zconf_mount $CLIENT2 $MOUNT2
1071 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1073 replay_barrier $SINGLEMDS
1075 do_node $CLIENT1 createmany -o $DIR/$tfile-1- 100 &
1077 do_node $CLIENT2 createmany -o $MOUNT2/$tfile-2- 100
1078 zconf_umount $CLIENT2 $MOUNT2
1081 facet_failover $SINGLEMDS
1082 # recovery shouldn't fail due to missing client 2
1083 client_up $CLIENT1 || return 1
1084 # All files from client1 should have been replayed
1085 do_node $CLIENT1 unlinkmany $DIR/$tfile-1- 100 || return 2
1087 [ -e $DIR/$tdir/$tfile-2-0 ] && error "$tfile-2-0 exists"
1090 run_test 11a "concurrent creates don't affect each other"
1093 local var=${SINGLEMDS}_svc
1094 zconf_mount $CLIENT2 $MOUNT2
1096 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1098 do_node $CLIENT2 createmany -o $MOUNT2/$tfile-2- 100
1100 replay_barrier $SINGLEMDS
1101 do_node $CLIENT1 createmany -o $DIR/$tfile-1- 100 &
1103 do_node $CLIENT2 unlinkmany -o $MOUNT2/$tfile-2- 100
1104 zconf_umount $CLIENT2 $MOUNT2
1107 facet_failover $SINGLEMDS
1108 # recovery shouldn't fail due to missing client 2
1109 client_up $CLIENT1 || return 1
1110 # All files from client1 should have been replayed
1111 do_node $CLIENT1 unlinkmany $DIR/$tfile-1- 100 || return 2
1113 [ -e $DIR/$tdir/$tfile-2-0 ] && error "$tfile-2-0 exists"
1116 run_test 11b "concurrent creates and unlinks don't affect each other"
1118 # test set #12: lock replay with VBR, bug 16356
1119 test_12a() { # former test_2a
1120 local var=${SINGLEMDS}_svc
1121 zconf_mount $CLIENT2 $MOUNT2
1123 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1125 do_node $CLIENT2 mkdir -p $MOUNT2/$tdir
1126 replay_barrier $SINGLEMDS
1127 do_node $CLIENT2 mcreate $MOUNT2/$tdir/$tfile
1128 do_node $CLIENT1 createmany -o $DIR/$tfile- 25
1129 #client1 read data from client2 which will be lost
1130 do_node $CLIENT1 $CHECKSTAT $DIR/$tdir/$tfile
1131 do_node $CLIENT1 createmany -o $DIR/$tfile-3- 25
1132 zconf_umount $CLIENT2 $MOUNT2
1134 facet_failover $SINGLEMDS
1135 # recovery shouldn't fail due to missing client 2
1136 client_up $CLIENT1 || return 1
1138 # All 50 files should have been replayed
1139 do_node $CLIENT1 unlinkmany $DIR/$tfile- 25 || return 2
1140 do_node $CLIENT1 unlinkmany $DIR/$tfile-3- 25 || return 3
1141 do_node $CLIENT1 $CHECKSTAT $DIR/$tdir/$tfile && return 4
1145 run_test 12a "lost data due to missed REMOTE client during replay"
1147 #restore COS setting
1148 restore_lustre_params < $cos_param_file
1149 rm -f $cos_param_file
1151 [ "$CLIENTS" ] && zconf_mount_clients $CLIENTS $DIR
1153 complete $(basename $0) $SECONDS
1154 check_and_cleanup_lustre