5 MOUNT_2=${MOUNT_2:-"yes"}
7 LUSTRE=${LUSTRE:-$(dirname $0)/..}
8 . $LUSTRE/tests/test-framework.sh
12 remote_mds_nodsh && log "SKIP: remote MDS with nodsh" && exit 0
14 ALWAYS_EXCEPT=" $REPLAY_VBR_EXCEPT"
17 [ "$SLOW" = "no" ] && EXCEPT_SLOW="7 "
21 check_and_setup_lustre
24 rm -rf $DIR/[df][0-9]*
26 [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
28 # if there is no CLIENT1 defined, some tests can be ran on localhost
29 CLIENT1=${CLIENT1:-$HOSTNAME}
30 # if CLIENT2 doesn't exist then use CLIENT1 instead
31 # All tests should use CLIENT2 with MOUNT2 only therefore it will work if
33 # Exception is the test which need two separate nodes
34 CLIENT2=${CLIENT2:-$CLIENT1}
36 is_mounted $MOUNT2 || error "MOUNT2 is not mounted"
39 # get_version(): Gets the version of an object on servers
40 # Parameter1: Client/Machine Name
41 # Parameter2: File Path
42 # Returns: Objectversion Or -1 if getobjversion fails.
45 local var=${SINGLEMDS}_svc
48 local fid=$(do_node $client $LFS path2fid $file)
49 local objver=$(do_facet $SINGLEMDS $LCTL --device ${!var} \
50 getobjversion \\\"$fid\\\")
52 [[ -z $objver ]] && objver=-1
57 # chk_get_version(): Wrapper to get_version().
58 # Parameter1: Client/Machine Name
59 # Parameter2: File Path
60 # Returns: Objectversion Or Exit with error in case objver is -1.
63 local objver=$(get_version $1 $2)
65 [[ "$objver" == "-1" ]] && error "object version is empty."
71 cos_param_file=$TMP/rvbr-cos-params
72 save_lustre_params $(get_facets MDS) "mdt.*.commit_on_sharing" > $cos_param_file
77 local ver=$(get_version $CLIENT1 $DIR/$tdir/1a)
79 [[ "$ver" == "-1" ]] && return 0
82 run_test 0a "getversion for non existent file shouldn't cause kernel panic"
85 local var=${SINGLEMDS}_svc
87 local file=$DIR/$tdir/f
89 do_node $CLIENT1 mkdir -p $DIR/$tdir/
90 do_node $CLIENT1 touch $file
91 fid=$(do_node $CLIENT1 $LFS path2fid $file)
92 do_node $CLIENT1 rm -rf $file
93 do_facet $SINGLEMDS $LCTL --device ${!var} getobjversion \\\"$fid\\\" || true
95 run_test 0b "getversion for non existent fid shouldn't cause kernel panic"
98 test_1a() { # former test_0a
99 local file=$DIR/$tfile
103 do_node $CLIENT1 mcreate $file
104 pre=$(chk_get_version $CLIENT1 $file)
105 do_node $CLIENT1 openfile -f O_RDWR $file
106 post=$(chk_get_version $CLIENT1 $file)
107 if (($pre != $post)); then
108 error "version changed unexpectedly: pre $pre, post $post"
111 run_test 1a "open and close do not change versions"
113 test_1b() { # former test_0b
114 local var=${SINGLEMDS}_svc
115 zconf_mount $CLIENT2 $MOUNT2
117 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
118 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
119 do_node $CLIENT1 $LFS mkdir -i 0 -c 1 $MOUNT/$tdir
121 replay_barrier $SINGLEMDS
122 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
123 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT $MOUNT/$tdir/$tfile
124 zconf_umount $CLIENT2 $MOUNT2
125 facet_failover $SINGLEMDS
127 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
128 if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
129 error_and_remount "open succeeded unexpectedly"
132 run_test 1b "open (O_CREAT) checks version of parent"
134 test_1c() { # former test_0c
135 local var=${SINGLEMDS}_svc
136 zconf_mount $CLIENT2 $MOUNT2
138 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
139 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
141 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
142 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tdir/$tfile
144 replay_barrier $SINGLEMDS
145 do_node $CLIENT2 chmod 0777 $MOUNT2/$tdir
146 do_node $CLIENT2 chmod 0666 $MOUNT2/$tdir/$tfile
147 rmultiop_start $CLIENT1 $DIR/$tdir/$tfile o_c
148 zconf_umount $CLIENT2 $MOUNT2
149 facet_failover $SINGLEMDS
151 client_up $CLIENT1 || error "$CLIENT1 evicted"
152 rmultiop_stop $CLIENT1 || error "close failed"
154 run_test 1c "open (non O_CREAT) does not checks versions"
156 # test set #2: CREAT (not open)
157 # - version of parent is not changed but checked
158 # - pre-version should be -1
159 # - post-version should be valid
160 test_2a() { # extended former test_0d
165 pre=$(chk_get_version $CLIENT1 $DIR)
166 do_node $CLIENT1 mkfifo $DIR/$tfile-fifo
167 post=$(chk_get_version $CLIENT1 $DIR)
168 if (($pre != $post)); then
169 error "version was changed: pre $pre, post $post"
172 pre=$(chk_get_version $CLIENT1 $DIR)
173 do_node $CLIENT1 mkdir $DIR/$tfile-dir
174 post=$(chk_get_version $CLIENT1 $DIR)
175 if (($pre != $post)); then
176 error "version was changed: pre $pre, post $post"
178 do_node $CLIENT1 rmdir $DIR/$tfile-dir
181 pre=$(chk_get_version $CLIENT1 $DIR)
182 do_node $CLIENT1 mkfifo $DIR/$tfile-nod
183 post=$(chk_get_version $CLIENT1 $DIR)
184 if (($pre != $post)); then
185 error "version was changed: pre $pre, post $post"
188 pre=$(chk_get_version $CLIENT1 $DIR)
189 do_node $CLIENT1 mkfifo $DIR/$tfile-symlink
190 post=$(chk_get_version $CLIENT1 $DIR)
191 if (($pre != $post)); then
192 error "version was changed: pre $pre, post $post"
195 if [ $MDSCOUNT -ge 2 ]; then
198 pre=$(chk_get_version $CLIENT1 $DIR)
199 do_node $CLIENT1 $LFS mkdir -i $MDT_IDX $DIR/$tfile-remote_dir
200 post=$(chk_get_version $CLIENT1 $DIR)
201 if (($pre != $post)); then
202 error "version was changed: pre $pre, post $post"
205 do_node $CLIENT1 rm -rf $DIR/$tfile-*
208 run_test 2a "create operations doesn't change version of parent"
210 test_2b() { # former test_0e
211 local var=${SINGLEMDS}_svc
212 zconf_mount $CLIENT2 $MOUNT2
214 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
215 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
217 do_node $CLIENT1 $LFS mkdir -i 0 -c 1 $MOUNT/$tdir
219 replay_barrier $SINGLEMDS
220 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
221 do_node $CLIENT1 mkfifo $DIR/$tdir/$tfile
222 zconf_umount $CLIENT2 $MOUNT2
223 facet_failover $SINGLEMDS
225 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
226 if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
227 error_and_remount "create succeeded unexpectedly"
230 run_test 2b "create checks version of parent"
232 test_3a() { # former test_0f
236 do_node $CLIENT1 mcreate $DIR/$tfile
237 pre=$(chk_get_version $CLIENT1 $DIR)
238 do_node $CLIENT1 rm $DIR/$tfile
239 post=$(chk_get_version $CLIENT1 $DIR)
240 if (($pre != $post)); then
241 error "version was changed: pre $pre, post $post"
244 if [ $MDSCOUNT -ge 2 ]; then
247 do_node $CLIENT1 $LFS mkdir -i $MDT_IDX $DIR/$tfile-remote_dir
248 pre=$(chk_get_version $CLIENT1 $DIR)
249 do_node $CLIENT1 rmdir $DIR/$tfile-remote_dir
250 post=$(chk_get_version $CLIENT1 $DIR)
251 if (($pre != $post)); then
252 error "version was changed: pre $pre, post $post"
256 run_test 3a "unlink doesn't change version of parent"
258 test_3b() { # former test_0g
259 local var=${SINGLEMDS}_svc
260 zconf_mount $CLIENT2 $MOUNT2
262 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
263 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
265 do_node $CLIENT1 $LFS mkdir -i 0 -c 1 $MOUNT/$tdir
266 do_node $CLIENT1 mcreate $DIR/$tdir/$tfile
268 replay_barrier $SINGLEMDS
269 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
270 do_node $CLIENT1 rm $DIR/$tdir/$tfile
271 zconf_umount $CLIENT2 $MOUNT2
272 facet_failover $SINGLEMDS
274 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
275 if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
276 error_and_remount "unlink succeeded unexpectedly"
279 run_test 3b "unlink checks version of parent"
281 test_4a() { # former test_0h
282 local file=$DIR/$tfile
286 do_node $CLIENT1 mcreate $file
287 pre=$(chk_get_version $CLIENT1 $file)
288 do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $file
289 post=$(chk_get_version $CLIENT1 $file)
290 if (($pre == $post)); then
291 error "version not changed: pre $pre, post $post"
294 run_test 4a "setattr of UID changes versions"
296 test_4b() { # former test_0i
297 local file=$DIR/$tfile
301 do_node $CLIENT1 mcreate $file
302 pre=$(chk_get_version $CLIENT1 $file)
303 do_node $CLIENT1 chgrp $RUNAS_GID $file
304 post=$(chk_get_version $CLIENT1 $file)
305 if (($pre == $post)); then
306 error "version not changed: pre $pre, post $post"
309 run_test 4b "setattr of GID changes versions"
311 test_4c() { # former test_0j
312 local file=$DIR/$tfile
313 local var=${SINGLEMDS}_svc
314 zconf_mount $CLIENT2 $MOUNT2
316 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
317 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
319 do_node $CLIENT1 mcreate $file
321 replay_barrier $SINGLEMDS
322 do_node $CLIENT2 chgrp $RUNAS_GID $MOUNT2/$tfile
323 do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $file
324 zconf_umount $CLIENT2 $MOUNT2
325 facet_failover $SINGLEMDS
327 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
328 if ! do_node $CLIENT1 $CHECKSTAT -u \\\#$UID $file; then
329 error_and_remount "setattr of UID succeeded unexpectedly"
332 run_test 4c "setattr of UID checks versions"
334 test_4d() { # former test_0k
335 local file=$DIR/$tfile
336 local var=${SINGLEMDS}_svc
337 zconf_mount $CLIENT2 $MOUNT2
339 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
340 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
342 do_node $CLIENT1 mcreate $file
344 replay_barrier $SINGLEMDS
345 do_node $CLIENT2 chown $RUNAS_ID:$RUNAS_GID $MOUNT2/$tfile
346 do_node $CLIENT1 chgrp $RUNAS_GID $file
347 zconf_umount $CLIENT2 $MOUNT2
348 facet_failover $SINGLEMDS
350 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
351 if ! do_node $CLIENT1 $CHECKSTAT -g \\\#$UID $file; then
352 error_and_remount "setattr of GID succeeded unexpectedly"
355 run_test 4d "setattr of GID checks versions"
357 test_4e() { # former test_0l
358 local file=$DIR/$tfile
362 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
363 pre=$(chk_get_version $CLIENT1 $file)
364 do_node $CLIENT1 chmod 666 $file
365 post=$(chk_get_version $CLIENT1 $file)
366 if (($pre == $post)); then
367 error "version not changed: pre $pre, post $post"
370 run_test 4e "setattr of permission changes versions"
372 test_4f() { # former test_0m
373 local file=$DIR/$tfile
374 local var=${SINGLEMDS}_svc
375 zconf_mount $CLIENT2 $MOUNT2
377 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
378 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
380 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
382 replay_barrier $SINGLEMDS
383 do_node $CLIENT2 chgrp $RUNAS_GID $MOUNT2/$tfile
384 do_node $CLIENT1 chmod 666 $file
385 zconf_umount $CLIENT2 $MOUNT2
386 facet_failover $SINGLEMDS
388 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
389 if ! do_node $CLIENT1 $CHECKSTAT -p 0644 $file; then
390 error_and_remount "setattr of permission succeeded unexpectedly"
393 run_test 4f "setattr of permission checks versions"
395 test_4g() { # former test_0n
396 local file=$DIR/$tfile
400 do_node $CLIENT1 mcreate $file
401 pre=$(chk_get_version $CLIENT1 $file)
402 do_node $CLIENT1 chattr +i $file
403 post=$(chk_get_version $CLIENT1 $file)
404 do_node $CLIENT1 chattr -i $file
405 if (($pre == $post)); then
406 error "version not changed: pre $pre, post $post"
409 run_test 4g "setattr of flags changes versions"
417 if ((${#attr} != 1)); then
418 error "checking multiple attributes not implemented yet"
420 do_node $client lsattr $file | cut -d ' ' -f 1 | grep -q $attr
423 test_4h() { # former test_0o
424 local file=$DIR/$tfile
426 local var=${SINGLEMDS}_svc
427 zconf_mount $CLIENT2 $MOUNT2
429 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
430 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
432 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
434 replay_barrier $SINGLEMDS
435 do_node $CLIENT2 chmod 666 $MOUNT2/$tfile
436 do_node $CLIENT1 chattr +i $file
437 zconf_umount $CLIENT2 $MOUNT2
438 facet_failover $SINGLEMDS
440 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
441 checkattr $CLIENT1 i $file
443 do_node $CLIENT1 chattr -i $file
444 if [ $rc -eq 0 ]; then
445 error "setattr of flags succeeded unexpectedly"
448 run_test 4h "setattr of flags checks versions"
450 test_4i() { # former test_0p
451 local file=$DIR/$tfile
455 local var=${SINGLEMDS}_svc
457 ad_orig=$(do_facet $SINGLEMDS "$LCTL get_param mdd.${!var}.atime_diff")
458 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.atime_diff=0"
459 do_node $CLIENT1 mcreate $file
460 pre=$(chk_get_version $CLIENT1 $file)
461 do_node $CLIENT1 touch $file
462 post=$(chk_get_version $CLIENT1 $file)
464 # We don't fail MDS in this test. atime_diff shall be
465 # restored to its original value.
467 do_facet $SINGLEMDS "$LCTL set_param $ad_orig"
468 if (($pre != $post)); then
469 error "version changed unexpectedly: pre $pre, post $post"
472 run_test 4i "setattr of times does not change versions"
474 test_4j() { # former test_0q
475 local file=$DIR/$tfile
479 do_node $CLIENT1 mcreate $file
480 pre=$(chk_get_version $CLIENT1 $file)
481 do_node $CLIENT1 $TRUNCATE $file 1
482 post=$(chk_get_version $CLIENT1 $file)
483 if (($pre != $post)); then
484 error "version changed unexpectedly: pre $pre, post $post"
487 run_test 4j "setattr of size does not change versions"
489 test_4k() { # former test_0r
490 local file=$DIR/$tfile
494 local var=${SINGLEMDS}_svc
495 zconf_mount $CLIENT2 $MOUNT2
497 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
498 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.atime_diff=0"
499 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
501 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
503 replay_barrier $SINGLEMDS
504 do_node $CLIENT2 chmod 666 $MOUNT2/$tfile
505 do_node $CLIENT1 $TRUNCATE $file 1
507 mtime_pre=$(do_node $CLIENT1 stat --format=%Y $file)
508 do_node $CLIENT1 touch $file
509 sleep 1 # avoid stat caching
510 mtime_post=$(do_node $CLIENT1 stat --format=%Y $file)
511 zconf_umount $CLIENT2 $MOUNT2
512 facet_failover $SINGLEMDS
514 client_up $CLIENT1 || error "$CLIENT1 evicted"
515 if (($mtime_pre >= $mtime_post)); then
516 error "time not changed: pre $mtime_pre, post $mtime_post"
518 if ! do_node $CLIENT1 $CHECKSTAT -s 1 $file; then
519 error_and_remount "setattr of size failed"
521 mtime=$(do_node $CLIENT1 stat --format=%Y $file)
522 if (($mtime != $mtime_post)); then
523 error "setattr of times failed: expected $mtime_post, got $mtime"
526 run_test 4k "setattr of times and size does not check versions"
528 test_5a() { # former test_0s
534 do_node $CLIENT1 mcreate $DIR/$tfile
535 do_node $CLIENT1 $LFS mkdir -i 0 -c 1 $DIR/$tdir
536 pre=$(chk_get_version $CLIENT1 $DIR/$tfile)
537 tp_pre=$(chk_get_version $CLIENT1 $DIR/$tdir)
538 do_node $CLIENT1 link $DIR/$tfile $DIR/$tdir/$tfile
539 post=$(chk_get_version $CLIENT1 $DIR/$tfile)
540 tp_post=$(chk_get_version $CLIENT1 $DIR/$tdir)
541 if (($pre == $post)); then
542 error "version of source not changed: pre $pre, post $post"
544 if (($tp_pre != $tp_post)); then
545 error "version of target parent was changed:"\
546 "pre $tp_pre, post $tp_post"
549 run_test 5a "link changes versions of source but not target parent"
551 test_5b() { # former test_0t
552 local var=${SINGLEMDS}_svc
553 zconf_mount $CLIENT2 $MOUNT2
555 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
556 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
558 do_node $CLIENT1 mcreate $DIR/$tfile
559 do_node $CLIENT1 $LFS mkdir -i 0 -c 1 $MOUNT/$tdir
561 replay_barrier $SINGLEMDS
562 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
563 do_node $CLIENT1 link $DIR/$tfile $DIR/$tdir/$tfile
564 zconf_umount $CLIENT2 $MOUNT2
565 facet_failover $SINGLEMDS
567 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
568 if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
569 error_and_remount "link should fail"
572 run_test 5b "link checks version of target parent"
574 test_5c() { # former test_0u
575 local var=${SINGLEMDS}_svc
576 zconf_mount $CLIENT2 $MOUNT2
578 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
579 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
581 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile
582 do_node $CLIENT1 $LFS mkdir -i 0 -c 1 $MOUNT/$tdir
584 replay_barrier $SINGLEMDS
585 do_node $CLIENT2 chmod 666 $MOUNT2/$tfile
586 do_node $CLIENT1 link $DIR/$tfile $DIR/$tdir/$tfile
587 zconf_umount $CLIENT2 $MOUNT2
588 facet_failover $SINGLEMDS
590 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
591 if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
592 error_and_remount "link should fail"
595 run_test 5c "link checks version of source"
597 test_6a() { # former test_0v
603 do_node $CLIENT1 mcreate $DIR/$tfile
604 do_node $CLIENT1 $LFS mkdir -i 0 -c 1 $MOUNT/$tdir
605 sp_pre=$(chk_get_version $CLIENT1 $DIR)
606 tp_pre=$(chk_get_version $CLIENT1 $DIR/$tdir)
607 do_node $CLIENT1 mv $DIR/$tfile $DIR/$tdir/$tfile
608 sp_post=$(chk_get_version $CLIENT1 $DIR)
609 tp_post=$(chk_get_version $CLIENT1 $DIR/$tdir)
610 if (($sp_pre != $sp_post)); then
611 error "version of source parent was changed:" \
612 "pre $sp_pre, post $sp_post"
614 if (($tp_pre != $tp_post)); then
615 error "version of target parent was changed:" \
616 "pre $tp_pre, post $tp_post"
619 run_test 6a "rename doesn't change versions of source parent and target parent"
621 test_6b() { # former test_0w
625 do_node $CLIENT1 mcreate $DIR/$tfile
626 pre=$(chk_get_version $CLIENT1 $DIR)
627 do_node $CLIENT1 mv $DIR/$tfile $DIR/$tfile-new
628 post=$(chk_get_version $CLIENT1 $DIR)
629 if (($pre != $post)); then
630 error "version of parent was changed: pre $pre, post $post"
633 run_test 6b "rename within same dir doesn't change version of parent"
635 test_6c() { # former test_0x
636 local var=${SINGLEMDS}_svc
637 zconf_mount $CLIENT2 $MOUNT2
639 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
640 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
642 do_node $CLIENT1 mcreate $DIR/$tfile
643 do_node $CLIENT1 $LFS mkdir -i 0 -c 1 $MOUNT/$tdir
645 replay_barrier $SINGLEMDS
646 do_node $CLIENT2 chmod 777 $MOUNT2
647 do_node $CLIENT1 mv $DIR/$tfile $DIR/$tdir/$tfile
648 zconf_umount $CLIENT2 $MOUNT2
649 facet_failover $SINGLEMDS
651 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
652 if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tfile; then
653 error_and_remount "rename should fail"
656 run_test 6c "rename checks version of source parent"
658 test_6d() { # former test_0y
659 local var=${SINGLEMDS}_svc
660 zconf_mount $CLIENT2 $MOUNT2
662 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
663 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
665 do_node $CLIENT1 mcreate $DIR/$tfile
666 do_node $CLIENT1 $LFS mkdir -i 0 -c 1 $MOUNT/$tdir
668 replay_barrier $SINGLEMDS
669 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
670 do_node $CLIENT1 mv $DIR/$tfile $DIR/$tdir/$tfile
671 zconf_umount $CLIENT2 $MOUNT2
672 facet_failover $SINGLEMDS
674 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
675 if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tfile; then
676 error_and_remount "rename should fail"
679 run_test 6d "rename checks version of target parent"
681 # pdirops tests, bug 18143
688 local var=${SINGLEMDS}_svc
689 zconf_mount $CLIENT2 $MOUNT2
691 local cname=$TESTNAME.$cycle
693 echo "start cycle: $cname"
694 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
695 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
697 do_node $CLIENT1 $LFS mkdir -i 0 -c 1 $MOUNT/$tdir
698 replay_barrier $SINGLEMDS
700 echo "$cname first: $first"
701 do_node $CLIENT1 $first || error "$cname: Cannot do first operation"
702 # client2 operations that will be lost
703 echo "$cname lost: $lost"
704 do_node $CLIENT2 $lost || error "$cname: Cannot do 'lost' operations"
706 echo "$cname last: $last"
707 do_node $CLIENT1 $last || error "$cname: Cannot do last operation"
708 zconf_umount $CLIENT2 $MOUNT2
709 facet_failover $SINGLEMDS
710 # should fail as conflict expected
711 client_evicted $CLIENT1 || rc=1
713 wait_recovery_complete $SINGLEMDS
714 wait_mds_ost_sync || error "wait_mds_ost_sync failed"
721 first="createmany -o $DIR/$tdir/$tfile- 1"
722 lost="rm $MOUNT2/$tdir/$tfile-0"
723 last="createmany -o $DIR/$tdir/$tfile- 1"
724 test_7_cycle "$first" "$lost" "$last" || error "Test 7a.1 failed"
726 first="createmany -o $DIR/$tdir/$tfile- 1"
727 lost="rm $MOUNT2/$tdir/$tfile-0"
728 last="$LFS mkdir -i 0 -c 1 $DIR/$tdir/$tfile-0"
729 test_7_cycle "$first" "$lost" "$last" || error "Test 7a.2 failed"
731 first="mkdir $DIR/$tdir/$tfile-0"
732 lost="mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile-1"
733 last="createmany -o $DIR/$tdir/$tfile- 1"
734 test_7_cycle "$first" "$lost" "$last" || error "Test 7a.3 failed"
737 run_test 7a "create, {lost}, create"
740 first="createmany -o $DIR/$tdir/$tfile- 1"
741 lost="rm $MOUNT2/$tdir/$tfile-0; createmany -o $MOUNT2/$tdir/$tfile- 1"
742 last="rm $DIR/$tdir/$tfile-0"
743 test_7_cycle "$first" "$lost" "$last" || error "Test 7b.1 failed"
745 first="createmany -o $DIR/$tdir/$tfile- 1"
746 lost="touch $MOUNT2/$tdir/$tfile; mv $MOUNT2/$tdir/$tfile $MOUNT2/$tdir/$tfile-0"
747 last="rm $DIR/$tdir/$tfile-0"
748 test_7_cycle "$first" "$lost" "$last" || error "Test 7b.2 failed"
750 first="createmany -o $DIR/$tdir/$tfile- 1"
751 lost="rm $MOUNT2/$tdir/$tfile-0; mkdir $MOUNT2/$tdir/$tfile-0"
752 last="rmdir $DIR/$tdir/$tfile-0"
753 test_7_cycle "$first" "$lost" "$last" || error "Test 7b.3 failed"
756 run_test 7b "create, {lost}, unlink"
759 first="createmany -o $DIR/$tdir/$tfile- 1"
760 lost="rm $MOUNT2/$tdir/$tfile-0; createmany -o $MOUNT2/$tdir/$tfile- 1"
761 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
762 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.1 failed"
764 first="createmany -o $DIR/$tdir/$tfile- 2"
765 lost="rm $MOUNT2/$tdir/$tfile-0; mkdir $MOUNT2/$tdir/$tfile-0"
766 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
767 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.2 failed"
769 first="createmany -o $DIR/$tdir/$tfile- 1; mkdir $DIR/$tdir/$tfile-1-0"
770 lost="rmdir $MOUNT2/$tdir/$tfile-1-0; createmany -o $MOUNT2/$tdir/$tfile-1- 1"
771 last="mv $DIR/$tdir/$tfile-1-0 $DIR/$tdir/$tfile-0"
772 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.3 failed"
774 first="createmany -o $DIR/$tdir/$tfile- 1"
775 lost="mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile"
776 last="mv $DIR/$tdir/$tfile $DIR/$tdir/$tfile-0"
777 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.4 failed"
780 run_test 7c "create, {lost}, rename"
783 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
784 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0"
785 last="createmany -o $DIR/$tdir/$tfile- 1"
786 test_7_cycle "$first" "$lost" "$last" && error "Test 7d.1 failed"
788 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
789 lost="mkdir $MOUNT2/$tdir/$tfile-0; rmdir $MOUNT2/$tdir/$tfile-0"
790 last="mkdir $DIR/$tdir/$tfile-0"
791 test_7_cycle "$first" "$lost" "$last" && error "Test 7d.2 failed"
793 first="mkdir $DIR/$tdir/$tfile-0; rmdir $DIR/$tdir/$tfile-0"
794 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile-1"
795 last="createmany -o $DIR/$tdir/$tfile- 1"
796 test_7_cycle "$first" "$lost" "$last" && error "Test 7d.3 failed"
799 run_test 7d "unlink, {lost}, create"
802 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
803 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0;createmany -o $MOUNT2/$tdir/$tfile- 1"
804 last="rm $DIR/$tdir/$tfile-0"
805 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.1 failed"
807 first="mkdir $DIR/$tdir/$tfile-0; rmdir $DIR/$tdir/$tfile-0"
808 lost="mkdir $MOUNT2/$tdir/$tfile-0; rmdir $MOUNT2/$tdir/$tfile-0; mkdir $MOUNT2/$tdir/$tfile-0"
809 last="rmdir $DIR/$tdir/$tfile-0"
810 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.2 failed"
812 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
813 lost="mkdir $MOUNT2/$tdir/$tfile-0"
814 last="rmdir $DIR/$tdir/$tfile-0"
815 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.3 failed"
817 first="mkdir $DIR/$tdir/$tfile-0; rmdir $DIR/$tdir/$tfile-0"
818 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
819 last="rm $DIR/$tdir/$tfile-0"
820 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.4 failed"
822 first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
823 lost="mv $MOUNT2/$tdir/$tfile-1 $MOUNT2/$tdir/$tfile-0"
824 last="rm $DIR/$tdir/$tfile-0"
825 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.5 failed"
828 run_test 7e "unlink, {lost}, unlink"
831 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
832 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
833 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
834 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.1 failed"
836 first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
837 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
838 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
839 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.2 failed"
841 first="mkdir $DIR/$tdir/$tfile; createmany -o $DIR/$tdir/$tfile- 1; rmdir $DIR/$tdir/$tfile"
842 lost="mkdir $MOUNT2/$tdir/$tfile"
843 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
844 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.3 failed"
846 first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
847 lost="mv $MOUNT2/$tdir/$tfile-1 $MOUNT2/$tdir/$tfile-0"
848 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
849 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.4 failed"
851 first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
852 lost="mkdir $MOUNT2/$tdir/$tfile-0"
853 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
854 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.5 failed"
857 run_test 7f "unlink, {lost}, rename"
860 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
861 lost="mkdir $MOUNT2/$tdir/$tfile-0;rmdir $MOUNT2/$tdir/$tfile-0"
862 last="createmany -o $DIR/$tdir/$tfile- 1"
863 test_7_cycle "$first" "$lost" "$last" && error "Test 7g.1 failed"
865 first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
866 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0"
867 last="mkdir $DIR/$tdir/$tfile-0"
868 test_7_cycle "$first" "$lost" "$last" && error "Test 7g.2 failed"
870 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
871 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
872 last="link $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
873 if [ "$MDS1_VERSION" -lt $(version_code 2.5.1) ]; then
874 test_7_cycle "$first" "$lost" "$last" ||
875 error "Test 7g.3 failed"
876 else #LU-4442 LU-3528
877 test_7_cycle "$first" "$lost" "$last" &&
878 error "Test 7g.3 failed"
882 run_test 7g "rename, {lost}, create"
885 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
886 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
887 last="rm $DIR/$tdir/$tfile-0"
888 test_7_cycle "$first" "$lost" "$last" || error "Test 7h.1 failed"
890 first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
891 lost="rm $MOUNT2/$tdir/$tfile-0; createmany -o $MOUNT2/$tdir/$tfile- 1"
892 last="rm $DIR/$tdir/$tfile-0"
893 test_7_cycle "$first" "$lost" "$last" || error "Test 7h.2 failed"
895 first="createmany -o $DIR/$tdir/$tfile- 1; mkdir $DIR/$tdir/$tfile; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
896 lost="rm $MOUNT2/$tdir/$tfile/$tfile-0"
897 last="rmdir $DIR/$tdir/$tfile"
898 #test_7_cycle "$first" "$lost" "$last" || error "Test 7h.3 failed"
901 run_test 7h "rename, {lost}, unlink"
904 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
905 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
906 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
907 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.1 failed"
909 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
910 lost="mkdir $MOUNT2/$tdir/$tfile-0"
911 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
912 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.1 failed"
914 first="createmany -o $DIR/$tdir/$tfile- 3; mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
915 lost="mv $MOUNT2/$tdir/$tfile-2 $MOUNT2/$tdir/$tfile-0"
916 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-2"
917 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.3 failed"
919 first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
920 lost="rm $MOUNT2/$tdir/$tfile-1"
921 last="mv $DIR/$tdir/$tfile $DIR/$tdir/$tfile-1"
922 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.4 failed"
925 run_test 7i "rename, {lost}, rename"
927 # test set #8: orphan handling bug 15392.
928 # Unlink during recovery creates orphan always just in case some late open may
929 # arrive. These orphans will be removed after recovery anyway.
930 # Tests check that valid create,unlink,create sequence will work in this case
931 # too but not fail on second create due to orphan found.
934 local var=${SINGLEMDS}_svc
935 zconf_mount $CLIENT2 $MOUNT2
937 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
939 do_node $CLIENT1 mcreate $DIR/$tfile
940 do_node $CLIENT1 mkdir $DIR/$tfile-2
941 replay_barrier $SINGLEMDS
942 # missed replay from client2 will lead to recovery by versions
943 do_node $CLIENT2 touch $MOUNT2/$tfile-2/$tfile
944 do_node $CLIENT1 rm $DIR/$tfile || return 1
945 do_node $CLIENT1 touch $DIR/$tfile || return 2
947 zconf_umount $CLIENT2 $MOUNT2
948 facet_failover $SINGLEMDS
949 client_up $CLIENT1 || return 6
951 do_node $CLIENT1 rm $DIR/$tfile || error "$tfile doesn't exists"
954 run_test 8a "create | unlink, create shouldn't fail"
957 local var=${SINGLEMDS}_svc
958 zconf_mount $CLIENT2 $MOUNT2
960 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
962 do_node $CLIENT1 touch $DIR/$tfile
963 do_node $CLIENT1 mkdir $DIR/$tfile-2
964 replay_barrier $SINGLEMDS
965 # missed replay from client2 will lead to recovery by versions
966 do_node $CLIENT2 touch $MOUNT2/$tfile-2/$tfile
967 do_node $CLIENT1 rm -f $MOUNT1/$tfile || return 1
968 do_node $CLIENT1 mcreate $MOUNT1/$tfile || return 2
970 zconf_umount $CLIENT2 $MOUNT2
971 facet_failover $SINGLEMDS
972 client_up $CLIENT1 || return 6
974 do_node $CLIENT1 rm $MOUNT1/$tfile || error "$tfile doesn't exists"
977 run_test 8b "create | unlink, create shouldn't fail"
980 local var=${SINGLEMDS}_svc
981 zconf_mount $CLIENT2 $MOUNT2
983 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
985 do_node $CLIENT1 touch $DIR/$tfile
986 do_node $CLIENT1 mkdir $DIR/$tfile-2
987 replay_barrier $SINGLEMDS
988 # missed replay from client2 will lead to recovery by versions
989 do_node $CLIENT2 touch $MOUNT2/$tfile-2/$tfile
990 do_node $CLIENT1 rm -f $MOUNT1/$tfile || return 1
991 do_node $CLIENT1 mkdir $MOUNT1/$tfile || return 2
993 zconf_umount $CLIENT2 $MOUNT2
994 facet_failover $SINGLEMDS
995 client_up $CLIENT1 || return 6
997 do_node $CLIENT1 rmdir $MOUNT1/$tfile || error "$tfile doesn't exists"
1000 run_test 8c "create | unlink, create shouldn't fail"
1003 # This test uses three Lustre clients on two hosts.
1005 # Lustre Client 1: $CLIENT1:$MOUNT ($DIR)
1006 # Lustre Client 2: $CLIENT2:$MOUNT2 ($DIR2)
1007 # Lustre Client 3: $CLIENT2:$MOUNT1 ($DIR1)
1009 test_10b() { # former test_2b
1012 local var=${SINGLEMDS}_svc
1014 [ $CLIENTCOUNT -ge 2 ] || \
1015 { skip "Need two or more clients, have $CLIENTCOUNT" && \
1018 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
1019 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1021 zconf_mount $CLIENT1 $MOUNT
1022 zconf_mount $CLIENT2 $MOUNT1
1023 zconf_mount $CLIENT2 $MOUNT2
1024 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile-a
1025 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile-b
1028 # Save an MDT transaction number before recovery.
1030 do_node $CLIENT1 touch $DIR1/$tfile
1031 pre=$(chk_get_version $CLIENT1 $DIR/$tfile)
1034 # Comments on the replay sequence state the expected result
1038 # "U" Unable to replay.
1041 replay_barrier $SINGLEMDS
1042 do_node $CLIENT1 chmod 666 $DIR/$tfile-a # R
1043 do_node $CLIENT2 chmod 666 $DIR1/$tfile-b # R
1044 do_node $CLIENT2 chgrp $RUNAS_GID $DIR2/$tfile-a # U
1045 do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile-a # J
1046 do_node $CLIENT2 $TRUNCATE $DIR2/$tfile-b 1 # U
1047 do_node $CLIENT2 chgrp $RUNAS_GID $DIR1/$tfile-b # R
1048 do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile-b # R
1049 zconf_umount $CLIENT2 $MOUNT2
1050 facet_failover $SINGLEMDS
1052 client_evicted $CLIENT1 || error "$CLIENT1:$MOUNT not evicted"
1053 client_up $CLIENT2 || error "$CLIENT2:$MOUNT1 evicted"
1056 # Check the MDT epoch. $post must be the first transaction
1057 # number assigned after recovery.
1059 do_node $CLIENT2 chmod 666 $DIR1/$tfile
1060 post=$(chk_get_version $CLIENT2 $DIR1/$tfile)
1061 if (($(($pre >> 32)) == $((post >> 32)))); then
1062 error "epoch not changed: pre $pre, post $post"
1065 if (($(($post & 0x00000000ffffffff)) != 1)); then
1066 error "transno should restart from one: got $post"
1069 do_node $CLIENT2 stat $DIR1/$tfile-a
1070 do_node $CLIENT2 stat $DIR1/$tfile-b
1072 do_node $CLIENT2 $CHECKSTAT -p 0666 -u \\\#$UID -g \\\#$UID \
1073 $DIR1/$tfile-a || error "$DIR/$tfile-a: unexpected state"
1074 do_node $CLIENT2 $CHECKSTAT -p 0666 -u \\\#$RUNAS_ID -g \\\#$RUNAS_GID \
1075 $DIR1/$tfile-b || error "$DIR/$tfile-b: unexpected state"
1077 zconf_umount $CLIENT2 $MOUNT1
1079 run_test 10b "3 clients: some, none, and all reqs replayed"
1081 # test set #11: operations in single directory
1083 local var=${SINGLEMDS}_svc
1084 zconf_mount $CLIENT2 $MOUNT2
1086 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1088 replay_barrier $SINGLEMDS
1090 do_node $CLIENT1 createmany -o $DIR/$tfile-1- 100 &
1092 do_node $CLIENT2 createmany -o $MOUNT2/$tfile-2- 100
1093 zconf_umount $CLIENT2 $MOUNT2
1096 facet_failover $SINGLEMDS
1097 # recovery shouldn't fail due to missing client 2
1098 client_up $CLIENT1 || return 1
1099 # All files from client1 should have been replayed
1100 do_node $CLIENT1 unlinkmany $DIR/$tfile-1- 100 || return 2
1102 [ -e $DIR/$tdir/$tfile-2-0 ] && error "$tfile-2-0 exists"
1105 run_test 11a "concurrent creates don't affect each other"
1108 local var=${SINGLEMDS}_svc
1109 zconf_mount $CLIENT2 $MOUNT2
1111 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1113 do_node $CLIENT2 createmany -o $MOUNT2/$tfile-2- 100
1115 replay_barrier $SINGLEMDS
1116 do_node $CLIENT1 createmany -o $DIR/$tfile-1- 100 &
1118 do_node $CLIENT2 unlinkmany -o $MOUNT2/$tfile-2- 100
1119 zconf_umount $CLIENT2 $MOUNT2
1122 facet_failover $SINGLEMDS
1123 # recovery shouldn't fail due to missing client 2
1124 client_up $CLIENT1 || return 1
1125 # All files from client1 should have been replayed
1126 do_node $CLIENT1 unlinkmany $DIR/$tfile-1- 100 || return 2
1128 [ -e $DIR/$tdir/$tfile-2-0 ] && error "$tfile-2-0 exists"
1131 run_test 11b "concurrent creates and unlinks don't affect each other"
1133 # test set #12: lock replay with VBR, bug 16356
1134 test_12a() { # former test_2a
1135 local var=${SINGLEMDS}_svc
1136 zconf_mount $CLIENT2 $MOUNT2
1138 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1140 do_node $CLIENT2 mkdir -p $MOUNT2/$tdir
1141 replay_barrier $SINGLEMDS
1142 do_node $CLIENT2 mcreate $MOUNT2/$tdir/$tfile
1143 do_node $CLIENT1 createmany -o $DIR/$tfile- 25
1144 #client1 read data from client2 which will be lost
1145 do_node $CLIENT1 $CHECKSTAT $DIR/$tdir/$tfile
1146 do_node $CLIENT1 createmany -o $DIR/$tfile-3- 25
1147 zconf_umount $CLIENT2 $MOUNT2
1149 facet_failover $SINGLEMDS
1150 # recovery shouldn't fail due to missing client 2
1151 client_up $CLIENT1 || return 1
1153 # All 50 files should have been replayed
1154 do_node $CLIENT1 unlinkmany $DIR/$tfile- 25 || return 2
1155 do_node $CLIENT1 unlinkmany $DIR/$tfile-3- 25 || return 3
1156 do_node $CLIENT1 $CHECKSTAT $DIR/$tdir/$tfile && return 4
1160 run_test 12a "lost data due to missed REMOTE client during replay"
1162 test_13() { # LU-8826
1163 local var=${SINGLEMDS}_svc
1165 if combined_mgs_mds ; then
1166 skip "Needs separate MGS to enable IR"
1170 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
1171 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1173 zconf_mount $CLIENT2 $MOUNT2
1174 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile
1176 # set ir_timeout to a reasonable small value
1177 local ir_timeout=$(do_facet mgs $LCTL get_param -n mgs.*.ir_timeout)
1178 do_facet mgs $LCTL set_param mgs.*.ir_timeout=5
1179 # make sure IR functional
1182 replay_barrier $SINGLEMDS
1183 do_node $CLIENT1 chmod 666 $DIR/$tfile
1184 do_node $CLIENT2 chmod 777 $DIR2/$tfile
1186 # make sure client data of $CLIENT2:$MOUNT2 is remained
1187 # define OBD_FAIL_TGT_CLIENT_DEL 0x718
1188 do_facet $SINGLEMDS $LCTL set_param fail_loc=0x718
1189 zconf_umount $CLIENT2 $MOUNT2
1190 # define OBD_FAIL_TGT_SLUGGISH_NET 0x719
1191 do_facet $SINGLEMDS $LCTL set_param fail_loc=0x719
1192 facet_failover $SINGLEMDS
1194 client_up $CLIENT1 || error "$CLIENT1 evicted"
1196 do_facet $SINGLEMDS $LCTL set_param fail_loc=0
1197 do_facet mgs $LCTL set_param mgs.*.ir_timeout=$ir_timeout
1199 do_node $CLIENT1 $CHECKSTAT -p 0666 $DIR/$tfile ||
1200 error "$DIR/$tfile-a: unexpected state"
1202 run_test 13 "Shouldn't give up VBR easily on sluggish network"
1204 #restore COS setting
1205 restore_lustre_params < $cos_param_file
1206 rm -f $cos_param_file
1208 [ "$CLIENTS" ] && zconf_mount_clients $CLIENTS $DIR
1210 complete_test $SECONDS
1211 check_and_cleanup_lustre