2 # -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*-
3 # vim:shiftwidth=4:softtabstop=4:tabstop=4:
8 ALWAYS_EXCEPT="12a $REPLAY_VBR_EXCEPT"
11 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
14 MOUNT_2=${MOUNT_2:-"yes"}
15 export MULTIOP=${MULTIOP:-multiop}
16 . $LUSTRE/tests/test-framework.sh
18 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
21 remote_mds_nodsh && log "SKIP: remote MDS with nodsh" && exit 0
23 [ "$SLOW" = "no" ] && EXCEPT_SLOW="7"
27 check_and_setup_lustre
30 rm -rf $DIR/[df][0-9]*
32 [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
34 # if there is no CLIENT1 defined, some tests can be ran on localhost
35 CLIENT1=${CLIENT1:-$HOSTNAME}
36 # if CLIENT2 doesn't exist then use CLIENT1 instead
37 # All tests should use CLIENT2 with MOUNT2 only therefore it will work if
39 # Exception is the test which need two separate nodes
40 CLIENT2=${CLIENT2:-$CLIENT1}
42 is_mounted $MOUNT2 || error "MOUNT2 is not mounted"
49 # We need to run do_node in bg, because pdsh does not exit
50 # if child process of run script exists.
51 # I.e. pdsh does not exit when runmultiop_bg_pause exited,
52 # because of multiop_bg_pause -> $MULTIOP_PROG &
53 # By the same reason we need sleep a bit after do_nodes starts
54 # to let runmultiop_bg_pause start muliop and
55 # update /tmp/multiop_bg.pid ;
56 # The rm /tmp/multiop_bg.pid guarantees here that
57 # we have the updated by runmultiop_bg_pause
58 # /tmp/multiop_bg.pid file
60 local pid_file=$TMP/multiop_bg.pid.$$
61 do_node $client "MULTIOP_PID_FILE=$pid_file LUSTRE= runmultiop_bg_pause $file $cmds" &
65 multiop_pid=$(do_node $client cat $pid_file)
66 [ -n "$multiop_pid" ] || error "$client : Can not get multiop_pid from $pid_file "
67 eval export $(node_var_name $client)_multiop_pid=$multiop_pid
68 eval export $(node_var_name $client)_do_node_pid=$pid
69 local var=$(node_var_name $client)_multiop_pid
70 echo client $client multiop_bg started multiop_pid=${!var}
76 local multiop_pid=$(node_var_name $client)_multiop_pid
77 local do_node_pid=$(node_var_name $client)_do_node_pid
79 echo "Stopping multiop_pid=${!multiop_pid} (kill ${!multiop_pid} on $client)"
80 do_node $client kill -USR1 ${!multiop_pid}
86 local var=${SINGLEMDS}_svc
91 fid=$(do_node $client $LFS path2fid $file)
92 do_facet $SINGLEMDS $LCTL --device ${!var} getobjversion \\\"$fid\\\"
96 cos_param_file=$TMP/rvbr-cos-params
97 save_lustre_params $(get_facets MDS) "mdt.*.commit_on_sharing" > $cos_param_file
100 get_version $CLIENT1 $DIR/$tdir/1a || true
102 run_test 0a "getversion for non existent file shouldn't cause kernel panic"
105 local var=${SINGLEMDS}_svc
107 local file=$DIR/$tdir/f
109 do_node $CLIENT1 mkdir -p $DIR/$tdir/
110 do_node $CLIENT1 touch $file
111 fid=$(do_node $CLIENT1 $LFS path2fid $file)
112 do_node $CLIENT1 rm -rf $file
113 do_facet $SINGLEMDS $LCTL --device ${!var} getobjversion \\\"$fid\\\" || true
115 run_test 0b "getversion for non existent fid shouldn't cause kernel panic"
118 test_1a() { # former test_0a
119 local file=$DIR/$tfile
123 do_node $CLIENT1 mcreate $file
124 pre=$(get_version $CLIENT1 $file)
125 do_node $CLIENT1 openfile -f O_RDWR $file
126 post=$(get_version $CLIENT1 $file)
127 if (($pre != $post)); then
128 error "version changed unexpectedly: pre $pre, post $post"
131 run_test 1a "open and close do not change versions"
133 test_1b() { # former test_0b
134 local var=${SINGLEMDS}_svc
135 zconf_mount $CLIENT2 $MOUNT2
137 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
138 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
139 do_node $CLIENT1 mkdir -p -m 755 $MOUNT/$tdir
141 replay_barrier $SINGLEMDS
142 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
143 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT $MOUNT/$tdir/$tfile
144 zconf_umount $CLIENT2 $MOUNT2
145 facet_failover $SINGLEMDS
147 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
148 if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
149 error_and_remount "open succeeded unexpectedly"
152 run_test 1b "open (O_CREAT) checks version of parent"
154 test_1c() { # former test_0c
155 local var=${SINGLEMDS}_svc
156 zconf_mount $CLIENT2 $MOUNT2
158 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
159 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
161 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
162 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tdir/$tfile
164 replay_barrier $SINGLEMDS
165 do_node $CLIENT2 chmod 0777 $MOUNT2/$tdir
166 do_node $CLIENT2 chmod 0666 $MOUNT2/$tdir/$tfile
167 rmultiop_start $CLIENT1 $DIR/$tdir/$tfile o_c
168 zconf_umount $CLIENT2 $MOUNT2
169 facet_failover $SINGLEMDS
171 client_up $CLIENT1 || error "$CLIENT1 evicted"
172 rmultiop_stop $CLIENT1 || error "close failed"
174 run_test 1c "open (non O_CREAT) does not checks versions"
176 # test set #2: CREAT (not open)
177 # - version of parent is not changed but checked
178 # - pre-version should be -1
179 # - post-version should be valid
180 test_2a() { # extended former test_0d
185 pre=$(get_version $CLIENT1 $DIR)
186 do_node $CLIENT1 mkfifo $DIR/$tfile-fifo
187 post=$(get_version $CLIENT1 $DIR)
188 if (($pre != $post)); then
189 error "version was changed: pre $pre, post $post"
192 pre=$(get_version $CLIENT1 $DIR)
193 do_node $CLIENT1 mkdir $DIR/$tfile-dir
194 post=$(get_version $CLIENT1 $DIR)
195 if (($pre != $post)); then
196 error "version was changed: pre $pre, post $post"
198 do_node $CLIENT1 rmdir $DIR/$tfile-dir
201 pre=$(get_version $CLIENT1 $DIR)
202 do_node $CLIENT1 mkfifo $DIR/$tfile-nod
203 post=$(get_version $CLIENT1 $DIR)
204 if (($pre != $post)); then
205 error "version was changed: pre $pre, post $post"
208 pre=$(get_version $CLIENT1 $DIR)
209 do_node $CLIENT1 mkfifo $DIR/$tfile-symlink
210 post=$(get_version $CLIENT1 $DIR)
211 if (($pre != $post)); then
212 error "version was changed: pre $pre, post $post"
215 if [ $MDSCOUNT -ge 2 ]; then
218 pre=$(get_version $CLIENT1 $DIR)
219 do_node $CLIENT1 $LFS mkdir -i $MDT_IDX $DIR/$tfile-remote_dir
220 post=$(get_version $CLIENT1 $DIR)
221 if (($pre != $post)); then
222 error "version was changed: pre $pre, post $post"
225 do_node $CLIENT1 rm -rf $DIR/$tfile-*
228 run_test 2a "create operations doesn't change version of parent"
230 test_2b() { # former test_0e
231 local var=${SINGLEMDS}_svc
232 zconf_mount $CLIENT2 $MOUNT2
234 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
235 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
237 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
239 replay_barrier $SINGLEMDS
240 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
241 do_node $CLIENT1 mkfifo $DIR/$tdir/$tfile
242 zconf_umount $CLIENT2 $MOUNT2
243 facet_failover $SINGLEMDS
245 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
246 if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
247 error_and_remount "create succeeded unexpectedly"
250 run_test 2b "create checks version of parent"
252 test_3a() { # former test_0f
256 do_node $CLIENT1 mcreate $DIR/$tfile
257 pre=$(get_version $CLIENT1 $DIR)
258 do_node $CLIENT1 rm $DIR/$tfile
259 post=$(get_version $CLIENT1 $DIR)
260 if (($pre != $post)); then
261 error "version was changed: pre $pre, post $post"
264 if [ $MDSCOUNT -ge 2 ]; then
267 do_node $CLIENT1 $LFS mkdir -i $MDT_IDX $DIR/$tfile-remote_dir
268 pre=$(get_version $CLIENT1 $DIR)
269 do_node $CLIENT1 rmdir $DIR/$tfile-remote_dir
270 post=$(get_version $CLIENT1 $DIR)
271 if (($pre != $post)); then
272 error "version was changed: pre $pre, post $post"
276 run_test 3a "unlink doesn't change version of parent"
278 test_3b() { # former test_0g
279 local var=${SINGLEMDS}_svc
280 zconf_mount $CLIENT2 $MOUNT2
282 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
283 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
285 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
286 do_node $CLIENT1 mcreate $DIR/$tdir/$tfile
288 replay_barrier $SINGLEMDS
289 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
290 do_node $CLIENT1 rm $DIR/$tdir/$tfile
291 zconf_umount $CLIENT2 $MOUNT2
292 facet_failover $SINGLEMDS
294 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
295 if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
296 error_and_remount "unlink succeeded unexpectedly"
299 run_test 3b "unlink checks version of parent"
301 test_4a() { # former test_0h
302 local file=$DIR/$tfile
306 do_node $CLIENT1 mcreate $file
307 pre=$(get_version $CLIENT1 $file)
308 do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $file
309 post=$(get_version $CLIENT1 $file)
310 if (($pre == $post)); then
311 error "version not changed: pre $pre, post $post"
314 run_test 4a "setattr of UID changes versions"
316 test_4b() { # former test_0i
317 local file=$DIR/$tfile
321 do_node $CLIENT1 mcreate $file
322 pre=$(get_version $CLIENT1 $file)
323 do_node $CLIENT1 chgrp $RUNAS_GID $file
324 post=$(get_version $CLIENT1 $file)
325 if (($pre == $post)); then
326 error "version not changed: pre $pre, post $post"
329 run_test 4b "setattr of GID changes versions"
331 test_4c() { # former test_0j
332 local file=$DIR/$tfile
333 local var=${SINGLEMDS}_svc
334 zconf_mount $CLIENT2 $MOUNT2
336 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
337 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
339 do_node $CLIENT1 mcreate $file
341 replay_barrier $SINGLEMDS
342 do_node $CLIENT2 chgrp $RUNAS_GID $MOUNT2/$tfile
343 do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $file
344 zconf_umount $CLIENT2 $MOUNT2
345 facet_failover $SINGLEMDS
347 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
348 if ! do_node $CLIENT1 $CHECKSTAT -u \\\#$UID $file; then
349 error_and_remount "setattr of UID succeeded unexpectedly"
352 run_test 4c "setattr of UID checks versions"
354 test_4d() { # former test_0k
355 local file=$DIR/$tfile
356 local var=${SINGLEMDS}_svc
357 zconf_mount $CLIENT2 $MOUNT2
359 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
360 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
362 do_node $CLIENT1 mcreate $file
364 replay_barrier $SINGLEMDS
365 do_node $CLIENT2 chown $RUNAS_ID:$RUNAS_GID $MOUNT2/$tfile
366 do_node $CLIENT1 chgrp $RUNAS_GID $file
367 zconf_umount $CLIENT2 $MOUNT2
368 facet_failover $SINGLEMDS
370 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
371 if ! do_node $CLIENT1 $CHECKSTAT -g \\\#$UID $file; then
372 error_and_remount "setattr of GID succeeded unexpectedly"
375 run_test 4d "setattr of GID checks versions"
377 test_4e() { # former test_0l
378 local file=$DIR/$tfile
382 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
383 pre=$(get_version $CLIENT1 $file)
384 do_node $CLIENT1 chmod 666 $file
385 post=$(get_version $CLIENT1 $file)
386 if (($pre == $post)); then
387 error "version not changed: pre $pre, post $post"
390 run_test 4e "setattr of permission changes versions"
392 test_4f() { # former test_0m
393 local file=$DIR/$tfile
394 local var=${SINGLEMDS}_svc
395 zconf_mount $CLIENT2 $MOUNT2
397 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
398 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
400 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
402 replay_barrier $SINGLEMDS
403 do_node $CLIENT2 chgrp $RUNAS_GID $MOUNT2/$tfile
404 do_node $CLIENT1 chmod 666 $file
405 zconf_umount $CLIENT2 $MOUNT2
406 facet_failover $SINGLEMDS
408 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
409 if ! do_node $CLIENT1 $CHECKSTAT -p 0644 $file; then
410 error_and_remount "setattr of permission succeeded unexpectedly"
413 run_test 4f "setattr of permission checks versions"
415 test_4g() { # former test_0n
416 local file=$DIR/$tfile
420 do_node $CLIENT1 mcreate $file
421 pre=$(get_version $CLIENT1 $file)
422 do_node $CLIENT1 chattr +i $file
423 post=$(get_version $CLIENT1 $file)
424 do_node $CLIENT1 chattr -i $file
425 if (($pre == $post)); then
426 error "version not changed: pre $pre, post $post"
429 run_test 4g "setattr of flags changes versions"
437 if ((${#attr} != 1)); then
438 error "checking multiple attributes not implemented yet"
440 do_node $client lsattr $file | cut -d ' ' -f 1 | grep -q $attr
443 test_4h() { # former test_0o
444 local file=$DIR/$tfile
446 local var=${SINGLEMDS}_svc
447 zconf_mount $CLIENT2 $MOUNT2
449 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
450 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
452 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
454 replay_barrier $SINGLEMDS
455 do_node $CLIENT2 chmod 666 $MOUNT2/$tfile
456 do_node $CLIENT1 chattr +i $file
457 zconf_umount $CLIENT2 $MOUNT2
458 facet_failover $SINGLEMDS
460 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
461 checkattr $CLIENT1 i $file
463 do_node $CLIENT1 chattr -i $file
464 if [ $rc -eq 0 ]; then
465 error "setattr of flags succeeded unexpectedly"
468 run_test 4h "setattr of flags checks versions"
470 test_4i() { # former test_0p
471 local file=$DIR/$tfile
475 local var=${SINGLEMDS}_svc
477 ad_orig=$(do_facet $SINGLEMDS "$LCTL get_param mdd.${!var}.atime_diff")
478 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.atime_diff=0"
479 do_node $CLIENT1 mcreate $file
480 pre=$(get_version $CLIENT1 $file)
481 do_node $CLIENT1 touch $file
482 post=$(get_version $CLIENT1 $file)
484 # We don't fail MDS in this test. atime_diff shall be
485 # restored to its original value.
487 do_facet $SINGLEMDS "$LCTL set_param $ad_orig"
488 if (($pre != $post)); then
489 error "version changed unexpectedly: pre $pre, post $post"
492 run_test 4i "setattr of times does not change versions"
494 test_4j() { # former test_0q
495 local file=$DIR/$tfile
499 do_node $CLIENT1 mcreate $file
500 pre=$(get_version $CLIENT1 $file)
501 do_node $CLIENT1 $TRUNCATE $file 1
502 post=$(get_version $CLIENT1 $file)
503 if (($pre != $post)); then
504 error "version changed unexpectedly: pre $pre, post $post"
507 run_test 4j "setattr of size does not change versions"
509 test_4k() { # former test_0r
510 local file=$DIR/$tfile
514 local var=${SINGLEMDS}_svc
515 zconf_mount $CLIENT2 $MOUNT2
517 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
518 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.atime_diff=0"
519 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
521 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $file
523 replay_barrier $SINGLEMDS
524 do_node $CLIENT2 chmod 666 $MOUNT2/$tfile
525 do_node $CLIENT1 $TRUNCATE $file 1
527 mtime_pre=$(do_node $CLIENT1 stat --format=%Y $file)
528 do_node $CLIENT1 touch $file
529 sleep 1 # avoid stat caching
530 mtime_post=$(do_node $CLIENT1 stat --format=%Y $file)
531 zconf_umount $CLIENT2 $MOUNT2
532 facet_failover $SINGLEMDS
534 client_up $CLIENT1 || error "$CLIENT1 evicted"
535 if (($mtime_pre >= $mtime_post)); then
536 error "time not changed: pre $mtime_pre, post $mtime_post"
538 if ! do_node $CLIENT1 $CHECKSTAT -s 1 $file; then
539 error_and_remount "setattr of size failed"
541 mtime=$(do_node $CLIENT1 stat --format=%Y $file)
542 if (($mtime != $mtime_post)); then
543 error "setattr of times failed: expected $mtime_post, got $mtime"
546 run_test 4k "setattr of times and size does not check versions"
548 test_5a() { # former test_0s
554 do_node $CLIENT1 mcreate $DIR/$tfile
555 do_node $CLIENT1 mkdir -p $DIR/$tdir
556 pre=$(get_version $CLIENT1 $DIR/$tfile)
557 tp_pre=$(get_version $CLIENT1 $DIR/$tdir)
558 do_node $CLIENT1 link $DIR/$tfile $DIR/$tdir/$tfile
559 post=$(get_version $CLIENT1 $DIR/$tfile)
560 tp_post=$(get_version $CLIENT1 $DIR/$tdir)
561 if (($pre == $post)); then
562 error "version of source not changed: pre $pre, post $post"
564 if (($tp_pre != $tp_post)); then
565 error "version of target parent was changed: pre $tp_pre, post $tp_post"
568 run_test 5a "link changes versions of source but not target parent"
570 test_5b() { # former test_0t
571 local var=${SINGLEMDS}_svc
572 zconf_mount $CLIENT2 $MOUNT2
574 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
575 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
577 do_node $CLIENT1 mcreate $DIR/$tfile
578 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
580 replay_barrier $SINGLEMDS
581 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
582 do_node $CLIENT1 link $DIR/$tfile $DIR/$tdir/$tfile
583 zconf_umount $CLIENT2 $MOUNT2
584 facet_failover $SINGLEMDS
586 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
587 if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
588 error_and_remount "link should fail"
591 run_test 5b "link checks version of target parent"
593 test_5c() { # former test_0u
594 local var=${SINGLEMDS}_svc
595 zconf_mount $CLIENT2 $MOUNT2
597 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
598 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
600 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile
601 do_node $CLIENT1 mkdir -p $DIR/$tdir
603 replay_barrier $SINGLEMDS
604 do_node $CLIENT2 chmod 666 $MOUNT2/$tfile
605 do_node $CLIENT1 link $DIR/$tfile $DIR/$tdir/$tfile
606 zconf_umount $CLIENT2 $MOUNT2
607 facet_failover $SINGLEMDS
609 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
610 if ! do_node $CLIENT1 $CHECKSTAT -a $DIR/$tdir/$tfile; then
611 error_and_remount "link should fail"
614 run_test 5c "link checks version of source"
616 test_6a() { # former test_0v
622 do_node $CLIENT1 mcreate $DIR/$tfile
623 do_node $CLIENT1 mkdir -p $DIR/$tdir
624 sp_pre=$(get_version $CLIENT1 $DIR)
625 tp_pre=$(get_version $CLIENT1 $DIR/$tdir)
626 do_node $CLIENT1 mv $DIR/$tfile $DIR/$tdir/$tfile
627 sp_post=$(get_version $CLIENT1 $DIR)
628 tp_post=$(get_version $CLIENT1 $DIR/$tdir)
629 if (($sp_pre != $sp_post)); then
630 error "version of source parent was changed: pre $sp_pre, post $sp_post"
632 if (($tp_pre != $tp_post)); then
633 error "version of target parent was changed: pre $tp_pre, post $tp_post"
636 run_test 6a "rename doesn't change versions of source parent and target parent"
638 test_6b() { # former test_0w
642 do_node $CLIENT1 mcreate $DIR/$tfile
643 pre=$(get_version $CLIENT1 $DIR)
644 do_node $CLIENT1 mv $DIR/$tfile $DIR/$tfile-new
645 post=$(get_version $CLIENT1 $DIR)
646 if (($pre != $post)); then
647 error "version of parent was changed: pre $pre, post $post"
650 run_test 6b "rename within same dir doesn't change version of parent"
652 test_6c() { # former test_0x
653 local var=${SINGLEMDS}_svc
654 zconf_mount $CLIENT2 $MOUNT2
656 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
657 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
659 do_node $CLIENT1 mcreate $DIR/$tfile
660 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
662 replay_barrier $SINGLEMDS
663 do_node $CLIENT2 chmod 777 $MOUNT2
664 do_node $CLIENT1 mv $DIR/$tfile $DIR/$tdir/$tfile
665 zconf_umount $CLIENT2 $MOUNT2
666 facet_failover $SINGLEMDS
668 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
669 if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tfile; then
670 error_and_remount "rename should fail"
673 run_test 6c "rename checks version of source parent"
675 test_6d() { # former test_0y
676 local var=${SINGLEMDS}_svc
677 zconf_mount $CLIENT2 $MOUNT2
679 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
680 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
682 do_node $CLIENT1 mcreate $DIR/$tfile
683 do_node $CLIENT1 mkdir -p -m 755 $DIR/$tdir
685 replay_barrier $SINGLEMDS
686 do_node $CLIENT2 chmod 777 $MOUNT2/$tdir
687 do_node $CLIENT1 mv $DIR/$tfile $DIR/$tdir/$tfile
688 zconf_umount $CLIENT2 $MOUNT2
689 facet_failover $SINGLEMDS
691 client_evicted $CLIENT1 || error "$CLIENT1 not evicted"
692 if do_node $CLIENT1 $CHECKSTAT -a $DIR/$tfile; then
693 error_and_remount "rename should fail"
696 run_test 6d "rename checks version of target parent"
698 # pdirops tests, bug 18143
705 local var=${SINGLEMDS}_svc
706 zconf_mount $CLIENT2 $MOUNT2
708 local cname=$TESTNAME.$cycle
710 echo "start cycle: $cname"
711 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
712 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
714 do_node $CLIENT1 mkdir -p $DIR/$tdir
715 replay_barrier $SINGLEMDS
717 echo "$cname first: $first"
718 do_node $CLIENT1 $first || error "$cname: Cannot do first operation"
719 # client2 operations that will be lost
720 echo "$cname lost: $lost"
721 do_node $CLIENT2 $lost || error "$cname: Cannot do 'lost' operations"
723 echo "$cname last: $last"
724 do_node $CLIENT1 $last || error "$cname: Cannot do last operation"
725 zconf_umount $CLIENT2 $MOUNT2
726 facet_failover $SINGLEMDS
727 # should fail as conflict expected
728 client_evicted $CLIENT1 || rc=1
730 wait_recovery_complete $SINGLEMDS
731 wait_mds_ost_sync $SINGLEMDS
738 first="createmany -o $DIR/$tdir/$tfile- 1"
739 lost="rm $MOUNT2/$tdir/$tfile-0"
740 last="createmany -o $DIR/$tdir/$tfile- 1"
741 test_7_cycle "$first" "$lost" "$last" || error "Test 7a.1 failed"
743 first="createmany -o $DIR/$tdir/$tfile- 1"
744 lost="rm $MOUNT2/$tdir/$tfile-0"
745 last="mkdir $DIR/$tdir/$tfile-0"
746 test_7_cycle "$first" "$lost" "$last" || error "Test 7a.2 failed"
748 first="mkdir $DIR/$tdir/$tfile-0"
749 lost="mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile-1"
750 last="createmany -o $DIR/$tdir/$tfile- 1"
751 test_7_cycle "$first" "$lost" "$last" || error "Test 7a.3 failed"
754 run_test 7a "create, {lost}, create"
757 first="createmany -o $DIR/$tdir/$tfile- 1"
758 lost="rm $MOUNT2/$tdir/$tfile-0; createmany -o $MOUNT2/$tdir/$tfile- 1"
759 last="rm $DIR/$tdir/$tfile-0"
760 test_7_cycle "$first" "$lost" "$last" || error "Test 7b.1 failed"
762 first="createmany -o $DIR/$tdir/$tfile- 1"
763 lost="touch $MOUNT2/$tdir/$tfile; mv $MOUNT2/$tdir/$tfile $MOUNT2/$tdir/$tfile-0"
764 last="rm $DIR/$tdir/$tfile-0"
765 test_7_cycle "$first" "$lost" "$last" || error "Test 7b.2 failed"
767 first="createmany -o $DIR/$tdir/$tfile- 1"
768 lost="rm $MOUNT2/$tdir/$tfile-0; mkdir $MOUNT2/$tdir/$tfile-0"
769 last="rmdir $DIR/$tdir/$tfile-0"
770 test_7_cycle "$first" "$lost" "$last" || error "Test 7b.3 failed"
773 run_test 7b "create, {lost}, unlink"
776 first="createmany -o $DIR/$tdir/$tfile- 1"
777 lost="rm $MOUNT2/$tdir/$tfile-0; createmany -o $MOUNT2/$tdir/$tfile- 1"
778 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
779 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.1 failed"
781 first="createmany -o $DIR/$tdir/$tfile- 2"
782 lost="rm $MOUNT2/$tdir/$tfile-0; mkdir $MOUNT2/$tdir/$tfile-0"
783 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
784 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.2 failed"
786 first="createmany -o $DIR/$tdir/$tfile- 1; mkdir $DIR/$tdir/$tfile-1-0"
787 lost="rmdir $MOUNT2/$tdir/$tfile-1-0; createmany -o $MOUNT2/$tdir/$tfile-1- 1"
788 last="mv $DIR/$tdir/$tfile-1-0 $DIR/$tdir/$tfile-0"
789 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.3 failed"
791 first="createmany -o $DIR/$tdir/$tfile- 1"
792 lost="mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile"
793 last="mv $DIR/$tdir/$tfile $DIR/$tdir/$tfile-0"
794 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.4 failed"
797 run_test 7c "create, {lost}, rename"
800 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
801 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0"
802 last="createmany -o $DIR/$tdir/$tfile- 1"
803 test_7_cycle "$first" "$lost" "$last" && error "Test 7d.1 failed"
805 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
806 lost="mkdir $MOUNT2/$tdir/$tfile-0; rmdir $MOUNT2/$tdir/$tfile-0"
807 last="mkdir $DIR/$tdir/$tfile-0"
808 test_7_cycle "$first" "$lost" "$last" && error "Test 7d.2 failed"
810 first="mkdir $DIR/$tdir/$tfile-0; rmdir $DIR/$tdir/$tfile-0"
811 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile-1"
812 last="createmany -o $DIR/$tdir/$tfile- 1"
813 test_7_cycle "$first" "$lost" "$last" && error "Test 7d.3 failed"
816 run_test 7d "unlink, {lost}, create"
819 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
820 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0;createmany -o $MOUNT2/$tdir/$tfile- 1"
821 last="rm $DIR/$tdir/$tfile-0"
822 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.1 failed"
824 first="mkdir $DIR/$tdir/$tfile-0; rmdir $DIR/$tdir/$tfile-0"
825 lost="mkdir $MOUNT2/$tdir/$tfile-0; rmdir $MOUNT2/$tdir/$tfile-0; mkdir $MOUNT2/$tdir/$tfile-0"
826 last="rmdir $DIR/$tdir/$tfile-0"
827 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.2 failed"
829 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
830 lost="mkdir $MOUNT2/$tdir/$tfile-0"
831 last="rmdir $DIR/$tdir/$tfile-0"
832 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.3 failed"
834 first="mkdir $DIR/$tdir/$tfile-0; rmdir $DIR/$tdir/$tfile-0"
835 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
836 last="rm $DIR/$tdir/$tfile-0"
837 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.4 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="rm $DIR/$tdir/$tfile-0"
842 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.5 failed"
845 run_test 7e "unlink, {lost}, unlink"
848 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
849 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
850 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
851 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.1 failed"
853 first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
854 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
855 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
856 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.2 failed"
858 first="mkdir $DIR/$tdir/$tfile; createmany -o $DIR/$tdir/$tfile- 1; rmdir $DIR/$tdir/$tfile"
859 lost="mkdir $MOUNT2/$tdir/$tfile"
860 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
861 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.3 failed"
863 first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
864 lost="mv $MOUNT2/$tdir/$tfile-1 $MOUNT2/$tdir/$tfile-0"
865 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
866 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.4 failed"
868 first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
869 lost="mkdir $MOUNT2/$tdir/$tfile-0"
870 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
871 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.5 failed"
874 run_test 7f "unlink, {lost}, rename"
877 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
878 lost="mkdir $MOUNT2/$tdir/$tfile-0;rmdir $MOUNT2/$tdir/$tfile-0"
879 last="createmany -o $DIR/$tdir/$tfile- 1"
880 test_7_cycle "$first" "$lost" "$last" && error "Test 7g.1 failed"
882 first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
883 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0"
884 last="mkdir $DIR/$tdir/$tfile-0"
885 test_7_cycle "$first" "$lost" "$last" && error "Test 7g.2 failed"
887 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
888 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
889 last="link $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
890 test_7_cycle "$first" "$lost" "$last" || error "Test 7g.3 failed"
893 run_test 7g "rename, {lost}, create"
896 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
897 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
898 last="rm $DIR/$tdir/$tfile-0"
899 test_7_cycle "$first" "$lost" "$last" || error "Test 7h.1 failed"
901 first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
902 lost="rm $MOUNT2/$tdir/$tfile-0; createmany -o $MOUNT2/$tdir/$tfile- 1"
903 last="rm $DIR/$tdir/$tfile-0"
904 test_7_cycle "$first" "$lost" "$last" || error "Test 7h.2 failed"
906 first="createmany -o $DIR/$tdir/$tfile- 1; mkdir $DIR/$tdir/$tfile; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
907 lost="rm $MOUNT2/$tdir/$tfile/$tfile-0"
908 last="rmdir $DIR/$tdir/$tfile"
909 #test_7_cycle "$first" "$lost" "$last" || error "Test 7h.3 failed"
912 run_test 7h "rename, {lost}, unlink"
915 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
916 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
917 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
918 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.1 failed"
920 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
921 lost="mkdir $MOUNT2/$tdir/$tfile-0"
922 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
923 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.1 failed"
925 first="createmany -o $DIR/$tdir/$tfile- 3; mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
926 lost="mv $MOUNT2/$tdir/$tfile-2 $MOUNT2/$tdir/$tfile-0"
927 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-2"
928 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.3 failed"
930 first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
931 lost="rm $MOUNT2/$tdir/$tfile-1"
932 last="mv $DIR/$tdir/$tfile $DIR/$tdir/$tfile-1"
933 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.4 failed"
936 run_test 7i "rename, {lost}, rename"
938 # test set #8: orphan handling bug 15392.
939 # Unlink during recovery creates orphan always just in case some late open may
940 # arrive. These orphans will be removed after recovery anyway.
941 # Tests check that valid create,unlink,create sequence will work in this case
942 # too but not fail on second create due to orphan found.
945 local var=${SINGLEMDS}_svc
946 zconf_mount $CLIENT2 $MOUNT2
948 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
950 do_node $CLIENT1 mcreate $DIR/$tfile
951 do_node $CLIENT1 mkdir $DIR/$tfile-2
952 replay_barrier $SINGLEMDS
953 # missed replay from client2 will lead to recovery by versions
954 do_node $CLIENT2 touch $MOUNT2/$tfile-2/$tfile
955 do_node $CLIENT1 rm $DIR/$tfile || return 1
956 do_node $CLIENT1 touch $DIR/$tfile || return 2
958 zconf_umount $CLIENT2 $MOUNT2
959 facet_failover $SINGLEMDS
960 client_up $CLIENT1 || return 6
962 do_node $CLIENT1 rm $DIR/$tfile || error "$tfile doesn't exists"
965 run_test 8a "create | unlink, create shouldn't fail"
968 local var=${SINGLEMDS}_svc
969 zconf_mount $CLIENT2 $MOUNT2
971 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
973 do_node $CLIENT1 touch $DIR/$tfile
974 do_node $CLIENT1 mkdir $DIR/$tfile-2
975 replay_barrier $SINGLEMDS
976 # missed replay from client2 will lead to recovery by versions
977 do_node $CLIENT2 touch $MOUNT2/$tfile-2/$tfile
978 do_node $CLIENT1 rm -f $MOUNT1/$tfile || return 1
979 do_node $CLIENT1 mcreate $MOUNT1/$tfile || return 2
981 zconf_umount $CLIENT2 $MOUNT2
982 facet_failover $SINGLEMDS
983 client_up $CLIENT1 || return 6
985 do_node $CLIENT1 rm $MOUNT1/$tfile || error "$tfile doesn't exists"
988 run_test 8b "create | unlink, create shouldn't fail"
991 local var=${SINGLEMDS}_svc
992 zconf_mount $CLIENT2 $MOUNT2
994 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
996 do_node $CLIENT1 touch $DIR/$tfile
997 do_node $CLIENT1 mkdir $DIR/$tfile-2
998 replay_barrier $SINGLEMDS
999 # missed replay from client2 will lead to recovery by versions
1000 do_node $CLIENT2 touch $MOUNT2/$tfile-2/$tfile
1001 do_node $CLIENT1 rm -f $MOUNT1/$tfile || return 1
1002 do_node $CLIENT1 mkdir $MOUNT1/$tfile || return 2
1004 zconf_umount $CLIENT2 $MOUNT2
1005 facet_failover $SINGLEMDS
1006 client_up $CLIENT1 || return 6
1008 do_node $CLIENT1 rmdir $MOUNT1/$tfile || error "$tfile doesn't exists"
1011 run_test 8c "create | unlink, create shouldn't fail"
1014 # This test uses three Lustre clients on two hosts.
1016 # Lustre Client 1: $CLIENT1:$MOUNT ($DIR)
1017 # Lustre Client 2: $CLIENT2:$MOUNT2 ($DIR2)
1018 # Lustre Client 3: $CLIENT2:$MOUNT1 ($DIR1)
1020 test_10b() { # former test_2b
1023 local var=${SINGLEMDS}_svc
1025 [ -n "$CLIENTS" ] || { skip "Need two or more clients" && exit 0; }
1026 [ $CLIENTCOUNT -ge 2 ] || \
1027 { skip "Need two or more clients, have $CLIENTCOUNT" && exit 0; }
1029 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
1030 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1032 zconf_mount $CLIENT1 $MOUNT
1033 zconf_mount $CLIENT2 $MOUNT1
1034 zconf_mount $CLIENT2 $MOUNT2
1035 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile-a
1036 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile-b
1039 # Save an MDT transaction number before recovery.
1041 do_node $CLIENT1 touch $DIR1/$tfile
1042 pre=$(get_version $CLIENT1 $DIR/$tfile)
1045 # Comments on the replay sequence state the expected result
1049 # "U" Unable to replay.
1052 replay_barrier $SINGLEMDS
1053 do_node $CLIENT1 chmod 666 $DIR/$tfile-a # R
1054 do_node $CLIENT2 chmod 666 $DIR1/$tfile-b # R
1055 do_node $CLIENT2 chgrp $RUNAS_GID $DIR2/$tfile-a # U
1056 do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile-a # J
1057 do_node $CLIENT2 $TRUNCATE $DIR2/$tfile-b 1 # U
1058 do_node $CLIENT2 chgrp $RUNAS_GID $DIR1/$tfile-b # R
1059 do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile-b # R
1060 zconf_umount $CLIENT2 $MOUNT2
1061 facet_failover $SINGLEMDS
1063 client_evicted $CLIENT1 || error "$CLIENT1:$MOUNT not evicted"
1064 client_up $CLIENT2 || error "$CLIENT2:$MOUNT1 evicted"
1067 # Check the MDT epoch. $post must be the first transaction
1068 # number assigned after recovery.
1070 do_node $CLIENT2 chmod 666 $DIR1/$tfile
1071 post=$(get_version $CLIENT2 $DIR1/$tfile)
1072 if (($(($pre >> 32)) == $((post >> 32)))); then
1073 error "epoch not changed: pre $pre, post $post"
1076 if (($(($post & 0x00000000ffffffff)) != 1)); then
1077 error "transno should restart from one: got $post"
1080 do_node $CLIENT2 stat $DIR1/$tfile-a
1081 do_node $CLIENT2 stat $DIR1/$tfile-b
1083 do_node $CLIENT2 $CHECKSTAT -p 0666 -u \\\#$UID -g \\\#$UID \
1084 $DIR1/$tfile-a || error "$DIR/$tfile-a: unexpected state"
1085 do_node $CLIENT2 $CHECKSTAT -p 0666 -u \\\#$RUNAS_ID -g \\\#$RUNAS_GID \
1086 $DIR1/$tfile-b || error "$DIR/$tfile-b: unexpected state"
1088 zconf_umount $CLIENT2 $MOUNT1
1090 run_test 10b "3 clients: some, none, and all reqs replayed"
1092 # test set #11: operations in single directory
1094 local var=${SINGLEMDS}_svc
1095 zconf_mount $CLIENT2 $MOUNT2
1097 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1099 replay_barrier $SINGLEMDS
1101 do_node $CLIENT1 createmany -o $DIR/$tfile-1- 100 &
1103 do_node $CLIENT2 createmany -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 11a "concurrent creates don't affect each other"
1119 local var=${SINGLEMDS}_svc
1120 zconf_mount $CLIENT2 $MOUNT2
1122 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1124 do_node $CLIENT2 createmany -o $MOUNT2/$tfile-2- 100
1126 replay_barrier $SINGLEMDS
1127 do_node $CLIENT1 createmany -o $DIR/$tfile-1- 100 &
1129 do_node $CLIENT2 unlinkmany -o $MOUNT2/$tfile-2- 100
1130 zconf_umount $CLIENT2 $MOUNT2
1133 facet_failover $SINGLEMDS
1134 # recovery shouldn't fail due to missing client 2
1135 client_up $CLIENT1 || return 1
1136 # All files from client1 should have been replayed
1137 do_node $CLIENT1 unlinkmany $DIR/$tfile-1- 100 || return 2
1139 [ -e $DIR/$tdir/$tfile-2-0 ] && error "$tfile-2-0 exists"
1142 run_test 11b "concurrent creates and unlinks don't affect each other"
1144 # test set #12: lock replay with VBR, bug 16356
1145 test_12a() { # former test_2a
1146 local var=${SINGLEMDS}_svc
1147 zconf_mount $CLIENT2 $MOUNT2
1149 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1151 do_node $CLIENT2 mkdir -p $MOUNT2/$tdir
1152 replay_barrier $SINGLEMDS
1153 do_node $CLIENT2 mcreate $MOUNT2/$tdir/$tfile
1154 do_node $CLIENT1 createmany -o $DIR/$tfile- 25
1155 #client1 read data from client2 which will be lost
1156 do_node $CLIENT1 $CHECKSTAT $DIR/$tdir/$tfile
1157 do_node $CLIENT1 createmany -o $DIR/$tfile-3- 25
1158 zconf_umount $CLIENT2 $MOUNT2
1160 facet_failover $SINGLEMDS
1161 # recovery shouldn't fail due to missing client 2
1162 client_up $CLIENT1 || return 1
1164 # All 50 files should have been replayed
1165 do_node $CLIENT1 unlinkmany $DIR/$tfile- 25 || return 2
1166 do_node $CLIENT1 unlinkmany $DIR/$tfile-3- 25 || return 3
1167 do_node $CLIENT1 $CHECKSTAT $DIR/$tdir/$tfile && return 4
1171 run_test 12a "lost data due to missed REMOTE client during replay"
1173 #restore COS setting
1174 restore_lustre_params < $cos_param_file
1175 rm -f $cos_param_file
1177 [ "$CLIENTS" ] && zconf_mount_clients $CLIENTS $DIR
1180 check_and_cleanup_lustre