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"
715 if at_is_enabled; then
716 at_max_saved=$(at_max_get $SINGLEMDS)
717 at_max_set $TIMEOUT mds client
720 do_node $CLIENT1 mkdir -p $DIR/$tdir
721 replay_barrier $SINGLEMDS
723 echo "$cname first: $first"
724 do_node $CLIENT1 $first || error "$cname: Cannot do first operation"
725 # client2 operations that will be lost
726 echo "$cname lost: $lost"
727 do_node $CLIENT2 $lost || error "$cname: Cannot do 'lost' operations"
729 echo "$cname last: $last"
730 do_node $CLIENT1 $last || error "$cname: Cannot do last operation"
731 zconf_umount $CLIENT2 $MOUNT2
732 facet_failover $SINGLEMDS
733 # should fail as conflict expected
734 client_evicted $CLIENT1 || rc=1
736 wait_recovery_complete $SINGLEMDS
737 wait_mds_ost_sync || error "wait_mds_ost_sync failed"
739 [[ $at_max_saved -eq 0 ]] || at_max_set $at_max_saved mds client
745 first="createmany -o $DIR/$tdir/$tfile- 1"
746 lost="rm $MOUNT2/$tdir/$tfile-0"
747 last="createmany -o $DIR/$tdir/$tfile- 1"
748 test_7_cycle "$first" "$lost" "$last" || error "Test 7a.1 failed"
750 first="createmany -o $DIR/$tdir/$tfile- 1"
751 lost="rm $MOUNT2/$tdir/$tfile-0"
752 last="mkdir $DIR/$tdir/$tfile-0"
753 test_7_cycle "$first" "$lost" "$last" || error "Test 7a.2 failed"
755 first="mkdir $DIR/$tdir/$tfile-0"
756 lost="mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile-1"
757 last="createmany -o $DIR/$tdir/$tfile- 1"
758 test_7_cycle "$first" "$lost" "$last" || error "Test 7a.3 failed"
761 run_test 7a "create, {lost}, create"
764 first="createmany -o $DIR/$tdir/$tfile- 1"
765 lost="rm $MOUNT2/$tdir/$tfile-0; createmany -o $MOUNT2/$tdir/$tfile- 1"
766 last="rm $DIR/$tdir/$tfile-0"
767 test_7_cycle "$first" "$lost" "$last" || error "Test 7b.1 failed"
769 first="createmany -o $DIR/$tdir/$tfile- 1"
770 lost="touch $MOUNT2/$tdir/$tfile; mv $MOUNT2/$tdir/$tfile $MOUNT2/$tdir/$tfile-0"
771 last="rm $DIR/$tdir/$tfile-0"
772 test_7_cycle "$first" "$lost" "$last" || error "Test 7b.2 failed"
774 first="createmany -o $DIR/$tdir/$tfile- 1"
775 lost="rm $MOUNT2/$tdir/$tfile-0; mkdir $MOUNT2/$tdir/$tfile-0"
776 last="rmdir $DIR/$tdir/$tfile-0"
777 test_7_cycle "$first" "$lost" "$last" || error "Test 7b.3 failed"
780 run_test 7b "create, {lost}, unlink"
783 first="createmany -o $DIR/$tdir/$tfile- 1"
784 lost="rm $MOUNT2/$tdir/$tfile-0; createmany -o $MOUNT2/$tdir/$tfile- 1"
785 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
786 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.1 failed"
788 first="createmany -o $DIR/$tdir/$tfile- 2"
789 lost="rm $MOUNT2/$tdir/$tfile-0; mkdir $MOUNT2/$tdir/$tfile-0"
790 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
791 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.2 failed"
793 first="createmany -o $DIR/$tdir/$tfile- 1; mkdir $DIR/$tdir/$tfile-1-0"
794 lost="rmdir $MOUNT2/$tdir/$tfile-1-0; createmany -o $MOUNT2/$tdir/$tfile-1- 1"
795 last="mv $DIR/$tdir/$tfile-1-0 $DIR/$tdir/$tfile-0"
796 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.3 failed"
798 first="createmany -o $DIR/$tdir/$tfile- 1"
799 lost="mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile"
800 last="mv $DIR/$tdir/$tfile $DIR/$tdir/$tfile-0"
801 test_7_cycle "$first" "$lost" "$last" || error "Test 7c.4 failed"
804 run_test 7c "create, {lost}, rename"
807 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
808 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0"
809 last="createmany -o $DIR/$tdir/$tfile- 1"
810 test_7_cycle "$first" "$lost" "$last" && error "Test 7d.1 failed"
812 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
813 lost="mkdir $MOUNT2/$tdir/$tfile-0; rmdir $MOUNT2/$tdir/$tfile-0"
814 last="mkdir $DIR/$tdir/$tfile-0"
815 test_7_cycle "$first" "$lost" "$last" && error "Test 7d.2 failed"
817 first="mkdir $DIR/$tdir/$tfile-0; rmdir $DIR/$tdir/$tfile-0"
818 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; mv $MOUNT2/$tdir/$tfile-0 $MOUNT2/$tdir/$tfile-1"
819 last="createmany -o $DIR/$tdir/$tfile- 1"
820 test_7_cycle "$first" "$lost" "$last" && error "Test 7d.3 failed"
823 run_test 7d "unlink, {lost}, create"
826 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
827 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0;createmany -o $MOUNT2/$tdir/$tfile- 1"
828 last="rm $DIR/$tdir/$tfile-0"
829 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.1 failed"
831 first="mkdir $DIR/$tdir/$tfile-0; rmdir $DIR/$tdir/$tfile-0"
832 lost="mkdir $MOUNT2/$tdir/$tfile-0; rmdir $MOUNT2/$tdir/$tfile-0; mkdir $MOUNT2/$tdir/$tfile-0"
833 last="rmdir $DIR/$tdir/$tfile-0"
834 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.2 failed"
836 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
837 lost="mkdir $MOUNT2/$tdir/$tfile-0"
838 last="rmdir $DIR/$tdir/$tfile-0"
839 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.3 failed"
841 first="mkdir $DIR/$tdir/$tfile-0; rmdir $DIR/$tdir/$tfile-0"
842 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
843 last="rm $DIR/$tdir/$tfile-0"
844 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.4 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="rm $DIR/$tdir/$tfile-0"
849 test_7_cycle "$first" "$lost" "$last" || error "Test 7e.5 failed"
852 run_test 7e "unlink, {lost}, unlink"
855 first="createmany -o $DIR/$tdir/$tfile- 1; rm $DIR/$tdir/$tfile-0"
856 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
857 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
858 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.1 failed"
860 first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
861 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
862 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
863 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.2 failed"
865 first="mkdir $DIR/$tdir/$tfile; createmany -o $DIR/$tdir/$tfile- 1; rmdir $DIR/$tdir/$tfile"
866 lost="mkdir $MOUNT2/$tdir/$tfile"
867 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
868 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.3 failed"
870 first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
871 lost="mv $MOUNT2/$tdir/$tfile-1 $MOUNT2/$tdir/$tfile-0"
872 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
873 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.4 failed"
875 first="createmany -o $DIR/$tdir/$tfile- 2; rm $DIR/$tdir/$tfile-0"
876 lost="mkdir $MOUNT2/$tdir/$tfile-0"
877 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
878 test_7_cycle "$first" "$lost" "$last" || error "Test 7f.5 failed"
881 run_test 7f "unlink, {lost}, rename"
884 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
885 lost="mkdir $MOUNT2/$tdir/$tfile-0;rmdir $MOUNT2/$tdir/$tfile-0"
886 last="createmany -o $DIR/$tdir/$tfile- 1"
887 test_7_cycle "$first" "$lost" "$last" && error "Test 7g.1 failed"
889 first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
890 lost="createmany -o $MOUNT2/$tdir/$tfile- 1; rm $MOUNT2/$tdir/$tfile-0"
891 last="mkdir $DIR/$tdir/$tfile-0"
892 test_7_cycle "$first" "$lost" "$last" && error "Test 7g.2 failed"
894 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
895 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
896 last="link $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
897 if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.5.1) ]
899 test_7_cycle "$first" "$lost" "$last" ||
900 error "Test 7g.3 failed"
901 else #LU-4442 LU-3528
902 test_7_cycle "$first" "$lost" "$last" &&
903 error "Test 7g.3 failed"
907 run_test 7g "rename, {lost}, create"
910 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
911 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
912 last="rm $DIR/$tdir/$tfile-0"
913 test_7_cycle "$first" "$lost" "$last" || error "Test 7h.1 failed"
915 first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
916 lost="rm $MOUNT2/$tdir/$tfile-0; createmany -o $MOUNT2/$tdir/$tfile- 1"
917 last="rm $DIR/$tdir/$tfile-0"
918 test_7_cycle "$first" "$lost" "$last" || error "Test 7h.2 failed"
920 first="createmany -o $DIR/$tdir/$tfile- 1; mkdir $DIR/$tdir/$tfile; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
921 lost="rm $MOUNT2/$tdir/$tfile/$tfile-0"
922 last="rmdir $DIR/$tdir/$tfile"
923 #test_7_cycle "$first" "$lost" "$last" || error "Test 7h.3 failed"
926 run_test 7h "rename, {lost}, unlink"
929 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
930 lost="createmany -o $MOUNT2/$tdir/$tfile- 1"
931 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
932 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.1 failed"
934 first="createmany -o $DIR/$tdir/$tfile- 1; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-1"
935 lost="mkdir $MOUNT2/$tdir/$tfile-0"
936 last="mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
937 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.1 failed"
939 first="createmany -o $DIR/$tdir/$tfile- 3; mv $DIR/$tdir/$tfile-1 $DIR/$tdir/$tfile-0"
940 lost="mv $MOUNT2/$tdir/$tfile-2 $MOUNT2/$tdir/$tfile-0"
941 last="mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile-2"
942 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.3 failed"
944 first="createmany -o $DIR/$tdir/$tfile- 2; mv $DIR/$tdir/$tfile-0 $DIR/$tdir/$tfile"
945 lost="rm $MOUNT2/$tdir/$tfile-1"
946 last="mv $DIR/$tdir/$tfile $DIR/$tdir/$tfile-1"
947 test_7_cycle "$first" "$lost" "$last" || error "Test 7i.4 failed"
950 run_test 7i "rename, {lost}, rename"
952 # test set #8: orphan handling bug 15392.
953 # Unlink during recovery creates orphan always just in case some late open may
954 # arrive. These orphans will be removed after recovery anyway.
955 # Tests check that valid create,unlink,create sequence will work in this case
956 # too but not fail on second create due to orphan found.
959 local var=${SINGLEMDS}_svc
960 zconf_mount $CLIENT2 $MOUNT2
962 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
964 do_node $CLIENT1 mcreate $DIR/$tfile
965 do_node $CLIENT1 mkdir $DIR/$tfile-2
966 replay_barrier $SINGLEMDS
967 # missed replay from client2 will lead to recovery by versions
968 do_node $CLIENT2 touch $MOUNT2/$tfile-2/$tfile
969 do_node $CLIENT1 rm $DIR/$tfile || return 1
970 do_node $CLIENT1 touch $DIR/$tfile || return 2
972 zconf_umount $CLIENT2 $MOUNT2
973 facet_failover $SINGLEMDS
974 client_up $CLIENT1 || return 6
976 do_node $CLIENT1 rm $DIR/$tfile || error "$tfile doesn't exists"
979 run_test 8a "create | unlink, create shouldn't fail"
982 local var=${SINGLEMDS}_svc
983 zconf_mount $CLIENT2 $MOUNT2
985 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
987 do_node $CLIENT1 touch $DIR/$tfile
988 do_node $CLIENT1 mkdir $DIR/$tfile-2
989 replay_barrier $SINGLEMDS
990 # missed replay from client2 will lead to recovery by versions
991 do_node $CLIENT2 touch $MOUNT2/$tfile-2/$tfile
992 do_node $CLIENT1 rm -f $MOUNT1/$tfile || return 1
993 do_node $CLIENT1 mcreate $MOUNT1/$tfile || return 2
995 zconf_umount $CLIENT2 $MOUNT2
996 facet_failover $SINGLEMDS
997 client_up $CLIENT1 || return 6
999 do_node $CLIENT1 rm $MOUNT1/$tfile || error "$tfile doesn't exists"
1002 run_test 8b "create | unlink, create shouldn't fail"
1005 local var=${SINGLEMDS}_svc
1006 zconf_mount $CLIENT2 $MOUNT2
1008 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1010 do_node $CLIENT1 touch $DIR/$tfile
1011 do_node $CLIENT1 mkdir $DIR/$tfile-2
1012 replay_barrier $SINGLEMDS
1013 # missed replay from client2 will lead to recovery by versions
1014 do_node $CLIENT2 touch $MOUNT2/$tfile-2/$tfile
1015 do_node $CLIENT1 rm -f $MOUNT1/$tfile || return 1
1016 do_node $CLIENT1 mkdir $MOUNT1/$tfile || return 2
1018 zconf_umount $CLIENT2 $MOUNT2
1019 facet_failover $SINGLEMDS
1020 client_up $CLIENT1 || return 6
1022 do_node $CLIENT1 rmdir $MOUNT1/$tfile || error "$tfile doesn't exists"
1025 run_test 8c "create | unlink, create shouldn't fail"
1028 # This test uses three Lustre clients on two hosts.
1030 # Lustre Client 1: $CLIENT1:$MOUNT ($DIR)
1031 # Lustre Client 2: $CLIENT2:$MOUNT2 ($DIR2)
1032 # Lustre Client 3: $CLIENT2:$MOUNT1 ($DIR1)
1034 test_10b() { # former test_2b
1037 local var=${SINGLEMDS}_svc
1039 [ -n "$CLIENTS" ] || { skip "Need two or more clients" && exit 0; }
1040 [ $CLIENTCOUNT -ge 2 ] || \
1041 { skip "Need two or more clients, have $CLIENTCOUNT" && exit 0; }
1043 do_facet $SINGLEMDS "$LCTL set_param mdd.${!var}.sync_permission=0"
1044 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1046 zconf_mount $CLIENT1 $MOUNT
1047 zconf_mount $CLIENT2 $MOUNT1
1048 zconf_mount $CLIENT2 $MOUNT2
1049 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile-a
1050 do_node $CLIENT1 openfile -f O_RDWR:O_CREAT -m 0644 $DIR/$tfile-b
1053 # Save an MDT transaction number before recovery.
1055 do_node $CLIENT1 touch $DIR1/$tfile
1056 pre=$(get_version $CLIENT1 $DIR/$tfile)
1059 # Comments on the replay sequence state the expected result
1063 # "U" Unable to replay.
1066 replay_barrier $SINGLEMDS
1067 do_node $CLIENT1 chmod 666 $DIR/$tfile-a # R
1068 do_node $CLIENT2 chmod 666 $DIR1/$tfile-b # R
1069 do_node $CLIENT2 chgrp $RUNAS_GID $DIR2/$tfile-a # U
1070 do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile-a # J
1071 do_node $CLIENT2 $TRUNCATE $DIR2/$tfile-b 1 # U
1072 do_node $CLIENT2 chgrp $RUNAS_GID $DIR1/$tfile-b # R
1073 do_node $CLIENT1 chown $RUNAS_ID:$RUNAS_GID $DIR/$tfile-b # R
1074 zconf_umount $CLIENT2 $MOUNT2
1075 facet_failover $SINGLEMDS
1077 client_evicted $CLIENT1 || error "$CLIENT1:$MOUNT not evicted"
1078 client_up $CLIENT2 || error "$CLIENT2:$MOUNT1 evicted"
1081 # Check the MDT epoch. $post must be the first transaction
1082 # number assigned after recovery.
1084 do_node $CLIENT2 chmod 666 $DIR1/$tfile
1085 post=$(get_version $CLIENT2 $DIR1/$tfile)
1086 if (($(($pre >> 32)) == $((post >> 32)))); then
1087 error "epoch not changed: pre $pre, post $post"
1090 if (($(($post & 0x00000000ffffffff)) != 1)); then
1091 error "transno should restart from one: got $post"
1094 do_node $CLIENT2 stat $DIR1/$tfile-a
1095 do_node $CLIENT2 stat $DIR1/$tfile-b
1097 do_node $CLIENT2 $CHECKSTAT -p 0666 -u \\\#$UID -g \\\#$UID \
1098 $DIR1/$tfile-a || error "$DIR/$tfile-a: unexpected state"
1099 do_node $CLIENT2 $CHECKSTAT -p 0666 -u \\\#$RUNAS_ID -g \\\#$RUNAS_GID \
1100 $DIR1/$tfile-b || error "$DIR/$tfile-b: unexpected state"
1102 zconf_umount $CLIENT2 $MOUNT1
1104 run_test 10b "3 clients: some, none, and all reqs replayed"
1106 # test set #11: operations in single directory
1108 local var=${SINGLEMDS}_svc
1109 zconf_mount $CLIENT2 $MOUNT2
1111 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1113 replay_barrier $SINGLEMDS
1115 do_node $CLIENT1 createmany -o $DIR/$tfile-1- 100 &
1117 do_node $CLIENT2 createmany -o $MOUNT2/$tfile-2- 100
1118 zconf_umount $CLIENT2 $MOUNT2
1121 facet_failover $SINGLEMDS
1122 # recovery shouldn't fail due to missing client 2
1123 client_up $CLIENT1 || return 1
1124 # All files from client1 should have been replayed
1125 do_node $CLIENT1 unlinkmany $DIR/$tfile-1- 100 || return 2
1127 [ -e $DIR/$tdir/$tfile-2-0 ] && error "$tfile-2-0 exists"
1130 run_test 11a "concurrent creates don't affect each other"
1133 local var=${SINGLEMDS}_svc
1134 zconf_mount $CLIENT2 $MOUNT2
1136 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1138 do_node $CLIENT2 createmany -o $MOUNT2/$tfile-2- 100
1140 replay_barrier $SINGLEMDS
1141 do_node $CLIENT1 createmany -o $DIR/$tfile-1- 100 &
1143 do_node $CLIENT2 unlinkmany -o $MOUNT2/$tfile-2- 100
1144 zconf_umount $CLIENT2 $MOUNT2
1147 facet_failover $SINGLEMDS
1148 # recovery shouldn't fail due to missing client 2
1149 client_up $CLIENT1 || return 1
1150 # All files from client1 should have been replayed
1151 do_node $CLIENT1 unlinkmany $DIR/$tfile-1- 100 || return 2
1153 [ -e $DIR/$tdir/$tfile-2-0 ] && error "$tfile-2-0 exists"
1156 run_test 11b "concurrent creates and unlinks don't affect each other"
1158 # test set #12: lock replay with VBR, bug 16356
1159 test_12a() { # former test_2a
1160 local var=${SINGLEMDS}_svc
1161 zconf_mount $CLIENT2 $MOUNT2
1163 do_facet $SINGLEMDS "$LCTL set_param mdt.${!var}.commit_on_sharing=0"
1165 do_node $CLIENT2 mkdir -p $MOUNT2/$tdir
1166 replay_barrier $SINGLEMDS
1167 do_node $CLIENT2 mcreate $MOUNT2/$tdir/$tfile
1168 do_node $CLIENT1 createmany -o $DIR/$tfile- 25
1169 #client1 read data from client2 which will be lost
1170 do_node $CLIENT1 $CHECKSTAT $DIR/$tdir/$tfile
1171 do_node $CLIENT1 createmany -o $DIR/$tfile-3- 25
1172 zconf_umount $CLIENT2 $MOUNT2
1174 facet_failover $SINGLEMDS
1175 # recovery shouldn't fail due to missing client 2
1176 client_up $CLIENT1 || return 1
1178 # All 50 files should have been replayed
1179 do_node $CLIENT1 unlinkmany $DIR/$tfile- 25 || return 2
1180 do_node $CLIENT1 unlinkmany $DIR/$tfile-3- 25 || return 3
1181 do_node $CLIENT1 $CHECKSTAT $DIR/$tdir/$tfile && return 4
1185 run_test 12a "lost data due to missed REMOTE client during replay"
1187 #restore COS setting
1188 restore_lustre_params < $cos_param_file
1189 rm -f $cos_param_file
1191 [ "$CLIENTS" ] && zconf_mount_clients $CLIENTS $DIR
1194 check_and_cleanup_lustre