8 PTLDEBUG=${PTLDEBUG:--1}
9 LUSTRE=${LUSTRE:-$(dirname $0)/..}
10 . $LUSTRE/tests/test-framework.sh
14 # tool to create lustre filesystem images
15 ALWAYS_EXCEPT="$CONF_SANITY_EXCEPT 32newtarball"
17 always_except LU-11915 110
20 always_except LU-9795 84 86 103
23 if ! combined_mgs_mds; then
24 always_except LU-11991 32a 32b 32c 32d 32e
25 always_except LU-9897 84
26 always_except LU-12032 123F
30 [ "$SLOW" = "no" ] && EXCEPT_SLOW="45 69 106 111 114"
34 # use small MDS + OST size to speed formatting time
35 # do not use too small MDSSIZE/OSTSIZE, which affect the default journal size
36 # STORED_MDSSIZE is used in test_18
37 STORED_MDSSIZE=$MDSSIZE
38 STORED_OSTSIZE=$OSTSIZE
40 [ "$mds1_FSTYPE" = zfs ] && MDSSIZE=400000
42 [ "$ost1_FSTYPE" = zfs ] && OSTSIZE=400000
52 # pass "-E lazy_itable_init" to mke2fs to speed up the formatting time
53 if [[ "$LDISKFS_MKFS_OPTS" != *lazy_itable_init* ]]; then
54 LDISKFS_MKFS_OPTS=$(csa_add "$LDISKFS_MKFS_OPTS" -E lazy_itable_init)
58 require_dsh_mds || exit 0
59 require_dsh_ost || exit 0
64 # The MGS must be started before the OSTs for a new fs, so start
65 # and stop to generate the startup logs.
68 wait_osc_import_state mds ost FULL
73 reformat_and_config() {
75 if ! combined_mgs_mds ; then
81 writeconf_or_reformat() {
82 # There are at most 2 OSTs for write_conf test
83 # who knows if/where $TUNEFS is installed?
84 # Better reformat if it fails...
85 writeconf_all $MDSCOUNT 2 ||
86 { echo "tunefs failed, reformatting instead" &&
87 reformat_and_config && return 0; }
96 echo "start mgs service on $(facet_active_host mgs)"
97 start mgs $(mgsdevname) $MGS_MOUNT_OPTS "$@"
103 local dev=$(mdsdevname $num)
106 echo "start mds service on `facet_active_host $facet`"
107 start $facet ${dev} $MDS_MOUNT_OPTS "$@" || return 94
110 stop_mdt_no_force() {
113 local dev=$(mdsdevname $num)
116 echo "stop mds service on `facet_active_host $facet`"
117 stop $facet || return 97
123 local dev=$(mdsdevname $num)
126 echo "stop mds service on `facet_active_host $facet`"
127 # These tests all use non-failover stop
128 stop $facet -f || return 97
132 local mdscount=$MDSCOUNT
135 [[ "$1" == "--mdscount" ]] && mdscount=$2 && shift 2
137 for ((num=1; num <= $mdscount; num++ )); do
138 start_mdt $num "$@" || return 94
140 for ((num=1; num <= $mdscount; num++ )); do
141 wait_clients_import_state ${CLIENTS:-$HOSTNAME} mds${num} FULL
146 if ! combined_mgs_mds ; then
154 for num in $(seq $MDSCOUNT); do
155 stop_mdt $num || return 97
160 echo "stop mgs service on `facet_active_host mgs`"
161 # These tests all use non-failover stop
162 stop mgs -f || return 97
166 echo "start ost1 service on `facet_active_host ost1`"
167 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS "$@" || return 95
168 wait_clients_import_ready ${CLIENTS:-$HOSTNAME} ost1
172 echo "stop ost1 service on `facet_active_host ost1`"
173 # These tests all use non-failover stop
174 stop ost1 -f || return 98
178 echo "start ost2 service on `facet_active_host ost2`"
179 start ost2 $(ostdevname 2) $OST_MOUNT_OPTS "$@" || return 92
180 wait_clients_import_ready ${CLIENTS:-$HOSTNAME} ost2
184 echo "stop ost2 service on `facet_active_host ost2`"
185 # These tests all use non-failover stop
186 stop ost2 -f || return 93
193 echo "mount $FSNAME ${mountopt:+with opts $mountopt} on $mountpath....."
194 zconf_mount $HOSTNAME $mountpath $mountopt || return 96
200 echo "umount lustre on $mountpath....."
201 zconf_umount $HOSTNAME $mountpath "$@" || return 97
204 manual_umount_client(){
207 echo "manual umount lustre on ${MOUNT}...."
208 do_facet client "umount ${FORCE} $MOUNT"
214 start_mds || error "MDT start failed"
215 start_ost || error "Unable to start OST1"
216 mount_client $MOUNT || error "client start failed"
217 client_up || error "client_up failed"
226 unload_modules_conf () {
227 if combined_mgs_mds || ! local_mode; then
228 unload_modules || return 1
233 stop_ost || return 202
234 stop_mds || return 201
235 unload_modules_conf || return 203
240 [ "x$1" != "x" ] && force='-f'
241 umount_client $MOUNT $force|| return 200
242 cleanup_nocli || return $?
247 echo "umount $MOUNT2 ..."
248 umount $MOUNT2 || true
249 echo "stopping fs2mds ..."
250 stop fs2mds -f || true
251 echo "stopping fs2ost ..."
252 stop fs2ost -f || true
256 do_facet client "cp /etc/passwd $DIR/a" || return 71
257 do_facet client "rm $DIR/a" || return 72
258 # make sure lustre is actually mounted (touch will block,
259 # but grep won't, so do it after)
260 do_facet client "grep $MOUNT' ' /proc/mounts > /dev/null" || return 73
261 echo "setup single mount lustre success"
265 do_facet client "touch $DIR/a" || return 71
266 do_facet client "rm $DIR/a" || return 72
267 do_facet client "touch $DIR2/a" || return 73
268 do_facet client "rm $DIR2/a" || return 74
269 echo "setup double mount lustre success"
273 cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w $1 | head -n 1
276 if [ "$ONLY" == "setup" ]; then
281 if [ "$ONLY" == "cleanup" ]; then
288 #create single point mountpoint
294 check_mount || error "check_mount failed"
295 cleanup || error "cleanup failed with $?"
297 run_test 0 "single mount setup"
300 start_mds || error "MDS start failed"
301 start_ost || error "unable to start OST"
302 echo "start ost second time..."
303 start_ost && error "2nd OST start should fail"
304 mount_client $MOUNT || error "client start failed"
305 check_mount || error "check_mount failed"
306 cleanup || error "cleanup failed with $?"
308 run_test 1 "start up ost twice (should return errors)"
311 start_mds || error "MDT start failed"
312 echo "start mds second time.."
313 start_mds && error "2nd MDT start should fail"
314 start_ost || error "OST start failed"
315 mount_client $MOUNT || error "mount_client failed to start client"
316 check_mount || error "check_mount failed"
317 cleanup || error "cleanup failed with $?"
319 run_test 2 "start up mds twice (should return err)"
323 #mount.lustre returns an error if already in mtab
324 mount_client $MOUNT && error "2nd client mount should fail"
325 check_mount || error "check_mount failed"
326 cleanup || error "cleanup failed with $?"
328 run_test 3 "mount client twice (should return err)"
332 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
333 stop_ost || error "Unable to stop OST1"
334 umount_client $MOUNT -f || error "unmount $MOUNT failed"
337 # ok for ost to fail shutdown
338 if [ 202 -ne $eno ] && [ 0 -ne $eno ]; then
339 error "cleanup failed with $?"
342 run_test 4 "force cleanup ost, then cleanup"
344 test_5a() { # was test_5
346 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
347 fuser -m -v $MOUNT && echo "$MOUNT is in use by user space process."
349 stop_mds || error "Unable to stop MDS"
351 # cleanup may return an error from the failed
352 # disconnects; for now I'll consider this successful
353 # if all the modules have unloaded.
357 echo "killing umount"
358 kill -TERM $UMOUNT_PID
359 echo "waiting for umount to finish"
361 if grep " $MOUNT " /proc/mounts; then
362 echo "test 5: /proc/mounts after failed umount"
366 echo "killing umount"
367 kill -TERM $UMOUNT_PID
368 echo "waiting for umount to finish"
370 grep " $MOUNT " /proc/mounts &&
371 error "/proc/mounts after second umount"
374 # manual_mount_client may fail due to umount succeeding above
376 # stop_mds is a no-op here, and should not fail
377 cleanup_nocli || error "cleanup_nocli failed with $?"
378 # df may have lingering entry
380 # mtab may have lingering entry
384 while [ "$WAIT" -ne "$MAX_WAIT" ]; do
386 grep -q $MOUNT" " /etc/mtab || break
387 echo "Waiting /etc/mtab updated ... "
388 WAIT=$(( WAIT + sleep))
390 [ "$WAIT" -eq "$MAX_WAIT" ] &&
391 error "/etc/mtab is not updated in $WAIT secs"
392 echo "/etc/mtab updated in $WAIT secs"
394 run_test 5a "force cleanup mds, then cleanup"
402 grep " $MOUNT " /etc/mtab &&
403 error false "unexpected entry in mtab before mount" && return 10
405 start_ost || error "OST start failed"
406 if ! combined_mgs_mds ; then
407 trap cleanup_5b EXIT ERR
408 start_mds || error "MDS start failed"
412 mount_client $MOUNT && error "mount_client $MOUNT should fail"
413 grep " $MOUNT " /etc/mtab &&
414 error "$MOUNT entry in mtab after failed mount"
416 # stop_mds is a no-op here, and should not fail
417 cleanup_nocli || error "cleanup_nocli failed with $?"
418 if ! combined_mgs_mds ; then
422 run_test 5b "Try to start a client with no MGS (should return errs)"
425 grep " $MOUNT " /etc/mtab &&
426 error false "unexpected entry in mtab before mount" && return 10
428 start_mds || error "MDS start failed"
429 start_ost || error "OST start failed"
430 local oldfs="${FSNAME}"
431 FSNAME="wrong.${FSNAME}"
432 mount_client $MOUNT || :
434 grep " $MOUNT " /etc/mtab &&
435 error "$MOUNT entry in mtab after failed mount"
437 cleanup_nocli || error "cleanup_nocli failed with $?"
439 run_test 5c "cleanup after failed mount (bug 2712) (should return errs)"
442 grep " $MOUNT " /etc/mtab &&
443 error "unexpected entry in mtab before mount"
445 start_ost || error "OST start failed"
446 start_mds || error "MDS start failed"
447 stop_ost -f || error "Unable to stop OST1"
448 mount_client $MOUNT || error "mount_client $MOUNT failed"
449 umount_client $MOUNT -f || error "umount_client $MOUNT failed"
450 cleanup_nocli || error "cleanup_nocli failed with $?"
451 ! grep " $MOUNT " /etc/mtab ||
452 error "$MOUNT entry in mtab after unmount"
454 run_test 5d "mount with ost down"
457 grep " $MOUNT " /etc/mtab &&
458 error false "unexpected entry in mtab before mount" && return 10
460 start_mds || error "MDS start failed"
461 start_ost || error "OST start failed"
463 #define OBD_FAIL_PTLRPC_DELAY_SEND 0x506
464 do_facet client "$LCTL set_param fail_loc=0x80000506"
465 mount_client $MOUNT || echo "mount failed (not fatal)"
466 cleanup || error "cleanup failed with $?"
467 grep " $MOUNT " /etc/mtab &&
468 error "$MOUNT entry in mtab after unmount"
471 run_test 5e "delayed connect, don't crash (bug 10268)"
474 combined_mgs_mds && skip "needs separate mgs and mds"
476 grep " $MOUNT " /etc/mtab &&
477 error false "unexpected entry in mtab before mount" && return 10
480 start_ost || error "OST start failed"
481 mount_client $MOUNT &
483 echo client_mount pid is $pid
487 if ! ps -f -p $pid >/dev/null; then
490 grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
491 error "mount returns $rc, expected to hang"
493 cleanup || error "cleanup failed with $?"
498 start_mds || error "start MDS failed"
500 # mount should succeed after start mds
502 grep " $MOUNT " /etc/mtab && echo "test 5f: mtab after mount"
503 cleanup || error "final call to cleanup failed with rc $?"
505 run_test 5f "mds down, cleanup after failed mount (bug 2712)"
509 [ "$CLIENT_VERSION" -lt $(version_code 2.9.53) ] &&
510 skip "automount of debugfs missing before 2.9.53"
511 umount /sys/kernel/debug
512 $LCTL get_param -n devices | egrep -v "error" && \
513 error "lctl can't access debugfs data"
514 grep " debugfs " /etc/mtab || error "debugfs failed to remount"
516 run_test 5g "handle missing debugfs"
522 #define OBD_FAIL_MDS_FS_SETUP 0x135
523 do_facet mds1 "$LCTL set_param fail_loc=0x80000135"
524 start_mdt 1 && error "start mdt should fail"
525 start_mdt 1 || error "start mdt failed"
526 client_up || error "client_up failed"
529 run_test 5h "start mdt failure at mdt_fs_setup()"
532 (( $MDS1_VERSION >= $(version_code 2.12.54) )) ||
533 skip "Need MDS version at least 2.12.54"
538 #define OBD_FAIL_QUOTA_INIT 0xA05
539 do_facet mds1 "$LCTL set_param fail_loc=0x80000A05"
540 start_mdt 1 && error "start mdt should fail"
541 start_mdt 1 || error "start mdt failed"
542 client_up || error "client_up failed"
545 run_test 5i "start mdt failure at mdt_quota_init()"
549 load_module ../libcfs/libcfs/libcfs ||
550 error "Failed to load modules libcfs rc = $?"
551 $LCTL set_param debug=all
554 run_test 5j "verify libcfs doesn't crash when setting debug flags"
559 mount_client $MOUNT || error "mount_client $MOUNT failed"
560 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
561 cleanup || error "cleanup failed with rc $?"
563 run_test 6 "manual umount, then mount again"
568 cleanup_nocli || error "cleanup_nocli failed with $?"
570 run_test 7 "manual umount, then cleanup"
574 mount_client $MOUNT2 || error "mount_client $MOUNT2 failed"
575 check_mount2 || error "check_mount2 failed"
576 umount_client $MOUNT2 || error "umount_client $MOUNT2 failed"
577 cleanup || error "cleanup failed with rc $?"
579 run_test 8 "double mount setup"
582 start_ost || error "OST start failed"
584 do_facet ost1 $LCTL set_param debug=\'inode trace\' ||
585 error "do_facet ost1 set_param inode trace failed."
586 do_facet ost1 $LCTL set_param subsystem_debug=\'mds ost\' ||
587 error "do_facet ost1 set_param debug mds ost failed."
589 CHECK_PTLDEBUG="`do_facet ost1 $LCTL get_param -n debug`"
590 if [ "$CHECK_PTLDEBUG" ] && { \
591 [ "$CHECK_PTLDEBUG" = "trace inode warning error emerg console" ] ||
592 [ "$CHECK_PTLDEBUG" = "trace inode" ]; }; then
593 echo "lnet.debug success"
595 error "lnet.debug: want 'trace inode', have '$CHECK_PTLDEBUG'"
597 CHECK_SUBSYS="`do_facet ost1 $LCTL get_param -n subsystem_debug`"
598 if [ "$CHECK_SUBSYS" ] && [ "$CHECK_SUBSYS" = "mds ost" ]; then
599 echo "lnet.subsystem_debug success"
601 error "lnet.subsystem_debug: want 'mds ost' got '$CHECK_SUBSYS'"
603 stop_ost || error "Unable to stop OST1"
605 run_test 9 "test ptldebug and subsystem for mkfs"
610 if ! combined_mgs_mds; then
611 files=$(do_facet mgs "find /{proc/fs,sys/fs,sys/kernel/debug}/lustre -type l -exec test ! -e {} \; -print")
612 [ -z $files ] || echo "MGS $files is a broken symlink"
615 files=$(do_facet mds1 "find /{proc/fs,sys/fs,sys/kernel/debug}/lustre -type l -exec test ! -e {} \; -print")
616 [ -z $files ] || echo "MDS $files is a broken symlink"
618 files=$(do_facet ost1 "find /{proc/fs,sys/fs,sys/kernel/debug}/lustre -type l -exec test ! -e {} \; -print")
619 [ -z $files ] || echo "OSS $files is a broken symlink"
621 files=$(do_facet client "find /{proc/fs,sys/fs,sys/kernel/debug}/lustre -type l -exec test ! -e {} \; -print")
622 [ -z $files ] || echo "clients $files is a broken symlink"
624 cleanup || error "cleanup failed with rc $?"
626 run_test 10a "find lctl param broken symlinks"
629 # Test 16 was to "verify that lustre will correct the mode of OBJECTS".
630 # But with new MDS stack we don't care about the mode of local objects
631 # anymore, so this test is removed. See bug 22944 for more details.
635 if [ "$mds1_FSTYPE" != ldiskfs ]; then
636 skip "ldiskfs only test"
640 check_mount || error "check_mount failed"
641 cleanup || error "cleanup failed with rc $?"
643 echo "Remove mds config log"
644 if ! combined_mgs_mds ; then
648 do_facet mgs "$DEBUGFS -w -R 'unlink CONFIGS/$FSNAME-MDT0000' \
649 $(mgsdevname) || return \$?" ||
650 error "do_facet mgs failed with $?"
652 if ! combined_mgs_mds ; then
656 start_ost || error "OST start failed"
657 start_mds && error "MDS start succeeded, but should fail"
660 run_test 17 "Verify failed mds_postsetup won't fail assertion (2936) (should return errs)"
663 if [ "$mds1_FSTYPE" != ldiskfs ]; then
664 skip "ldiskfs only test"
667 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
672 # check if current MDSSIZE is large enough
673 [ $MDSSIZE -ge $MIN ] && OK=1 && myMDSSIZE=$MDSSIZE &&
674 log "use MDSSIZE=$MDSSIZE"
676 # check if the global config has a large enough MDSSIZE
677 [ -z "$OK" -a ! -z "$STORED_MDSSIZE" ] &&
678 [ $STORED_MDSSIZE -ge $MIN ] &&
679 OK=1 && myMDSSIZE=$STORED_MDSSIZE &&
680 log "use STORED_MDSSIZE=$STORED_MDSSIZE"
682 # check if the block device is large enough
683 is_blkdev $SINGLEMDS $MDSDEV $MIN
684 local large_enough=$?
685 if [ -n "$OK" ]; then
686 [ $large_enough -ne 0 ] && OK=""
688 [ $large_enough -eq 0 ] && OK=1 && myMDSSIZE=$MIN &&
689 log "use device $MDSDEV with MIN=$MIN"
692 # check if a loopback device has enough space for fs metadata (5%)
694 if [ -z "$OK" ]; then
695 local SPACE=$(do_facet $SINGLEMDS "[ -f $MDSDEV -o ! \
696 -e $MDSDEV ] && df -P \\\$(dirname $MDSDEV)" |
697 awk '($1 != "Filesystem") { print $4 }')
698 ! [ -z "$SPACE" ] && [ $SPACE -gt $((MIN / 20)) ] &&
699 OK=1 && myMDSSIZE=$MIN &&
700 log "use file $MDSDEV with MIN=$MIN"
703 [ -z "$OK" ] && skip_env "$MDSDEV too small for ${MIN}kB MDS"
705 echo "mount mds with large journal..."
707 local OLD_MDSSIZE=$MDSSIZE
711 echo "mount lustre system..."
713 check_mount || error "check_mount failed"
715 echo "check journal size..."
716 local FOUNDSIZE=$(do_facet $SINGLEMDS "$DEBUGFS -c -R 'stat <8>' $MDSDEV" | awk '/Size: / { print $NF; exit;}')
717 if [ $FOUNDSIZE -gt $((32 * 1024 * 1024)) ]; then
718 log "Success: mkfs creates large journals. Size: $((FOUNDSIZE >> 20))M"
720 error "expected journal size > 32M, found $((FOUNDSIZE >> 20))M"
723 cleanup || error "cleanup failed with rc $?"
728 run_test 18 "check mkfs creates large journals"
731 start_mds || error "MDS start failed"
732 stop_mds || error "Unable to stop MDS"
734 run_test 19a "start/stop MDS without OSTs"
737 start_ost || error "Unable to start OST1"
738 stop_ost -f || error "Unable to stop OST1"
740 run_test 19b "start/stop OSTs without MDS"
743 # first format the ost/mdt
744 start_mds || error "MDS start failed"
745 start_ost || error "Unable to start OST1"
746 mount_client $MOUNT || error "mount_client $MOUNT failed"
747 check_mount || error "check_mount failed"
748 rm -f $DIR/$tfile || error "remove $DIR/$tfile failed."
749 mount_client $MOUNT remount,ro || error "remount client with ro failed"
750 touch $DIR/$tfile && error "$DIR/$tfile created incorrectly"
751 [ -e $DIR/$tfile ] && error "$DIR/$tfile exists incorrectly"
752 mount_client $MOUNT remount,rw || error "remount client with rw failed"
753 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
754 MCNT=$(grep -c $MOUNT' ' /etc/mtab)
755 [ "$MCNT" -ne 1 ] && error "$MOUNT in /etc/mtab $MCNT times"
757 stop_mds || error "Unable to stop MDS"
758 stop_ost || error "Unable to stop OST1"
760 run_test 20 "remount ro,rw mounts work and doesn't break /etc/mtab"
763 start_mds || error "MDS start failed"
764 start_ost || error "unable to start OST1"
765 wait_osc_import_state mds ost FULL
766 stop_ost || error "unable to stop OST1"
767 stop_mds || error "unable to stop MDS"
769 run_test 21a "start mds before ost, stop ost first"
772 start_ost || error "unable to start OST1"
773 start_mds || error "MDS start failed"
774 wait_osc_import_state mds ost FULL
775 stop_mds || error "unable to stop MDS"
776 stop_ost || error "unable to stop OST1"
778 run_test 21b "start ost before mds, stop mds first"
781 start_ost || error "Unable to start OST1"
782 start_mds || error "MDS start failed"
783 start_ost2 || error "Unable to start OST2"
784 wait_osc_import_state mds ost2 FULL
785 stop_ost || error "Unable to stop OST1"
786 stop_ost2 || error "Unable to stop OST2"
787 stop_mds || error "Unable to stop MDS"
788 #writeconf to remove all ost2 traces for subsequent tests
789 writeconf_or_reformat
791 run_test 21c "start mds between two osts, stop mds last"
794 combined_mgs_mds && skip "need separate mgs device"
799 start_mgs || error "unable to start MGS"
800 start_ost || error "unable to start OST1"
801 start_ost2 || error "unable to start OST2"
802 start_mds || error "MDS start failed"
803 wait_osc_import_state mds ost2 FULL
805 local zkeeper=${KEEP_ZPOOL}
806 stack_trap "KEEP_ZPOOL=$zkeeper" EXIT
809 stop_ost || error "Unable to stop OST1"
810 stop_ost2 || error "Unable to stop OST2"
811 stop_mds || error "Unable to stop MDS"
813 #writeconf to remove all ost2 traces for subsequent tests
814 writeconf_or_reformat
815 KEEP_ZPOOL="${zkeeper}"
817 start_mgs || error "unable to start MGS"
819 run_test 21d "start mgs then ost and then mds"
822 MGSNID="$saved_mgsnid"
824 echo "stopping fs2mgs ..."
825 stop $fs2mgs -f || true
828 test_21e() { # LU-5863
829 if [[ -z "$fs3ost_DEV" || -z "$fs2ost_DEV" || -z "$fs2mds_DEV" ]]; then
830 is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
831 skip_env "mixed loopback and real device not working"
834 local fs2mdsdev=$(mdsdevname 1_2)
835 local fs2ostdev=$(ostdevname 1_2)
836 local fs3ostdev=$(ostdevname 2_2)
838 local fs2mdsvdev=$(mdsvdevname 1_2)
839 local fs2ostvdev=$(ostvdevname 1_2)
840 local fs3ostvdev=$(ostvdevname 2_2)
842 # temporarily use fs3ost as fs2mgs
844 local fs2mgsdev=$fs3ostdev
845 local fs2mgsvdev=$fs3ostvdev
847 local fsname=test1234
849 add $fs2mgs $(mkfs_opts mgs $fs2mgsdev) --fsname=$fsname \
850 --reformat $fs2mgsdev $fs2mgsvdev || error "add fs2mgs failed"
851 start $fs2mgs $fs2mgsdev $MGS_MOUNT_OPTS && trap cleanup_21e EXIT INT ||
852 error "start fs2mgs failed"
854 local saved_mgsnid="$MGSNID"
855 MGSNID=$(do_facet $fs2mgs $LCTL list_nids | xargs | tr ' ' ,)
857 add fs2mds $(mkfs_opts mds1 $fs2mdsdev $fsname) \
858 --reformat $fs2mdsdev $fs2mdsvdev || error "add fs2mds failed"
859 add fs2ost $(mkfs_opts ost1 $fs2ostdev $fsname) \
860 --reformat $fs2ostdev $fs2ostvdev || error "add fs2ost failed"
862 start fs2ost $fs2ostdev $OST_MOUNT_OPTS || error "start fs2ost failed"
863 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS || error "start fs2mds failed"
865 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
866 $MOUNT_CMD $MGSNID:/$fsname $MOUNT2 || error "mount $MOUNT2 failed"
867 DIR=$MOUNT2 MOUNT=$MOUNT2 check_mount || error "check $MOUNT2 failed"
871 run_test 21e "separate MGS and MDS"
874 start_mds || error "MDS start failed"
876 echo "Client mount with ost in logs, but none running"
877 start_ost || error "unable to start OST1"
878 # wait until mds connected to ost and open client connection
879 wait_osc_import_state mds ost FULL
880 stop_ost || error "unable to stop OST1"
881 mount_client $MOUNT || error "mount_client $MOUNT failed"
882 # check_mount will block trying to contact ost
883 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
884 rm -f $DIR/$tfile || error "remove $DIR/$tfile failed"
885 umount_client $MOUNT -f
888 echo "Client mount with a running ost"
889 start_ost || error "unable to start OST1"
891 # if gss enabled, wait full time to let connection from
892 # mds to ost be established, due to the mismatch between
893 # initial connect timeout and gss context negotiation timeout.
894 # This perhaps could be remove after AT landed.
895 echo "sleep $((TIMEOUT + TIMEOUT + TIMEOUT))s"
896 sleep $((TIMEOUT + TIMEOUT + TIMEOUT))
898 mount_client $MOUNT || error "mount_client $MOUNT failed"
899 wait_osc_import_state mds ost FULL
900 wait_osc_import_ready client ost
901 check_mount || error "check_mount failed"
904 cleanup || error "cleanup failed with rc $?"
906 run_test 22 "start a client before osts (should return errs)"
908 test_23a() { # was test_23
911 stop $SINGLEMDS || error "failed to stop $SINGLEMDS"
912 # force down client so that recovering mds waits for reconnect
913 local running=$(grep -c $MOUNT /proc/mounts) || true
914 if [ $running -ne 0 ]; then
915 echo "Stopping client $MOUNT (opts: -f)"
919 # enter recovery on failed mds
920 local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
921 start $SINGLEMDS $MDT_DEV $MDS_MOUNT_OPTS || error "MDS start failed"
922 # try to start a new client
923 mount_client $MOUNT &
925 MOUNT_PID=$(ps -ef | grep "t lustre" | grep -v grep | awk '{print $2}')
926 MOUNT_LUSTRE_PID=$(ps -ef | grep mount.lustre |
927 grep -v grep | awk '{print $2}')
928 echo mount pid is ${MOUNT_PID}, mount.lustre pid is ${MOUNT_LUSTRE_PID}
930 ps --ppid $MOUNT_LUSTRE_PID
931 echo "waiting for mount to finish"
933 # "ctrl-c" sends SIGINT but it usually (in script) does not work on child process
934 # SIGTERM works but it does not spread to offspring processses
935 kill -s TERM $MOUNT_PID
936 kill -s TERM $MOUNT_LUSTRE_PID
937 # we can not wait $MOUNT_PID because it is not a child of this shell
943 while [ "$WAIT" -lt "$MAX_WAIT" ]; do
945 PID1=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_PID)
946 PID2=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_LUSTRE_PID)
949 [ -z "$PID1" -a -z "$PID2" ] && break
950 echo "waiting for mount to finish ... "
951 WAIT=$(( WAIT + sleep))
953 if [ "$WAIT" -eq "$MAX_WAIT" ]; then
954 error "MOUNT_PID $MOUNT_PID and "\
955 "MOUNT_LUSTRE_PID $MOUNT_LUSTRE_PID still not killed in $WAIT secs"
958 cleanup || error "cleanup failed with rc $?"
960 run_test 23a "interrupt client during recovery mount delay"
962 test_23b() { # was test_23
963 start_mds || error "MDS start failed"
964 start_ost || error "Unable to start OST1"
965 # Simulate -EINTR during mount OBD_FAIL_LDLM_CLOSE_THREAD
966 $LCTL set_param fail_loc=0x80000313
968 cleanup || error "cleanup failed with rc $?"
970 run_test 23b "Simulate -EINTR during mount"
973 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
975 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
976 is_blkdev $SINGLEMDS $MDSDEV &&
977 skip_env "mixed loopback and real device not working"
980 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
982 local fs2mdsdev=$(mdsdevname 1_2)
983 local fs2ostdev=$(ostdevname 1_2)
984 local fs2mdsvdev=$(mdsvdevname 1_2)
985 local fs2ostvdev=$(ostvdevname 1_2)
988 # LU-9733 test fsname started with numbers as well
989 local FSNAME2=969362ae
991 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev} ) --nomgs --mgsnode=$MGSNID \
992 --fsname=${FSNAME2} --reformat $fs2mdsdev $fs2mdsvdev || exit 10
994 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --fsname=${FSNAME2} \
995 --reformat $fs2ostdev $fs2ostvdev || exit 10
998 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT
999 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
1000 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
1001 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
1003 # LU-9733 test fsname started with numbers
1004 cl_user=$(do_facet $SINGLEMDS lctl --device $FSNAME2-MDT0000 \
1005 changelog_register -n) ||
1006 error "register changelog failed"
1008 do_facet $SINGLEMDS lctl --device $FSNAME2-MDT0000 \
1009 changelog_deregister $cl_user ||
1010 error "deregister changelog failed"
1012 check_mount || error "check_mount failed"
1013 # files written on 1 should not show up on 2
1014 cp /etc/passwd $DIR/$tfile
1016 [ -e $MOUNT2/$tfile ] && error "File bleed"
1019 cp /etc/passwd $MOUNT2/$tfile ||
1020 error "cp /etc/passwd $MOUNT2/$tfile failed"
1021 rm $MOUNT2/$tfile || error "remove $MOUNT2/$tfile failed"
1022 # 2 is actually mounted
1023 grep $MOUNT2' ' /proc/mounts > /dev/null || error "$MOUNT2 not mounted"
1025 facet_failover fs2mds
1026 facet_failover fs2ost
1028 umount_client $MOUNT
1029 # the MDS must remain up until last MDT
1031 MDS=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
1032 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
1033 [ -z "$MDS" ] && error "No MDT"
1035 cleanup_nocli || error "cleanup_nocli failed with rc $?"
1037 run_test 24a "Multiple MDTs on a single node"
1040 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
1042 skip "needs combined MGT and MDT device"
1044 if [ -z "$fs2mds_DEV" ]; then
1045 local dev=${SINGLEMDS}_dev
1046 local MDSDEV=${!dev}
1047 is_blkdev $SINGLEMDS $MDSDEV &&
1048 skip_env "mixed loopback and real device not working"
1051 local fs2mdsdev=$(mdsdevname 1_2)
1052 local fs2mdsvdev=$(mdsvdevname 1_2)
1054 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev} ) --mgs --fsname=${FSNAME}2 \
1055 --reformat $fs2mdsdev $fs2mdsvdev || exit 10
1057 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && {
1059 error "start MDS should fail"
1062 cleanup || error "cleanup failed with rc $?"
1064 run_test 24b "Multiple MGSs on a single node (should return err)"
1068 check_mount || error "check_mount failed"
1069 local MODULES=$($LCTL modules | awk '{ print $2 }')
1070 rmmod $MODULES 2>/dev/null || true
1071 cleanup || error "cleanup failed with $?"
1073 run_test 25 "Verify modules are referenced"
1077 # we need modules before mount for sysctl, so make sure...
1078 do_facet $SINGLEMDS "lsmod | grep -q lustre || modprobe lustre"
1079 #define OBD_FAIL_MDS_FS_SETUP 0x135
1080 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000135"
1081 start_mds && error "MDS started but should not have started"
1082 $LCTL get_param -n devices
1083 DEVS=$($LCTL get_param -n devices | egrep -v MG | wc -l)
1084 [ $DEVS -gt 0 ] && error "number of devices is $DEVS, should be zero"
1085 # start mds to drop writeconf setting
1086 start_mds || error "Unable to start MDS"
1087 stop_mds || error "Unable to stop MDS"
1088 unload_modules_conf || error "unload_modules_conf failed with $?"
1090 run_test 26 "MDT startup failure cleans LOV (should return errs)"
1094 start_ost || error "Unable to start OST1"
1095 start_mds || error "Unable to start MDS"
1096 echo "Requeue thread should have started: "
1097 ps -e | grep ll_cfg_requeue
1098 set_persistent_param_and_check ost1 \
1099 "obdfilter.$FSNAME-OST0000.client_cache_seconds" \
1100 "$FSNAME-OST0000.ost.client_cache_seconds"
1101 cleanup_nocli || error "cleanup_nocli failed with rc $?"
1103 run_test 27a "Reacquire MGS lock if OST started first"
1108 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
1109 awk '($3 ~ "mdt" && $4 ~ "MDT0000") { print $4 }')
1111 facet_failover $SINGLEMDS
1112 set_persistent_param_and_check $SINGLEMDS \
1113 "mdt.$device.identity_acquire_expire" \
1114 "$device.mdt.identity_acquire_expire"
1115 set_persistent_param_and_check client \
1116 "mdc.$device-mdc-*.max_rpcs_in_flight" \
1117 "$device.mdc.max_rpcs_in_flight"
1119 cleanup || error "cleanup failed with $?"
1121 run_test 27b "Reacquire MGS lock after failover"
1123 test_28A() { # was test_28
1126 local TEST="llite.$FSNAME-*.max_read_ahead_whole_mb"
1127 local PARAM="$FSNAME.llite.max_read_ahead_whole_mb"
1128 local orig=$($LCTL get_param -n $TEST)
1129 local max=$($LCTL get_param -n \
1130 llite.$FSNAME-*.max_read_ahead_per_file_mb)
1132 orig=${orig%%.[0-9]*}
1134 echo "ORIG:$orig MAX:$max"
1135 [[ $max -le $orig ]] && orig=$((max - 3))
1136 echo "ORIG:$orig MAX:$max"
1138 local final=$((orig + 1))
1140 set_persistent_param_and_check client "$TEST" "$PARAM" $final
1141 final=$((final + 1))
1142 set_persistent_param_and_check client "$TEST" "$PARAM" $final
1143 umount_client $MOUNT || error "umount_client $MOUNT failed"
1144 mount_client $MOUNT || error "mount_client $MOUNT failed"
1146 local result=$($LCTL get_param -n $TEST)
1148 if [ $result -ne $final ]; then
1149 error "New config not seen: wanted $final got $result"
1151 echo "New config success: got $result"
1153 set_persistent_param_and_check client "$TEST" "$PARAM" $orig
1154 cleanup || error "cleanup failed with rc $?"
1156 run_test 28A "permanent parameter setting"
1158 test_28a() { # LU-4221
1159 [[ "$OST1_VERSION" -ge $(version_code 2.5.52) ]] ||
1160 skip "Need OST version at least 2.5.52"
1161 [ "$ost1_FSTYPE" = zfs ] &&
1162 skip "LU-4221: no such proc params for ZFS OSTs"
1169 local device="$FSNAME-OST0000"
1173 # In this test we will set three kinds of proc parameters with
1174 # lctl set_param -P or lctl conf_param:
1175 # 1. non-symlink ones in the OFD
1176 # 2. non-symlink ones in the OSD
1179 # prepare a non-symlink parameter in the OFD
1180 name="client_cache_seconds"
1181 param="$device.ost.$name"
1182 cmd="obdfilter.$device.$name"
1184 # permanently setting the parameter in the OFD
1185 old=$(do_facet ost1 $LCTL get_param -n $cmd)
1187 set_persistent_param_and_check ost1 "$cmd" "$param" $new
1188 set_persistent_param_and_check ost1 "$cmd" "$param" $old
1191 # prepare a non-symlink parameter in the OSD
1193 param="$device.osd.$name"
1194 cmd="osd-*.$device.$name"
1196 # conf_param the parameter in the OSD
1197 old=$(do_facet ost1 $LCTL get_param -n $cmd)
1198 new=$(((old + 1) % 2))
1199 set_persistent_param_and_check ost1 "$cmd" "$param" $new
1200 set_persistent_param_and_check ost1 "$cmd" "$param" $old
1202 cleanup || error "cleanup failed with $?"
1204 run_test 28a "set symlink parameters permanently with lctl"
1207 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >= 2 OSTs"
1208 setup_noconfig > /dev/null 2>&1
1209 start_ost2 || error "Unable to start OST2"
1212 local PARAM="$FSNAME-OST0001.osc.active"
1213 # With lctl set_param -P the value $PROC_ACT will be sent to
1214 # all nodes. The [!M] filter out the ability to set active
1215 # on the MDS servers which is tested with wait_osp_* below.
1216 # For ost_server_uuid that only exist on client so filtering
1218 local PROC_ACT="os[cp].$FSNAME-OST0001-osc-[^M]*.active"
1219 local PROC_UUID="os[cp].$FSNAME-OST0001-osc-[^M]*.ost_server_uuid"
1221 ACTV=$($LCTL get_param -n $PROC_ACT)
1223 set_persistent_param_and_check client $PROC_ACT $PARAM $DEAC
1224 # also check ost_server_uuid status
1225 RESULT=$($LCTL get_param -n $PROC_UUID | grep DEACTIV)
1226 if [ -z "$RESULT" ]; then
1227 error "Client not deactivated: $($LCTL get_param \
1230 echo "Live client success: got $RESULT"
1234 wait_osp_active ost ${FSNAME}-OST0001 1 0
1236 # test new client starts deactivated
1237 umount_client $MOUNT || error "umount_client $MOUNT failed"
1238 mount_client $MOUNT || error "mount_client $MOUNT failed"
1240 # the 2nd and 3rd field of ost_server_uuid do not update at the same
1241 # time when using lctl set_param -P
1242 wait_update_facet client \
1243 "$LCTL get_param -n $PROC_UUID | awk '{print \\\$3 }'" \
1245 error "New client start active: $($LCTL get_param -n $PROC_UUID)"
1247 echo "New client success: got '$($LCTL get_param -n $PROC_UUID)'"
1249 # make sure it reactivates
1250 set_persistent_param_and_check client $PROC_ACT $PARAM $ACTV
1252 umount_client $MOUNT
1253 stop_ost2 || error "Unable to stop OST2"
1254 cleanup_nocli || error "cleanup_nocli failed with $?"
1255 #writeconf to remove all ost2 traces for subsequent tests
1256 writeconf_or_reformat
1258 run_test 29 "permanently remove an OST"
1263 echo Big config llog
1264 local path="llite.$FSNAME-*"
1265 local cpath="$FSNAME.llite"
1266 local param="max_read_ahead_whole_mb"
1268 local test="${path}.$param"
1269 local conf="${cpath}.$param"
1271 local orig=$($LCTL get_param -n $test)
1272 local list=(1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5)
1273 for i in ${list[*]}; do
1274 set_persistent_param_and_check client $test $conf $i
1276 # make sure client restart still works
1277 umount_client $MOUNT
1278 mount_client $MOUNT || error "mount_client $MOUNT failed"
1279 [ "$($LCTL get_param -n $test)" -ne "$i" ] &&
1280 error "Param didn't stick across restart $($test) != $i"
1283 echo Erase parameter setting
1284 if [[ $PERM_CMD == *"set_param -P"* ]]; then
1285 do_facet mgs "$PERM_CMD -d $test" ||
1286 error "Erase param $test failed"
1288 do_facet mgs "$PERM_CMD -d $conf" ||
1289 error "Erase param $conf failed"
1291 umount_client $MOUNT
1292 mount_client $MOUNT || error "mount_client $MOUNT failed"
1293 local final=$($LCTL get_param -n $test)
1294 echo "deleted (default) value=$final, orig=$orig"
1295 orig=${orig%%.[0-9]*}
1296 final=${final%%.[0-9]*}
1297 # assumes this parameter started at the default value
1298 [ "$final" -eq "$orig" ] ||
1299 error "Deleted value=$final -ne orig=$orig"
1301 cleanup || error "cleanup failed with rc $?"
1303 run_test 30a "Big config llog and permanent parameter deletion"
1308 local orignids=$($LCTL get_param -n \
1309 osc.$FSNAME-OST0000-osc-[^M]*.import | grep failover_nids)
1311 local orignidcount=$(echo "$orignids" | wc -w)
1313 # Make a fake nid. Use the OST nid, and add 20 to the least significant
1314 # numerical part of it. Hopefully that's not already a failover address
1316 local OSTNID=$(do_facet ost1 "$LCTL get_param nis" | tail -1 | \
1318 local ORIGVAL=$(echo $OSTNID | egrep -oi "[0-9]*@")
1319 local NEWVAL=$((($(echo $ORIGVAL | egrep -oi "[0-9]*") + 20) % 256))
1320 local NEW=$(echo $OSTNID | sed "s/$ORIGVAL/$NEWVAL@/")
1321 echo "Using fake nid $NEW"
1323 local TEST="$LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1324 grep failover_nids | sed -n 's/.*\($NEW\).*/\1/p'"
1325 if [[ $PERM_CMD == *"set_param -P"* ]]; then
1326 PARAM="osc.$FSNAME-OST0000-osc-[^M]*.import"
1327 echo "Setting $PARAM from $TEST to $NEW"
1328 do_facet mgs "$PERM_CMD $PARAM='connection=$NEW'" ||
1329 error "$PERM_CMD $PARAM failed"
1331 PARAM="$FSNAME-OST0000.failover.node"
1332 echo "Setting $PARAM from $TEST to $NEW"
1333 do_facet mgs "$PERM_CMD $PARAM='$NEW'" ||
1334 error "$PARAM $PARAM failed"
1336 wait_update_facet client "$TEST" "$NEW" ||
1337 error "check $PARAM failed!"
1339 local NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1341 local NIDCOUNT=$(echo "$NIDS" | wc -w)
1342 echo "should have $((orignidcount + 1)) entries \
1343 in failover nids string, have $NIDCOUNT"
1344 [ $NIDCOUNT -eq $((orignidcount + 1)) ] ||
1345 error "Failover nid not added"
1347 if [[ $PERM_CMD == *"set_param -P"* ]]; then
1348 do_facet mgs "$PERM_CMD -d osc.$FSNAME-OST0000-osc-*.import"
1350 do_facet mgs "$PERM_CMD -d $FSNAME-OST0000.failover.node" ||
1351 error "$PERM_CMD delete failed"
1353 umount_client $MOUNT
1354 mount_client $MOUNT || error "mount_client $MOUNT failed"
1356 NIDS=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[^M]*.import |
1358 NIDCOUNT=$(echo "$NIDS" | wc -w)
1359 echo "only $orignidcount final entries should remain \
1360 in failover nids string, have $NIDCOUNT"
1361 [ $NIDCOUNT -eq $orignidcount ] || error "Failover nids not removed"
1363 cleanup || error "cleanup failed with rc $?"
1365 run_test 30b "Remove failover nids"
1367 test_31() { # bug 10734
1368 # ipaddr must not exist
1369 $MOUNT_CMD 4.3.2.1@tcp:/lustre $MOUNT || true
1370 cleanup || error "cleanup failed with rc $?"
1372 run_test 31 "Connect to non-existent node (shouldn't crash)"
1376 T32_BLIMIT=40960 # Kbytes
1379 T32_PROLIMIT=$((T32_BLIMIT/10))
1381 # This is not really a test but a tool to create new disk
1382 # image tarballs for the upgrade tests.
1384 # Disk image tarballs should be created on single-node
1385 # clusters by running this test with default configurations
1386 # plus a few mandatory environment settings that are verified
1387 # at the beginning of the test.
1389 test_32newtarball() {
1393 local tmp=$TMP/t32_image_create
1404 local pj_quota_file_old
1407 if [ $FSNAME != t32fs -o \( -z "$MDSDEV" -a -z "$MDSDEV1" \) -o \
1408 $OSTCOUNT -ne 2 -o -z "$OSTDEV1" ]; then
1409 error "Needs FSNAME=t32fs MDSCOUNT=2 " \
1410 "MDSDEV1=<nonexistent_file> " \
1411 "MDSDEV2=<nonexistent_file> " \
1412 "(or MDSDEV, in the case of b1_8) " \
1413 "OSTCOUNT=2 OSTDEV1=<nonexistent_file> " \
1414 "OSTDEV2=<nonexistent_file>"
1418 echo "Found stale $tmp"
1422 mkdir $tmp/src || return 1
1423 tar cf - -C $src . | tar xf - -C $tmp/src
1425 # format ost with comma-separated NIDs to verify LU-4460
1426 local failnid="$(h2nettype 1.2.3.4),$(h2nettype 4.3.2.1)"
1427 MGSNID="$MGSNID,$MGSNID" OSTOPT="--failnode=$failnid" formatall
1431 [[ "$MDS1_VERSION" -ge $(version_code 2.3.50) ]] ||
1432 $LFS quotacheck -ug /mnt/$FSNAME
1433 $LFS setquota -u $T32_QID -b 0 -B $T32_BLIMIT -i 0 -I $T32_ILIMIT \
1436 if [[ $MDSCOUNT -ge 2 ]]; then
1437 remote_dir=/mnt/$FSNAME/remote_dir
1438 $LFS mkdir -i 1 $remote_dir
1439 tar cf - -C $tmp/src . | tar xf - -C $remote_dir
1441 target_dir=$remote_dir
1442 if [[ $MDS1_VERSION -ge $(version_code 2.7.0) ]]; then
1443 striped_dir=/mnt/$FSNAME/striped_dir_old
1444 $LFS mkdir -i 1 -c 2 $striped_dir
1445 tar cf - -C $tmp/src . | tar xf - -C $striped_dir
1448 tar cf - -C $tmp/src . | tar xf - -C /mnt/$FSNAME
1449 target_dir=/mnt/$FSNAME
1452 # add project quota #
1453 [[ $mds1_FSTYPE == "ldiskfs" &&
1454 $MDS1_VERSION -gt $(version_code 2.9.55) ]] ||
1455 [[ $mds1_FSTYPE == "zfs" &&
1456 $MDS1_VERSION -gt $(version_code 2.10.53) ]] && {
1457 pj_quota_dir=$target_dir/project_quota_dir
1458 pj_quota_file_old=$pj_quota_dir/pj_quota_file_old
1460 enable_project_quota
1461 set_mdt_qtype ugp ||
1462 error "enable mdt quota failed"
1464 set_ost_qtype ugp ||
1465 error "enable ost quota failed"
1467 mkdir -p $pj_quota_dir
1468 $LFS setquota -p $T32_PRJID -b 0 -B $T32_PROLIMIT -i 0 \
1469 -I $T32_ILIMIT $pj_quota_dir ||
1470 error "setquota -p $T32_PRJID failed"
1472 $LFS setstripe $pj_quota_file_old -c 1 ||
1473 error "setstripe $pj_quota_file_old failed"
1475 chown $T32_QID:$T32_QID $pj_quota_file_old ||
1476 error "chown $pj_quota_file_old failed"
1478 change_project -p $T32_PRJID $pj_quota_file_old
1480 mkdir -p $tmp/src/project_quota_dir
1481 cp $pj_quota_file_old $tmp/src/project_quota_dir/
1484 #####################
1485 tar cf - -C $tmp/src . | tar xf - -C /mnt/$FSNAME
1487 #if [[ $MDSCOUNT -ge 2 ]]; then
1488 # remote_dir=/mnt/$FSNAME/remote_dir
1489 # $LFS mkdir -i 1 $remote_dir
1490 # tar cf - -C $tmp/src . | tar xf - -C $remote_dir
1492 # if [[ "$MDS1_VERSION" -ge $(version_code 2.7.0) ]]; then
1493 # striped_dir=/mnt/$FSNAME/striped_dir_old
1494 # $LFS mkdir -i 1 -c 2 $striped_dir
1495 # tar cf - -C $tmp/src . | tar xf - -C $striped_dir
1500 if [[ $MDS1_VERSION -ge $(version_code 2.9.51) ]]; then
1501 pfl_dir=$target_dir/pfl_dir
1502 pfl_file=$pfl_dir/pfl_file
1504 $LFS setstripe -E 2M -c 1 -o 0 -E -1 -S 2M -c 1 -o 1 \
1506 error "Create PFL file failed"
1508 dd if=/dev/urandom of=$pfl_file bs=1k count=3k
1509 mkdir -p $tmp/src/pfl_dir
1510 cp $pfl_file $tmp/src/pfl_dir/
1515 if [[ $MDS1_VERSION -ge $(version_code 2.10.56) ]]; then
1516 dom_dir=$target_dir/dom_dir
1517 dom_file=$dom_dir/dom_file
1518 flr_dir=$target_dir/flr_dir
1519 flr_file=$flr_dir/flr_file
1522 $LFS setstripe -E 1M -L mdt -E -1 -S 4M $dom_file
1523 dd if=/dev/urandom of=$dom_file bs=1k count=2k
1524 mkdir -p $tmp/src/dom_dir
1525 cp $dom_file $tmp/src/dom_dir
1528 $LFS mirror create -N2 $flr_file
1529 dd if=/dev/urandom of=$flr_file bs=1k count=1
1530 mkdir -p $tmp/src/flr_dir
1531 cp $flr_file $tmp/src/flr_dir
1535 local large_xattr_dir=/mnt/$FSNAME/large_xattr_test_dir
1536 local xattr_file=$large_xattr_dir/large_xattr_file
1538 mkdir $large_xattr_dir
1540 setfattr -n user.fooattr -v $(printf "%c" {1..4096} ) $xattr_file ||
1545 mkdir $tmp/img || return 1
1549 pushd_dir=/mnt/$FSNAME
1550 if [[ $MDSCOUNT -ge 2 ]]; then
1551 pushd_dir=$remote_dir
1552 if [[ "$MDS1_VERSION" -ge $(version_code 2.7.0) ]]; then
1554 BLOCKSIZE=1024 ls -Rni --time-style=+%s >$tmp/img/list2
1560 BLOCKSIZE=1024 ls -Rni --time-style=+%s >$tmp/img/list
1561 find ! -name .lustre -type f -exec sha1sum {} \; |
1562 sort -k 2 >$tmp/img/sha1sums
1564 $LCTL get_param -n version | head -n 1 |
1565 sed -e 's/^lustre: *//' >$tmp/img/commit
1567 [[ "$MDS1_VERSION" -ge $(version_code 2.3.50) ]] ||
1568 $LFS quotaon -ug /mnt/$FSNAME
1569 $LFS quota -u $T32_QID -v /mnt/$FSNAME
1570 $LFS quota -v -u $T32_QID /mnt/$FSNAME |
1571 awk 'BEGIN { num='1' } { if ($1 == "'/mnt/$FSNAME'") \
1572 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1573 | tr -d "*" > $tmp/img/bspace
1574 $LFS quota -v -u $T32_QID /mnt/$FSNAME |
1575 awk 'BEGIN { num='5' } { if ($1 == "'/mnt/$FSNAME'") \
1576 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1577 | tr -d "*" > $tmp/img/ispace
1578 echo $T32_BLIMIT > $tmp/img/blimit
1579 echo $T32_ILIMIT > $tmp/img/ilimit
1581 $MULTIOP /mnt/$FSNAME/orph_file Ouw_c&
1585 debugfs -R "ls /PENDING" ${MDSDEV1:-$MDSDEV}
1586 cp ${MDSDEV1:-$MDSDEV} $tmp/img
1595 find -type f -exec sha1sum {} \; | sort -k 2 >$tmp/sha1sums.src
1598 if ! diff -u $tmp/sha1sums.src $tmp/img/sha1sums; then
1599 echo "Data verification failed"
1602 uname -r >$tmp/img/kernel
1603 uname -m >$tmp/img/arch
1605 for ((num=1; num <= $MDSCOUNT; num++)); do
1606 local devname=$(mdsdevname $num)
1610 [[ num -eq 1 ]] && image_name=mdt || image_name=mdt$num
1611 [[ $(facet_fstype $facet) != zfs ]] ||
1612 devname=$(mdsvdevname $num)
1613 dd conv=sparse bs=4k if=$devname of=$tmp/img/$image_name
1616 for ((num=1; num <= $OSTCOUNT; num++)); do
1617 local devname=$(ostdevname $num)
1621 [[ num -eq 1 ]] && image_name=ost || image_name=ost$num
1622 [[ $(facet_fstype $facet) != zfs ]] ||
1623 devname=$(ostdevname $num)
1624 dd conv=sparse bs=4k if=$devname of=$tmp/img/$image_name
1627 version=$(sed -e 's/\(^[0-9]\+\.[0-9]\+\)\(.*$\)/\1/' $tmp/img/commit |
1628 sed -e 's/\./_/g') # E.g., "1.8.7" -> "1_8"
1631 tar cjvf $dst/disk$version-"$mds1_FSTYPE".tar.bz2 -S *
1636 # run_test 32newtarball "Create a new test_32 disk image tarball for this version"
1639 # The list of applicable tarballs is returned via the caller's
1640 # variable "tarballs".
1643 [ "$CLIENTONLY" ] && skip "Client-only testing"
1645 check_versions || skip "do not upgrade with mismatched client/server"
1647 local node=$(facet_active_host $SINGLEMDS)
1648 local r="do_node $node"
1650 ! $r which "$TUNEFS" && skip_env "tunefs.lustre required on $node"
1652 local IMGTYPE="$mds1_FSTYPE"
1654 [[ -n "$T32IMAGE" ]] && tarballs=$T32IMAGE ||
1655 tarballs=$($r find $RLUSTRE/tests -maxdepth 1 \
1656 -name \'disk*-$IMGTYPE.tar.bz2\')
1658 [ -z "$tarballs" ] && skip "No applicable tarballs found"
1661 t32_test_cleanup() {
1663 local facet=$SINGLEMDS
1666 echo "== cleanup with rc=$rc =="
1667 if $shall_cleanup_lustre; then
1668 umount $tmp/mnt/lustre || rc=$?
1670 if $shall_cleanup_mdt; then
1671 $r $UMOUNT $tmp/mnt/mdt || rc=$?
1673 if $shall_cleanup_mdt1; then
1674 $r $UMOUNT $tmp/mnt/mdt1 || rc=$?
1676 if $shall_cleanup_ost; then
1677 $r $UMOUNT $tmp/mnt/ost || rc=$?
1679 if $shall_cleanup_ost1; then
1680 $r $UMOUNT $tmp/mnt/ost1 || rc=$?
1685 if [[ "$mds1_FSTYPE" == zfs ]]; then
1687 local poolname_list="t32fs-mdt1 t32fs-ost1"
1689 ! $mdt2_is_available || poolname_list+=" t32fs-mdt2"
1691 for poolname in $poolname_list; do
1692 destroy_zpool $facet $poolname
1695 combined_mgs_mds || start_mgs || rc=$?
1699 t32_bits_per_long() {
1701 # Yes, this is not meant to be perfect.
1711 t32_reload_modules() {
1713 local all_removed=false
1716 [ "$mds1_FSTYPE" == zfs ] && do_rpc_nodes $node "service zed stop"
1718 while ((i < 20)); do
1719 echo "Unloading modules on $node: Attempt $i"
1720 do_rpc_nodes $node $LUSTRE_RMMOD "$mds1_FSTYPE" &&
1722 do_rpc_nodes $node check_mem_leak || return 1
1723 if $all_removed; then
1724 do_rpc_nodes $node load_modules
1727 if [ "$mds1_FSTYPE" == zfs ]; then
1728 do_rpc_nodes $node "$ZPOOL status -v"
1733 echo "Unloading modules on $node: Given up"
1737 t32_wait_til_devices_gone() {
1743 echo wait for devices to go
1744 while ((i < 20)); do
1745 devices=$(do_rpc_nodes $node $LCTL device_list | wc -l)
1746 loops=$(do_rpc_nodes $node losetup -a | grep -c t32)
1747 ((devices == 0 && loops == 0)) && return 0
1751 echo "waiting for dev on $node: dev $devices loop $loops given up"
1752 do_rpc_nodes $node "losetup -a"
1753 do_rpc_nodes $node "$LCTL device_list"
1757 t32_verify_quota() {
1764 # LU-2435: if the underlying zfs doesn't support userobj_accounting,
1765 # lustre will estimate the object count usage. This fails quota
1766 # verification in 32b. The object quota usage should be accurate after
1767 # zfs-0.7.0 is released.
1768 [ "$mds1_FSTYPE" == zfs ] && {
1769 local zfs_version=$(do_facet $facet cat /sys/module/zfs/version)
1771 [ $(version_code $zfs_version) -lt $(version_code 0.7.0) ] && {
1772 echo "Skip quota verify for zfs: $zfs_version"
1777 $LFS quota -u $T32_QID -v $mnt
1779 qval=$($LFS quota -v -u $T32_QID $mnt |
1780 awk 'BEGIN { num='1' } { if ($1 == "'$mnt'") \
1781 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1783 [ $qval -eq $img_bspace ] || {
1784 echo "bspace, act:$qval, exp:$img_bspace"
1788 qval=$($LFS quota -v -u $T32_QID $mnt |
1789 awk 'BEGIN { num='5' } { if ($1 == "'$mnt'") \
1790 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1792 [ $qval -eq $img_ispace ] || {
1793 echo "ispace, act:$qval, exp:$img_ispace"
1797 qval=$($LFS quota -v -u $T32_QID $mnt |
1798 awk 'BEGIN { num='3' } { if ($1 == "'$mnt'") \
1799 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1801 [ $qval -eq $img_blimit ] || {
1802 echo "blimit, act:$qval, exp:$img_blimit"
1806 qval=$($LFS quota -v -u $T32_QID $mnt |
1807 awk 'BEGIN { num='7' } { if ($1 == "'$mnt'") \
1808 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1810 [ $qval -eq $img_ilimit ] || {
1811 echo "ilimit, act:$qval, exp:$img_ilimit"
1815 set_persistent_param_and_check $facet \
1816 "osd-$mds1_FSTYPE.$fsname-MDT0000.quota_slave.enabled" \
1817 "$fsname.quota.mdt" ug
1819 set_persistent_param_and_check $facet \
1820 "osd-$mds1_FSTYPE.$fsname-OST0000.quota_slave.enabled" \
1821 "$fsname.quota.ost" ug
1824 runas -u $T32_QID -g $T32_QID dd if=/dev/zero of=$mnt/t32_qf_new \
1825 bs=1M count=$((img_blimit / 1024)) oflag=sync && {
1826 echo "Write succeed, but expect -EDQUOT"
1829 rm -f $mnt/t32_qf_new
1831 runas -u $T32_QID -g $T32_QID createmany -m $mnt/t32_qf_ \
1833 echo "Create succeed, but expect -EDQUOT"
1836 unlinkmany $mnt/t32_qf_ $img_ilimit
1846 sync_all_data > /dev/null 2>&1 || true
1848 [ "$uuid" != "global" ] || uuid=$mnt
1850 $LFS quota -v "$1" "$2" $mnt |
1851 awk 'BEGIN { num='$spec' } { if ($1 == "'$uuid'") \
1852 { if (NF == 1) { getline } else { num++ } ; print $num;} }' \
1859 local dne_upgrade=${dne_upgrade:-"no"}
1860 local dom_upgrade=${dom_upgrade:-"no"}
1861 local project_upgrade=${project_upgrade:-"no"}
1862 local ff_convert=${ff_convert:-"no"}
1863 local pfl_upgrade=${pfl_upgrade:-"no"}
1864 local project_quota_upgrade=${project_quota_upgrade:-"no"}
1865 local dom_new_upgrade=${dom_new_upgrade:-"no"}
1866 local flr_upgrade=${flr_upgrade:-"no"}
1867 local shall_cleanup_mdt=false
1868 local shall_cleanup_mdt1=false
1869 local shall_cleanup_ost=false
1870 local shall_cleanup_ost1=false
1871 local shall_cleanup_lustre=false
1872 local mdt2_is_available=false
1873 local ost2_is_available=false
1874 local node=$(facet_active_host $SINGLEMDS)
1875 local r="do_node $node"
1891 local mdt_dev=$tmp/mdt
1892 local mdt2_dev=$tmp/mdt2
1893 local ost_dev=$tmp/ost
1894 local ost2_dev=$tmp/ost2
1898 local pfl_file=$tmp/mnt/lustre/remote_dir/pfl_dir/pfl_file
1899 local flr_file=$tmp/mnt/lustre/remote_dir/flr_dir/flr_file
1900 local dom_file=$tmp/mnt/lustre/remote_dir/dom_dir/dom_file
1901 local quota_dir=$tmp/mnt/lustre/remote_dir/project_quota_dir
1903 combined_mgs_mds || stop_mgs || error "Unable to stop MGS"
1904 trap 'trap - RETURN; t32_test_cleanup' RETURN
1907 nid=$($r $LCTL list_nids | head -1)
1909 mkdir -p $tmp/mnt/lustre || error "mkdir $tmp/mnt/lustre failed"
1910 $r mkdir -p $tmp/mnt/{mdt,mdt1,ost,ost1}
1911 $r tar xjvf $tarball -S -C $tmp || {
1912 error_noexit "Unpacking the disk image tarball"
1915 img_commit=$($r cat $tmp/commit)
1916 img_kernel=$($r cat $tmp/kernel)
1917 img_arch=$($r cat $tmp/arch)
1918 img_bspace=$($r cat $tmp/bspace)
1919 img_ispace=$($r cat $tmp/ispace)
1921 # older images did not have "blimit" and "ilimit" files
1922 # use old values for T32_BLIMIT and T32_ILIMIT
1923 $r test -f $tmp/blimit && img_blimit=$($r cat $tmp/blimit) ||
1925 $r test -f $tmp/ilimit && img_ilimit=$($r cat $tmp/ilimit) ||
1928 echo "Upgrading from $(basename $tarball), created with:"
1929 echo " Commit: $img_commit"
1930 echo " Kernel: $img_kernel"
1931 echo " Arch: $img_arch"
1932 echo "OST version: $(lustre_build_version ost1)"
1934 # The conversion can be made only when both of the following
1935 # conditions are satisfied:
1936 # - ost device img version < 2.3.64
1937 # - ost server version >= 2.5
1938 [ $(version_code $img_commit) -ge $(version_code 2.3.64) -o \
1939 "$OST1_VERSION" -lt $(version_code 2.5.0) ] &&
1942 ! $r test -f $mdt2_dev || mdt2_is_available=true
1943 ! $r test -f $ost2_dev || ost2_is_available=true
1945 if [[ "$mds1_FSTYPE" == zfs ]]; then
1946 echo "== fstype is zfs =="
1949 local poolname_list="t32fs-mdt1 t32fs-ost1"
1951 ! $mdt2_is_available || poolname_list+=" t32fs-mdt2"
1953 for poolname in $poolname_list; do
1955 $ZPOOL list -H $poolname >/dev/null 2>&1 ||
1956 $ZPOOL import -f -d $tmp $poolname"
1959 # upgrade zpool to latest supported features, including
1960 # dnode quota accounting in 0.7.0
1961 $r "$ZPOOL upgrade -a"
1963 mdt_dev=t32fs-mdt1/mdt1
1964 ost_dev=t32fs-ost1/ost1
1965 ! $mdt2_is_available || mdt2_dev=t32fs-mdt2/mdt2
1966 ! $ost2_is_available || ost2_dev=t32fs-ost2/ost2
1967 wait_update_facet $SINGLEMDS "$ZPOOL list |
1968 awk '/^t32fs-mdt1/ { print \\\$1 }'" "t32fs-mdt1" || {
1969 error_noexit "import zfs pool failed"
1972 elif [ "$project_upgrade" != "no" ]; then
1973 echo "== project upgrade =="
1974 ! $r tune2fs -O project $mdt_dev &&
1975 error_noexit "enable project on mdt0 failed" &&
1977 $mdt2_is_available && ! $r tune2fs "-O project" $mdt2_dev &&
1978 error_noexit "enable project on mdt failed" &&
1980 ! $r tune2fs -O project $ost_dev &&
1981 error_noexit "enable project on ost failed" &&
1983 $ost2_is_available && ! $r tune2fs -O project $ost2_dev &&
1984 error_noexit "enable project on ost2 failed" &&
1988 $r $LCTL set_param debug="$PTLDEBUG"
1990 $r $TUNEFS --dryrun $mdt_dev || {
1992 error_noexit "tunefs.lustre before mounting the MDT"
1996 if $mdt2_is_available; then
1997 $r $TUNEFS --dryrun $mdt2_dev || {
1999 error_noexit "tunefs.lustre before mounting the MDT"
2004 if [ "$writeconf" ]; then
2005 echo "== writeconf mdt tunefs and quota =="
2007 if [ "$mds1_FSTYPE" == ldiskfs ]; then
2009 $r $TUNEFS --quota $mdt_dev || {
2011 error_noexit "Enable mdt quota feature"
2015 if [ "$project_quota_upgrade" != "no" ]; then
2016 echo "== enable mdt2 project quota =="
2017 $r $TUNE2FS -O project $mdt_dev || {
2019 error_noexit "tune2fs $mdt_dev failed"
2024 if $mdt2_is_available; then
2025 $r $TUNEFS --quota $mdt2_dev || {
2027 error_noexit "Enable mdt2 quota feature"
2030 if [ "$project_quota_upgrade" != "no" ]; then
2031 echo "== enable mdt2 project quota =="
2032 $r $TUNE2FS -O project $mdt2_dev || {
2035 "tune2fs $mdt2_dev failed"
2042 echo "== replace nids =="
2043 if [ -n "$($LCTL list_nids | grep -v '\(tcp\|lo\)[[:digit:]]*$')" ]; then
2044 [[ "$MGS_VERSION" -ge $(version_code 2.3.59) ]] ||
2045 skip "LU-2200: Cannot run over IB w/o lctl replace_nids "
2046 "(Need MGS version at least 2.3.59)"
2049 local osthost=$(facet_active_host ost1)
2050 local ostnid=$(do_node $osthost $LCTL list_nids | head -1)
2053 if [ "$mds1_FSTYPE" == ldiskfs ]; then
2056 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt
2057 $r $LCTL replace_nids $fsname-OST0000 $ostnid || {
2059 error_noexit "replace_nids $fsname-OST0000 $ostnid failed"
2062 if $ost2_is_available; then
2063 $r $LCTL replace_nids $fsname-OST0001 $ostnid || {
2065 error_noexit "replace_nids $fsname-OST0001 $ostnid failed"
2069 $r $LCTL replace_nids $fsname-MDT0000 $nid || {
2071 error_noexit "replace_nids $fsname-MDT0000 $nid failed"
2074 if $mdt2_is_available; then
2075 $r $LCTL replace_nids $fsname-MDT0001 $nid || {
2077 error_noexit "replace_nids $fsname-MDT0001 $nid failed"
2081 $r $UMOUNT $tmp/mnt/mdt
2083 mopts=exclude=$fsname-OST0000
2084 if [ "$mds1_FSTYPE" == ldiskfs ]; then
2089 t32_wait_til_devices_gone $node
2091 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt || {
2093 error_noexit "Mounting the MDT"
2096 shall_cleanup_mdt=true
2098 if $mdt2_is_available; then
2099 echo "== mdt2 available =="
2100 mopts=mgsnode=$nid,$mopts
2101 $r $MOUNT_CMD -o $mopts $mdt2_dev $tmp/mnt/mdt1 || {
2103 error_noexit "Mounting the MDT"
2106 shall_cleanup_mdt1=true
2107 echo "== mount new MDT $mdt2_dev =="
2109 $r $LCTL set_param -n mdt.${fsname}*.enable_remote_dir=1 || {
2110 error_noexit "enable remote dir create failed"
2114 elif [ "$dne_upgrade" != "no" ]; then
2115 local fs2mdsdev=$(mdsdevname 1_2)
2116 local fs2mdsvdev=$(mdsvdevname 1_2)
2118 echo "== mkfs new MDT on ${fs2mdsdev} =="
2119 if [ "$mds1_FSTYPE" == ldiskfs ]; then
2120 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\""
2123 add $SINGLEMDS $(mds2failover_HOST="" \
2124 mkfs_opts mds2 $fs2mdsdev $fsname) --reformat \
2125 $mkfsoptions $fs2mdsdev $fs2mdsvdev > /dev/null || {
2126 error_noexit "Mkfs new MDT failed"
2130 [[ "$mds1_FSTYPE" != zfs ]] || import_zpool mds1
2132 $r $TUNEFS --dryrun $fs2mdsdev || {
2133 error_noexit "tunefs.lustre before mounting the MDT"
2137 echo "== mount new MDT....$fs2mdsdev =="
2138 $r $MOUNT_CMD -o $mopts $fs2mdsdev $tmp/mnt/mdt1 || {
2139 error_noexit "mount mdt1 failed"
2143 $r $LCTL set_param -n mdt.${fsname}*.enable_remote_dir=1 ||
2144 error_noexit "enable remote dir create failed"
2146 shall_cleanup_mdt1=true
2149 uuid=$($r $LCTL get_param -n mdt.$fsname-MDT0000.uuid) || {
2150 error_noexit "Getting MDT UUID"
2153 if [ "$uuid" != $fsname-MDT0000_UUID ]; then
2154 error_noexit "Unexpected MDT UUID: \"$uuid\""
2158 $r $TUNEFS --dryrun $ost_dev || {
2159 error_noexit "tunefs.lustre before mounting the OST"
2163 if $ost2_is_available; then
2164 $r $TUNEFS --dryrun $ost2_dev || {
2165 error_noexit "tunefs.lustre before mounting the OST"
2170 if [ "$writeconf" ]; then
2171 echo "== writeconf and ost quota tunefs =="
2172 mopts=mgsnode=$nid,$writeconf
2173 if [ "$ost1_FSTYPE" == ldiskfs ]; then
2175 $r $TUNEFS --quota $ost_dev || {
2177 error_noexit "Enable ost quota feature"
2181 if [ "$project_quota_upgrade" != "no" ]; then
2182 echo "== enable ost project quota =="
2183 $r $TUNE2FS -O project $ost_dev || {
2185 error_noexit "tune2fs $ost_dev failed"
2190 if $ost2_is_available; then
2191 $r $TUNEFS --quota $ost2_dev || {
2193 error_noexit "Enable ost2 quota feature"
2196 if [ "$project_quota_upgrade" != "no" ]; then
2197 echo "== enable ost2 project quota =="
2198 $r $TUNE2FS -O project $ost2_dev || {
2201 "tune2fs $ost2_dev failed"
2209 if [ "$mds1_FSTYPE" == ldiskfs ]; then
2214 $r $MOUNT_CMD -onomgs -o$mopts $ost_dev $tmp/mnt/ost || {
2215 error_noexit "Mounting the OST"
2219 if $ost2_is_available; then
2220 $r $MOUNT_CMD -onomgs -o$mopts $ost2_dev $tmp/mnt/ost1 || {
2221 error_noexit "Mounting the OST2"
2224 shall_cleanup_ost1=true
2227 shall_cleanup_ost=true
2229 uuid=$($r $LCTL get_param -n obdfilter.$fsname-OST0000.uuid) || {
2230 error_noexit "Getting OST UUID"
2233 if [ "$uuid" != $fsname-OST0000_UUID ]; then
2234 error_noexit "Unexpected OST UUID: \"$uuid\""
2238 if $ost2_is_available; then
2239 uuid=$($r $LCTL get_param -n obdfilter.$fsname-OST0001.uuid) ||{
2240 error_noexit "Getting OST1 UUID"
2243 if [ "$uuid" != $fsname-OST0001_UUID ]; then
2244 error_noexit "Unexpected OST1 UUID: \"$uuid\""
2249 if [[ $PERM_CMD =~ "set_param" ]]; then
2250 echo "== perm cmd = '$PERM_CMD' =="
2251 $r $PERM_CMD osc.$fsname-OST0000*.import=connection=$nid || {
2252 error_noexit "Setting OST \"failover.node\""
2255 $r $PERM_CMD mdc.$fsname-MDT0000*.import=connection=$nid || {
2256 error_noexit "Setting MDT \"failover.node\""
2259 $r $PERM_CMD osc.$fsname-OST0000-*.max_dirty_mb=15 || {
2260 error_noexit "Setting \"max_dirty_mb\""
2263 $r $PERM_CMD mdc.$fsname-MDT0000-*.max_rpcs_in_flight=9 || {
2264 error_noexit "Setting \"max_rpcs_in_flight\""
2267 $r $PERM_CMD lov.$fsname-MDT0000-*.stripesize=4M || {
2268 error_noexit "Setting \"lov.stripesize\""
2271 $r $PERM_CMD mdd.$fsname-MDT0000-*.atime_diff=70 || {
2272 error_noexit "Setting \"mdd.atime_diff\""
2276 echo "== perm cmd = '$PERM_CMD' =="
2277 $r $PERM_CMD $fsname-OST0000.failover.node=$nid || {
2278 error_noexit "Setting OST \"failover.node\""
2282 $r $PERM_CMD $fsname-MDT0000.failover.node=$nid || {
2283 error_noexit "Setting MDT \"failover.node\""
2287 $r $PERM_CMD $fsname-OST0000.osc.max_dirty_mb=15 || {
2288 error_noexit "Setting \"max_dirty_mb\""
2291 $r $PERM_CMD $fsname-MDT0000.mdc.max_rpcs_in_flight=9 || {
2292 error_noexit "Setting \"max_rpcs_in_flight\""
2295 $r $PERM_CMD $fsname-MDT0000.lov.stripesize=4M || {
2296 error_noexit "Setting \"lov.stripesize\""
2299 $r $PERM_CMD $fsname-MDT0000.mdd.atime_diff=70 || {
2300 error_noexit "Setting \"mdd.atime_diff\""
2305 $r $LCTL pool_new $fsname.interop || {
2306 error_noexit "Setting \"interop\""
2310 if [ "$ff_convert" != "no" -a "$ost1_FSTYPE" == ldiskfs ]; then
2311 echo "== ff convert ($ff_convert) =="
2312 $r $LCTL lfsck_start -M $fsname-OST0000 || {
2313 error_noexit "Start OI scrub on OST0"
2317 # The oi_scrub should be on ost1, but for test_32(),
2318 # all on the SINGLEMDS.
2319 wait_update_facet $SINGLEMDS "$LCTL get_param -n \
2320 osd-ldiskfs.$fsname-OST0000.oi_scrub |
2321 awk '/^status/ { print \\\$2 }'" "completed" 30 || {
2322 error_noexit "Failed to get the expected 'completed'"
2326 local UPDATED=$($r $LCTL get_param -n \
2327 osd-ldiskfs.$fsname-OST0000.oi_scrub |
2328 awk '/^updated/ { print $2 }')
2329 [ $UPDATED -ge 1 ] || {
2330 error_noexit "Only $UPDATED objects have been converted"
2335 if [[ "$dne_upgrade" != "no" ]] || $mdt2_is_available; then
2336 echo "== dne upgrate ($dne_upgrade) or mdt2 available =="
2337 if [[ $PERM_CMD =~ "set_param" ]]; then
2338 $r $PERM_CMD mdc.$fsname-MDT0001*.import=connection=$nid || {
2339 error_noexit "Setting MDT1 \"failover.node\""
2343 $r $PERM_CMD mdc.$fsname-MDT0001-*.max_rpcs_in_flight=9 || {
2344 error_noexit "Setting MDT1 \"max_rpcs_in_flight\""
2347 $r $PERM_CMD lov.$fsname-MDT0001-*.stripesize=4M || {
2348 error_noexit "Setting MDT1 \"lov.stripesize\""
2352 $r $PERM_CMD $fsname-MDT0001.failover.node=$nid || {
2353 error_noexit "Setting MDT1 \"failover.node\""
2356 $r $PERM_CMD $fsname-MDT0001.mdc.max_rpcs_in_flight=9 || {
2357 error_noexit "Setting MDT1 \"max_rpcs_in_flight\""
2360 $r $PERM_CMD $fsname-MDT0001.lov.stripesize=4M || {
2361 error_noexit "Setting MDT1 \"lov.stripesize\""
2367 if [ "$writeconf" ]; then
2368 echo "== writeconf and client mount =="
2369 $MOUNT_CMD $nid:/$fsname -o user_xattr $tmp/mnt/lustre || {
2370 error_noexit "Mounting the client"
2374 shall_cleanup_lustre=true
2375 $r $LCTL set_param debug="$PTLDEBUG"
2377 t32_verify_quota $SINGLEMDS $fsname $tmp/mnt/lustre || {
2378 error_noexit "verify quota failed"
2382 if $r test -f $tmp/list; then
2383 echo "== list verification =="
2385 # There is not a Test Framework API to copy files to or
2386 # from a remote node.
2388 # LU-2393 - do both sorts on same node to ensure locale
2390 local list_file=$tmp/list
2392 if $mdt2_is_available; then
2393 if [[ -d $tmp/mnt/lustre/striped_dir_old ]] &&
2394 $r test -f $tmp/list2; then
2395 list_file=$tmp/list2
2396 pushd $tmp/mnt/lustre/striped_dir_old
2398 pushd $tmp/mnt/lustre/remote_dir
2401 pushd $tmp/mnt/lustre
2403 $r cat $list_file | sort -k 6 >$tmp/list.orig
2404 BLOCKSIZE=1024 ls -Rni --time-style=+%s | sort -k 6 |
2405 sed 's/\. / /' >$tmp/list || {
2411 # 32-bit and 64-bit clients use different algorithms to
2412 # convert FIDs into inode numbers. Hence, remove the
2413 # inode numbers from the lists, if the original list was
2414 # created on an architecture with different number of
2417 if [ $(t32_bits_per_long $(uname -m)) != \
2418 $(t32_bits_per_long $img_arch) ]; then
2419 echo "Different number of bits per \"long\"" \
2420 "from the disk image"
2421 for list in list.orig list; do
2422 sed -i -e 's/^[0-9]\+[ \t]\+//' \
2426 if ! diff -ub $tmp/list.orig $tmp/list; then
2427 error_noexit "list verification failed"
2431 echo "== list verification skipped =="
2434 #non-dom upgrade to dom
2435 if [ "$dom_upgrade" != "no" ]; then
2436 echo "== dom upgrade =="
2437 $LFS setstripe -E 1M -L mdt -E EOF $tmp/mnt/lustre/dom || {
2438 error_noexit "Verify DoM creation"
2441 [ $($LFS getstripe -L $tmp/mnt/lustre/dom) == "mdt" ] || {
2442 error_noexit "Verify a DoM file"
2445 dd if=/dev/urandom of=$tmp/mnt/lustre/dom bs=4096 \
2446 count=1 conv=fsync || {
2447 error_noexit "Cannot write to DoM file"
2450 [ $(stat -c%s $tmp/mnt/lustre/dom) == 4096 ] || {
2451 error_noexit "DoM: bad size after write"
2454 rm $tmp/mnt/lustre/dom
2456 set_persistent_param_and_check mds \
2457 "lod.*MDT0000*.dom_stripesize" \
2458 "$fsname-MDT0000.lod.dom_stripesize" 0 || {
2459 error_noexit "Changing \"dom_stripesize\""
2465 #$LFS setstripe -E 1M -L mdt -E -1 -S 4M $dom_file
2466 if [ "$dom_new_upgrade" != "no" ]; then
2467 if ! $mdt2_is_available; then
2468 dom_file=$tmp/mnt/lustre/dom_dir/dom_file
2470 echo "== check DoM file can be accessed =="
2471 [ $($LFS getstripe -I1 -L $dom_file) == "mdt" ] || {
2472 error_noexit "Verify a DoM file"
2475 [ $(stat -c%s $dom_file) == $((2 * 1024 * 1024)) ] || {
2476 error_noexit "DoM: bad size after write"
2481 if [ "$flr_upgrade" != "no" ]; then
2482 if ! $mdt2_is_available; then
2483 flr_file=$tmp/mnt/lustre/flr_dir/flr_file
2485 local mirror_count=$($LFS getstripe -N $flr_file)
2486 echo "== check FLR file =="
2487 [ $mirror_count == 2 ] || {
2488 error_noexit "FLR mirror count wrong"
2493 if [ "$dne_upgrade" != "no" ]; then
2494 echo "== dne upgrade striped_dir =="
2495 $LFS mkdir -i 1 -c2 $tmp/mnt/lustre/striped_dir || {
2496 error_noexit "set striped dir failed"
2499 $LFS setdirstripe -D -c2 $tmp/mnt/lustre/striped_dir
2501 pushd $tmp/mnt/lustre
2502 tar -c --exclude=./striped_dir \
2503 --exclude=./striped_dir_old \
2504 --exclude=./remote_dir -f - .|
2505 tar -xvf - -C striped_dir 1>/dev/null || {
2506 error_noexit "cp to striped dir failed"
2512 if [ "$pfl_upgrade" != "no" ]; then
2519 echo "== check PFL file =="
2520 if ! $mdt2_is_available; then
2521 pfl_file=$tmp/mnt/lustre/pfl_dir/pfl_file
2523 comp_cnt=$($LFS getstripe --component-count $pfl_file)
2524 [ $comp_cnt == 2 ] || {
2525 error_noexit "wrong comp_cnt $comp_cnt"
2529 comp_size=$($LFS getstripe -I1 -E $pfl_file)
2530 [ $comp_size == 2097152 ] || {
2531 error_noexit "wrong component size $comp_size"
2535 comp_id=$($LFS getstripe -I1 -i $pfl_file)
2536 [ $comp_id == 0 ] || {
2537 error_noexit "wrong comp id $comp_id"
2541 comp_id=$($LFS getstripe -I2 -i $pfl_file)
2542 [ $comp_id -eq 1 ] || {
2543 error_noexit "wrong comp id $comp_id"
2547 stripe_size=$($LFS getstripe -I1 -S $pfl_file)
2548 [ $stripe_size -eq 1048576 ] || {
2549 error_noexit "wrong stripe size $stripe_size"
2553 stripe_size=$($LFS getstripe -I2 -S $pfl_file)
2554 [ $comp_size -eq 2097152 ] || {
2555 error_noexit "wrong component size $comp_size"
2560 local large_xattr_dir=$tmp/mnt/lustre/large_xattr_test_dir
2562 if [[ -d $large_xattr_dir ]]; then
2563 echo "== check Large EA =="
2564 local xattr_file=$large_xattr_dir/large_xattr_file
2566 xattr_val=$(getfattr --only-values\
2567 -n user.fooattr $xattr_file) || {
2568 error_noexit "Large EA cannot be read"
2572 [[ $xattr_val == $(printf "%c" {1..4096}) ]] || {
2573 error_noexit "Wrong large EA value"
2578 if [ "$project_quota_upgrade" != "no" ]; then
2579 if ! $mdt2_is_available; then
2580 quota_dir=$tmp/mnt/lustre/project_quota_dir
2584 echo "== check Project Quota =="
2585 hardlimit=$(getquota -p $T32_PRJID global 3 \
2587 [ $hardlimit == $T32_PROLIMIT ] || {
2588 error_noexit "wrong hardlimit $hardlimit"
2593 # If it is upgrade from DNE (2.5), then rename the remote dir,
2594 # which is created in 2.5 to striped dir.
2595 if $mdt2_is_available && [[ "$dne_upgrade" != "no" ]]; then
2596 echo "== rename remote_dir =="
2597 stripe_index=$($LFS getdirstripe -i \
2598 $tmp/mnt/lustre/remote_dir)
2600 [[ $stripe_index -eq 1 ]] || {
2601 error_noexit "get index \"$stripe_index\"" \
2602 "from remote dir failed"
2605 mv $tmp/mnt/lustre/remote_dir \
2606 $tmp/mnt/lustre/striped_dir/ || {
2607 error_noexit "mv remote dir failed"
2612 # If it is upgraded from DNE (2.7), then move the striped dir
2613 # which was created in 2.7 to the new striped dir.
2614 if $mdt2_is_available && [[ "$dne_upgrade" != "no" ]] &&
2615 echo "== rename striped dir =="
2616 [[ -d $tmp/mnt/lustre/striped_dir_old ]]; then
2617 stripe_count=$($LFS getdirstripe -c \
2618 $tmp/mnt/lustre/striped_dir_old)
2619 [[ $stripe_count -eq 2 ]] || {
2620 error_noexit "get count $stripe_count" \
2621 "from striped dir failed"
2624 mv $tmp/mnt/lustre/striped_dir_old \
2625 $tmp/mnt/lustre/striped_dir/ || {
2626 error_noexit "mv striped dir failed"
2632 $r $LCTL set_param -n osd*.*.force_sync=1
2633 dd if=/dev/zero of=$tmp/mnt/lustre/tmp_file bs=10k count=10 || {
2634 error_noexit "dd failed"
2637 rm -rf $tmp/mnt/lustre/tmp_file || {
2638 error_noexit "rm failed"
2642 if $r test -f $tmp/sha1sums; then
2643 echo "== checking sha1sums =="
2644 # LU-2393 - do both sorts on same node to ensure locale
2646 $r cat $tmp/sha1sums | sort -k 2 >$tmp/sha1sums.orig
2647 if [[ "$dne_upgrade" != "no" ]]; then
2648 if [[ -d $tmp/mnt/lustre/striped_dir/remote_dir ]]; then
2649 pushd $tmp/mnt/lustre/striped_dir/remote_dir
2651 pushd $tmp/mnt/lustre/striped_dir
2653 elif [[ "$pfl_upgrade" != "no" ]] ||
2654 [[ "$flr_upgrade" != "no" ]] ||
2655 [[ "$dom_new_upgrade" != "no" ]] ||
2656 [[ "$project_quota_upgrade" != "no" ]] ||
2657 [[ -d $tmp/mnt/lustre/remote_dir ]]; then
2658 pushd $tmp/mnt/lustre/remote_dir
2660 pushd $tmp/mnt/lustre
2663 find ! -path "*remote_dir*" ! -path "*striped_dir*" \
2664 ! -name .lustre -type f -exec sha1sum {} \; |
2665 sort -k 2 >$tmp/sha1sums || {
2667 error_noexit "sha1sum"
2673 if ! diff -ub $tmp/sha1sums.orig $tmp/sha1sums; then
2674 echo "==** find $save files start **=="
2675 find $save -type f -ls
2676 echo "==** find $save files finish **=="
2677 error_noexit "sha1sum verification failed"
2681 # if upgrade from DNE(2.5), then check remote directory
2682 # if upgrade from DNE(2.7), then check striped directory
2683 if $mdt2_is_available &&
2684 [[ "$dne_upgrade" != "no" ]]; then
2685 echo "== mdt2 upgrade sha1sum check =="
2686 local new_dir="$tmp/mnt/lustre/striped_dir"
2687 local striped_dir_old="$new_dir/striped_dir_old"
2689 local dir_list="$new_dir/remote_dir"
2690 [[ ! -d $triped_dir_old ]] ||
2691 dir_list+=" $striped_dir_old"
2693 for dir in $dir_list; do
2694 echo "== dir = $dir =="
2696 find ! -name .lustre -type f \
2697 -exec sha1sum {} \; |
2698 sort -k 2 >$tmp/sha1sums || {
2701 error_noexit "sha1sum"
2705 if ! diff -ub $tmp/sha1sums.orig \
2708 error_noexit "sha1sum $dir" \
2715 echo "== sha1sum verification skipped =="
2718 # PFL write test after sha1sum check
2719 if [ "$pfl_upgrade" != "no" ]; then
2720 local rw_len=$((3 * 1034 * 1024))
2722 if ! $mdt2_is_available; then
2723 pfl_file=$tmp/mnt/lustre/pfl_dir/pfl_file
2725 small_write $pfl_file $rw_len || {
2726 error_noexit "PFL RW Failed"
2731 if [ "$dne_upgrade" != "no" ]; then
2732 rm -rf $tmp/mnt/lustre/striped_dir || {
2733 error_noexit "remove remote dir failed"
2738 # migrate files/dirs to remote MDT, then move them back
2739 if [ "$MDS1_VERSION" -ge $(version_code 2.7.50) -a \
2740 $dne_upgrade != "no" ]; then
2741 $r $LCTL set_param -n \
2742 mdt.${fsname}*.enable_remote_dir=1 2>/dev/null
2744 echo "== test migration =="
2745 pushd $tmp/mnt/lustre
2746 for dir in $(find ! -name .lustre ! -name . -type d); do
2747 mdt_index=$($LFS getdirstripe -i $dir)
2748 stripe_cnt=$($LFS getdirstripe -c $dir)
2749 if [ $mdt_index = 0 -a $stripe_cnt -le 1 ]; then
2750 $LFS migrate -m 1 $dir || {
2752 error_noexit "migrate MDT1 failed"
2758 for dir in $(find ! -name . ! -name .lustre -type d); do
2759 mdt_index=$($LFS getdirstripe -i $dir)
2760 stripe_cnt=$($LFS getdirstripe -c $dir)
2761 if [ $mdt_index = 1 -a $stripe_cnt -le 1 ]; then
2762 $LFS migrate -m 0 $dir || {
2764 error_noexit "migrate MDT0 failed"
2773 # When adding new data verification tests, please check for
2774 # the presence of the required reference files first, like
2775 # the "sha1sums" and "list" tests above, to avoid the need to
2776 # regenerate every image for each test addition.
2779 nrpcs_orig=$($LCTL get_param \
2780 -n mdc.*MDT0000*.max_rpcs_in_flight) || {
2781 error_noexit "Getting \"max_rpcs_in_flight\""
2784 nrpcs=$((nrpcs_orig + 5))
2786 set_persistent_param_and_check client \
2787 "mdc.$fsname-MDT0000*.max_rpcs_in_flight" \
2788 "$fsname-MDT0000.mdc.max_rpcs_in_flight" $nrpcs || {
2789 error_noexit "Changing \"max_rpcs_in_flight\""
2793 umount $tmp/mnt/lustre || {
2794 error_noexit "Unmounting the client"
2797 shall_cleanup_lustre=false
2799 $MOUNT_CMD $nid:/$fsname $tmp/mnt/lustre || {
2800 error_noexit "Mounting the client"
2804 if [ "$mds1_FSTYPE" == ldiskfs -a \
2805 "$project_upgrade" != "no" ]; then
2806 ! $LFS project -d -p 1 $tmp/mnt/lustre/* &&
2807 error_noexit "set project failed" &&
2811 [[ $(do_facet mds1 pgrep orph_.*-MDD | wc -l) == 0 ]] ||
2812 error "MDD orphan cleanup thread not quit"
2814 umount $tmp/mnt/lustre || {
2815 error_noexit "Unmounting the client"
2819 if [[ "$dne_upgrade" != "no" ]] || $mdt2_is_available; then
2820 $r $UMOUNT $tmp/mnt/mdt1 || {
2821 error_noexit "Unmounting the MDT2"
2824 if [[ "$mds1_FSTYPE" == zfs ]]; then
2825 $r "$ZPOOL export t32fs-mdt2"
2827 shall_cleanup_mdt1=false
2830 $r $UMOUNT $tmp/mnt/mdt || {
2831 error_noexit "Unmounting the MDT"
2834 if [[ "$mds1_FSTYPE" == zfs ]]; then
2835 $r "$ZPOOL export t32fs-mdt1"
2837 shall_cleanup_mdt=false
2839 $r $UMOUNT $tmp/mnt/ost || {
2840 error_noexit "Unmounting the OST"
2843 if $ost2_is_available; then
2844 $r $UMOUNT $tmp/mnt/ost1 || {
2845 error_noexit "Unmounting the OST1"
2848 shall_cleanup_ost1=false
2851 if [[ $ost1_FSTYPE == zfs ]]; then
2852 $r "$ZPOOL export t32fs-ost1"
2853 if $ost2_is_available; then
2854 $r "$ZPOOL export t32fs-ost2"
2857 shall_cleanup_ost=false
2859 t32_reload_modules $node || {
2860 error_noexit "Reloading modules"
2864 if [[ "$mds1_FSTYPE" == zfs ]]; then
2865 local poolname=t32fs-mdt1
2867 $ZPOOL list -H $poolname >/dev/null 2>&1 ||
2868 $ZPOOL import -f -d $tmp $poolname"
2870 # upgrade zpool to latest supported features,
2871 # including dnode quota accounting in 0.7.0
2872 $r "$ZPOOL upgrade $poolname"
2875 # mount a second time to make sure we didnt leave upgrade flag on
2876 $r $TUNEFS --dryrun $mdt_dev || {
2878 error_noexit "tunefs.lustre before remounting the MDT"
2882 mopts=exclude=$fsname-OST0000
2883 if [ "$mds1_FSTYPE" == ldiskfs ]; then
2886 $r $MOUNT_CMD -o $mopts $mdt_dev $tmp/mnt/mdt || {
2887 error_noexit "Remounting the MDT"
2890 shall_cleanup_mdt=true
2900 for tarball in $tarballs; do
2901 banner "testing $tarball upgrade"
2902 t32_test $tarball || let "rc += $?"
2906 run_test 32a "Upgrade (not live)"
2914 for tarball in $tarballs; do
2915 banner "testing $tarball upgrade with writeconf"
2916 t32_test $tarball writeconf || let "rc += $?"
2920 run_test 32b "Upgrade with writeconf"
2928 for tarball in $tarballs; do
2929 banner "testing $tarball upgrade with DNE"
2931 dne_upgrade=yes t32_test $tarball writeconf || rc=$?
2935 run_test 32c "dne upgrade test"
2943 for tarball in $tarballs; do
2944 banner "testing $tarball with filter_fid upgrade"
2945 ff_convert=yes t32_test $tarball || rc=$?
2949 run_test 32d "convert filter_fid upgrade test"
2952 [[ "$MDS1_VERSION" -ge $(version_code 2.10.56) ]] ||
2953 skip "Need MDS version at least 2.10.56"
2960 for tarball in $tarballs; do
2961 [[ "$tarball" =~ "2_9" ]] ||
2962 { echo "skip $(basename $tarball)"; continue; }
2964 banner "testing $tarball upgrade with DoM"
2965 dom_upgrade=yes t32_test $tarball writeconf || let "rc += $?"
2969 run_test 32e "dom upgrade test"
2972 [[ $MDS1_VERSION -ge $(version_code 2.10.56) ]] ||
2973 skip "Need MDS version at least 2.10.56"
2980 for tarball in $tarballs; do
2981 [[ "$tarball" =~ "2_10" ]] ||
2982 { echo "skip $(basename $tarball)"; continue; }
2983 pfl_upgrade=yes project_quota_upgrade=yes \
2984 t32_test $tarball writeconf || let "rc += $?"
2988 run_test 32f "pfl upgrade test"
2991 [[ $MDS1_VERSION -ge $(version_code 2.10.56) ]] ||
2992 skip "Need MDS version at least 2.10.56"
2999 for tarball in $tarballs; do
3000 [[ $tarball =~ "2_12" ]] ||
3001 { echo "skip $(basename $tarball)"; continue; }
3002 flr_upgrade=yes dom_new_upgrade=yes \
3003 t32_test $tarball writeconf || let "rc += $?"
3007 run_test 32g "flr/dom upgrade test"
3009 test_33a() { # bug 12333, was test_33
3010 local FSNAME2=test-$testnum
3012 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
3015 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
3017 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
3018 local dev=${SINGLEMDS}_dev
3019 local MDSDEV=${!dev}
3021 is_blkdev $SINGLEMDS $MDSDEV &&
3022 skip_env "mixed loopback and real device not working"
3025 local fs2mdsdev=$(mdsdevname 1_2)
3026 local fs2ostdev=$(ostdevname 1_2)
3027 local fs2mdsvdev=$(mdsvdevname 1_2)
3028 local fs2ostvdev=$(ostvdevname 1_2)
3030 if [ "$mds1_FSTYPE" == ldiskfs ]; then
3031 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\"" # See bug 17931.
3034 if combined_mgs_mds; then
3035 local mgs_flag="--mgs"
3038 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --fsname=${FSNAME2} \
3039 --reformat $mgs_flag $mkfsoptions $fs2mdsdev $fs2mdsvdev ||
3041 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
3042 --fsname=${FSNAME2} --index=0x1fff --reformat $fs2ostdev \
3043 $fs2ostvdev || exit 10
3045 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT
3046 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
3048 if [[ $PERM_CMD == *"set_param -P"* ]]; then
3049 do_facet mgs "$PERM_CMD timeout=200" ||
3050 error "$PERM_CMD timeout=200 failed"
3052 do_facet mgs "$PERM_CMD $FSNAME2.sys.timeout=200" ||
3053 error "$PERM_CMD $FSNAME2.sys.timeout=200 failed"
3055 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
3056 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
3059 cp /etc/hosts $MOUNT2/ || error "copy /etc/hosts $MOUNT2/ failed"
3060 $LFS getstripe $MOUNT2/hosts ||
3061 error "$LFS getstripe $MOUNT2/hosts failed"
3065 if (( "$MGS_VERSION" >= $(version_code 2.15.51) &&
3066 "$MDS1_VERSION" >= $(version_code 2.15.51) )); then
3067 # test lctl del_ost on large index
3068 do_facet mgs "$LCTL del_ost -t ${FSNAME2}-OST1fff" ||
3069 error "del_ost failed with $?"
3070 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 ||
3071 error "$MOUNT_CMD failed"
3073 $LFS df | grep -q OST1fff &&
3074 error "del_ost did not remove OST1fff!"
3080 cleanup_nocli || error "cleanup_nocli failed with $?"
3082 run_test 33a "Mount ost with a large index number"
3084 test_33b() { # was test_34
3087 do_facet client dd if=/dev/zero of=$MOUNT/24 bs=1024k count=1
3088 # Drop lock cancelation reply during umount
3089 #define OBD_FAIL_LDLM_CANCEL_NET 0x304
3090 do_facet client $LCTL set_param fail_loc=0x80000304
3091 #lctl set_param debug=-1
3092 umount_client $MOUNT
3093 cleanup || error "cleanup failed with $?"
3095 run_test 33b "Drop cancel during umount"
3098 (( MDS1_VERSION >= $(version_code 2.15.57) )) ||
3099 skip "Need MDS version at least 2.15.57"
3100 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
3101 local tstid=${TSTID:-"$(id -u $TSTUSR)"}
3103 local qpool="qpool1"
3105 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
3107 local fs2mdsdev=$(mdsdevname 1_2)
3108 local fs2ostdev=$(ostdevname 1_2)
3109 local fs2mdsvdev=$(mdsvdevname 1_2)
3110 local fs2ostvdev=$(ostvdevname 1_2)
3112 if [ "$mds1_FSTYPE" == ldiskfs ]; then
3113 mkfsoptions="--mkfsoptions=\\\"-J size=8\\\"" # See bug 17931.
3116 if combined_mgs_mds; then
3117 local mgs_flag="--mgs"
3121 stack_trap unload_modules_conf
3123 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --fsname=${FSNAME} \
3124 --reformat $mgs_flag $mkfsoptions $fs2mdsdev $fs2mdsvdev ||
3126 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
3127 --fsname=${FSNAME} --index=0x7c6 --reformat $fs2ostdev \
3128 $fs2ostvdev || exit 10
3131 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
3132 stack_trap "stop fs2mds -f"
3133 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
3134 stack_trap "stop fs2ost -f"
3136 mount_client $MOUNT || error "client start failed"
3137 stack_trap "umount_client $MOUNT"
3138 mkdir_on_mdt0 $DIR/$tdir || error "cannot create $DIR/$tdir"
3139 chmod 0777 $DIR/$tdir || error "chown failed"
3140 if [[ $PERM_CMD == *"set_param -P"* ]]; then
3141 do_facet mgs $PERM_CMD \
3142 osd-*.$FSNAME-OST*.quota_slave.enable=$QUOTA_TYPE
3144 do_facet mgs $PERM_CMD $FSNAME.quota.ost=$QUOTA_TYPE ||
3145 error "set ost quota type failed"
3148 local old_MDSCOUNT=$MDSCOUNT
3150 stack_trap "MDSCOUNT=$old_MDSCOUNT"
3152 pool_add $qpool || error "pool_add failed"
3153 pool_add_targets $qpool 0x7c6
3155 $LFS setquota -u $tstid -B20M -b 0 $MOUNT
3156 $LFS setquota -g $tstid -B20M -b 0 $MOUNT
3157 $LFS setquota -u $tstid -B20M -b 0 --pool $qpool $MOUNT
3158 $LFS setquota -g $tstid -B20M -b 0 --pool $qpool $MOUNT
3160 for i in {1..10}; do
3161 runas -u $tstid -g $tstid dd if=/dev/zero of=$DIR/$tdir/f1 \
3162 bs=1M count=30 oflag=direct
3168 #umount_client $MOUNT || error "client start failed"
3171 #cleanup_nocli || error "cleanup_nocli failed with $?"
3173 run_test 33c "Mount ost with a large index number"
3177 do_facet client "bash runmultiop_bg_pause $DIR/file O_c"
3178 manual_umount_client
3180 do_facet client killall -USR1 multiop
3181 if [ $rc -eq 0 ]; then
3182 error "umount not fail!"
3185 cleanup || error "cleanup failed with rc $?"
3187 run_test 34a "umount with opened file should be fail"
3191 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3192 stop_mds || error "Unable to stop MDS"
3194 manual_umount_client --force || error "mtab after failed umount with $?"
3196 cleanup || error "cleanup failed with $?"
3198 run_test 34b "force umount with failed mds should be normal"
3202 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
3203 stop_ost || error "Unable to stop OST1"
3205 manual_umount_client --force || error "mtab after failed umount with $?"
3207 cleanup || error "cleanup failed with $?"
3209 run_test 34c "force umount with failed ost should be normal"
3211 test_35a() { # bug 12459
3214 DBG_SAVE="`$LCTL get_param -n debug`"
3215 $LCTL set_param debug="ha"
3217 log "Set up a fake failnode for the MDS"
3219 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
3220 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
3222 if [[ $PERM_CMD == *"set_param -P"* ]]; then
3223 do_facet mgs "$PERM_CMD \
3224 mdc.*${device}*.import=connection=$(h2nettype $FAKENID)" ||
3225 error "Setting mdc.*${device}*.import=connection=\
3226 $(h2nettype $FAKENID) failed."
3228 do_facet mgs "$PERM_CMD \
3229 ${device}.failover.node=$(h2nettype $FAKENID)" ||
3230 error "Setting ${device}.failover.node=\
3231 $(h2nettype $FAKENID) failed."
3233 log "Wait for RECONNECT_INTERVAL seconds (10s)"
3236 MSG="conf-sanity.sh test_35a `date +%F%kh%Mm%Ss`"
3239 log "Stopping the MDT: $device"
3240 stop_mdt 1 || error "MDT0 stop fail"
3242 df $MOUNT > /dev/null 2>&1 &
3244 log "Restarting the MDT: $device"
3245 start_mdt 1 || error "MDT0 start fail"
3246 log "Wait for df ($DFPID) ... "
3249 $LCTL set_param debug="$DBG_SAVE"
3251 # retrieve from the log the first server that the client tried to
3252 # contact after the connection loss
3253 $LCTL dk $TMP/lustre-log-$TESTNAME.log
3254 NEXTCONN=`awk "/${MSG}/ {start = 1;}
3255 /import_select_connection.*$device-mdc.* using connection/ {
3257 if (\\\$NF ~ /$FAKENID/)
3263 }" $TMP/lustre-log-$TESTNAME.log`
3264 [ "$NEXTCONN" != "0" ] &&
3265 error "Tried to connect to ${NEXTCONN} not last active server"
3266 cleanup || error "cleanup failed with $?"
3267 # remove nid settings
3268 writeconf_or_reformat
3270 run_test 35a "Reconnect to the last active server first"
3272 test_35b() { # bug 18674
3273 remote_mds || skip "local MDS"
3277 $LCTL set_param debug="ha"
3279 MSG="conf-sanity.sh test_35b `date +%F%kh%Mm%Ss`"
3282 log "Set up a fake failnode for the MDS"
3284 local device=$(do_facet $SINGLEMDS "$LCTL get_param -n devices" |
3285 awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
3287 if [[ $PERM_CMD == *"set_param -P"* ]]; then
3288 do_facet mgs "$PERM_CMD \
3289 mdc.*${device}*.import=connection=$(h2nettype $FAKENID)" ||
3290 error "Set mdc.*${device}*.import=connection=\
3291 $(h2nettype $FAKENID) failed"
3293 do_facet mgs "$PERM_CMD \
3294 ${device}.failover.node=$(h2nettype $FAKENID)" ||
3295 error "Set ${device}.failover.node=\
3296 $(h2nettype $FAKENID) failed"
3299 local at_max_saved=0
3300 # adaptive timeouts may prevent seeing the issue
3301 if at_is_enabled; then
3302 at_max_saved=$(at_max_get mds)
3303 at_max_set 0 mds client
3306 mkdir $MOUNT/$tdir || error "mkdir $MOUNT/$tdir failed"
3308 log "Injecting EBUSY on MDS"
3309 # Setting OBD_FAIL_MDS_RESEND=0x136
3310 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000136" ||
3311 error "unable to set param fail_loc=0x80000136"
3313 $LCTL set_param mdc.${FSNAME}*.stats=clear
3315 log "Creating a test file and stat it"
3316 touch $MOUNT/$tdir/$tfile || error "touch $MOUNT/$tdir/$tfile failed"
3317 stat $MOUNT/$tdir/$tfile
3319 log "Stop injecting EBUSY on MDS"
3320 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0" ||
3321 error "unable to set param fail_loc=0"
3322 rm -f $MOUNT/$tdir/$tfile || error "remove $MOUNT/$tdir/$tfile failed"
3325 # restore adaptive timeout
3326 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds client
3328 $LCTL dk $TMP/lustre-log-$TESTNAME.log
3330 CONNCNT=$($LCTL get_param mdc.${FSNAME}*.stats |
3331 awk '/mds_connect/{print $2}')
3333 # retrieve from the log if the client has ever tried to
3334 # contact the fake server after the loss of connection
3335 FAILCONN=`awk "BEGIN {ret = 0;}
3336 /import_select_connection.*${FSNAME}-MDT0000-mdc.* using connection/ {
3338 if (\\\$NF ~ /$FAKENID/) {
3343 END {print ret}" $TMP/lustre-log-$TESTNAME.log`
3345 [ "$FAILCONN" == "0" ] &&
3346 error "The client reconnection has not been triggered"
3347 [ "$FAILCONN" == "2" ] &&
3348 error "Primary server busy, client reconnect to failover failed"
3351 # When OBD_FAIL_MDS_RESEND is hit, we sleep for 2 * obd_timeout
3352 # Reconnects are supposed to be rate limited to one every 5s
3353 [ $CONNCNT -gt $((2 * $TIMEOUT / 5 + 1)) ] &&
3354 error "Too many reconnects $CONNCNT"
3356 cleanup || error "cleanup failed with $?"
3357 # remove nid settings
3358 writeconf_or_reformat
3360 run_test 35b "Continue reconnection retries, if the active server is busy"
3363 [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs"
3365 [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] ||
3369 local FSNAME2=test1234
3370 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
3372 [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST && fs3ost_HOST=$ost1_HOST
3374 if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" -o -z "$fs3ost_DEV" ]; then
3375 is_blkdev $SINGLEMDS $MDSDEV &&
3376 skip_env "mixed loopback and real device not working"
3379 local fs2mdsdev=$(mdsdevname 1_2)
3380 local fs2ostdev=$(ostdevname 1_2)
3381 local fs3ostdev=$(ostdevname 2_2)
3382 local fs2mdsvdev=$(mdsvdevname 1_2)
3383 local fs2ostvdev=$(ostvdevname 1_2)
3384 local fs3ostvdev=$(ostvdevname 2_2)
3387 add fs2mds $(mkfs_opts mds1 ${fs2mdsdev}) --mgs --fsname=${FSNAME2} \
3388 --reformat $fs2mdsdev $fs2mdsvdev || exit 10
3389 # XXX after we support non 4K disk blocksize in ldiskfs, specify a
3390 # different one than the default value here.
3391 add fs2ost $(mkfs_opts ost1 ${fs2ostdev}) --mgsnode=$MGSNID \
3392 --fsname=${FSNAME2} --reformat $fs2ostdev $fs2ostvdev || exit 10
3393 add fs3ost $(mkfs_opts ost2 ${fs3ostdev}) --mgsnode=$MGSNID \
3394 --fsname=${FSNAME2} --reformat $fs3ostdev $fs3ostvdev || exit 10
3396 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
3397 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
3398 start fs3ost $fs3ostdev $OST_MOUNT_OPTS
3399 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
3400 $MOUNT_CMD $MGSNID:/${FSNAME2} $MOUNT2 || error "$MOUNT_CMD failed"
3402 sleep 5 # until 11778 fixed
3404 dd if=/dev/zero of=$MOUNT2/$tfile bs=1M count=7 || error "dd failed"
3406 BKTOTAL=$($LCTL get_param -n obdfilter.*.kbytestotal |
3407 awk 'BEGIN{total=0}; {total+=$1}; END{print total}')
3408 BKFREE=$($LCTL get_param -n obdfilter.*.kbytesfree |
3409 awk 'BEGIN{free=0}; {free+=$1}; END{print free}')
3410 BKAVAIL=$($LCTL get_param -n obdfilter.*.kbytesavail |
3411 awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}')
3412 STRING=$(df -P $MOUNT2 | tail -n 1 | awk '{print $2","$3","$4}')
3413 DFTOTAL=$(echo $STRING | cut -d, -f1)
3414 DFUSED=$(echo $STRING | cut -d, -f2)
3415 DFAVAIL=$(echo $STRING | cut -d, -f3)
3416 DFFREE=$(($DFTOTAL - $DFUSED))
3418 ALLOWANCE=$((64 * $OSTCOUNT))
3420 if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
3421 [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
3422 echo "**** FAIL: df total($DFTOTAL) mismatch OST total($BKTOTAL)"
3425 if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
3426 [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
3427 echo "**** FAIL: df free($DFFREE) mismatch OST free($BKFREE)"
3430 if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
3431 [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
3432 echo "**** FAIL: df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
3437 stop fs3ost -f || error "unable to stop OST3"
3438 stop fs2ost -f || error "unable to stop OST2"
3439 stop fs2mds -f || error "unable to stop second MDS"
3440 unload_modules_conf || error "unable unload modules"
3443 run_test 36 "df report consistency on OSTs with different block size"
3446 local mntpt=$(facet_mntpt $SINGLEMDS)
3447 local mdsdev=$(mdsdevname ${SINGLEMDS//mds/})
3448 local mdsdev_sym="$TMP/sym_mdt.img"
3449 local opts=$MDS_MOUNT_OPTS
3452 if [ "$mds1_FSTYPE" != ldiskfs ]; then
3453 skip "ldiskfs only test"
3456 echo "MDS : $mdsdev"
3457 echo "SYMLINK : $mdsdev_sym"
3458 do_facet $SINGLEMDS rm -f $mdsdev_sym
3460 do_facet $SINGLEMDS ln -s $mdsdev $mdsdev_sym
3462 echo "mount symlink device - $mdsdev_sym"
3464 if ! do_facet $SINGLEMDS test -b $mdsdev; then
3465 opts=$(csa_add "$opts" -o loop)
3469 mount_op=$(do_facet $SINGLEMDS mount -v -t lustre $opts \
3470 $mdsdev_sym $mntpt 2>&1)
3473 echo mount_op=$mount_op
3475 do_facet $SINGLEMDS "$UMOUNT $mntpt && rm -f $mdsdev_sym"
3477 if $(echo $mount_op | grep -q "unable to set tunable"); then
3478 error "set tunables failed for symlink device"
3481 [ $rc -eq 0 ] || error "mount symlink $mdsdev_sym failed! rc=$rc"
3483 run_test 37 "verify set tunables works for symlink device"
3485 test_38() { # bug 14222
3486 local mntpt=$(facet_mntpt $SINGLEMDS)
3491 local SRC="/etc /bin"
3492 local FILES=$(find $SRC -type f -mtime +1 | head -n $COUNT)
3494 log "copying $(echo $FILES | wc -w) files to $DIR/$tdir"
3495 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3496 tar cf - $FILES | tar xf - -C $DIR/$tdir ||
3497 error "copying $SRC to $DIR/$tdir"
3499 umount_client $MOUNT || error "umount_client $MOUNT failed"
3500 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
3501 stop_mds || error "Unable to stop MDS"
3502 log "delete lov_objid file on MDS"
3504 mount_fstype $SINGLEMDS || error "mount MDS failed (1)"
3506 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid; rm $mntpt/lov_objid"
3508 unmount_fstype $SINGLEMDS || error "umount failed (1)"
3510 # check create in mds_lov_connect
3511 start_mds || error "unable to start MDS"
3512 mount_client $MOUNT || error "mount_client $MOUNT failed"
3514 [ $V ] && log "verifying $DIR/$tdir/$f"
3515 diff -q $f $DIR/$tdir/$f || ERROR=y
3517 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
3518 if [ "$ERROR" = "y" ]; then
3519 # check it's updates in sync
3520 umount_client $MOUNT
3522 mount_fstype $SIGNLEMDS
3523 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
3524 unmount_fstype $SINGLEMDS
3525 error "old and new files are different after connect" || true
3527 touch $DIR/$tdir/f2 || error "f2 file create failed"
3529 # check it's updates in sync
3530 umount_client $MOUNT || error "second umount_client $MOUNT failed"
3533 mount_fstype $SINGLEMDS || error "mount MDS failed (3)"
3535 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
3536 do_facet $SINGLEMDS dd if=/dev/zero of=$mntpt/lov_objid.clear count=8
3538 unmount_fstype $SINGLEMDS || error "umount failed (3)"
3540 start_mds || error "unable to start MDS"
3541 mount_client $MOUNT || error "mount_client $MOUNT failed"
3543 [ $V ] && log "verifying $DIR/$tdir/$f"
3544 diff -q $f $DIR/$tdir/$f || ERROR=y
3546 touch $DIR/$tdir/f3 || error "f3 file create failed"
3547 do_facet $SINGLEMDS "$LCTL get_param osp.*.prealloc_next_id"
3548 umount_client $MOUNT || error "third umount_client $MOUNT failed"
3550 mount_fstype $SINGLEMDS || error "mount MDS failed (4)"
3551 do_facet $SINGLEMDS "od -Ax -td8 $mntpt/lov_objid"
3552 unmount_fstype $SINGLEMDS || error "umount failed (4)"
3554 [[ "$ERROR" != "y" ]] ||
3555 error "old and new files are different after sync"
3557 log "files compared the same"
3558 cleanup || error "cleanup failed with $?"
3560 run_test 38 "MDS recreates missing lov_objid file from OST data"
3563 [[ -n "$(type -p perl)" ]] || skip_env "need perl for leak_finder.pl"
3567 cleanup || error "cleanup failed with $?"
3568 perl $SRCDIR/leak_finder.pl $TMP/debug 2>&1 | egrep '*** Leak:' &&
3569 error "memory leak detected" || true
3571 run_test 39 "leak_finder recognizes both LUSTRE and LNET malloc messages"
3573 test_40() { # bug 15759
3574 start_ost || error "Unable to start OST1"
3575 #define OBD_FAIL_TGT_TOOMANY_THREADS 0x706
3576 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x80000706"
3578 cleanup || error "cleanup failed with rc $?"
3580 run_test 40 "race during service thread startup"
3582 test_41a() { #bug 14134
3583 if [ "$mds1_FSTYPE" == ldiskfs ] &&
3584 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
3585 skip "Loop devices does not work with nosvc option"
3588 combined_mgs_mds || skip "needs combined MGT and MDT device"
3590 start_mdt 1 -o nosvc -n
3591 if [ $MDSCOUNT -ge 2 ]; then
3592 for num in $(seq 2 $MDSCOUNT); do
3593 start_mdt $num || return
3596 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS
3597 start_mdt 1 -o nomgs,force
3598 mount_client $MOUNT || error "mount_client $MOUNT failed"
3601 echo "blah blah" > $MOUNT/$tfile
3604 umount_client $MOUNT || error "umount_client $MOUNT failed"
3605 stop ost1 -f || error "unable to stop OST1"
3606 stop_mds || error "Unable to stop MDS"
3607 stop_mds || error "Unable to stop MDS on second try"
3609 run_test 41a "mount mds with --nosvc and --nomgs"
3612 if [ "$mds1_FSTYPE" == ldiskfs ] &&
3613 ! do_facet $SINGLEMDS test -b $(mdsdevname 1); then
3614 skip "Loop devices does not work with nosvc option"
3617 ! combined_mgs_mds && skip "needs combined mgs device"
3621 local MDSDEV=$(mdsdevname ${SINGLEMDS//mds/})
3623 start_mdt 1 -o nosvc -n
3624 if [ $MDSCOUNT -ge 2 ]; then
3625 for num in $(seq 2 $MDSCOUNT); do
3626 start_mdt $num || return
3629 start_ost || error "Unable to start OST1"
3630 start_mdt 1 -o nomgs,force
3631 mount_client $MOUNT || error "mount_client $MOUNT failed"
3634 echo "blah blah" > $MOUNT/$tfile
3635 cat $MOUNT/$tfile || error "cat $MOUNT/$tfile failed"
3637 umount_client $MOUNT -f || error "umount_client $MOUNT failed"
3638 stop_ost || error "Unable to stop OST1"
3639 stop_mds || error "Unable to stop MDS"
3640 stop_mds || error "Unable to stop MDS on second try"
3642 run_test 41b "mount mds with --nosvc and --nomgs on first mount"
3645 local oss_list=$(comma_list $(osts_nodes))
3647 (( "$MDS1_VERSION" >= $(version_code 2.15.62.4) )) ||
3648 skip "Need MDS >= 2.15.62.4 for parallel device locking"
3650 # ensure mds1 ost1 have been created even if running sub-test standalone
3653 cleanup || error "cleanup failed"
3655 # using directly mount command instead of start() function to avoid
3656 # any side effect of // with others/externals tools/features
3657 # ("zpool import", ...)
3659 # MDT concurrent start
3661 LOAD_MODULES_REMOTE=true load_modules
3662 do_facet $SINGLEMDS "lsmod | grep -q libcfs" ||
3663 error "MDT concurrent start: libcfs module not loaded"
3665 local mds1dev=$(mdsdevname 1)
3666 local mds1mnt=$(facet_mntpt mds1)
3667 local mds1opts=$MDS_MOUNT_OPTS
3669 if [[ "$mds1_FSTYPE" == ldiskfs ]] &&
3670 ! do_facet mds1 test -b $mds1dev; then
3671 mds1opts=$(csa_add "$mds1opts" -o loop)
3673 if [[ "$mds1_FSTYPE" == zfs ]]; then
3674 import_zpool mds1 || return ${PIPESTATUS[0]}
3677 #define OBD_FAIL_TGT_MOUNT_RACE 0x716
3678 do_facet mds1 "$LCTL set_param fail_loc=0x80000716"
3680 do_facet mds1 mount -t lustre $mds1dev $mds1mnt $mds1opts &
3683 do_facet mds1 mount -t lustre $mds1dev $mds1mnt $mds1opts
3688 do_facet mds1 "$LCTL set_param fail_loc=0x0"
3689 if [ $rc -eq 0 ] && [ $rc2 -ne 0 ]; then
3690 echo "1st MDT start succeed"
3691 echo "2nd MDT start failed with $rc2"
3692 elif [ $rc2 -eq 0 ] && [ $rc -ne 0 ]; then
3693 echo "1st MDT start failed with $rc"
3694 echo "2nd MDT start succeed"
3697 error "unexpected concurrent MDT mounts result, rc=$rc rc2=$rc2"
3700 if [ $MDSCOUNT -ge 2 ]; then
3701 for num in $(seq 2 $MDSCOUNT); do
3702 start_mdt $num || return
3706 # OST concurrent start
3708 do_rpc_nodes $oss_list "lsmod | grep -q libcfs" ||
3709 error "OST concurrent start: libcfs module not loaded"
3711 local ost1dev=$(ostdevname 1)
3712 local ost1mnt=$(facet_mntpt ost1)
3713 local ost1opts=$OST_MOUNT_OPTS
3715 if [ "$ost1_FSTYPE" == ldiskfs ] &&
3716 ! do_facet ost1 test -b $ost1dev; then
3717 ost1opts=$(csa_add "$ost1opts" -o loop)
3719 if [[ "$ost1_FSTYPE" == zfs ]]; then
3720 import_zpool ost1 || return ${PIPESTATUS[0]}
3723 #define OBD_FAIL_TGT_MOUNT_RACE 0x716
3724 do_facet ost1 "$LCTL set_param fail_loc=0x80000716"
3726 do_facet ost1 mount -t lustre $ost1dev $ost1mnt $ost1opts &
3729 do_facet ost1 mount -t lustre $ost1dev $ost1mnt $ost1opts
3733 do_facet ost1 "$LCTL set_param fail_loc=0x0"
3734 if [ $rc -eq 0 ] && [ $rc2 -ne 0 ]; then
3735 echo "1st OST start succeed"
3736 echo "2nd OST start failed with $rc2"
3737 elif [ $rc2 -eq 0 ] && [ $rc -ne 0 ]; then
3738 echo "1st OST start failed with $rc"
3739 echo "2nd OST start succeed"
3743 error "unexpected concurrent OST mounts result, rc=$rc rc2=$rc2"
3749 # verify everything ok
3754 error "MDT(s) start failed"
3762 error "OST(s) start failed"
3770 error "client start failed"
3777 error "client mount failed"
3781 run_test 41c "concurrent mounts of MDT/OST should all fail but one"
3783 test_42() { #bug 14693
3787 check_mount || error "client was not mounted"
3789 if [[ $PERM_CMD == *"set_param -P"* ]]; then
3790 PARAM="llite.$FSNAME-*.some_wrong_param"
3792 PARAM="$FSNAME.llite.some_wrong_param"
3795 do_facet mgs $PERM_CMD $PARAM=10
3796 umount_client $MOUNT ||
3797 error "unmounting client failed with invalid llite param"
3798 mount_client $MOUNT ||
3799 error "mounting client failed with invalid llite param"
3801 do_facet mgs $PERM_CMD $PARAM=20
3802 cleanup || error "stopping $FSNAME failed with invalid sys param"
3804 check_mount || error "client was not mounted with invalid sys param"
3805 cleanup || error "stopping $FSNAME failed with invalid sys param"
3807 run_test 42 "allow client/server mount/unmount with invalid config param"
3810 [[ "$MGS_VERSION" -ge $(version_code 2.5.58) ]] ||
3811 skip "Need MDS version at least 2.5.58"
3812 [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root"
3815 USER1=$(getent passwd | grep :$ID1:$ID1: | cut -d: -f1)
3816 [ -z "$USER1" ] && skip_env "missing user with uid=$ID1 gid=$ID1"
3819 chmod ugo+x $DIR || error "chmod 0 failed"
3820 set_persistent_param_and_check mds1 \
3821 "mdt.$FSNAME-MDT0000.root_squash" \
3822 "$FSNAME.mdt.root_squash" \
3824 wait_update $HOSTNAME \
3825 "$LCTL get_param -n llite.${FSNAME}*.root_squash" \
3827 error "check llite root_squash failed!"
3828 set_persistent_param_and_check mds1 \
3829 "mdt.$FSNAME-MDT0000.nosquash_nids" \
3830 "$FSNAME.mdt.nosquash_nids" \
3832 wait_update $HOSTNAME \
3833 "$LCTL get_param -n llite.${FSNAME}*.nosquash_nids" \
3835 error "check llite nosquash_nids failed!"
3838 # create set of test files
3840 echo "111" > $DIR/$tfile-userfile || error "write 1 failed"
3841 chmod go-rw $DIR/$tfile-userfile || error "chmod 1 failed"
3842 chown $RUNAS_ID.$RUNAS_ID $DIR/$tfile-userfile || error "chown failed"
3844 echo "222" > $DIR/$tfile-rootfile || error "write 2 failed"
3845 chmod go-rw $DIR/$tfile-rootfile || error "chmod 2 faield"
3847 mkdir_on_mdt0 $DIR/$tdir-rootdir || error "mkdir failed"
3848 chmod go-rwx $DIR/$tdir-rootdir || error "chmod 3 failed"
3849 touch $DIR/$tdir-rootdir/tfile-1 || error "touch failed"
3851 echo "777" > $DIR/$tfile-user1file || error "write 7 failed"
3852 chmod go-rw $DIR/$tfile-user1file || error "chmod 7 failed"
3853 chown $ID1.$ID1 $DIR/$tfile-user1file || error "chown failed"
3856 # check root_squash:
3857 # set root squash UID:GID to RUNAS_ID
3858 # root should be able to access only files owned by RUNAS_ID
3860 set_persistent_param_and_check mds1 \
3861 "mdt.$FSNAME-MDT0000.root_squash" \
3862 "$FSNAME.mdt.root_squash" \
3863 "$RUNAS_ID:$RUNAS_ID"
3864 wait_update $HOSTNAME \
3865 "$LCTL get_param -n llite.${FSNAME}*.root_squash" \
3866 "$RUNAS_ID:$RUNAS_ID" ||
3867 error "check llite root_squash failed!"
3869 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-userfile)
3870 dd if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null ||
3871 error "$ST: root read permission is denied"
3872 echo "$ST: root read permission is granted - ok"
3875 dd conv=notrunc of=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null ||
3876 error "$ST: root write permission is denied"
3877 echo "$ST: root write permission is granted - ok"
3879 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
3880 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null &&
3881 error "$ST: root read permission is granted"
3882 echo "$ST: root read permission is denied - ok"
3885 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null &&
3886 error "$ST: root write permission is granted"
3887 echo "$ST: root write permission is denied - ok"
3889 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
3890 rm $DIR/$tdir-rootdir/tfile-1 1>/dev/null 2>/dev/null &&
3891 error "$ST: root unlink permission is granted"
3892 echo "$ST: root unlink permission is denied - ok"
3894 touch $DIR/tdir-rootdir/tfile-2 1>/dev/null 2>/dev/null &&
3895 error "$ST: root create permission is granted"
3896 echo "$ST: root create permission is denied - ok"
3899 # check root_squash is enforced independently
3900 # of client cache content
3902 # access file by USER1, keep access open
3903 # root should be denied access to user file
3905 runas -u $ID1 tail -f $DIR/$tfile-user1file 1>/dev/null 2>&1 &
3909 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-user1file)
3910 dd if=$DIR/$tfile-user1file 1>/dev/null 2>&1 &&
3911 { kill $pid; error "$ST: root read permission is granted"; }
3912 echo "$ST: root read permission is denied - ok"
3915 dd conv=notrunc of=$DIR/$tfile-user1file 1>/dev/null 2>&1 &&
3916 { kill $pid; error "$ST: root write permission is granted"; }
3917 echo "$ST: root write permission is denied - ok"
3923 # check nosquash_nids:
3924 # put client's NID into nosquash_nids list,
3925 # root should be able to access root file after that
3927 local NIDLIST=$($LCTL list_nids all | tr '\n' ' ')
3928 NIDLIST="2@gni $NIDLIST 192.168.0.[2,10]@tcp"
3929 NIDLIST=$(echo $NIDLIST | tr -s ' ' ' ')
3930 set_persistent_param_and_check mds1 \
3931 "mdt.$FSNAME-MDT0000.nosquash_nids" \
3932 "$FSNAME-MDTall.mdt.nosquash_nids" \
3934 wait_update $HOSTNAME \
3935 "$LCTL get_param -n llite.${FSNAME}*.nosquash_nids" \
3937 error "check llite nosquash_nids failed!"
3939 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
3940 dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null ||
3941 error "$ST: root read permission is denied"
3942 echo "$ST: root read permission is granted - ok"
3945 dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null ||
3946 error "$ST: root write permission is denied"
3947 echo "$ST: root write permission is granted - ok"
3949 ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
3950 rm $DIR/$tdir-rootdir/tfile-1 ||
3951 error "$ST: root unlink permission is denied"
3952 echo "$ST: root unlink permission is granted - ok"
3953 touch $DIR/$tdir-rootdir/tfile-2 ||
3954 error "$ST: root create permission is denied"
3955 echo "$ST: root create permission is granted - ok"
3956 cleanup || error "cleanup failed with $?"
3958 run_test 43a "check root_squash and nosquash_nids"
3960 test_43b() { # LU-5690
3961 [[ "$MGS_VERSION" -ge $(version_code 2.7.62) ]] ||
3962 skip "Need MGS version 2.7.62+"
3964 if [[ -z "$fs2mds_DEV" ]]; then
3965 is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
3966 skip_env "mixed loopback and real device not working"
3969 local fs2mdsdev=$(mdsdevname 1_2)
3970 local fs2mdsvdev=$(mdsvdevname 1_2)
3972 # temporarily use fs2mds as fs2mgs
3974 local fs2mgsdev=$fs2mdsdev
3975 local fs2mgsvdev=$fs2mdsvdev
3977 local fsname=test1234
3979 load_module llite/lustre
3980 local client_ip=$(host_nids_address $HOSTNAME $NETTYPE)
3981 local host=${client_ip//*./}
3982 local net=${client_ip/%$host/}
3983 local nosquash_nids=$(h2nettype $net[$host,$host,$host])
3985 add $fs2mgs $(mkfs_opts mgs $fs2mgsdev) --fsname=$fsname \
3986 --param mdt.root_squash=$RUNAS_ID:$RUNAS_ID \
3987 --param mdt.nosquash_nids=$nosquash_nids \
3988 --reformat $fs2mgsdev $fs2mgsvdev || error "add fs2mgs failed"
3989 start $fs2mgs $fs2mgsdev $MGS_MOUNT_OPTS || error "start fs2mgs failed"
3990 stop $fs2mgs -f || error "stop fs2mgs failed"
3991 cleanup || error "cleanup failed with $?"
3993 run_test 43b "parse nosquash_nids with commas in expr_list"
3997 check_mount || error "check_mount"
3998 UUID=$($LCTL get_param llite.${FSNAME}*.uuid | cut -d= -f2)
4000 UUIDS=$(do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.*.uuid")
4001 for VAL in $UUIDS; do
4002 NID=$(echo $VAL | cut -d= -f1)
4003 CLUUID=$(echo $VAL | cut -d= -f2)
4004 [ "$UUID" = "$CLUUID" ] && STATS_FOUND=yes && break
4006 [ "$STATS_FOUND" = "no" ] && error "stats not found for client"
4007 cleanup || error "cleanup failed with $?"
4009 run_test 44 "mounted client proc entry exists"
4013 check_mount || error "check_mount"
4014 stop_mds || error "Unable to stop MDS"
4018 #define OBD_FAIL_PTLRPC_LONG_REPL_UNLINK 0x50f
4019 do_facet client "$LCTL set_param fail_loc=0x8000050f"
4022 manual_umount_client --force || error "manual_umount_client failed"
4023 do_facet client "$LCTL set_param fail_loc=0x0"
4024 start_mds || error "unable to start MDS"
4025 mount_client $MOUNT || error "mount_client $MOUNT failed"
4026 cleanup || error "cleanup failed with $?"
4028 run_test 45 "long unlink handling in ptlrpcd"
4035 umount_client $MOUNT2 || rc=$?
4036 umount_client $MOUNT || rc=$?
4037 while [ $count -gt 0 ]; do
4038 stop ost${count} -f || rc=$?
4042 cleanup_nocli || rc=$?
4043 #writeconf to remove all ost2 traces for subsequent tests
4044 writeconf_or_reformat
4049 echo "Testing with $OSTCOUNT OSTs"
4051 start_mds || error "unable to start MDS"
4052 #first client should see only one ost
4053 start_ost || error "Unable to start OST1"
4054 wait_osc_import_state mds ost FULL
4056 mount_client $MOUNT || error "mount_client $MOUNT failed"
4057 trap "cleanup_46a $OSTCOUNT" EXIT ERR
4060 for (( i=2; i<=$OSTCOUNT; i++ )); do
4061 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
4062 error "start_ost$i $(ostdevname $i) failed"
4065 # wait until osts in sync
4066 for (( i=2; i<=$OSTCOUNT; i++ )); do
4067 wait_osc_import_state mds ost$i FULL
4068 wait_osc_import_ready client ost$i
4071 #second client see all ost's
4073 mount_client $MOUNT2 || error "mount_client failed"
4074 $LFS setstripe -c -1 $MOUNT2 ||
4075 error "$LFS setstripe -c -1 $MOUNT2 failed"
4076 $LFS getstripe $MOUNT2 || error "$LFS getstripe $MOUNT2 failed"
4078 echo "ok" > $MOUNT2/widestripe
4079 $LFS getstripe $MOUNT2/widestripe ||
4080 error "$LFS getstripe $MOUNT2/widestripe failed"
4081 # fill acl buffer for avoid expand lsm to them
4082 awk -F : '{if (FNR < 25) { print "u:"$1":rwx" }}' /etc/passwd |
4084 setfacl -m $acl $MOUNT2/widestripe
4088 stat $MOUNT/widestripe || error "stat $MOUNT/widestripe failed"
4090 cleanup_46a $OSTCOUNT || error "cleanup_46a failed"
4092 run_test 46a "handle ost additional - wide striped file"
4097 check_mount || error "check_mount failed"
4098 $LCTL set_param ldlm.namespaces.$FSNAME-*-*-*.lru_size=100
4102 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
4103 if echo $ns | grep "MDT[[:digit:]]*"; then
4106 lrs=$(echo $ns | sed 's/.*lru_size=//')
4107 lru_size[count]=$lrs
4112 facet_failover $SINGLEMDS
4113 client_up || error "client_up failed"
4116 for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
4117 if echo $ns | grep "MDT[[:digit:]]*"; then
4120 lrs=$(echo $ns | sed 's/.*lru_size=//')
4121 if ! test "$lrs" -eq "${lru_size[count]}"; then
4122 n=$(echo $ns | sed -e 's/ldlm.namespaces.//' -e 's/.lru_size=.*//')
4123 error "$n has lost lru_size: $lrs vs. ${lru_size[count]}"
4128 cleanup || error "cleanup failed with $?"
4130 run_test 47 "server restart does not make client loss lru_resize settings"
4135 # reformat after this test is needed - if the test fails,
4136 # we will have unkillable file at FS
4140 test_48() { # bz-17636 LU-7473
4144 check_mount || error "check_mount failed"
4146 $LFS setstripe -c -1 $MOUNT ||
4147 error "$LFS setstripe -c -1 $MOUNT failed"
4148 $LFS getstripe $MOUNT || error "$LFS getstripe $MOUNT failed"
4150 echo "ok" > $MOUNT/widestripe
4151 $LFS getstripe $MOUNT/widestripe ||
4152 error "$LFS getstripe $MOUNT/widestripe failed"
4154 # In the future, we may introduce more EAs, such as selinux, enlarged
4155 # LOV EA, and so on. These EA will use some EA space that is shared by
4156 # ACL entries. So here we only check some reasonable ACL entries count,
4157 # instead of the max number that is calculated from the max_ea_size.
4158 if [ "$MDS1_VERSION" -lt $(version_code 2.8.57) ]; then
4159 count=28 # hard coded of RPC protocol
4160 elif large_xattr_enabled; then
4161 count=4500 # max_num 8187 max_ea_size = 65452
4162 # not create too many (4500) to save test time
4164 count=450 # max_num 497 max_ea_size = 4012
4167 echo "It is expected to hold at least $count ACL entries"
4168 trap cleanup_48 EXIT ERR
4169 for ((i = 0; i < $count; i++)) do
4170 setfacl -m u:$((i + 100)):rw $MOUNT/widestripe ||
4171 error "Fail to setfacl for $MOUNT/widestripe at $i"
4174 cancel_lru_locks mdc
4175 stat $MOUNT/widestripe || error "stat $MOUNT/widestripe failed"
4176 local r_count=$(getfacl $MOUNT/widestripe | grep "user:" | wc -l)
4178 count=$((count + 1)) # for the entry "user::rw-"
4180 [ $count -eq $r_count ] ||
4181 error "Expected ACL entries $count, but got $r_count"
4185 run_test 48 "too many acls on file"
4187 # check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE
4188 test_49a() { # bug 17710
4189 local timeout_orig=$TIMEOUT
4190 local ldlm_timeout_orig=$LDLM_TIMEOUT
4191 local LOCAL_TIMEOUT=20
4193 LDLM_TIMEOUT=$LOCAL_TIMEOUT
4194 TIMEOUT=$LOCAL_TIMEOUT
4198 check_mount || error "client mount failed"
4200 echo "check ldlm_timout..."
4201 local LDLM_MDS="$(do_facet $SINGLEMDS $LCTL get_param -n ldlm_timeout)"
4202 local LDLM_OST1="$(do_facet ost1 $LCTL get_param -n ldlm_timeout)"
4203 local LDLM_CLIENT="$(do_facet client $LCTL get_param -n ldlm_timeout)"
4205 if [ $LDLM_MDS -ne $LDLM_OST1 -o $LDLM_MDS -ne $LDLM_CLIENT ]; then
4206 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
4209 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT / 3)) ]; then
4210 error "LDLM_TIMEOUT($LDLM_MDS) is not $((LOCAL_TIMEOUT / 3))"
4213 umount_client $MOUNT || error "umount_client $MOUNT failed"
4214 stop_ost || error "problem stopping OSS"
4215 stop_mds || error "problem stopping MDS"
4217 LDLM_TIMEOUT=$ldlm_timeout_orig
4218 TIMEOUT=$timeout_orig
4220 run_test 49a "check PARAM_SYS_LDLM_TIMEOUT option of mkfs.lustre"
4222 test_49b() { # bug 17710
4223 local timeout_orig=$TIMEOUT
4224 local ldlm_timeout_orig=$LDLM_TIMEOUT
4225 local LOCAL_TIMEOUT=20
4227 LDLM_TIMEOUT=$((LOCAL_TIMEOUT - 1))
4228 TIMEOUT=$LOCAL_TIMEOUT
4232 check_mount || error "client mount failed"
4234 local LDLM_MDS="$(do_facet $SINGLEMDS $LCTL get_param -n ldlm_timeout)"
4235 local LDLM_OST1="$(do_facet ost1 $LCTL get_param -n ldlm_timeout)"
4236 local LDLM_CLIENT="$(do_facet client $LCTL get_param -n ldlm_timeout)"
4238 if [ $LDLM_MDS -ne $LDLM_OST1 -o $LDLM_MDS -ne $LDLM_CLIENT ]; then
4239 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
4242 if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT - 1)) ]; then
4243 error "LDLM_TIMEOUT($LDLM_MDS) is not $((LOCAL_TIMEOUT - 1))"
4246 cleanup || error "cleanup failed"
4248 LDLM_TIMEOUT=$ldlm_timeout_orig
4249 TIMEOUT=$timeout_orig
4251 run_test 49b "check PARAM_SYS_LDLM_TIMEOUT option of mkfs.lustre"
4254 # wait long enough to exceed OBD_STATFS_CACHE_SECONDS = 1
4256 # Test both statfs and lfs df and fail if either one fails
4257 multiop_bg_pause $1 f_
4260 killall -USR1 multiop
4261 [ $RC -ne 0 ] && log "lazystatfs multiop failed"
4262 wait $PID || { RC=$?; log "multiop return error "; }
4264 # wait long enough to exceed OBD_STATFS_CACHE_SECONDS = 1
4269 if kill -s 0 $PID; then
4272 log "lazystatfs lfs df failed to complete in 5s"
4280 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
4281 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
4283 lazystatfs $MOUNT || error "lazystatfs failed but no down servers"
4285 cleanup || error "cleanup failed with rc $?"
4287 run_test 50a "lazystatfs all servers available"
4291 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
4292 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
4294 # Wait for client to detect down OST
4295 stop_ost || error "Unable to stop OST1"
4296 wait_osc_import_state client ost DISCONN
4298 log "OSCs should all be DISCONN"
4300 lazystatfs $MOUNT || error "lazystatfs should not return EIO"
4302 umount_client $MOUNT || error "Unable to unmount client"
4303 stop_mds || error "Unable to stop MDS"
4305 run_test 50b "lazystatfs all servers down"
4308 start_mds || error "Unable to start MDS"
4309 start_ost || error "Unable to start OST1"
4310 start_ost2 || error "Unable to start OST2"
4311 mount_client $MOUNT || error "Unable to mount client"
4312 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
4313 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
4315 # Wait for client to detect down OST
4316 stop_ost || error "Unable to stop OST1"
4317 wait_osc_import_state mds ost DISCONN
4318 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
4320 umount_client $MOUNT || error "Unable to unmount client"
4321 stop_ost2 || error "Unable to stop OST2"
4322 stop_mds || error "Unable to stop MDS"
4323 #writeconf to remove all ost2 traces for subsequent tests
4324 writeconf_or_reformat
4326 run_test 50c "lazystatfs one server down"
4329 start_mds || error "Unable to start MDS"
4330 start_ost || error "Unable to start OST1"
4331 start_ost2 || error "Unable to start OST2"
4332 mount_client $MOUNT || error "Unable to mount client"
4333 $LCTL set_param llite.$FSNAME-*.lazystatfs=1
4334 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
4336 # Issue the statfs during the window where the client still
4337 # belives the OST to be available but it is in fact down.
4338 # No failure just a statfs which hangs for a timeout interval.
4339 stop_ost || error "Unable to stop OST1"
4340 lazystatfs $MOUNT || error "lazystatfs failed with one down server"
4342 umount_client $MOUNT || error "Unable to unmount client"
4343 stop_ost2 || error "Unable to stop OST2"
4344 stop_mds || error "Unable to stop MDS"
4345 #writeconf to remove all ost2 traces for subsequent tests
4346 writeconf_or_reformat
4348 run_test 50d "lazystatfs client/server conn race"
4355 start_mds || error "Unable to start MDS"
4356 #first client should see only one ost
4357 start_ost || error "Unable to start OST1"
4358 wait_osc_import_state mds ost FULL
4360 # Wait for client to detect down OST
4361 stop_ost || error "Unable to stop OST1"
4362 wait_osc_import_state mds ost DISCONN
4364 mount_client $MOUNT || error "Unable to mount client"
4365 $LCTL set_param llite.$FSNAME-*.lazystatfs=0
4367 multiop_bg_pause $MOUNT _f
4371 if [ $RC1 -ne 0 ]; then
4372 log "multiop failed $RC1"
4375 sleep $(( $TIMEOUT+1 ))
4377 [ $? -ne 0 ] && error "process isn't sleep"
4378 start_ost || error "Unable to start OST1"
4379 wait $pid || error "statfs failed"
4382 umount_client $MOUNT || error "Unable to unmount client"
4383 stop_ost || error "Unable to stop OST1"
4384 stop_mds || error "Unable to stop MDS"
4386 run_test 50e "normal statfs all servers down"
4391 CONN_PROC="osc.$FSNAME-OST0001-osc-[M]*.ost_server_uuid"
4393 start_mds || error "Unable to start mds"
4394 #first client should see only one ost
4395 start_ost || error "Unable to start OST1"
4396 wait_osc_import_state mds ost FULL
4398 start_ost2 || error "Unable to start OST2"
4399 wait_osc_import_state mds ost2 FULL
4401 # Wait for client to detect down OST
4402 stop_ost2 || error "Unable to stop OST2"
4404 wait_osc_import_state mds ost2 DISCONN
4405 mount_client $MOUNT || error "Unable to mount client"
4406 $LCTL set_param llite.$FSNAME-*.lazystatfs=0
4408 multiop_bg_pause $MOUNT _f
4412 if [ $RC1 -ne 0 ]; then
4413 log "lazystatfs multiop failed $RC1"
4416 sleep $(( $TIMEOUT+1 ))
4418 [ $? -ne 0 ] && error "process isn't sleep"
4419 start_ost2 || error "Unable to start OST2"
4420 wait $pid || error "statfs failed"
4421 stop_ost2 || error "Unable to stop OST2"
4424 umount_client $MOUNT -f || error "Unable to unmount client"
4425 stop_ost || error "Unable to stop OST1"
4426 stop_mds || error "Unable to stop MDS"
4427 #writeconf to remove all ost2 traces for subsequent tests
4428 writeconf_or_reformat
4430 run_test 50f "normal statfs one server in down"
4433 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >=2 OSTs"
4435 start_ost2 || error "Unable to start OST2"
4436 wait_osc_import_state mds ost2 FULL
4437 wait_osc_import_ready client ost2
4439 if [[ $PERM_CMD == *"set_param -P"* ]]; then
4440 local PARAM="osc.${FSNAME}-OST0001*.active"
4442 local PARAM="${FSNAME}-OST0001.osc.active"
4445 $LFS setstripe -c -1 $DIR/$tfile || error "$LFS setstripe failed"
4446 do_facet mgs $PERM_CMD $PARAM=0 || error "Unable to deactivate OST"
4448 umount_client $MOUNT || error "Unable to unmount client"
4449 mount_client $MOUNT || error "Unable to mount client"
4450 # This df should not cause a panic
4453 do_facet mgs $PERM_CMD $PARAM=1 || error "Unable to activate OST"
4454 rm -f $DIR/$tfile || error "unable to remove file $DIR/$tfile"
4455 umount_client $MOUNT || error "Unable to unmount client"
4456 stop_ost2 || error "Unable to stop OST2"
4457 stop_ost || error "Unable to stop OST1"
4458 stop_mds || error "Unable to stop MDS"
4459 #writeconf to remove all ost2 traces for subsequent tests
4460 writeconf_or_reformat
4462 run_test 50g "deactivated OST should not cause panic"
4466 # prepare MDT/OST, make OSC inactive for OST1
4467 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >=2 OSTs"
4469 [ "$ost1_FSTYPE" == zfs ] && import_zpool ost1
4470 do_facet ost1 "$TUNEFS --param osc.active=0 `ostdevname 1`" ||
4471 error "tunefs OST1 failed"
4472 start_mds || error "Unable to start MDT"
4473 start_ost || error "Unable to start OST1"
4474 start_ost2 || error "Unable to start OST2"
4475 mount_client $MOUNT || error "client start failed"
4477 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
4479 # activatate OSC for OST1
4480 set_persistent_param_and_check client \
4481 "osc.${FSNAME}-OST0000-osc-[!M]*.active" \
4482 "${FSNAME}-OST0000.osc.active" 1
4484 mkdir $DIR/$tdir/2 || error "mkdir $DIR/$tdir/2 failed"
4485 $LFS setstripe -c -1 -i 0 $DIR/$tdir/2 ||
4486 error "$LFS setstripe $DIR/$tdir/2 failed"
4487 sleep 1 && echo "create a file after OST1 is activated"
4488 # doing some io, shouldn't crash
4489 dd if=/dev/zero of=$DIR/$tdir/2/$tfile-io bs=1M count=10
4491 # check OSC import is working
4492 stat $DIR/$tdir/2/* >/dev/null 2>&1 ||
4493 error "some OSC imports are still not connected"
4497 umount_client $MOUNT || error "Unable to umount client"
4498 stop_ost2 || error "Unable to stop OST2"
4499 cleanup_nocli || error "cleanup_nocli failed with $?"
4501 run_test 50h "LU-642: activate deactivated OST"
4504 # prepare MDT/OST, make OSC inactive for OST1
4505 [ "$MDSCOUNT" -lt "2" ] && skip "needs >= 2 MDTs"
4508 [ $(facet_fstype mds2) == zfs ] && import_zpool mds2
4509 do_facet mds2 "$TUNEFS --param mdc.active=0 $(mdsdevname 2)" ||
4510 error "tunefs MDT2 failed"
4511 start_mds || error "Unable to start MDT"
4512 start_ost || error "Unable to start OST1"
4513 start_ost2 || error "Unable to start OST2"
4514 mount_client $MOUNT || error "client start failed"
4516 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
4518 if [[ $PERM_CMD == *"set_param -P"* ]]; then
4519 $PERM_CMD mdc.${FSNAME}-MDT0001-mdc-*.active=0 &&
4520 error "deactive MDC0 succeeds"
4522 $PERM_CMD ${FSNAME}-MDT0000.mdc.active=0 &&
4523 error "deactive MDC0 succeeds"
4526 # activate MDC for MDT2
4527 set_persistent_param_and_check client \
4528 "mdc.${FSNAME}-MDT0001-mdc-*.active" \
4529 "${FSNAME}-MDT0001.mdc.active" 1
4531 wait_clients_import_state ${CLIENTS:-$HOSTNAME} mds2 FULL
4532 if [ "$MDS1_VERSION" -ge $(version_code 2.7.60) ]
4534 wait_dne_interconnect
4536 $LFS mkdir -i1 $DIR/$tdir/2 || error "mkdir $DIR/$tdir/2 failed"
4538 createmany -o $DIR/$tdir/2/$tfile-%d 1 || error "create files failed"
4540 rm -rf $DIR/$tdir/2 || error "unlink dir failed"
4542 # deactivate MDC for MDT2
4543 set_persistent_param_and_check client \
4544 "mdc.${FSNAME}-MDT0001-mdc-*.active" \
4545 "${FSNAME}-MDT0001.mdc.active" 0
4547 wait_osp_active mds ${FSNAME}-MDT0001 1 0
4549 $LFS mkdir -i1 $DIR/$tdir/2 &&
4550 error "mkdir $DIR/$tdir/2 succeeds after deactive MDT"
4552 $LFS mkdir -i0 -c$MDSCOUNT $DIR/$tdir/striped_dir ||
4553 error "mkdir $DIR/$tdir/striped_dir fails after deactive MDT2"
4555 local stripe_count=$($LFS getdirstripe -c $DIR/$tdir/striped_dir)
4556 [ $stripe_count -eq $((MDSCOUNT - 1)) ] ||
4557 error "wrong $stripe_count != $((MDSCOUNT -1)) for striped_dir"
4560 umount_client $MOUNT || error "Unable to umount client"
4565 run_test 50i "activate deactivated MDT"
4568 local LOCAL_TIMEOUT=20
4572 check_mount || error "check_mount failed"
4574 mkdir $MOUNT/$tdir || error "mkdir $MOUNT/$tdir failed"
4575 $LFS setstripe -c -1 $MOUNT/$tdir ||
4576 error "$LFS setstripe -c -1 $MOUNT/$tdir failed"
4577 #define OBD_FAIL_MDS_REINT_DELAY 0x142
4578 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x142"
4579 touch $MOUNT/$tdir/$tfile &
4582 start_ost2 || error "Unable to start OST1"
4584 stop_ost2 || error "Unable to stop OST1"
4585 umount_client $MOUNT -f || error "unmount $MOUNT failed"
4586 cleanup_nocli || error "stop server failed"
4587 #writeconf to remove all ost2 traces for subsequent tests
4588 writeconf_or_reformat
4590 run_test 51 "Verify that mdt_reint handles RMF_MDT_MD correctly when an OST is added"
4599 do_node $node mkdir -p $dest
4600 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
4602 do_node $node 'tar cf - '$*' | tar xf - -C '$dest';
4603 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
4604 [ $? -eq 0 ] || { error "Unable to tar files"; return 2; }
4606 do_node $node 'getfattr -d -m "[a-z]*\\." '$*' > '$xattrs
4607 [ $? -eq 0 ] || { error "Unable to read xattrs"; return 3; }
4617 local backup2=${TMP}/backup2
4619 do_node $node mkdir -p $backup2
4620 [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
4622 do_node $node 'tar cf - '$*' | tar xf - -C '$backup2';
4623 [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
4624 [ $? -eq 0 ] || { error "Unable to tar files to diff"; return 2; }
4626 do_node $node "diff -rq $backup $backup2"
4627 [ $? -eq 0 ] || { error "contents differ"; return 3; }
4629 local xattrs2=${TMP}/xattrs2
4630 do_node $node 'getfattr -d -m "[a-z]*\\." '$*' > '$xattrs2
4631 [ $? -eq 0 ] || { error "Unable to read xattrs to diff"; return 4; }
4633 do_node $node "diff $xattrs $xattrs2"
4634 [ $? -eq 0 ] || { error "xattrs differ"; return 5; }
4636 do_node $node "rm -rf $backup2 $xattrs2"
4637 [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 6; }
4641 if [ "$mds1_FSTYPE" != ldiskfs ]; then
4642 skip "ldiskfs only test"
4645 start_mds || error "Unable to start MDS"
4646 start_ost || error "Unable to start OST1"
4647 mount_client $MOUNT || error "Unable to mount client"
4650 local ost1mnt=$(facet_mntpt ost1)
4651 local ost1node=$(facet_active_host ost1)
4652 local ost1tmp=$TMP/conf52
4655 mkdir $DIR/$tdir || error "Unable to create $DIR/$tdir"
4656 touch $TMP/modified_first || error "Unable to create temporary file"
4657 local mtime=$(stat -c %Y $TMP/modified_first)
4658 do_node $ost1node "mkdir -p $ost1tmp &&
4659 touch -m -d @$mtime $ost1tmp/modified_first" ||
4660 error "Unable to create temporary file"
4663 $LFS setstripe -c -1 -S 1M $DIR/$tdir || error "$LFS setstripe failed"
4665 for (( i=0; i < nrfiles; i++ )); do
4666 multiop $DIR/$tdir/$tfile-$i Ow1048576w1048576w524288c ||
4667 error "multiop failed"
4672 # sync all the data and make sure no pending data on the client,
4673 # thus the SOM xattr would not be changed any more.
4674 cancel_lru_locks osc
4677 echo backup files to $TMP/$tdir
4678 local files=$(find $DIR/$tdir -type f -newer $TMP/modified_first)
4679 copy_files_xattrs $(hostname) $TMP/$tdir $TMP/file_xattrs $files ||
4680 error "Unable to copy files"
4682 umount_client $MOUNT || error "Unable to umount client"
4683 stop_ost || error "Unable to stop ost1"
4685 echo mount ost1 as ldiskfs
4686 do_node $ost1node mkdir -p $ost1mnt || error "Unable to create $ost1mnt"
4687 if ! do_node $ost1node test -b $ost1_dev; then
4690 do_node $ost1node mount -t "$ost1_FSTYPE" $loop $ost1_dev \
4692 error "Unable to mount ost1 as ldiskfs"
4695 echo backup objects to $ost1tmp/objects
4696 local objects=$(do_node $ost1node 'find '$ost1mnt'/O/[0-9]* -type f'\
4697 '-size +0 -newer '$ost1tmp'/modified_first -regex ".*\/[0-9]+"')
4698 copy_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs \
4700 error "Unable to copy objects"
4702 # move objects to lost+found
4703 do_node $ost1node 'mv '$objects' '${ost1mnt}'/lost+found'
4704 [ $? -eq 0 ] || { error "Unable to move objects"; return 14; }
4706 do_node $ost1node "umount $ost1mnt" ||
4707 error "Unable to umount ost1 as ldiskfs"
4709 start_ost || error "Unable to start OST1"
4710 mount_client $MOUNT || error "Unable to mount client"
4712 local REPAIRED=$(do_node $ost1node "$LCTL get_param \
4713 -n osd-ldiskfs.$FSNAME-OST0000.oi_scrub" |
4714 awk '/^lf_repa[ri]*ed/ { print $2 }')
4715 [ $REPAIRED -gt 0 ] ||
4716 error "Some entry under /lost+found should be repaired"
4719 diff_files_xattrs $(hostname) $TMP/$tdir $TMP/file_xattrs $files ||
4720 error "Unable to diff files"
4722 rm -rf $TMP/$tdir $TMP/file_xattrs ||
4723 error "Unable to delete temporary files"
4724 do_node $ost1node "rm -rf $ost1tmp" ||
4725 error "Unable to delete temporary files"
4726 cleanup || error "cleanup failed with $?"
4728 run_test 52 "check recovering objects from lost+found"
4730 # Checks threads_min/max/started for some service
4732 # Arguments: service name (OST or MDT), facet (e.g., ost1, $SINGLEMDS), and a
4733 # parameter pattern prefix like 'ost.*.ost'.
4746 local msg="Insane $modname thread counts"
4747 local ncpts=$(check_cpt_number $facet)
4751 check_mount || return 41
4753 # We need to expand $parampat, but it may match multiple parameters, so
4754 # we'll pick the first one
4755 if ! paramp=$(do_facet $facet "lctl get_param -N ${parampat}.threads_min"|head -1); then
4756 error "Couldn't expand ${parampat}.threads_min parameter name"
4760 # Remove the .threads_min part
4761 paramp=${paramp%.threads_min}
4763 # Check for sanity in defaults
4764 tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4766 tmax=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4768 tstarted=$(do_facet $facet "$LCTL get_param \
4769 -n ${paramp}.threads_started" || echo 0)
4770 lassert 23 "$msg (PDSH problems?)" '(($tstarted && $tmin && $tmax))' ||
4772 lassert 24 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' ||
4774 nthrs=$(expr $tmax - $tmin)
4775 if [ $nthrs -lt $ncpts ]; then
4781 [ $tmin -eq $tmax -a $tmin -eq $tstarted ] &&
4782 skip_env "module parameter forced $facet thread count"
4784 # Check that we can change min/max
4785 do_facet $facet "$LCTL set_param \
4786 ${paramp}.threads_min=$((tmin + nthrs))"
4787 do_facet $facet "$LCTL set_param \
4788 ${paramp}.threads_max=$((tmax - nthrs))"
4789 tmin2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4791 tmax2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4793 lassert 25 "$msg" '(($tmin2 == ($tmin + $nthrs) &&
4794 $tmax2 == ($tmax - $nthrs)))' || return $?
4796 # Check that we can set min/max to the same value
4797 tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4799 do_facet $facet "$LCTL set_param ${paramp}.threads_max=$tmin"
4800 tmin2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4802 tmax2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4804 lassert 26 "$msg" '(($tmin2 == $tmin && $tmax2 == $tmin))' || return $?
4806 # Check that we can't set max < min
4807 do_facet $facet "$LCTL set_param ${paramp}.threads_max=$((tmin - 1))"
4808 tmin2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4810 tmax2=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4812 lassert 27 "$msg" '(($tmin2 <= $tmax2))' || return $?
4814 # We need to ensure that we get the module options desired; to do this
4815 # we set LOAD_MODULES_REMOTE=true and we call setmodopts below.
4816 LOAD_MODULES_REMOTE=true
4819 local newvalue="${opts}=$(expr $basethr \* $ncpts)"
4821 setmodopts -a $modname "$newvalue" oldvalue
4824 check_mount || return 41
4826 # Restore previous setting of MODOPTS_*
4827 setmodopts $modname "$oldvalue"
4829 (( $MDS1_VERSION > $(version_code 2.12.52.91) )) || {
4830 echo "skip interop for MDS < v2_12_52-91-g183cb1e3cdd2"
4834 # Check that $opts took
4835 tmin=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_min" ||
4837 tmax=$(do_facet $facet "$LCTL get_param -n ${paramp}.threads_max" ||
4839 tstarted=$(do_facet $facet \
4840 "$LCTL get_param -n ${paramp}.threads_started" || echo 0)
4841 lassert 28 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' ||
4847 thread_sanity OST ost1 'ost.*.ost' 'oss_num_threads' '16'
4848 cleanup || error "cleanup failed with rc $?"
4850 run_test 53a "check OSS thread count params"
4854 thread_sanity MDT $SINGLEMDS 'mds.*.*.' 'mds_num_threads' 16
4855 cleanup || error "cleanup failed with $?"
4857 run_test 53b "check MDS thread count params"
4860 if [ "$mds1_FSTYPE" != ldiskfs ]; then
4861 skip "ldiskfs only test"
4864 do_rpc_nodes $(facet_host ost1) run_llverdev $(ostdevname 1) -p ||
4865 error "llverdev failed with rc=$?"
4868 run_test 54a "test llverdev and partial verify of device"
4871 if [ "$mds1_FSTYPE" != ldiskfs ]; then
4872 skip "ldiskfs only test"
4876 run_llverfs $MOUNT -p || error "llverfs failed with rc=$?"
4877 cleanup || error "cleanup failed with rc=$?"
4879 run_test 54b "test llverfs and partial verify of filesystem"
4883 local max_ost_index=$1
4885 echo -n $(((max_ost_index + 1) * 8))
4889 if [ "$mds1_FSTYPE" != ldiskfs ]; then
4890 skip "ldiskfs only test"
4893 local mdsdev=$(mdsdevname 1)
4894 local mdsvdev=$(mdsvdevname 1)
4898 if ! combined_mgs_mds; then
4899 stop_mgs || error "stopping MGS service failed"
4900 format_mgs || error "formatting MGT failed"
4902 add mds1 $(mkfs_opts mds1 ${mdsdev}) --reformat $mdsdev \
4904 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=$i \
4905 --reformat $(ostdevname 1) $(ostvdevname 1)
4911 echo checking size of lov_objid for ost index $i
4912 LOV_OBJID_SIZE=$(do_facet mds1 "$DEBUGFS -R 'stat lov_objid' $mdsdev 2>/dev/null" |
4913 grep ^User | awk -F 'Size: ' '{print $2}')
4914 if [ "$LOV_OBJID_SIZE" != $(lov_objid_size $i) ]; then
4915 error "lov_objid size has to be $(lov_objid_size $i), not $LOV_OBJID_SIZE"
4917 echo ok, lov_objid size is correct: $LOV_OBJID_SIZE
4924 run_test 55 "check lov_objid size"
4927 local mds_journal_size_orig=$MDSJOURNALSIZE
4933 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --index=10000 --reformat \
4934 $(ostdevname 1) $(ostvdevname 1)
4935 add ost2 $(mkfs_opts ost2 $(ostdevname 2)) --index=1000 --reformat \
4936 $(ostdevname 2) $(ostvdevname 2)
4939 start_ost || error "Unable to start first ost (idx 10000)"
4940 start_ost2 || error "Unable to start second ost (idx 1000)"
4941 mount_client $MOUNT || error "Unable to mount client"
4945 # test instantiating PFL components with sparse index LU-15513
4946 mkdir -p $MOUNT/$tdir
4947 $LFS setstripe -E 4M -c 1 -E 1G -c 4 -S4M -E eof -c -1 $MOUNT/$tdir
4948 dd if=/dev/zero of=$MOUNT/$tdir/$tfile bs=4K count=1 seek=10k ||
4949 error "dd to second component failed"
4951 if [[ "$MDS1_VERSION" -ge $(version_code 2.6.54) ]] ||
4952 [[ "$MDS1_VERSION" -ge $(version_code 2.5.4) &&
4953 "$MDS1_VERSION" -lt $(version_code 2.5.11) ]]; then
4954 wait_osc_import_state mds ost1 FULL
4955 wait_osc_import_state mds ost2 FULL
4956 $LFS setstripe --stripe-count=-1 $DIR/$tfile ||
4957 error "Unable to setstripe $DIR/$tfile"
4958 n=$($LFS getstripe --stripe-count $DIR/$tfile)
4959 [ "$n" -eq 2 ] || error "Stripe count not two: $n"
4964 MDSJOURNALSIZE=$mds_journal_size_orig
4967 run_test 56a "check big OST indexes and out-of-index-order start"
4972 umount_client $MOUNT -f || error "unmount client failed"
4981 [ $MDSCOUNT -lt 3 ] && skip "needs >= 3 MDTs"
4983 trap cleanup_56b EXIT RETURN ERR
4986 if ! combined_mgs_mds ; then
4991 add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) --index=0 --reformat \
4992 $(mdsdevname 1) $(mdsvdevname 1)
4993 add mds2 $(mkfs_opts mds2 $(mdsdevname 2)) --index=1 --reformat \
4994 $(mdsdevname 2) $(mdsvdevname 2)
4995 add mds3 $(mkfs_opts mds3 $(mdsdevname 3)) --index=1000 --reformat \
4996 $(mdsdevname 3) $(mdsvdevname 3)
5000 start_mdt 1 || error "MDT 1 (idx 0) start failed"
5001 start_mdt 2 || error "MDT 2 (idx 1) start failed"
5002 start_mdt 3 || error "MDT 3 (idx 1000) start failed"
5003 start_ost || error "Unable to start first ost"
5004 start_ost2 || error "Unable to start second ost"
5006 do_nodes $(comma_list $(mdts_nodes)) \
5007 "$LCTL set_param mdt.*.enable_remote_dir=1 \
5008 mdt.*.enable_remote_dir_gid=-1"
5010 mount_client $MOUNT || error "Unable to mount client"
5012 $LFS mkdir -c3 $MOUNT/$tdir || error "failed to make testdir"
5014 echo "This is test file 1!" > $MOUNT/$tdir/$tfile.1 ||
5015 error "failed to make test file 1"
5016 echo "This is test file 2!" > $MOUNT/$tdir/$tfile.2 ||
5017 error "failed to make test file 2"
5018 echo "This is test file 1000!" > $MOUNT/$tdir/$tfile.1000 ||
5019 error "failed to make test file 1000"
5021 rm -rf $MOUNT/$tdir || error "failed to remove testdir"
5023 $LFS mkdir -i1000 $MOUNT/$tdir.1000 ||
5024 error "create remote dir at idx 1000 failed"
5027 echo "=== START lfs df OUTPUT ==="
5029 echo "==== END lfs df OUTPUT ===="
5031 mdtcnt=$(echo -e "$output" | grep $FSNAME-MDT | wc -l)
5032 ostcnt=$(echo -e "$output" | grep $FSNAME-OST | wc -l)
5034 echo "lfs df returned mdt count $mdtcnt and ost count $ostcnt"
5035 [ $mdtcnt -eq 3 ] || error "lfs df returned wrong mdt count"
5036 [ $ostcnt -eq 2 ] || error "lfs df returned wrong ost count"
5038 echo "This is test file 1!" > $MOUNT/$tdir.1000/$tfile.1 ||
5039 error "failed to make test file 1"
5040 echo "This is test file 2!" > $MOUNT/$tdir.1000/$tfile.2 ||
5041 error "failed to make test file 2"
5042 echo "This is test file 1000!" > $MOUNT/$tdir.1000/$tfile.1000 ||
5043 error "failed to make test file 1000"
5044 rm -rf $MOUNT/$tdir.1000 || error "failed to remove remote_dir"
5047 echo "=== START lfs mdts OUTPUT ==="
5049 echo "==== END lfs mdts OUTPUT ===="
5051 echo -e "$output" | grep -v "MDTS:" | awk '{print $1}' |
5052 sed 's/://g' > $TMP/mdts-actual.txt
5053 sort $TMP/mdts-actual.txt -o $TMP/mdts-actual.txt
5055 echo -e "0\n1\n1000" > $TMP/mdts-expected.txt
5057 diff $TMP/mdts-expected.txt $TMP/mdts-actual.txt
5060 rm $TMP/mdts-expected.txt $TMP/mdts-actual.txt
5062 [ $result -eq 0 ] || error "target_obd proc file is incorrect!"
5064 run_test 56b "test target_obd correctness with nonconsecutive MDTs"
5066 test_57a() { # bug 22656
5067 do_rpc_nodes $(facet_active_host ost1) load_modules_local
5068 local NID=$(do_facet ost1 "$LCTL get_param nis" |
5069 tail -1 | awk '{print $1}')
5070 writeconf_or_reformat
5071 [ "$ost1_FSTYPE" == zfs ] && import_zpool ost1
5072 do_facet ost1 "$TUNEFS --failnode=$NID `ostdevname 1`" ||
5073 error "tunefs failed"
5075 start_ost && error "OST registration from failnode should fail"
5078 run_test 57a "initial registration from failnode should fail (should return errs)"
5081 do_rpc_nodes $(facet_active_host ost1) load_modules_local
5082 local NID=$(do_facet ost1 "$LCTL get_param nis" |
5083 tail -1 | awk '{print $1}')
5084 writeconf_or_reformat
5085 [ "$ost1_FSTYPE" == zfs ] && import_zpool ost1
5086 do_facet ost1 "$TUNEFS --servicenode=$NID `ostdevname 1`" ||
5087 error "tunefs failed"
5089 start_ost || error "OST registration from servicenode should not fail"
5092 run_test 57b "initial registration from servicenode should not fail"
5095 do_facet mgs $LCTL get_param mgs.MGS.live.$FSNAME | grep OST | wc -l
5098 test_58() { # bug 22658
5099 combined_mgs_mds || stop_mgs || error "stopping MGS service failed"
5101 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
5102 createmany -o $DIR/$tdir/$tfile-%d 100
5103 unlinkmany $DIR/$tdir/$tfile-%d 100
5104 stop_mds || error "Unable to stop MDS"
5106 local MNTDIR=$(facet_mntpt $SINGLEMDS)
5107 local devname=$(mdsdevname ${SINGLEMDS//mds/})
5109 # remove all files from the OBJECTS dir
5110 mount_fstype $SINGLEMDS
5112 do_facet $SINGLEMDS "find $MNTDIR/O/1/d* -type f -delete"
5114 unmount_fstype $SINGLEMDS
5115 # restart MDS with missing llog files
5116 start_mds || error "unable to start MDS"
5117 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0"
5120 run_test 58 "missing llog files must not prevent MDT from mounting"
5123 start_mgsmds >> /dev/null
5124 local C1=$(count_osts)
5125 if [ $C1 -eq 0 ]; then
5126 start_ost >> /dev/null
5130 echo "original ost count: $C1 (expect > 0)"
5131 [ $C1 -gt 0 ] || error "No OSTs in $FSNAME log"
5132 start_mgsmds -o writeconf >> /dev/null || error "MDT start failed"
5133 local C2=$(count_osts)
5134 echo "after mdt writeconf count: $C2 (expect 0)"
5135 [ $C2 -gt 0 ] && error "MDT writeconf should erase OST logs"
5136 echo "OST start without writeconf should fail:"
5137 start_ost >> /dev/null &&
5138 error "OST start without writeconf didn't fail"
5139 echo "OST start with writeconf should succeed:"
5140 start_ost -o writeconf >> /dev/null || error "OST1 start failed"
5141 local C3=$(count_osts)
5142 echo "after ost writeconf count: $C3 (expect 1)"
5143 [ $C3 -eq 1 ] || error "new OST writeconf should add:"
5144 start_ost2 -o writeconf >> /dev/null || error "OST2 start failed"
5145 local C4=$(count_osts)
5146 echo "after ost2 writeconf count: $C4 (expect 2)"
5147 [ $C4 -eq 2 ] || error "OST2 writeconf should add log"
5148 stop_ost2 >> /dev/null
5149 cleanup_nocli >> /dev/null
5150 #writeconf to remove all ost2 traces for subsequent tests
5151 writeconf_or_reformat
5153 run_test 59 "writeconf mount option"
5155 test_60a() { # LU-471
5156 if [ "$mds1_FSTYPE" != ldiskfs ]; then
5157 skip "ldiskfs only test"
5162 for num in $(seq $MDSCOUNT); do
5163 add mds${num} $(mkfs_opts mds${num} $(mdsdevname $num)) \
5164 --mkfsoptions='\" -E stride=64 -O ^uninit_bg\"' \
5165 --reformat $(mdsdevname $num) $(mdsvdevname $num) ||
5169 dump=$(do_facet $SINGLEMDS dumpe2fs $(mdsdevname 1))
5170 [ ${PIPESTATUS[0]} -eq 0 ] || error "dumpe2fs $(mdsdevname 1) failed"
5172 # MDT default has dirdata feature
5173 echo $dump | grep dirdata > /dev/null || error "dirdata is not set"
5174 # we disable uninit_bg feature
5175 echo $dump | grep uninit_bg > /dev/null && error "uninit_bg is set"
5176 # we set stride extended options
5177 echo $dump | grep stride > /dev/null || error "stride is not set"
5181 run_test 60a "check mkfs.lustre --mkfsoptions -E -O options setting"
5184 [[ "$mds1_FSTYPE" == ldiskfs ]] || skip "ldiskfs only test"
5186 local features=$(do_facet $SINGLEMDS $DUMPE2FS $(mdsdevname 1) |
5188 [ ${PIPESTATUS[0]} -eq 0 ] || error "$DUMPE2FS $(mdsdevname 1) failed"
5191 # ea_inode feature should be enabled by default for MDTs
5192 [[ "$features" =~ "ea_inode" ]] || error "ea_inode is not set"
5193 # large_dir feature should be enabled by default for MDTs
5194 [[ "$features" =~ "large_dir" ]] || error "large_dir is not set"
5196 run_test 60b "check mkfs.lustre MDT default features"
5198 test_61a() { # LU-80
5199 local lxattr=$(large_xattr_enabled)
5201 (( "$MDS1_VERSION" >= $(version_code 2.1.53) )) ||
5202 skip "Need MDS version at least 2.1.53 for large_xattr"
5204 if [[ "$mds1_FSTYPE" == ldiskfs ]] && ! large_xattr_enabled; then
5207 for ((num=1; num <= $MDSCOUNT; num++)); do
5208 do_facet mds${num} $TUNE2FS -O ea_inode \
5209 $(mdsdevname $num) ||
5210 error "tune2fs on mds $num failed"
5214 setup || error "setting up the filesystem failed"
5215 client_up || error "starting client failed"
5217 local file=$DIR/$tfile
5218 touch $file || error "touch $file failed"
5220 local large_value="$(generate_string $(max_xattr_size))"
5221 local small_value="bar"
5223 local name="trusted.big"
5224 log "save large xattr of $(max_xattr_size) bytes on $name on $file"
5225 setfattr -n $name -v $large_value $file ||
5226 error "saving $name on $file failed"
5228 local new_value=$(get_xattr_value $name $file)
5229 [[ "$new_value" != "$large_value" ]] &&
5230 error "$name different after saving"
5232 log "shrink value of $name on $file"
5233 setfattr -n $name -v $small_value $file ||
5234 error "shrinking value of $name on $file failed"
5236 new_value=$(get_xattr_value $name $file)
5237 [[ "$new_value" != "$small_value" ]] &&
5238 error "$name different after shrinking"
5240 log "grow value of $name on $file"
5241 setfattr -n $name -v $large_value $file ||
5242 error "growing value of $name on $file failed"
5244 new_value=$(get_xattr_value $name $file)
5245 [[ "$new_value" != "$large_value" ]] &&
5246 error "$name different after growing"
5248 log "check value of $name on $file after remounting MDS"
5250 new_value=$(get_xattr_value $name $file)
5251 [[ "$new_value" != "$large_value" ]] &&
5252 error "$name different after remounting MDS"
5254 log "remove large xattr $name from $file"
5255 setfattr -x $name $file || error "removing $name from $file failed"
5257 if $lxattr && [ "$mds1_FSTYPE" == ldiskfs ]; then
5258 stopall || error "stopping for e2fsck run"
5259 for num in $(seq $MDSCOUNT); do
5260 run_e2fsck $(facet_active_host mds$num) \
5261 $(mdsdevname $num) "-y" ||
5262 error "e2fsck MDT$num failed"
5264 setup_noconfig || error "remounting the filesystem failed"
5267 # need to delete this file to avoid problems in other tests
5269 cleanup || error "stopping systems failed"
5271 run_test 61a "large xattr"
5273 test_61b() { # LU-80
5274 local lxattr=$(large_xattr_enabled)
5276 (( $MDS1_VERSION >= $(version_code 2.15.51) )) ||
5277 skip "Need MDS version at least 2.15.51 for large_xattr fix"
5279 [[ "$mds1_FSTYPE" == "ldiskfs" ]] || skip "ldiskfs specific bug"
5281 if ! large_xattr_enabled; then
5284 for (( num=1; num <= $MDSCOUNT; num++ )); do
5285 do_facet mds${num} $TUNE2FS -O ea_inode \
5286 $(mdsdevname $num) ||
5287 error "tune2fs on mds $num failed"
5291 setup || error "setting up the filesystem failed"
5292 client_up || error "starting client failed"
5294 local _file=$MOUNT/panda
5295 local large_value="$(generate_string $(max_xattr_size))"
5296 local name="trusted.big"
5298 touch ${_file} || error "touch ${_file} failed"
5299 setfattr -n $name -v $large_value ${_file} ||
5300 error "saving $name on $file failed"
5302 MDT_DEV="${FSNAME}-MDT0000"
5303 MDT_DEVNAME=$(mdsdevname ${SINGLEMDS//mds/})
5305 stopall || error "stopping for e2fsck run"
5308 ino=$(do_facet $SINGLEMDS "$DEBUGFS -R 'stat /ROOT/panda' \
5309 ${MDT_DEVNAME} | grep trusted.big")
5310 ino=$(echo "${ino}" | awk '{print $2;}')
5311 echo "large ea "${ino}
5313 do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"ln $ino /lost+found\\\" \
5316 setup_noconfig || error "remounting the filesystem failed"
5318 do_facet $SINGLEMDS $LCTL lfsck_start -M ${MDT_DEV} -t namespace || {
5319 error "can't start lfsck namespace"
5323 wait_update_facet $SINGLEMDS "$LCTL get_param -n \
5324 mdd.${MDT_DEV}.lfsck_namespace |
5325 awk '/^status/ { print \\\$2 }'" "completed" 32 || {
5326 error "(2) unexpected status"
5329 stopall || error "stopping for e2fsck run"
5330 for num in $(seq $MDSCOUNT); do
5331 run_e2fsck $(facet_active_host mds$num) \
5332 $(mdsdevname $num) "-y" ||
5333 error "e2fsck MDT$num failed"
5335 setup_noconfig || error "remounting the filesystem failed"
5337 # need to delete this file to avoid problems in other tests
5339 cleanup || error "stopping systems failed"
5341 run_test 61b "large xattr"
5344 if [ "$mds1_FSTYPE" != ldiskfs ]; then
5345 skip "ldiskfs only test"
5347 [[ "$MDS1_VERSION" -ge $(version_code 2.2.51) ]] ||
5348 skip "Need MDS version at least 2.2.51"
5351 local mdsdev=$(mdsdevname 1)
5352 local ostdev=$(ostdevname 1)
5354 echo "disable journal for mds"
5355 do_facet mds1 $TUNE2FS -O ^has_journal $mdsdev || error "tune2fs failed"
5356 start_mds && error "MDT start should fail"
5357 echo "disable journal for ost"
5358 do_facet ost1 $TUNE2FS -O ^has_journal $ostdev || error "tune2fs failed"
5359 start_ost && error "OST start should fail"
5360 cleanup || error "cleanup failed with rc $?"
5363 run_test 62 "start with disabled journal"
5366 if [ "$mds1_FSTYPE" != ldiskfs ]; then
5367 skip "ldiskfs only test"
5370 do_rpc_nodes $(facet_active_host $SINGLEMDS) load_module ldiskfs
5371 local inode_slab=$(do_facet $SINGLEMDS "cat /proc/slabinfo" |
5372 awk '/ldiskfs_inode_cache/ { print $5 / $6 }')
5373 if [ -z "$inode_slab" ]; then
5374 skip "ldiskfs module has not been loaded"
5377 if grep -q "CONFIG_DEBUG_LOCK_ALLOC=y" /boot/config-$(uname -r); then
5378 skip "test is not compatible with CONFIG_DEBUG_LOCK_ALLOC=y"
5381 echo "$inode_slab ldiskfs inodes per page"
5382 [ "${inode_slab%.*}" -ge "3" ] && return 0
5384 # If kmalloc-128 is also 1 per page - this is a debug kernel
5385 # and so this is not an error.
5386 local kmalloc128=$(do_facet $SINGLEMDS "cat /proc/slabinfo" |
5387 awk '/^(dma-kmalloc|size)-128 / { print $5 / $6 }')
5388 # 32 128-byte chunks in 4k
5389 [ "${kmalloc128%.*}" -lt "32" ] ||
5390 error "ldiskfs inode too big, only $inode_slab objs/page, " \
5391 "kmalloc128 = $kmalloc128 objs/page"
5393 run_test 63 "Verify each page can at least hold 3 ldiskfs inodes"
5396 start_mds || error "unable to start MDS"
5397 start_ost || error "Unable to start OST1"
5398 start_ost2 || error "Unable to start second ost"
5399 mount_client $MOUNT || error "Unable to mount client"
5400 stop_ost2 || error "Unable to stop second ost"
5403 umount_client $MOUNT -f || error "unmount $MOUNT failed"
5404 cleanup_nocli || error "cleanup_nocli failed with $?"
5405 #writeconf to remove all ost2 traces for subsequent tests
5406 writeconf_or_reformat
5408 run_test 64 "check lfs df --lazy "
5410 test_65() { # LU-2237
5411 # Currently, the test is only valid for ldiskfs backend
5412 [ "$mds1_FSTYPE" != ldiskfs ] &&
5413 skip "ldiskfs only test"
5415 local devname=$(mdsdevname ${SINGLEMDS//mds/})
5416 local brpt=$(facet_mntpt brpt)
5419 if ! do_facet $SINGLEMDS "test -b $devname"; then
5423 stop_mds || error "Unable to stop MDS"
5424 local obj=$(do_facet $SINGLEMDS \
5425 "$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" |
5427 if [ -z "$obj" ]; then
5428 # The MDT may be just re-formatted, mount the MDT for the
5429 # first time to guarantee the "last_rcvd" file is there.
5430 start_mds || error "fail to mount the MDS for the first time"
5431 stop_mds || error "Unable to stop MDS"
5434 # remove the "last_rcvd" file
5435 do_facet $SINGLEMDS "mkdir -p $brpt"
5436 do_facet $SINGLEMDS \
5437 "mount -t $mds1_FSTYPE $opts $devname $brpt"
5438 do_facet $SINGLEMDS "rm -f ${brpt}/last_rcvd"
5439 do_facet $SINGLEMDS "$UMOUNT $brpt"
5441 # restart MDS, the "last_rcvd" file should be recreated.
5442 start_mds || error "fail to restart the MDS"
5443 stop_mds || error "Unable to stop MDS"
5444 obj=$(do_facet $SINGLEMDS \
5445 "$DEBUGFS -c -R \\\"stat last_rcvd\\\" $devname" | grep Inode)
5446 [ -n "$obj" ] || error "fail to re-create the last_rcvd"
5448 run_test 65 "re-create the lost last_rcvd file when server mount"
5451 [[ "$MGS_VERSION" -ge $(version_code 2.3.59) ]] ||
5452 skip "Need MGS version at least 2.3.59"
5454 check_versions || skip "do not replace_nids with mismatched versions"
5457 local OST1_NID=$(do_facet ost1 $LCTL list_nids | head -1)
5458 local MDS_NID=$(do_facet $SINGLEMDS $LCTL list_nids | head -1)
5460 # add EXCLUDE records to config log, they are not to be
5461 # removed by lctl replace_nids
5462 set_conf_param_and_check mds \
5463 "$LCTL get_param -n osc.$FSNAME-OST0000-osc-MDT0000.active" \
5464 "$FSNAME-OST0000.osc.active" \
5467 echo "replace_nids should fail if MDS, OSTs and clients are UP"
5468 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
5469 error "replace_nids fail"
5471 umount_client $MOUNT || error "unmounting client failed"
5472 echo "replace_nids should fail if MDS and OSTs are UP"
5473 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
5474 error "replace_nids fail"
5476 stop_ost || error "Unable to stop OST1"
5477 echo "replace_nids should fail if MDS is UP"
5478 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID &&
5479 error "replace_nids fail"
5481 stop_mds || error "stopping mds failed"
5483 if combined_mgs_mds; then
5484 start_mdt 1 "-o nosvc" ||
5485 error "starting mds with nosvc option failed"
5488 echo "command should accept two parameters"
5489 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 &&
5490 error "command should accept two params"
5492 echo "correct device name should be passed"
5493 do_facet mgs $LCTL replace_nids $FSNAME-WRONG0000 $OST1_NID &&
5494 error "wrong devname"
5496 echo "wrong nids list should not destroy the system"
5497 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 "wrong nids list" &&
5499 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 "asdfasdf, asdfadf" &&
5502 echo "replace OST nid"
5503 do_facet mgs $LCTL replace_nids $FSNAME-OST0000 $OST1_NID ||
5504 error "replace nids failed"
5506 echo "command should accept two parameters"
5507 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 &&
5508 error "command should accept two params"
5510 echo "wrong nids list should not destroy the system"
5511 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 "wrong nids list" &&
5514 local FAKE_NIDS="192.168.0.112@tcp1,192.168.0.112@tcp2"
5515 local FAKE_FAILOVER="192.168.0.113@tcp1,192.168.0.113@tcp2"
5516 local NIDS_AND_FAILOVER="$MDS_NID,$FAKE_NIDS:$FAKE_FAILOVER"
5517 echo "set NIDs with failover"
5518 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 $NIDS_AND_FAILOVER ||
5519 error "replace nids failed"
5522 echo "replace MDS nid"
5523 do_facet mgs $LCTL replace_nids $FSNAME-MDT0000 $MDS_NID ||
5524 error "replace nids failed"
5526 if ! combined_mgs_mds ; then
5529 stop_mds || error "Unable to stop MDS"
5532 start_mgsmds || error "start mgsmds failed"
5533 set_conf_param_and_check mds \
5534 "$LCTL get_param -n osc.$FSNAME-OST0000-osc-MDT0000.active" \
5535 "$FSNAME-OST0000.osc.active" \
5537 start_ost || error "unable to start OST"
5538 mount_client $MOUNT || error "mount client failed"
5540 check_mount || error "error after nid replace"
5541 cleanup || error "cleanup failed"
5544 run_test 66 "replace nids"
5546 test_67() { #LU-2950
5547 local legacy="$TMP/legacy_lnet_config"
5548 local new="$TMP/new_routes_test"
5549 local out="$TMP/config_out_file"
5550 local verify="$TMP/conv_verify"
5551 local verify_conf="$TMP/conf_verify"
5553 # Create the legacy file that will be run through the
5554 # lustre_routes_conversion script
5555 cat <<- LEGACY_LNET_CONFIG > $legacy
5556 tcp1 23 192.168.213.1@tcp:1; tcp5 34 193.30.4.3@tcp:4;
5557 tcp2 54 10.1.3.2@tcp;
5558 tcp3 10.3.4.3@tcp:3;
5562 # Create the verification file to verify the output of
5563 # lustre_routes_conversion script against.
5564 cat <<- VERIFY_LNET_CONFIG > $verify
5565 tcp1: { gateway: 192.168.213.1@tcp, hop: 23, priority: 1 }
5566 tcp5: { gateway: 193.30.4.3@tcp, hop: 34, priority: 4 }
5567 tcp2: { gateway: 10.1.3.2@tcp, hop: 54 }
5568 tcp3: { gateway: 10.3.4.3@tcp, priority: 3 }
5569 tcp4: { gateway: 10.3.3.4@tcp }
5572 # Create the verification file to verify the output of
5573 # lustre_routes_config script against
5574 cat <<- VERIFY_LNET_CONFIG > $verify_conf
5575 lctl --net tcp1 add_route 192.168.213.1@tcp 23 1
5576 lctl --net tcp5 add_route 193.30.4.3@tcp 34 4
5577 lctl --net tcp2 add_route 10.1.3.2@tcp 54 4
5578 lctl --net tcp3 add_route 10.3.4.3@tcp 1 3
5579 lctl --net tcp4 add_route 10.3.3.4@tcp 1 3
5582 $LUSTRE_ROUTES_CONVERSION $legacy $new > /dev/null
5583 if [ -f $new ]; then
5584 # verify the conversion output
5585 cmp -s $new $verify > /dev/null
5586 if [ $? -eq 1 ]; then
5587 error "routes conversion failed"
5590 lustre_routes_config --dry-run --verbose $new > $out
5591 # check that the script succeeded
5592 cmp -s $out $verify_conf > /dev/null
5593 if [ $? -eq 1 ]; then
5594 error "routes config failed"
5597 error "routes conversion test failed"
5599 # remove generated files
5600 rm -f $new $legacy $verify $verify_conf $out
5602 run_test 67 "test routes conversion and configuration"
5610 [ "$MDS1_VERSION" -ge $(version_code 2.4.53) ] ||
5611 skip "Need MDS version at least 2.4.53"
5613 umount_client $MOUNT || error "umount client failed"
5618 # START-END - the sequences we'll be reserving
5619 START=$(do_facet $SINGLEMDS \
5620 $LCTL get_param -n seq.ctl*.space | awk -F'[[ ]' '{print $2}')
5621 END=$((START + (1 << 30)))
5622 do_facet $SINGLEMDS \
5623 $LCTL set_param seq.ctl*.fldb="[$START-$END\):0:mdt"
5625 # reset the sequences MDT0000 has already assigned
5626 do_facet $SINGLEMDS \
5627 $LCTL set_param seq.srv*MDT0000.space=clear
5629 # remount to let the client allocate new sequence
5630 mount_client $MOUNT || error "mount client failed"
5632 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
5633 do_facet $SINGLEMDS \
5634 $LCTL get_param seq.srv*MDT0000.space
5635 $LFS path2fid $DIR/$tfile
5637 local old_ifs="$IFS"
5639 fid=($($LFS path2fid $DIR/$tfile))
5643 if [[ $seq < $END ]]; then
5644 error "used reserved sequence $seq?"
5646 cleanup || error "cleanup failed with $?"
5648 run_test 68 "be able to reserve specific sequences in FLDB"
5650 # Test 69: is about the total number of objects ever created on an OST.
5651 # so that when it is reformatted the normal MDS->OST orphan recovery won't
5652 # just "precreate" the missing objects. In the past it might try to recreate
5653 # millions of objects after an OST was reformatted
5655 [[ "$MDS1_VERSION" -lt $(version_code 2.4.2) ]] &&
5656 skip "Need MDS version at least 2.4.2"
5658 [[ "$MDS1_VERSION" -ge $(version_code 2.4.50) ]] &&
5659 [[ "$MDS1_VERSION" -lt $(version_code 2.5.0) ]] &&
5660 skip "Need MDS version at least 2.5.0"
5663 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
5664 do_nodes $(comma_list $(osts_nodes)) $LCTL set_param \
5665 seq.*OST*-super.width=$DATA_SEQ_MAX_WIDTH
5667 # use OST0000 since it probably has the most creations
5668 local OSTNAME=$(ostname_from_index 0)
5669 local mdtosc_proc1=$(get_mdtosc_proc_path mds1 $OSTNAME)
5670 local last_id=$(do_facet mds1 $LCTL get_param -n \
5671 osp.$mdtosc_proc1.prealloc_last_id)
5673 # Want to have OST LAST_ID over 5 * OST_MAX_PRECREATE to
5674 # verify that the LAST_ID recovery is working properly. If
5675 # not, then the OST will refuse to allow the MDS connect
5676 # because the LAST_ID value is too different from the MDS
5677 #define OST_MAX_PRECREATE=20000
5678 local ost_max_pre=20000
5679 local num_create=$(( ost_max_pre * 5 + 1 - last_id))
5681 # If the LAST_ID is already over 5 * OST_MAX_PRECREATE, we don't
5682 # need to create any files. So, skip this section.
5683 if [ $num_create -gt 0 ]; then
5684 # Check the number of inodes available on OST0
5686 local ifree=$($LFS df -i $MOUNT |
5687 awk '/OST0000/ { print $4 }'; exit ${PIPESTATUS[0]})
5688 log "On OST0, $ifree inodes available. Want $num_create. rc=$?"
5690 $LFS setstripe -i 0 $DIR/$tdir ||
5691 error "$LFS setstripe -i 0 $DIR/$tdir failed"
5692 if [ $ifree -lt 10000 ]; then
5693 files=$(( ifree - 50 ))
5698 local j=$((num_create / files + 1))
5699 for i in $(seq 1 $j); do
5700 createmany -o $DIR/$tdir/$tfile-$i- $files ||
5701 error "createmany fail create $files files: $?"
5702 unlinkmany $DIR/$tdir/$tfile-$i- $files ||
5703 error "unlinkmany failed unlink $files files"
5707 # delete all of the files with objects on OST0 so the
5708 # filesystem is not inconsistent later on
5709 $LFS find $MOUNT --ost 0 -print0 | xargs -0 rm
5711 umount_client $MOUNT || error "umount client failed"
5712 stop_ost || error "OST0 stop failure"
5713 add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --reformat --replace \
5714 $(ostdevname 1) $(ostvdevname 1) ||
5715 error "reformat and replace $ostdev failed"
5716 start_ost || error "OST0 restart failure"
5717 wait_osc_import_state mds ost FULL
5719 mount_client $MOUNT || error "mount client failed"
5720 touch $DIR/$tdir/$tfile-last || error "create file after reformat"
5721 local idx=$($LFS getstripe -i $DIR/$tdir/$tfile-last)
5722 [ $idx -ne 0 ] && error "$DIR/$tdir/$tfile-last on $idx not 0" || true
5724 local iused=$($LFS df -i $MOUNT |
5725 awk '/OST0000/ { print $3 }'; exit ${PIPESTATUS[0]})
5726 log "On OST0, $iused used inodes rc=$?"
5727 [ $iused -ge $((ost_max_pre + 1000)) ] &&
5728 error "OST replacement created too many inodes; $iused"
5729 cleanup || error "cleanup failed with $?"
5731 run_test 69 "replace an OST with the same index"
5734 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5737 cleanup || error "cleanup failed with $?"
5739 start_mdt 1 || error "MDT0 start fail"
5741 start_ost || error "OST0 start fail"
5742 for num in $(seq 2 $MDSCOUNT); do
5743 start_mdt $num || return
5746 mount_client $MOUNT || error "mount client fails"
5748 mkdir $DIR/$tdir || error "create $DIR/$tdir failed"
5750 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5751 error "create remote dir fail"
5753 rm -rf $DIR/$tdir || error "delete dir fail"
5754 cleanup || error "cleanup failed with $?"
5756 run_test 70a "start MDT0, then OST, then MDT1"
5759 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5762 start_ost || error "OST0 start fail"
5764 start_mds || error "MDS start fail"
5766 mount_client $MOUNT || error "mount client fails"
5768 mkdir $DIR/$tdir || error "create $DIR/$tdir failed"
5770 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5771 error "create remote dir fail"
5773 rm -rf $DIR/$tdir || error "delete dir fail"
5775 cleanup || error "cleanup failed with $?"
5777 run_test 70b "start OST, MDT1, MDT0"
5780 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5783 start_mds || error "MDS start fail"
5784 start_ost || error "OST0 start fail"
5786 mount_client $MOUNT || error "mount client fails"
5787 stop_mdt 1 || error "MDT1 start fail"
5789 local mdc_for_mdt1=$($LCTL dl | grep MDT0000-mdc | awk '{print $4}')
5790 echo "deactivate $mdc_for_mdt1"
5791 $LCTL --device $mdc_for_mdt1 deactivate ||
5792 error "set $mdc_for_mdt1 deactivate failed"
5794 mkdir $DIR/$tdir && error "mkdir succeed"
5796 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir &&
5797 error "create remote dir succeed"
5799 cleanup || error "cleanup failed with $?"
5801 run_test 70c "stop MDT0, mkdir fail, create remote dir fail"
5804 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5807 start_mds || error "MDS start fail"
5808 start_ost || error "OST0 start fail"
5810 mount_client $MOUNT || error "mount client fails"
5812 stop_mdt 2 || error "MDT1 start fail"
5814 local mdc_for_mdt2=$($LCTL dl | grep MDT0001-mdc |
5816 echo "deactivate $mdc_for_mdt2"
5817 $LCTL --device $mdc_for_mdt2 deactivate ||
5818 error "set $mdc_for_mdt2 deactivate failed"
5820 mkdir $DIR/$tdir || error "mkdir fail"
5821 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir &&
5822 error "create remote dir succeed"
5824 rm -rf $DIR/$tdir || error "delete dir fail"
5826 cleanup || error "cleanup failed with $?"
5828 run_test 70d "stop MDT1, mkdir succeed, create remote dir fail"
5831 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5833 [ "$MDS1_VERSION" -ge $(version_code 2.7.62) ] ||
5834 skip "Need MDS version at least 2.7.62"
5836 reformat || error "reformat failed with $?"
5840 local mdsdev=$(mdsdevname 1)
5841 local ostdev=$(ostdevname 1)
5842 local mdsvdev=$(mdsvdevname 1)
5843 local ostvdev=$(ostvdevname 1)
5844 local opts_mds="$(mkfs_opts mds1 $mdsdev) --reformat $mdsdev $mdsvdev"
5845 local opts_ost="$(mkfs_opts ost1 $ostdev) --reformat $ostdev $ostvdev"
5847 if ! combined_mgs_mds ; then
5851 add mds1 $opts_mds || error "add mds1 failed"
5852 start_mdt 1 || error "start mdt1 failed"
5853 add ost1 $opts_ost || error "add ost1 failed"
5854 start_ost || error "start ost failed"
5855 mount_client $MOUNT > /dev/null || error "mount client $MOUNT failed"
5857 local soc=$(do_facet mds1 "$LCTL get_param -n \
5858 mdt.*MDT0000.sync_lock_cancel")
5859 [ $soc == "never" ] || error "SoC enabled on single MDS"
5861 for i in $(seq 2 $MDSCOUNT); do
5862 mdsdev=$(mdsdevname $i)
5863 mdsvdev=$(mdsvdevname $i)
5864 opts_mds="$(mkfs_opts mds$i $mdsdev) --reformat $mdsdev \
5866 add mds$i $opts_mds || error "add mds$i failed"
5867 start_mdt $i || error "start mdt$i fail"
5870 wait_dne_interconnect
5872 for i in $(seq $MDSCOUNT); do
5873 soc=$(do_facet mds$i "$LCTL get_param -n \
5874 mdt.*MDT000$((i - 1)).sync_lock_cancel")
5875 [ $soc == "blocking" ] || error "SoC not enabled on DNE"
5878 for i in $(seq 2 $MDSCOUNT); do
5879 stop_mdt $i || error "stop mdt$i fail"
5881 soc=$(do_facet mds1 "$LCTL get_param -n \
5882 mdt.*MDT0000.sync_lock_cancel")
5883 [ $soc == "never" ] || error "SoC enabled on single MDS"
5884 umount_client $MOUNT -f > /dev/null
5886 cleanup || error "cleanup failed with $?"
5888 run_test 70e "Sync-on-Cancel will be enabled by default on DNE"
5891 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5892 if combined_mgs_mds; then
5893 skip "needs separate MGS/MDT"
5897 start_mdt 1 || error "MDT0 start fail"
5898 start_ost || error "OST0 start fail"
5899 for num in $(seq 2 $MDSCOUNT); do
5900 start_mdt $num || return
5903 start_ost2 || error "OST1 start fail"
5905 mount_client $MOUNT || error "mount client fails"
5907 mkdir $DIR/$tdir || error "mkdir fail"
5908 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5909 error "create remote dir succeed"
5911 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5912 rm -rf $DIR/$tdir || error "delete dir fail"
5914 umount_client $MOUNT || error "umount_client failed"
5915 stop_mds || error "MDS stop fail"
5916 stop_ost || error "OST0 stop fail"
5917 stop_ost2 || error "OST1 stop fail"
5919 run_test 71a "start MDT0 OST0, MDT1, OST1"
5922 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5923 if combined_mgs_mds; then
5924 skip "needs separate MGS/MDT"
5928 for num in $(seq 2 $MDSCOUNT); do
5929 start_mdt $num || return
5931 start_ost || error "OST0 start fail"
5932 start_mdt 1 || error "MDT0 start fail"
5933 start_ost2 || error "OST1 start fail"
5935 mount_client $MOUNT || error "mount client fails"
5937 mkdir $DIR/$tdir || error "mkdir fail"
5938 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5939 error "create remote dir succeed"
5941 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5942 rm -rf $DIR/$tdir || error "delete dir fail"
5944 umount_client $MOUNT || error "umount_client failed"
5945 stop_mds || error "MDT0 stop fail"
5946 stop_ost || error "OST0 stop fail"
5947 stop_ost2 || error "OST1 stop fail"
5949 run_test 71b "start MDT1, OST0, MDT0, OST1"
5952 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5953 combined_mgs_mds && skip "needs separate MGS/MDT"
5957 start_ost || error "OST0 start fail"
5958 start_ost2 || error "OST1 start fail"
5959 for num in $(seq 2 $MDSCOUNT); do
5960 start_mdt $num || return
5962 start_mdt 1 || error "MDT0 start fail"
5964 mount_client $MOUNT || error "mount client fails"
5966 mkdir $DIR/$tdir || error "mkdir fail"
5967 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5968 error "create remote dir succeed"
5970 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
5971 rm -rf $DIR/$tdir || error "delete dir fail"
5973 umount_client $MOUNT || error "umount_client failed"
5974 stop_mds || error "MDS stop fail"
5975 stop_ost || error "OST0 stop fail"
5976 stop_ost2 || error "OST1 stop fail"
5979 run_test 71c "start OST0, OST1, MDT1, MDT0"
5982 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
5983 combined_mgs_mds && skip "needs separate MGS/MDT"
5987 start_ost || error "OST0 start fail"
5988 for num in $(seq 2 $MDSCOUNT); do
5989 start_mdt $num || return
5991 start_mdt 1 || error "MDT0 start fail"
5992 start_ost2 || error "OST1 start fail"
5994 mount_client $MOUNT || error "mount client fails"
5996 mkdir $DIR/$tdir || error "mkdir fail"
5997 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
5998 error "create remote dir succeed"
6000 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
6001 rm -rf $DIR/$tdir || error "delete dir fail"
6003 umount_client $MOUNT || error "umount_client failed"
6004 stop_mds || error "MDS stop fail"
6005 stop_ost || error "OST0 stop fail"
6006 stop_ost2 || error "OST1 stop fail"
6009 run_test 71d "start OST0, MDT1, MDT0, OST1"
6012 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
6013 combined_mgs_mds && skip "needs separate MGS/MDT"
6017 start_ost || error "OST0 start fail"
6018 for num in $(seq 2 $MDSCOUNT); do
6019 start_mdt $num || return
6021 start_ost2 || error "OST1 start fail"
6022 start_mdt 1 || error "MDT0 start fail"
6024 mount_client $MOUNT || error "mount client fails"
6026 mkdir $DIR/$tdir || error "mkdir fail"
6027 $LFS mkdir -i $MDTIDX $DIR/$tdir/remote_dir ||
6028 error "create remote dir succeed"
6030 mcreate $DIR/$tdir/remote_dir/$tfile || error "create file failed"
6031 rm -rf $DIR/$tdir || error "delete dir fail"
6033 umount_client $MOUNT || error "umount_client failed"
6034 stop_mds || error "MDS stop fail"
6035 stop_ost || error "OST0 stop fail"
6036 stop_ost2 || error "OST1 stop fail"
6039 run_test 71e "start OST0, MDT1, OST1, MDT0"
6041 test_72() { #LU-2634
6042 [ "$mds1_FSTYPE" != ldiskfs ] &&
6043 skip "ldiskfs only test"
6045 local mdsdev=$(mdsdevname 1)
6046 local ostdev=$(ostdevname 1)
6047 local cmd="$E2FSCK -fnvd $mdsdev"
6054 if combined_mgs_mds; then
6055 add_options='--reformat'
6057 add_options='--reformat --replace'
6060 #tune MDT with "-O extents"
6062 for num in $(seq $MDSCOUNT); do
6063 add mds${num} $(mkfs_opts mds$num $(mdsdevname $num)) \
6064 $add_options $(mdsdevname $num) $(mdsvdevname $num) ||
6065 error "add mds $num failed"
6066 do_facet mds${num} "$TUNE2FS -O extents $(mdsdevname $num)" ||
6067 error "$TUNE2FS failed on mds${num}"
6070 add ost1 $(mkfs_opts ost1 $ostdev) $add_options $ostdev ||
6071 error "add $ostdev failed"
6072 start_mds || error "start mds failed"
6073 start_ost || error "start ost failed"
6074 mount_client $MOUNT || error "mount client failed"
6076 #create some short symlinks
6077 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
6078 createmany -o $DIR/$tdir/$tfile-%d $fn
6079 echo "create $fn short symlinks"
6080 for i in $(seq -w 1 $fn); do
6081 ln -s $DIR/$tdir/$tfile-$i $MOUNT/$tfile-$i
6086 umount_client $MOUNT || error "umount client failed"
6087 stop_mds || error "stop mds failed"
6088 stop_ost || error "stop ost failed"
6091 run_e2fsck $(facet_active_host $SINGLEMDS) $mdsdev "-n"
6093 run_test 72 "test fast symlink with extents flag enabled"
6095 test_73() { #LU-3006
6096 [ "$ost1_FSTYPE" == zfs ] && import_zpool ost1
6097 do_facet ost1 "$TUNEFS --failnode=1.2.3.4@$NETTYPE $(ostdevname 1)" ||
6098 error "1st tunefs failed"
6099 start_mgsmds || error "start mds failed"
6100 start_ost || error "start ost failed"
6101 mount_client $MOUNT || error "mount client failed"
6102 $LCTL get_param -n osc.*OST0000-osc-[^M]*.import | grep failover_nids |
6103 grep 1.2.3.4@$NETTYPE || error "failover nids haven't changed"
6104 umount_client $MOUNT || error "umount client failed"
6108 run_test 73 "failnode to update from mountdata properly"
6112 (( $MDS1_VERSION >= $(version_code 2.15.57.16) )) ||
6113 skip "need MDS version >= 2.15.57.16 for per-device timeouts"
6116 stack_trap "cleanup"
6118 # Prepare fs2, share the mgs of fs
6119 local FSNAME2=fs15246
6120 local fs2mdsdev=$(mdsdevname 1_2)
6121 local fs2ostdev=$(ostdevname 1_2)
6122 local fs2mdsvdev=$(mdsvdevname 1_2)
6123 local fs2ostvdev=$(ostvdevname 1_2)
6125 add fs2mds $(mkfs_opts mds1 $fs2mdsdev) --fsname=$FSNAME2 \
6126 --reformat $fs2mdsdev $fs2mdsvdev || error "add fs2mds failed"
6127 add fs2ost $(mkfs_opts ost1 $fs2ostdev) --fsname=$FSNAME2 \
6128 --reformat $fs2ostdev $fs2ostvdev || error "add fs2ost failed"
6130 stack_trap "cleanup_fs2"
6132 start fs2ost $fs2ostdev $OST_MOUNT_OPTS || error "start fs2ost failed"
6133 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS || error "start fs2mds failed"
6135 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
6136 $MOUNT_CMD $MGSNID:/$FSNAME2 $MOUNT2 || error "mount $MOUNT2 failed"
6138 echo "========== All mounted lustre fs ===================="
6139 mount | grep 'type lustre'
6140 echo "====================================================="
6142 # Set and check osc/ldlm_enqueue_min
6143 $LCTL set_param osc.${FSNAME}-*.ldlm_enqueue_min=99 ||
6144 error "failed to set per-device adaptive parameters on client"
6145 stack_trap "$LCTL set_param osc.${FSNAME}-*.ldlm_enqueue_min=0"
6147 local ldlm_enqueue_min
6148 ldlm_enqueue_min=$($LCTL get_param -n osc.${FSNAME}-*.ldlm_enqueue_min \
6150 (( $ldlm_enqueue_min == 99 )) ||
6151 error "wrong ldlm_enqueue_min value for osc.${FSNAME}-*"
6153 # Check fs2 as reference
6154 ldlm_enqueue_min=$($LCTL get_param -n osc.${FSNAME2}-*.ldlm_enqueue_min\
6156 (( $ldlm_enqueue_min == 0 )) ||
6157 error "wrong ldlm_enqueue_min value for osc.${FSNAME2}-*"
6159 # Set and check obdfilter/at_min
6160 do_facet ost1 $LCTL set_param obdfilter.${FSNAME}-*.at_min=1 ||
6161 error "failed to set per-device adaptive parameters on ost"
6162 stack_trap "do_facet ost1 $LCTL set_param obdfilter.${FSNAME}-*.at_min=0"
6165 at_min=$(do_facet ost1 $LCTL get_param -n obdfilter.${FSNAME}-*.at_min \
6167 (( $at_min == 1 )) ||
6168 error "wrong at_min value for obdfilter.${FSNAME}-*"
6170 # set and check mdc/at_max
6171 $LCTL set_param mdc.${FSNAME}-*.at_max=599 ||
6172 error "failed to set per-device adaptive parameters on client"
6173 stack_trap "$LCTL set_param mdc.${FSNAME}-*.at_max=0"
6176 at_max=$($LCTL get_param -n mdc.${FSNAME}-*.at_max | uniq)
6177 (( $at_max == 599 )) ||
6178 error "wrong at_max value for osc.${FSNAME}-*"
6180 # Check fs2 as reference
6181 at_max=$($LCTL get_param -n mdc.${FSNAME2}-*.at_max | uniq)
6182 (( $at_max == 0 )) ||
6183 error "wrong at_max value for osc.${FSNAME2}-*"
6185 # Set and check mds/at_max
6186 do_facet mds1 $LCTL set_param *.${FSNAME}-*.at_max=599 ||
6187 error "failed to set per-device adaptive parameters on mds"
6188 stack_trap "do_facet mds1 $LCTL set_param *.${FSNAME}-*.at_max=0"
6191 at_max=$(do_facet mds1 $LCTL get_param -n mdt.${FSNAME}-*.at_max | uniq)
6192 (( at_max == 599 )) ||
6193 error "wrong at_max value for mdt.${FSNAME}-*"
6195 # Set and check mgs&mgc/at_history
6196 local mgs_nid=$(do_facet $SINGLEMDS $LCTL list_nids | tail -1)
6197 $LCTL set_param mgc.MGC$mgs_nid.at_history=588
6198 stack_trap "$LCTL set_param mgc.MGC$mgs_nid.at_history=0"
6201 at_history=$($LCTL get_param -n mgc.MGC$mgs_nid.at_history)
6202 (( $at_history == 588 )) ||
6203 error "wrong at_history value for mgc.MGC$mgs_nid"
6205 do_facet mgs $LCTL set_param mgs.MGS.at_history=588
6206 stack_trap "do_facet mgs $LCTL set_param mgs.MGS.at_history=0"
6207 at_history=$(do_facet mgs $LCTL get_param -n mgs.MGS.at_history)
6208 (( $at_history == 588 )) ||
6209 error "wrong at_history value for mgs.MGS"
6211 run_test 74 "Test per-device adaptive timeout parameters"
6213 test_75() { # LU-2374
6214 [[ "$MDS1_VERSION" -lt $(version_code 2.4.1) ]] &&
6215 skip "Need MDS version at least 2.4.1"
6218 local opts_mds="$(mkfs_opts mds1 $(mdsdevname 1)) \
6219 --replace --reformat $(mdsdevname 1) $(mdsvdevname 1)"
6220 local opts_ost="$(mkfs_opts ost1 $(ostdevname 1)) \
6221 --replace --reformat $(ostdevname 1) $(ostvdevname 1)"
6224 #check with default parameters
6225 add mds1 $opts_mds || error "add mds1 failed for default params"
6226 add ost1 $opts_ost || error "add ost1 failed for default params"
6228 opts_mds=$(echo $opts_mds | sed -e "s/--mdt//")
6229 opts_mds=$(echo $opts_mds |
6230 sed -e "s/--index=$index/--index=$index --mdt/")
6231 opts_ost=$(echo $opts_ost | sed -e "s/--ost//")
6232 opts_ost=$(echo $opts_ost |
6233 sed -e "s/--index=$index/--index=$index --ost/")
6235 add mds1 $opts_mds || error "add mds1 failed for new params"
6236 add ost1 $opts_ost || error "add ost1 failed for new params"
6241 run_test 75 "The order of --index should be irrelevant"
6244 [[ "$MGS_VERSION" -ge $(version_code 2.4.52) ]] ||
6245 skip "Need MDS version at least 2.4.52"
6248 local MDMB_PARAM="osc.*.max_dirty_mb"
6249 echo "Change MGS params"
6250 local MAX_DIRTY_MB=$($LCTL get_param -n $MDMB_PARAM |
6252 echo "max_dirty_mb: $MAX_DIRTY_MB"
6253 local NEW_MAX_DIRTY_MB=$((MAX_DIRTY_MB - 10))
6254 echo "new_max_dirty_mb: $NEW_MAX_DIRTY_MB"
6255 do_facet mgs $LCTL set_param -P $MDMB_PARAM=$NEW_MAX_DIRTY_MB
6256 wait_update $HOSTNAME "$LCTL get_param -n $MDMB_PARAM |
6257 head -1" $NEW_MAX_DIRTY_MB
6258 MAX_DIRTY_MB=$($LCTL get_param -n $MDMB_PARAM | head -1)
6259 echo "$MAX_DIRTY_MB"
6260 [ $MAX_DIRTY_MB = $NEW_MAX_DIRTY_MB ] ||
6261 error "error while apply max_dirty_mb"
6263 echo "Check the value is stored after remount"
6266 wait_update $HOSTNAME "$LCTL get_param -n $MDMB_PARAM |
6267 head -1" $NEW_MAX_DIRTY_MB
6268 MAX_DIRTY_MB=$($LCTL get_param -n $MDMB_PARAM | head -1)
6269 [ $MAX_DIRTY_MB = $NEW_MAX_DIRTY_MB ] ||
6270 error "max_dirty_mb is not saved after remount"
6272 echo "Change OST params"
6273 CLIENT_PARAM="obdfilter.*.client_cache_count"
6274 local CLIENT_CACHE_COUNT
6275 CLIENT_CACHE_COUNT=$(do_facet ost1 $LCTL get_param -n $CLIENT_PARAM |
6277 echo "client_cache_count: $CLIENT_CACHE_COUNT"
6278 NEW_CLIENT_CACHE_COUNT=$((CLIENT_CACHE_COUNT+CLIENT_CACHE_COUNT))
6279 echo "new_client_cache_count: $NEW_CLIENT_CACHE_COUNT"
6280 do_facet mgs $LCTL set_param -P $CLIENT_PARAM=$NEW_CLIENT_CACHE_COUNT
6281 wait_update $(facet_host ost1) "$LCTL get_param -n $CLIENT_PARAM |
6282 head -1" $NEW_CLIENT_CACHE_COUNT
6283 CLIENT_CACHE_COUNT=$(do_facet ost1 $LCTL get_param -n $CLIENT_PARAM |
6285 echo "$CLIENT_CACHE_COUNT"
6286 [ $CLIENT_CACHE_COUNT = $NEW_CLIENT_CACHE_COUNT ] ||
6287 error "error while apply client_cache_count"
6289 echo "Check the value is stored after remount"
6292 wait_update $(facet_host ost1) "$LCTL get_param -n $CLIENT_PARAM |
6293 head -1" $NEW_CLIENT_CACHE_COUNT
6294 CLIENT_CACHE_COUNT=$(do_facet ost1 $LCTL get_param -n $CLIENT_PARAM |
6296 echo "$CLIENT_CACHE_COUNT"
6297 [ $CLIENT_CACHE_COUNT = $NEW_CLIENT_CACHE_COUNT ] ||
6298 error "client_cache_count is not saved after remount"
6301 run_test 76a "set permanent params with lctl across mounts"
6303 test_76b() { # LU-4783
6304 [[ "$MGS_VERSION" -ge $(version_code 2.5.57) ]] ||
6305 skip "Need MGS version at least 2.5.57"
6308 do_facet mgs $LCTL get_param mgs.MGS.live.params ||
6309 error "start params log failed"
6312 run_test 76b "verify params log setup correctly"
6315 [[ "$MGS_VERSION" -ge $(version_code 2.8.54) ]] ||
6316 skip "Need MDS version at least 2.4.52"
6318 local MASK_PARAM="mdd.*.changelog_mask"
6319 echo "Change changelog_mask"
6320 do_facet mgs $LCTL set_param -P $MASK_PARAM=-CLOSE ||
6321 error "Can't change changlog_mask"
6322 wait_update $(facet_host mds) "$LCTL get_param -n $MASK_PARAM |
6325 echo "Check the value is stored after mds remount"
6326 stop_mds || error "Failed to stop MDS"
6327 start_mds || error "Failed to start MDS"
6328 local CHANGELOG_MASK=$(do_facet mgs $LCTL get_param -n $MASK_PARAM)
6329 echo $CHANGELOG_MASK | grep CLOSE > /dev/null &&
6330 error "changelog_mask is not changed"
6334 run_test 76c "verify changelog_mask is applied with lctl set_param -P"
6336 test_76d() { #LU-9399
6339 local xattr_cache="llite.*.xattr_cache"
6340 local cmd="$LCTL get_param -n $xattr_cache | head -1"
6341 local new=$((($(eval $cmd) + 1) % 2))
6343 echo "lctl set_param -P llite.*.xattr_cache=$new"
6344 do_facet mgs $LCTL set_param -P $xattr_cache=$new ||
6345 error "Can't change xattr_cache"
6346 wait_update $HOSTNAME "$cmd" "$new"
6348 echo "Check $xattr_cache on client $MOUNT"
6349 umount_client $MOUNT || error "umount $MOUNT failed"
6350 mount_client $MOUNT || error "mount $MOUNT failed"
6351 [ $(eval $cmd) -eq $new ] ||
6352 error "$xattr_cache != $new on client $MOUNT"
6354 echo "Check $xattr_cache on the new client $MOUNT2"
6355 mount_client $MOUNT2 || error "mount $MOUNT2 failed"
6356 [ $(eval $cmd) -eq $new ] ||
6357 error "$xattr_cache != $new on client $MOUNT2"
6358 umount_client $MOUNT2 || error "umount $MOUNT2 failed"
6362 run_test 76d "verify llite.*.xattr_cache can be set by 'lctl set_param -P' correctly"
6364 test_77() { # LU-3445
6365 [[ "$MDS1_VERSION" -ge $(version_code 2.8.55) ]] ||
6366 skip "Need MDS version 2.8.55+ "
6368 if [[ -z "$fs2ost_DEV" || -z "$fs2mds_DEV" ]]; then
6369 is_blkdev $SINGLEMDS $(mdsdevname ${SINGLEMDS//mds/}) &&
6370 skip_env "mixed loopback and real device not working"
6373 local fs2mdsdev=$(mdsdevname 1_2)
6374 local fs2ostdev=$(ostdevname 1_2)
6375 local fs2mdsvdev=$(mdsvdevname 1_2)
6376 local fs2ostvdev=$(ostvdevname 1_2)
6377 local fsname=test1234
6379 local failnid="$(h2nettype 1.2.3.4),$(h2nettype 4.3.2.1)"
6381 combined_mgs_mds || stop_mgs || error "stopping MGS service failed"
6383 add fs2mds $(mkfs_opts mds1 $fs2mdsdev) --mgs --fsname=$fsname \
6384 --reformat $fs2mdsdev $fs2mdsvdev || error "add fs2mds failed"
6385 start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_fs2 EXIT INT ||
6386 error "start fs2mds failed"
6388 mgsnid=$(do_facet fs2mds $LCTL list_nids | xargs | tr ' ' ,)
6389 mgsnid="0.0.0.0@tcp,$mgsnid,$mgsnid:$mgsnid"
6391 add fs2ost --mgsnode=$mgsnid $(mkfs_opts ost1 $fs2ostdev) \
6392 --failnode=$failnid --fsname=$fsname \
6393 --reformat $fs2ostdev $fs2ostvdev ||
6394 error "add fs2ost failed"
6395 start fs2ost $fs2ostdev $OST_MOUNT_OPTS || error "start fs2ost failed"
6397 mkdir -p $MOUNT2 || error "mkdir $MOUNT2 failed"
6398 $MOUNT_CMD $mgsnid:/$fsname $MOUNT2 || error "mount $MOUNT2 failed"
6399 DIR=$MOUNT2 MOUNT=$MOUNT2 check_mount || error "check $MOUNT2 failed"
6402 run_test 77 "comma-separated MGS NIDs and failover node NIDs"
6405 [[ "$mds1_FSTYPE" != ldiskfs ||
6406 "$ost1_FSTYPE" != ldiskfs ]] &&
6407 skip "ldiskfs only test"
6409 # reformat the Lustre filesystem with a smaller size
6410 local saved_MDSCOUNT=$MDSCOUNT
6411 local saved_MDSSIZE=$MDSSIZE
6412 local saved_OSTCOUNT=$OSTCOUNT
6413 local saved_OSTSIZE=$OSTSIZE
6416 MDSSIZE=$((MDSSIZE - 20000))
6417 OSTSIZE=$((OSTSIZE - 20000))
6418 reformat || error "(1) reformat Lustre filesystem failed"
6419 MDSSIZE=$saved_MDSSIZE
6420 OSTSIZE=$saved_OSTSIZE
6422 # mount the Lustre filesystem
6423 setup_noconfig || error "(2) setup Lustre filesystem failed"
6426 log "create test files"
6431 mkdir $MOUNT/$tdir || error "(3) mkdir $MOUNT/$tdir failed"
6433 for i in $(seq $num_files); do
6434 file=$MOUNT/$tdir/$tfile-$i
6435 dd if=/dev/urandom of=$file count=1 bs=1M || {
6436 $LCTL get_param osc.*.cur*grant*
6437 $LFS df; $LFS df -i;
6438 # stop creating files if there is no more space
6439 if [ ! -e $file ]; then
6440 num_files=$((i - 1))
6444 $LFS getstripe -v $file
6445 local ost_idx=$(LFS getstripe -i $file)
6446 do_facet ost$((ost_idx + 1)) \
6447 $LCTL get_param obdfilter.*.*grant*
6448 error "(4) create $file failed"
6452 # unmount the Lustre filesystem
6453 cleanup || error "(5) cleanup Lustre filesystem failed"
6455 # run e2fsck on the MDT and OST devices
6456 local mds_host=$(facet_active_host $SINGLEMDS)
6457 local ost_host=$(facet_active_host ost1)
6458 local mds_dev=$(mdsdevname ${SINGLEMDS//mds/})
6459 local ost_dev=$(ostdevname 1)
6461 run_e2fsck $mds_host $mds_dev "-y"
6462 run_e2fsck $ost_host $ost_dev "-y"
6464 # get the original block count of the MDT and OST filesystems
6465 local mds_orig_blks=$(get_block_count $SINGLEMDS $mds_dev)
6466 local ost_orig_blks=$(get_block_count ost1 $ost_dev)
6468 # expand the MDT and OST filesystems to the device size
6469 run_resize2fs $SINGLEMDS $mds_dev "" || error "expand $SINGLEMDS failed"
6470 run_resize2fs ost1 $ost_dev "" || error "expand ost1 failed"
6472 # run e2fsck on the MDT and OST devices again
6473 run_e2fsck $mds_host $mds_dev "-y"
6474 run_e2fsck $ost_host $ost_dev "-y"
6476 # mount the Lustre filesystem
6480 log "check files after expanding the MDT and OST filesystems"
6481 for i in $(seq $num_files); do
6482 file=$MOUNT/$tdir/$tfile-$i
6483 $CHECKSTAT -t file -s 1048576 $file ||
6484 error "(6) checkstat $file failed"
6488 log "create more files after expanding the MDT and OST filesystems"
6489 for i in $(seq $((num_files + 1)) $((num_files + 10))); do
6490 file=$MOUNT/$tdir/$tfile-$i
6491 dd if=/dev/urandom of=$file count=1 bs=1M ||
6492 error "(7) create $file failed"
6495 # unmount the Lustre filesystem
6496 cleanup || error "(8) cleanup Lustre filesystem failed"
6498 # run e2fsck on the MDT and OST devices
6499 run_e2fsck $mds_host $mds_dev "-y"
6500 run_e2fsck $ost_host $ost_dev "-y"
6502 # get the maximum block count of the MDT and OST filesystems
6503 local mds_max_blks=$(get_block_count $SINGLEMDS $mds_dev)
6504 local ost_max_blks=$(get_block_count ost1 $ost_dev)
6506 # get the minimum block count of the MDT and OST filesystems
6507 local mds_min_blks=$(run_resize2fs $SINGLEMDS $mds_dev "" "-P" 2>&1 |
6508 grep minimum | sed -e 's/^.*filesystem: //g')
6509 local ost_min_blks=$(run_resize2fs ost1 $ost_dev "" "-P" 2>&1 |
6510 grep minimum | sed -e 's/^.*filesystem: //g')
6512 # shrink the MDT and OST filesystems to a smaller size
6516 if [[ $mds_max_blks -gt $mds_min_blks &&
6517 $mds_max_blks -gt $mds_orig_blks ]]; then
6518 [[ $mds_orig_blks -gt $mds_min_blks ]] &&
6519 base_blks=$mds_orig_blks || base_blks=$mds_min_blks
6520 new_blks=$(( (mds_max_blks - base_blks) / 2 + base_blks ))
6521 run_resize2fs $SINGLEMDS $mds_dev $new_blks ||
6522 error "shrink $SINGLEMDS to $new_blks failed"
6526 if [[ $ost_max_blks -gt $ost_min_blks &&
6527 $ost_max_blks -gt $ost_orig_blks ]]; then
6528 [[ $ost_orig_blks -gt $ost_min_blks ]] &&
6529 base_blks=$ost_orig_blks || base_blks=$ost_min_blks
6530 new_blks=$(( (ost_max_blks - base_blks) / 2 + base_blks ))
6531 run_resize2fs ost1 $ost_dev $new_blks ||
6532 error "shrink ost1 to $new_blks failed"
6536 # check whether the MDT or OST filesystem was shrunk or not
6538 combined_mgs_mds || stop_mgs || error "(9) stop mgs failed"
6539 reformat_and_config ||
6540 error "(10) reformat Lustre filesystem failed"
6544 # run e2fsck on the MDT and OST devices again
6545 run_e2fsck $mds_host $mds_dev "-y"
6546 run_e2fsck $ost_host $ost_dev "-y"
6548 # mount the Lustre filesystem again
6552 log "check files after shrinking the MDT and OST filesystems"
6553 for i in $(seq $((num_files + 10))); do
6554 file=$MOUNT/$tdir/$tfile-$i
6555 $CHECKSTAT -t file -s 1048576 $file ||
6556 error "(11) checkstat $file failed"
6559 # unmount and reformat the Lustre filesystem
6560 cleanup || error "(12) cleanup Lustre filesystem failed"
6561 combined_mgs_mds || stop_mgs || error "(13) stop mgs failed"
6563 MDSCOUNT=$saved_MDSCOUNT
6564 OSTCOUNT=$saved_OSTCOUNT
6565 reformat_and_config || error "(14) reformat Lustre filesystem failed"
6567 run_test 78 "run resize2fs on MDT and OST filesystems"
6569 test_79() { # LU-4227
6570 [[ "$MDS1_VERSION" -ge $(version_code 2.5.59) ]] ||
6571 skip "Need MDS version at least 2.5.59"
6573 local mdsdev1=$(mdsdevname 1)
6574 local mdsvdev1=$(mdsvdevname 1)
6575 local mdsdev2=$(mdsdevname 2)
6576 local mdsvdev2=$(mdsvdevname 2)
6577 local ostdev1=$(ostdevname 1)
6578 local ostvdev1=$(ostvdevname 1)
6579 local opts_mds1="$(mkfs_opts mds1 $mdsdev1) --reformat"
6580 local opts_mds2="$(mkfs_opts mds2 $mdsdev2) --reformat"
6581 local opts_ost1="$(mkfs_opts ost1 $ostdev1) --reformat"
6584 # remove --mgs/--mgsnode from mkfs.lustre options
6585 opts_mds1=$(echo $opts_mds1 | sed -e "s/--mgs//")
6587 mgsnode_opt=$(echo $opts_mds2 |
6588 awk '{ for ( i = 1; i < NF; i++ )
6589 if ( $i ~ "--mgsnode" ) { print $i; break } }')
6590 [ -n "$mgsnode_opt" ] &&
6591 opts_mds2=$(echo $opts_mds2 | sed -e "s/$mgsnode_opt//")
6593 mgsnode_opt=$(echo $opts_ost1 |
6594 awk '{ for ( i = 1; i < NF; i++ )
6595 if ( $i ~ "--mgsnode" ) { print $i; break } }')
6596 [ -n "$mgsnode_opt" ] &&
6597 opts_ost1=$(echo $opts_ost1 | sed -e "s/$mgsnode_opt//")
6599 # -MGS, format a mdt without --mgs option
6600 add mds1 $opts_mds1 $mdsdev1 $mdsvdev1 &&
6601 error "Must specify --mgs when formatting mdt combined with mgs"
6603 # +MGS, format a mdt/ost without --mgsnode option
6604 add mds1 $(mkfs_opts mds1 $mdsdev1) --reformat $mdsdev1 $mdsvdev1 \
6605 > /dev/null || error "start mds1 failed"
6606 add mds2 $opts_mds2 $mdsdev2 $mdsvdev2 &&
6607 error "Must specify --mgsnode when formatting a mdt"
6608 add ost1 $opts_ost1 $ostdev1 $ostvdev1 &&
6609 error "Must specify --mgsnode when formatting an ost"
6613 run_test 79 "format MDT/OST without mgs option (should return errors)"
6616 start_mds || error "Failed to start MDT"
6617 start_ost || error "Failed to start OST1"
6618 uuid=$(do_facet ost1 $LCTL get_param -n mgc.*.uuid)
6619 #define OBD_FAIL_MGS_PAUSE_TARGET_CON 0x906
6620 do_facet ost1 "$LCTL set_param fail_val=10 fail_loc=0x906"
6621 do_facet mgs "$LCTL set_param fail_val=10 fail_loc=0x906"
6622 do_facet mgs "$LCTL set_param -n mgs/MGS/evict_client $uuid"
6624 start_ost2 || error "Failed to start OST2"
6626 do_facet ost1 "$LCTL set_param fail_loc=0"
6631 run_test 80 "mgc import reconnect race"
6633 #Save the original values of $OSTCOUNT and $OSTINDEX$i.
6635 local new_ostcount=$1
6636 saved_ostcount=$OSTCOUNT
6637 OSTCOUNT=$new_ostcount
6641 for ((i = 1; i <= $OSTCOUNT; i++ )); do
6643 eval saved_ostindex$i=${!index}
6648 # Restore the original values of $OSTCOUNT and $OSTINDEX$i.
6649 restore_ostindex() {
6653 echo "restoring OSTCOUNT=$saved_ostcount and OSTINDEXn"
6655 for ((i = 1; i <= $OSTCOUNT; i++ )); do
6656 index=saved_ostindex$i
6657 eval OSTINDEX$i=${!index}
6659 OSTCOUNT=$saved_ostcount
6662 if ! combined_mgs_mds ; then
6667 # The main purpose of this test is to ensure the OST_INDEX_LIST functions as
6668 # expected. This test uses OST_INDEX_LIST to format OSTs with a randomly
6669 # assigned index and ensures we can mount such a formatted file system
6670 test_81() { # LU-4665
6671 (( MDS1_VERSION >= $(version_code 2.6.54) )) ||
6672 skip "Need MDS version at least 2.6.54"
6673 (( OSTCOUNT >= 3 )) || skip_env "needs >= 3 OSTs"
6677 # Each time RANDOM is referenced, a random integer between 0 and 32767
6680 local saved_ostindex1=$OSTINDEX1
6681 for i in 65535 $((RANDOM + 65536)); do
6682 echo -e "\nFormat ost1 with --index=$i, should fail"
6684 if add ost1 $(mkfs_opts ost1 $(ostdevname 1)) --reformat \
6685 $(ostdevname 1) $(ostvdevname 1); then
6686 OSTINDEX1=$saved_ostindex1
6687 error "format ost1 with --index=$i should fail"
6690 OSTINDEX1=$saved_ostindex1
6693 stack_trap restore_ostindex
6695 # Format OSTs with random sparse indices.
6696 local rand_ost=$(((RANDOM * 2 % 65533) + 1))
6697 echo "Format $OSTCOUNT OSTs with OST_INDEX_LIST=[0,$rand_ost,65534]"
6698 OST_INDEX_LIST=[0,$rand_ost,65534] formatall ||
6699 error "formatall failed with $?"
6701 # Setup and check Lustre filesystem.
6702 start_mgsmds || error "start_mgsmds failed"
6703 for ((i = 1; i <= $OSTCOUNT; i++ )); do
6704 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
6705 error "start ost$i failed"
6708 mount_client $MOUNT || error "mount client $MOUNT failed"
6709 check_mount || error "check client $MOUNT failed"
6713 local max_easize=$($LCTL get_param -n llite.*.max_easize)
6714 local xattr_size_max=$((4096 - 84)) # 4096 less ldiskfs ea overhead
6716 # XATTR_SIZE_MAX less ldiskfs ea overhead
6717 large_xattr_enabled && xattr_size_max=$((65536 - 84))
6718 (( max_easize >= xattr_size_max )) ||
6719 error "max_easize $max_easize < $xattr_size_max bytes"
6721 test_mkdir $DIR/$tdir
6722 $LFS setstripe -i $rand_ost $DIR/$tdir/$tfile ||
6723 error "error creating $tfile on ost$rand_ost"
6724 $LFS getstripe $DIR/$tdir/$tfile
6731 cmd="getstripe -i $DIR/$tdir/$tfile"
6734 (( $found == $rand_ost )) || error "index $found is not $rand_ost"
6736 cmd="find $DIR/$tdir -i $rand_ost"
6740 [[ "$found" == "$DIR/$tdir/$tfile" ]] ||
6741 error "'lfs find' returned '$found', not '$tfile' by index"
6744 uuid=$(ostuuid_from_index $rand_ost)
6746 cmd="find $DIR/$tdir -O $uuid"
6751 [[ "$found" == "$DIR/$tdir/$tfile" ]] ||
6752 error "'lfs find' returned '$found', not '$tfile' by UUID"
6754 run_test 81 "sparse OST indexing"
6756 # Here we exercise the stripe placement functionality on a file system that
6757 # has formatted the OST with a random index. With the file system the following
6758 # functionality is tested:
6760 # 1. Creating a new file with a specific stripe layout.
6762 # 2. Modifiy a existing empty file with a specific stripe layout.
6764 # 3. Ensure we fail to set the stripe layout of a file that already has one.
6766 # 4. If ost-index is defined we need to ensure it is the first entry in the
6767 # ost index list returned by lfs getstripe.
6769 # 5. Lastly ensure this functionality fails with directories.
6770 test_82a() { # LU-4665
6771 [[ "$MDS1_VERSION" -ge $(version_code 2.6.54) ]] ||
6772 skip "Need MDS version at least 2.6.54"
6773 [[ $OSTCOUNT -ge 3 ]] || skip_env "needs >= 3 OSTs"
6779 # Format OSTs with random sparse indices.
6783 local LOV_V1_INSANE_STRIPE_COUNT=65532
6784 for i in $(seq $OSTCOUNT); do
6785 index=$(((RANDOM * 2) % LOV_V1_INSANE_STRIPE_COUNT))
6786 ost_indices+=" $index"
6788 ost_indices=$(comma_list $ost_indices)
6790 stack_trap "restore_ostindex" EXIT
6791 echo -e "\nFormat $OSTCOUNT OSTs with sparse indices $ost_indices"
6792 OST_INDEX_LIST=[$ost_indices] formatall
6794 # Setup Lustre filesystem.
6795 start_mgsmds || error "start_mgsmds failed"
6796 for i in $(seq $OSTCOUNT); do
6797 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
6798 error "start ost$i failed"
6801 # Collect debug information - start of test
6802 do_nodes $(comma_list $(mdts_nodes)) \
6803 $LCTL get_param osp.*.prealloc_*_id
6805 mount_client $MOUNT || error "mount client $MOUNT failed"
6809 check_lfs_df_ret_val $? || error "$LFS df $MOUNT failed"
6810 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
6812 stack_trap "do_nodes $(comma_list $(mdts_nodes)) \
6813 $LCTL get_param osp.*.prealloc_*_id || true" EXIT
6815 # 1. If the file does not exist, new file will be created
6816 # with specified OSTs.
6817 local file=$DIR/$tdir/$tfile-1
6818 local cmd="$LFS setstripe -o $ost_indices $file"
6820 eval $cmd || error "$cmd failed"
6821 check_stripe_count $file $OSTCOUNT
6822 check_obdidx $file $ost_indices
6823 dd if=/dev/urandom of=$file count=1 bs=1M > /dev/null 2>&1 ||
6824 error "write $file failed"
6826 # 2. If the file already exists and is an empty file, the file
6827 # will be attached with specified layout.
6828 file=$DIR/$tdir/$tfile-2
6829 mcreate $file || error "mcreate $file failed"
6830 cmd="$LFS setstripe -o $ost_indices $file"
6832 eval $cmd || error "$cmd failed"
6833 dd if=/dev/urandom of=$file count=1 bs=1M > /dev/null 2>&1 ||
6834 error "write $file failed"
6835 check_stripe_count $file $OSTCOUNT
6836 check_obdidx $file $ost_indices
6838 # 3. If the file already has a valid layout attached, the command
6839 # should fail with EBUSY.
6841 eval $cmd && error "stripe is already set on $file, $cmd should fail"
6843 # 4. If [--stripe-index|-i <start_ost_idx>] is used, the index must
6844 # be in the OST indices list.
6845 local start_ost_idx=${ost_indices##*,}
6846 file=$DIR/$tdir/$tfile-3
6847 cmd="$LFS setstripe -o $ost_indices -i $start_ost_idx $file"
6849 eval $cmd || error "$cmd failed"
6850 check_stripe_count $file $OSTCOUNT
6851 check_obdidx $file $ost_indices
6852 check_start_ost_idx $file $start_ost_idx
6854 file=$DIR/$tdir/$tfile-4
6855 cmd="$LFS setstripe"
6856 cmd+=" -o $(exclude_items_from_list $ost_indices $start_ost_idx)"
6857 cmd+=" -i $start_ost_idx $file"
6859 eval $cmd && error "index $start_ost_idx should be in $ost_indices"
6861 # 5. Specifying OST indices for directory should succeed.
6862 local dir=$DIR/$tdir/$tdir
6863 mkdir $dir || error "mkdir $dir failed"
6864 cmd="$LFS setstripe -o $ost_indices $dir"
6865 if [ "$MDS1_VERSION" -gt $(version_code 2.11.53) ] &&
6866 [ "$CLIENT_VERSION" -gt $(version_code 2.11.53) ]; then
6868 eval $cmd || error "unable to specify OST indices on directory"
6870 echo "need MDS+client version at least 2.11.53"
6873 run_test 82a "specify OSTs for file (succeed) or directory (succeed)"
6875 # Test 82b is run to ensure that if the user supplies a pool with a specific
6876 # stripe layout that it behaves proprerly. It should fail in the case that
6877 # the supplied OST index list points to OSTs not contained in the user
6879 test_82b() { # LU-4665
6880 [[ "$MDS1_VERSION" -ge $(version_code 2.6.54) ]] ||
6881 skip "Need MDS version at least 2.6.54"
6882 [[ $OSTCOUNT -ge 4 ]] || skip_env "needs >= 4 OSTs"
6888 # Format OSTs with random sparse indices.
6892 local LOV_V1_INSANE_STRIPE_COUNT=65532
6893 for i in $(seq $OSTCOUNT); do
6894 index=$(((RANDOM * 2) % LOV_V1_INSANE_STRIPE_COUNT))
6895 ost_indices+=" $index"
6897 ost_indices=$(comma_list $ost_indices)
6899 stack_trap "restore_ostindex" EXIT
6900 echo -e "\nFormat $OSTCOUNT OSTs with sparse indices $ost_indices"
6901 OST_INDEX_LIST=[$ost_indices] formatall
6903 # Setup Lustre filesystem.
6904 start_mgsmds || error "start_mgsmds failed"
6905 for i in $(seq $OSTCOUNT); do
6906 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS ||
6907 error "start ost$i failed"
6910 mount_client $MOUNT || error "mount client $MOUNT failed"
6914 check_lfs_df_ret_val $? || error "$LFS df $MOUNT failed"
6915 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
6917 # Create a new pool and add OSTs into it.
6918 local ost_pool=$FSNAME.$TESTNAME
6919 create_pool $ost_pool || error "create OST pool $ost_pool failed"
6921 local ost_idx_in_list=${ost_indices##*,}
6922 local ost_idx_in_pool=$(exclude_items_from_list $ost_indices \
6925 local ost_targets="$FSNAME-OST["
6926 for i in ${ost_idx_in_pool//,/ }; do
6927 ost_targets=$ost_targets$(printf "%04x," $i)
6929 ost_targets="${ost_targets%,}]"
6931 local ost_targets_uuid=$(for i in ${ost_idx_in_pool//,/ }; \
6932 do printf "$FSNAME-OST%04x_UUID\n" $i; done |
6933 sort -u | tr '\n' ' ')
6935 local cmd="$LCTL pool_add $ost_pool $ost_targets"
6936 do_facet mgs $cmd || error "$cmd failed"
6937 wait_update $HOSTNAME "$LCTL get_param -n lov.$FSNAME-*.pools.$TESTNAME|
6938 sort -u | tr '\n' ' ' " "$ost_targets_uuid" ||
6939 error "wait_update $ost_pool failed"
6940 wait_update_facet $SINGLEMDS "$LCTL pool_list $ost_pool | wc -l" 4 ||
6941 error "wait_update pool_list $ost_pool failed"
6943 # If [--pool|-p <pool_name>] is set with [--ost-list|-o <ost_indices>],
6944 # then the OSTs must be the members of the pool.
6945 local file=$DIR/$tdir/$tfile
6946 cmd="$LFS setstripe -p $ost_pool -o $ost_idx_in_list $file"
6948 eval $cmd && error "OST with index $ost_idx_in_list should be" \
6949 "in OST pool $ost_pool"
6951 # Only select OST $ost_idx_in_list from $ost_pool for file.
6952 ost_idx_in_list=${ost_idx_in_pool#*,}
6953 cmd="$LFS setstripe -p $ost_pool -o $ost_idx_in_list $file"
6955 eval $cmd || error "$cmd failed"
6956 cmd="$LFS getstripe $file"
6958 eval $cmd || error "$cmd failed"
6959 check_stripe_count $file 2
6960 check_obdidx $file $ost_idx_in_list
6961 dd if=/dev/urandom of=$file count=1 bs=1M > /dev/null 2>&1 ||
6962 error "write $file failed"
6964 run_test 82b "specify OSTs for file with --pool and --ost-list options"
6967 [[ "$OST1_VERSION" -ge $(version_code 2.6.91) ]] ||
6968 skip "Need OST version at least 2.6.91"
6969 if [ "$ost1_FSTYPE" != ldiskfs ]; then
6970 skip "ldiskfs only test"
6979 ostmnt=$(facet_mntpt ost1)
6981 # Mount the OST as an ldiskfs filesystem.
6982 log "mount the OST $dev as a $ost1_FSTYPE filesystem"
6983 add ost1 $(mkfs_opts ost1 $dev) $FSTYPE_OPT \
6984 --reformat $dev > /dev/null ||
6985 error "format ost1 error"
6987 if ! test -b $dev; then
6988 mnt_opts=$(csa_add "$OST_MOUNT_FS_OPTS" -o loop)
6990 echo "mnt_opts $mnt_opts"
6991 do_facet ost1 mount -t "$ost1_FSTYPE" $dev \
6993 # Run llverfs on the mounted ldiskfs filesystem.
6994 # It is needed to get ENOSPACE.
6995 log "run llverfs in partial mode on the OST $ost1_FSTYPE $ostmnt"
6996 do_rpc_nodes $(facet_host ost1) run_llverfs $ostmnt -vpl \
6997 "no" || error "run_llverfs error on $ost1_FSTYPE"
7000 log "unmount the OST $dev"
7003 # Delete file IO_scrub. Later osd_scrub_setup will try to
7004 # create "IO_scrub" but will get ENOSPACE.
7006 echo "start ost1 service on `facet_active_host ost1`"
7007 start ost1 `ostdevname 1` $OST_MOUNT_OPTS
7010 err=$(do_facet ost1 dmesg | grep "VFS: Busy inodes after unmount of")
7011 echo "string err $err"
7012 [ -z "$err" ] || error $err
7015 run_test 83 "ENOSPACE on OST doesn't cause message VFS: \
7016 Busy inodes after unmount ..."
7019 local facet=$SINGLEMDS
7020 local num=$(echo $facet | tr -d "mds")
7021 local dev=$(mdsdevname $num)
7022 local time_min=$(recovery_time_min)
7023 local recovery_duration
7024 local completed_clients
7025 local correct_clients
7028 echo "start mds service on $(facet_active_host $facet)"
7029 start_mds "-o recovery_time_hard=$time_min,recovery_time_soft=$time_min" ||
7030 error "start MDS failed"
7032 start_ost || error "start OST0000 failed"
7033 wait_osc_import_state mds ost1 FULL
7034 start_ost2 || error "start OST0001 failed"
7035 wait_osc_import_state mds ost2 FULL
7037 echo "recovery_time=$time_min, timeout=$TIMEOUT, wrap_up=$wrap_up"
7039 mount_client $MOUNT1 || error "mount $MOUNT1 failed"
7040 mount_client $MOUNT2 || error "mount $MOUNT2 failed"
7041 # make sure new superblock labels are sync'd before disabling writes
7045 replay_barrier $SINGLEMDS
7046 createmany -o $DIR1/$tfile-%d 1000
7048 # We need to catch the end of recovery window to extend it.
7049 # Skip 5 requests and add delay to request handling.
7050 #define OBD_FAIL_TGT_REPLAY_DELAY 0x709 | FAIL_SKIP
7051 do_facet $SINGLEMDS "lctl set_param fail_loc=0x20000709 fail_val=5"
7053 facet_failover --fsck $SINGLEMDS || error "failover: $?"
7056 echo "recovery status"
7057 do_facet $SINGLEMDS \
7058 "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status"
7060 recovery_duration=$(do_facet $SINGLEMDS \
7061 "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status" |
7062 awk '/recovery_duration/ { print $2 }')
7063 (( $recovery_duration > $time_min + $wrap_up )) &&
7064 error "recovery_duration > recovery_time_hard + wrap up"
7065 completed_clients=$(do_facet $SINGLEMDS \
7066 "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status" |
7067 awk '/completed_clients/ { print $2 }')
7069 correct_clients="$MDSCOUNT/$((MDSCOUNT+1))"
7070 [ "$completed_clients" = "${correct_clients}" ] ||
7071 error "$completed_clients != $correct_clients"
7073 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
7074 umount_client $MOUNT1
7075 umount_client $MOUNT2
7081 run_test 84 "check recovery_hard_time"
7084 [[ "$OST1_VERSION" -ge $(version_code 2.7.55) ]] ||
7085 skip "Need OST version at least 2.7.55"
7086 ##define OBD_FAIL_OSD_OST_EA_FID_SET 0x197
7087 do_facet ost1 "lctl set_param fail_loc=0x197"
7091 run_test 85 "osd_ost init: fail ea_fid_set"
7096 # ost1 has already registered to the MGS before the reformat.
7097 # So after reformatting it with option "-G", it could not be
7098 # mounted to the MGS. Cleanup the system for subsequent tests.
7103 [ "$ost1_FSTYPE" = zfs ] &&
7104 skip "LU-6442: no such mkfs params for ZFS OSTs"
7105 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
7106 skip "Need server version newer than 2.7.55"
7109 local OLDSIZE=$(do_facet ost1 "$DEBUGFS -c -R stats $(ostdevname 1)" |
7110 awk '/Flex block group size: / { print $NF; exit; }')
7112 [ "$OLDSIZE" == "$NEWSIZE" ] && skip "$NEWSIZE groups already"
7114 local opts=" -O flex_bg -G $NEWSIZE"
7115 opts=$(OST_FS_MKFS_OPTS+="$opts" mkfs_opts ost1 $(ostdevname 1))
7116 opts+=" --reformat $(ostdevname 1) $(ostvdevname 1)"
7117 echo "params: $opts"
7119 trap cleanup_86 EXIT ERR
7122 add ost1 $opts || error "add ost1 failed with new params"
7124 local FOUNDSIZE=$(do_facet ost1 "$DEBUGFS -c -R stats $(ostdevname 1)" |
7125 awk '/Flex block group size: / { print $NF; exit; }')
7127 [[ $FOUNDSIZE == $NEWSIZE ]] ||
7128 error "Flex block group size: $FOUNDSIZE, expected: $NEWSIZE"
7132 run_test 86 "Replacing mkfs.lustre -G option"
7134 test_87() { #LU-6544
7135 [[ "$MDS1_VERSION" -ge $(version_code 2.9.51) ]] ||
7136 skip "Need MDS version at least 2.9.51"
7137 [[ "$mds1_FSTYPE" != ldiskfs ]] &&
7138 skip "ldiskfs only test"
7139 [[ $OSTCOUNT -gt 59 ]] &&
7140 skip "Ignore wide striping situation"
7141 [ -n "$FILESET" ] && skip "Not functional for FILESET set"
7143 local mdsdev=$(mdsdevname 1)
7144 local mdsvdev=$(mdsvdevname 1)
7145 local file=$DIR/$tfile
7146 local mntpt=$(facet_mntpt $SINGLEMDS)
7147 local used_xattr_blk=0
7148 local inode_size=${1:-1024}
7150 local xtest="trusted.test"
7154 local stripe_cnt=$(($OSTCOUNT + 2))
7156 #Please see ldiskfs_make_lustre() for MDT inode size calculation
7157 if [ $stripe_cnt -gt 16 ]; then
7160 left_size=$(expr $inode_size - \
7163 32 - 40 \* 3 - 32 \* 3 - $stripe_cnt \* 24 - 16 - 3 - \
7165 24 - 18 - $(expr length $tfile) - 16 - 4)
7166 if [ $left_size -le 0 ]; then
7167 echo "No space($left_size) is expected in inode."
7168 echo "Try 1-byte xattr instead to verify this."
7171 echo "Estimate: at most $left_size-byte space left in inode."
7177 if ! combined_mgs_mds ; then
7181 add mds1 $(mkfs_opts mds1 ${mdsdev}) --stripe-count-hint=$stripe_cnt \
7182 --reformat $mdsdev $mdsvdev || error "add mds1 failed"
7183 start_mdt 1 > /dev/null || error "start mdt1 failed"
7184 for i in $(seq $OSTCOUNT); do
7185 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS > /dev/null ||
7186 error "start ost$i failed"
7188 mount_client $MOUNT > /dev/null || error "mount client $MOUNT failed"
7189 check_mount || error "check client $MOUNT failed"
7192 $LFS setstripe -E 1M -S 1M -c 1 -E 64M -c 1 -E -1 -c -1 $file ||
7193 error "Create file with 3 components failed"
7194 $TRUNCATE $file $((1024*1024*64+1)) || error "truncate file failed"
7195 i=$($LFS getstripe -I3 -c $file) || error "get 3rd stripe count failed"
7196 if [ $i -ne $OSTCOUNT ]; then
7197 left_size=$(expr $left_size + $(expr $OSTCOUNT - $i) \* 24)
7198 echo -n "Since only $i out $OSTCOUNT OSTs are used, "
7199 echo -n "the expected left space is changed to "
7200 echo "$left_size bytes at most."
7202 value=$(generate_string $left_size)
7203 setfattr -n $xtest -v $value $file
7204 orig=$(get_xattr_value $xtest $file)
7205 [[ "$orig" != "$value" ]] && error "$xtest changed"
7207 #Verify if inode has some expected space left
7208 umount $MOUNT > /dev/null || error "umount $MOUNT failed"
7209 stop_mdt 1 > /dev/null || error "stop mdt1 failed"
7210 mount_ldiskfs $SINGLEMDS || error "mount -t ldiskfs $SINGLEMDS failed"
7212 do_facet $SINGLEMDS ls -sal $mntpt/ROOT/$tfile
7213 used_xattr_blk=$(do_facet $SINGLEMDS ls -s $mntpt/ROOT/$tfile |
7215 [[ $used_xattr_blk -eq 0 ]] &&
7216 error "Please check MDS inode size calculation: \
7217 more than $left_size-byte space left in inode."
7218 echo "Verified: at most $left_size-byte space left in inode."
7220 unmount_ldiskfs $SINGLEMDS
7222 for i in $(seq $OSTCOUNT); do
7223 stop ost$i -f || error "stop ost$i failed"
7226 run_test 87 "check if MDT inode can hold EAs with N stripes properly"
7229 [ "$mds1_FSTYPE" == zfs ] &&
7230 skip "LU-6662: no implementation for ZFS"
7234 add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) \
7235 --reformat $(mdsdevname 1) || error "add mds1 failed"
7237 do_facet mds1 "$TUNEFS $(mdsdevname 1) |
7238 grep -e \".*opts:.*errors=remount-ro.*\"" ||
7239 error "default mount options is missing"
7241 add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) \
7242 --mountfsoptions="user_xattr,errors=panic" \
7243 --reformat $(mdsdevname 1) || error "add mds1 failed"
7245 do_facet mds1 "$TUNEFS $(mdsdevname 1) |
7246 grep -e \".*opts:.*errors=panic.*\"" ||
7247 error "user can't override default mount options"
7249 run_test 88 "check the default mount options can be overridden"
7251 test_89() { # LU-7131
7252 [[ "$MDS1_VERSION" -ge $(version_code 2.9.54) ]] ||
7253 skip "Need MDT version at least 2.9.54"
7255 local key=failover.node
7256 local val1=192.0.2.254@tcp0 # Reserved IPs, see RFC 5735
7257 local val2=192.0.2.255@tcp0
7258 local mdsdev=$(mdsdevname 1)
7263 if [[ "$mds1_FSTYPE" == zfs ]]; then
7264 import_zpool mds1 || return ${PIPESTATUS[0]}
7267 # Check that parameters are added correctly
7268 echo "tunefs --param $key=$val1"
7269 do_facet mds1 "$TUNEFS --param $key=$val1 $mdsdev >/dev/null" ||
7270 error "tunefs --param $key=$val1 failed"
7271 params=$(do_facet mds1 $TUNEFS --dryrun $mdsdev) ||
7272 error "tunefs --dryrun failed"
7273 params=${params##*Parameters:}
7274 params=${params%%exiting*}
7275 [ $(echo $params | tr ' ' '\n' | grep -c $key=$val1) = "1" ] ||
7276 error "on-disk parameter not added correctly via tunefs"
7278 # Check that parameters replace existing instances when added
7279 echo "tunefs --param $key=$val2"
7280 do_facet mds1 "$TUNEFS --param $key=$val2 $mdsdev >/dev/null" ||
7281 error "tunefs --param $key=$val2 failed"
7282 params=$(do_facet mds1 $TUNEFS --dryrun $mdsdev) ||
7283 error "tunefs --dryrun failed"
7284 params=${params##*Parameters:}
7285 params=${params%%exiting*}
7286 [ $(echo $params | tr ' ' '\n' | grep -c $key=) = "1" ] ||
7287 error "on-disk parameter not replaced via tunefs"
7288 [ $(echo $params | tr ' ' '\n' | grep -c $key=$val2) = "1" ] ||
7289 error "on-disk parameter not replaced correctly via tunefs"
7291 # Check that a parameter is erased properly
7292 echo "tunefs --erase-param $key"
7293 do_facet mds1 "$TUNEFS --erase-param $key $mdsdev >/dev/null" ||
7294 error "tunefs --erase-param $key failed"
7295 params=$(do_facet mds1 $TUNEFS --dryrun $mdsdev) ||
7296 error "tunefs --dryrun failed"
7297 params=${params##*Parameters:}
7298 params=${params%%exiting*}
7299 [ $(echo $params | tr ' ' '\n' | grep -c $key=) = "0" ] ||
7300 error "on-disk parameter not erased correctly via tunefs"
7302 # Check that all the parameters are erased
7303 do_facet mds1 "$TUNEFS --param $key=$val1 $mdsdev >/dev/null" ||
7304 error "tunefs --param $key=$val1 failed"
7305 echo "tunefs --erase-params"
7306 do_facet mds1 "$TUNEFS --erase-params $mdsdev >/dev/null" ||
7307 error "tunefs --erase-params failed"
7308 params=$(do_facet mds1 $TUNEFS --dryrun $mdsdev) ||
7309 error "tunefs --dryrun failed"
7310 params=${params##*Parameters:}
7311 params=${params%%exiting*}
7312 params=$(echo $params | tr ' ' '\n')
7314 error "all on-disk parameters not erased correctly via tunefs $params"
7316 # Check the order of options --erase-params and --param
7317 echo "tunefs --param $key=$val1 --erase-params"
7319 "$TUNEFS --param $key=$val1 --erase-params $mdsdev >/dev/null"||
7320 error "tunefs --param $key=$val1 --erase-params failed"
7321 params=$(do_facet mds1 $TUNEFS --dryrun $mdsdev) ||
7322 error "tunefs --dryrun failed"
7323 params=${params##*Parameters:}
7324 params=${params%%exiting*}
7325 [ $(echo $params | tr ' ' '\n') == "$key=$val1" ] ||
7326 error "on-disk param not added correctly with --erase-params"
7330 run_test 89 "check tunefs --param and --erase-param{s} options"
7333 # $2 (optional) value of max_mod_rpcs_in_flight to set
7334 check_max_mod_rpcs_in_flight() {
7342 idx=$(printf "%04x" $($LFS getdirstripe -i $dir))
7343 facet="mds$((0x$idx + 1))"
7345 if [ -z "$mmr" ]; then
7346 # get value of max_mod_rcps_in_flight
7347 mmr=$($LCTL get_param -n \
7348 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight) ||
7349 error "Unable to get max_mod_rpcs_in_flight"
7350 echo "max_mod_rcps_in_flight is $mmr"
7352 # set value of max_mod_rpcs_in_flight
7354 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight=$mmr ||
7355 error "Unable to set max_mod_rpcs_in_flight to $mmr"
7356 echo "max_mod_rpcs_in_flight set to $mmr"
7359 # create mmr+1 files
7360 echo "creating $((mmr + 1)) files ..."
7362 for i in $(seq $((mmr + 1))); do
7368 # consumes mmr-1 modify RPC slots
7369 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
7370 # drop requests on MDT so that RPC slots are consumed
7371 # during all the request resend interval
7372 do_facet $facet "$LCTL set_param fail_loc=0x159"
7373 echo "launch $((mmr - 1)) chmod in parallel ..."
7374 for i in $(seq $((mmr - 1))); do
7375 chmod 0600 $dir/file-$i &
7379 # send one additional modify RPC
7380 do_facet $facet "$LCTL set_param fail_loc=0"
7381 echo "launch 1 additional chmod in parallel ..."
7382 chmod 0600 $dir/file-$mmr &
7385 # check this additional modify RPC get a modify RPC slot
7386 # and succeed its operation
7387 checkstat -vp 0600 $dir/file-$mmr ||
7388 error "Unable to send $mmr modify RPCs in parallel"
7393 # consumes mmr modify RPC slots
7394 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
7395 # drop requests on MDT so that RPC slots are consumed
7396 # during all the request resend interval
7397 do_facet $facet "$LCTL set_param fail_loc=0x159"
7398 echo "launch $mmr chmod in parallel ..."
7399 for i in $(seq $mmr); do
7400 chmod 0666 $dir/file-$i &
7404 # send one additional modify RPC
7405 do_facet $facet "$LCTL set_param fail_loc=0"
7406 echo "launch 1 additional chmod in parallel ..."
7407 chmod 0666 $dir/file-$((mmr + 1)) &
7410 # check this additional modify RPC blocked getting a modify RPC slot
7411 checkstat -vp 0644 $dir/file-$((mmr + 1)) ||
7412 error "Unexpectedly send $(($mmr + 1)) modify RPCs in parallel"
7416 get_mdt_max_mod_rpcs_in_flight_val() {
7420 # It will be enough to get one value from one MDT
7421 max_mrif=$(do_facet $facet \
7422 "$LCTL get_param -n \
7423 mdt.$FSNAME-MDT*.max_mod_rpcs_in_flight | head -n 1")
7424 if [[ $max_mrif ]]; then
7427 max_mrif=$(do_facet $facet \
7428 cat /sys/module/mdt/parameters/max_mod_rpcs_per_client)
7433 set_mdt_max_mod_rpcs_in_flight() {
7438 lctl_op=$($LCTL get_param \
7439 mdt.*.max_mod_rpcs_in_flight)
7440 if [[ $lctl_op ]]; then
7443 mdt.$FSNAME-MDT*.max_mod_rpcs_in_flight=$max_mrif"
7447 /sys/module/mdt/parameters/max_mod_rpcs_per_client"
7448 echo "the deprecated max_mod_rpcs_per_client \
7449 parameter was involved"
7456 [[ $($LCTL get_param mdc.*.import |
7457 grep "connect_flags:.*multi_mod_rpc") ]] ||
7458 skip "Need MDC with 'multi_mod_rpcs' feature"
7460 # check default value
7461 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
7462 check_max_mod_rpcs_in_flight $DIR/$tdir
7466 run_test 90a "check max_mod_rpcs_in_flight is enforced"
7476 [[ $($LCTL get_param mdc.*.import |
7477 grep "connect_flags:.*multi_mod_rpc") ]] ||
7478 skip "Need MDC with 'multi_mod_rpcs' feature"
7481 # update max_mod_rpcs_in_flight
7482 $LFS mkdir -c1 $DIR/${tdir}1 || error "mkdir $DIR/${tdir}1 failed"
7483 check_max_mod_rpcs_in_flight $DIR/${tdir}1 1
7486 # check client is able to send multiple modify RPCs in paralell
7487 tmp=$($LCTL get_param -n mdc.$FSNAME-MDT*-mdc-*.import |
7488 grep -c "multi_mod_rpcs")
7489 if [ "$tmp" -ne $MDSCOUNT ]; then
7491 skip "Client not able to send multiple modify RPCs in parallel"
7494 # update max_mod_rpcs_in_flight
7495 $LFS mkdir -c1 $DIR/${tdir}2 || error "mkdir $DIR/${tdir}2 failed"
7496 check_max_mod_rpcs_in_flight $DIR/${tdir}2 5
7499 $LFS mkdir -c1 $DIR/${tdir}3 || error "mkdir $DIR/${tdir}3 failed"
7500 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/${tdir}3))
7501 facet="mds$((0x$idx + 1))"
7503 mmrpc=$(get_mdt_max_mod_rpcs_in_flight_val $facet)
7504 echo "mdt_max_mod_rpcs_in_flight is $mmrpc"
7505 # update max_mod_rpcs_in_flight
7506 umount_client $MOUNT
7507 set_mdt_max_mod_rpcs_in_flight 16 $facet
7509 $LCTL set_param mdc.$FSNAME-MDT$idx-mdc-*.max_rpcs_in_flight=17
7510 check_max_mod_rpcs_in_flight $DIR/${tdir}3 16
7512 # restore MDT max_mod_rpcs_in_flight initial value
7513 set_mdt_max_mod_rpcs_in_flight $mmrpc $facet
7515 rm -rf $DIR/${tdir}?
7518 run_test 90b "check max_mod_rpcs_in_flight is enforced after update"
7521 # get max_rpcs_in_flight value
7522 mrif_90c=$($LCTL get_param -n \
7523 mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight)
7524 echo "max_rpcs_in_flight is $mrif_90c"
7526 # get MDC max_mod_rpcs_in_flight value
7527 mmrif_90c=$($LCTL get_param -n \
7528 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight)
7529 echo "MDC max_mod_rpcs_in_flight is $mmrif_90c"
7531 # get MDT max_mod_rpcs_in_flight value
7532 mmrpc_90c=$(get_mdt_max_mod_rpcs_in_flight_val "mds1")
7533 echo "mdt_max_mod_rpcs_in_flight is $mmrpc_90c"
7536 restore_params_90c() {
7539 # restore max_rpcs_in_flight value
7540 do_facet mgs $LCTL set_param -P \
7541 mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight=$mrif_90c
7543 # restore max_mod_rpcs_in_flight value
7544 do_facet mgs $LCTL set_param -P \
7545 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight=$mmrif_90c
7547 # restore MDT max_mod_rpcs_in_flight value
7548 set_mdt_max_mod_rpcs_in_flight $mmrpc_90c "mds1"
7556 [[ $($LCTL get_param mdc.*.import |
7557 grep "connect_flags:.*multi_mod_rpc") ]] ||
7558 skip "Need MDC with 'multi_mod_rpcs' feature"
7560 # check client is able to send multiple modify RPCs in paralell
7561 tmp=$($LCTL get_param -n mdc.$FSNAME-MDT*-mdc-*.import |
7562 grep -c "multi_mod_rpcs")
7563 if [ "$tmp" -ne $MDSCOUNT ]; then
7565 skip "Client not able to send multiple modify RPCs in parallel"
7569 stack_trap restore_params_90c
7572 # attempt to set max_mod_rpcs_in_flight to max_rpcs_in_flight value
7573 # prerequisite: set MDT max_mod_rpcs_in_flight to
7574 # max_rpcs_in_flight value
7575 set_mdt_max_mod_rpcs_in_flight $mrif_90c "mds1"
7577 # if max_mod_rpcs_in_flight is set to be equal to or larger than
7578 # max_rpcs_in_flight, then max_rpcs_in_flight will be increased
7579 if [[ "$CLIENT_VERSION" -ge $(version_code 2.13.53) ]]; then
7581 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight=$mrif_90c ||
7582 error "set max_mod_rpcs_in_flight to $mrif_90c failed"
7584 local new_mrif=$($LCTL get_param -n \
7585 mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight)
7586 ((new_mrif == mrif_90c + 1)) ||
7587 error "max_rpcs_in_flight was not increased"
7590 umount_client $MOUNT
7591 set_mdt_max_mod_rpcs_in_flight $mmrpc_90c "mds1"
7595 # attempt to set max_mod_rpcs_in_flight to MDT max_mod_rpcs_in_flight+1
7596 # prerequisite: set max_rpcs_in_flight to MDT max_mod_rpcs_in_flight+2
7598 mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight=$((mmrpc_90c + 2))
7601 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight=$((mmrpc_90c + 1)) &&
7602 error "set max_mod_rpcs_in_flight to $((mmrpc_90c + 1)) should fail"
7605 # attempt to set max_mod_rpcs_in_flight permanently
7606 do_facet mgs $LCTL set_param -P \
7607 mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight=$mrif_90c
7609 do_facet mgs $LCTL set_param -P \
7610 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight=$mrif_90c
7612 remount_client $MOUNT
7614 wait_update_facet --verbose client "$LCTL get_param -n \
7615 mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight" \
7616 "$((mrif_90c + 1))" ||
7617 error "expected '$((mrif_90c + 1))' for max_rpcs_in_flight"
7619 wait_update_facet --verbose client "$LCTL get_param -n \
7620 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight" \
7622 error "expected '$mrif_90c' for max_mod_rpcs_in_flight"
7627 run_test 90c "check max_mod_rpcs_in_flight update limits"
7638 [[ $($LCTL get_param mdc.*.import |
7639 grep "connect_flags:.*multi_mod_rpc") ]] ||
7640 skip "Need MDC with 'multi_mod_rpcs' feature"
7642 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
7643 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
7644 facet="mds$((0x$idx + 1))"
7646 # check client version supports multislots
7647 tmp=$($LCTL get_param -N \
7648 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
7649 if [ -z "$tmp" ]; then
7651 skip "Client does not support multiple modify RPCs in flight"
7654 # get current value of max_mod_rcps_in_flight
7655 mmr=$($LCTL get_param -n \
7656 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
7657 echo "max_mod_rcps_in_flight is $mmr"
7660 echo "creating $mmr files ..."
7662 for i in $(seq $mmr); do
7663 touch $DIR/$tdir/file-$i
7666 # prepare for close RPC
7667 multiop_bg_pause $DIR/$tdir/file-close O_c
7670 # consumes mmr modify RPC slots
7671 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
7672 # drop requests on MDT so that RPC slots are consumed
7673 # during all the request resend interval
7674 do_facet $facet "$LCTL set_param fail_loc=0x159"
7675 echo "launch $mmr chmod in parallel ..."
7676 for i in $(seq $mmr); do
7677 chmod 0600 $DIR/$tdir/file-$i &
7680 # send one additional close RPC
7681 do_facet $facet "$LCTL set_param fail_loc=0"
7682 echo "launch 1 additional close in parallel ..."
7684 cancel_lru_locks mdc
7687 # check this additional close RPC get a modify RPC slot
7688 # and multiop process completed
7689 [ -d /proc/$pid ] &&
7690 error "Unable to send the additional close RPC in parallel"
7695 run_test 90d "check one close RPC is allowed above max_mod_rpcs_in_flight"
7697 check_uuid_on_ost() {
7699 do_facet ost1 "$LCTL get_param obdfilter.${FSNAME}*.exports.'$nid'.uuid"
7702 check_uuid_on_mdt() {
7704 do_facet $SINGLEMDS "$LCTL get_param mdt.${mds1_svc}*.exports.'$nid'.uuid"
7712 [[ "$OST1_VERSION" -ge $(version_code 2.7.63) ]] ||
7713 skip "Need OST version at least 2.7.63"
7714 [[ "$MDS1_VERSION" -ge $(version_code 2.7.63) ]] ||
7715 skip "Need MDT version at least 2.7.63"
7717 start_mds || error "MDS start failed"
7718 start_ost || error "unable to start OST"
7719 mount_client $MOUNT || error "client start failed"
7720 check_mount || error "check_mount failed"
7723 nid=$($LCTL list_nids | head -1 | sed "s/\./\\\./g")
7727 uuid=$(get_client_uuid $MOUNT)
7729 echo "list nids on mdt:"
7730 do_facet $SINGLEMDS "$LCTL list_param mdt.${FSNAME}*.exports.*"
7731 echo "uuid from $nid:"
7732 do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.'$nid'.uuid"
7734 found=$(check_uuid_on_mdt $nid | grep $uuid)
7735 [ -z "$found" ] && error "can't find $uuid $nid on MDT"
7736 found=$(check_uuid_on_ost $nid | grep $uuid)
7737 [ -z "$found" ] && error "can't find $uuid $nid on OST"
7739 # umount the client so it won't reconnect
7740 manual_umount_client --force || error "failed to umount $?"
7741 # shouldn't disappear on MDS after forced umount
7742 found=$(check_uuid_on_mdt $nid | grep $uuid)
7743 [ -z "$found" ] && error "can't find $uuid $nid"
7746 do_facet $SINGLEMDS \
7747 "$LCTL set_param -n mdt.${mds1_svc}.evict_client nid:$nid"
7748 sleep 1 # eviction above is async, give it some time to proceed
7750 found=$(check_uuid_on_mdt $nid | grep $uuid)
7751 [ -n "$found" ] && error "found $uuid $nid on MDT"
7752 found=$(check_uuid_on_ost $nid | grep $uuid)
7753 [ -n "$found" ] && error "found $uuid $nid on OST"
7755 # check it didn't reconnect (being umounted)
7756 sleep $((TIMEOUT+1))
7757 found=$(check_uuid_on_mdt $nid | grep $uuid)
7758 [ -n "$found" ] && error "found $uuid $nid on MDT"
7759 found=$(check_uuid_on_ost $nid | grep $uuid)
7760 [ -n "$found" ] && error "found $uuid $nid on OST"
7764 run_test 91 "evict-by-nid support"
7766 generate_ldev_conf() {
7767 # generate an ldev.conf file
7768 local ldevconfpath=$1
7770 local fsldevformat=""
7773 local facets="mgs,$(get_facets OST),$(get_facets MDS)"
7774 for facet in ${facets//,/ }; do
7776 fstype=$(facet_fstype $facet)
7777 [ "$fstype" = zfs ] && fsldevformat="$fstype:"
7778 local host=$(facet_host $facet)
7780 local varfo=${facet}failover_HOST
7781 if [ $facet == mgs ] && combined_mgs_mds; then
7782 varfo=mds1failover_HOST
7784 [ -n "${!varfo}" ] && fo=${!varfo}
7785 local type=$(echo $facet | tr -d "[:digit:]" | \
7786 tr "[:lower:]" "[:upper:]" | sed s/MDS/MDT/ )
7788 [ ${facet} == mgs ] ||
7789 num=$(facet_number $facet)
7790 printf "%s\t%s\t%s-%s%04x\t%s%s\n" \
7797 $(facet_device $facet) >> $ldevconfpath
7800 echo "----- $ldevconfpath -----"
7802 echo "--- END $ldevconfpath ---"
7807 # generate a nids file (mapping between hostname to nid)
7808 # looks like we only have the MGS nid available to us
7809 # so just echo that to a file
7811 echo -e "${mgs_HOST}\t${MGSNID}" > $nidspath
7813 echo "----- $nidspath -----"
7815 echo "--- END $nidspath ---"
7818 compare_ldev_output() {
7819 local ldev_output=$1
7820 local expected_output=$2
7822 sort $expected_output -o $expected_output
7823 sort $ldev_output -o $ldev_output
7825 echo "-- START OF LDEV OUTPUT --"
7827 echo "--- END OF LDEV OUTPUT ---"
7829 echo "-- START OF EXPECTED OUTPUT --"
7830 cat $expected_output
7831 echo "--- END OF EXPECTED OUTPUT ---"
7833 diff $expected_output $ldev_output
7838 if [ -z "$LDEV" ]; then
7839 error "ldev is missing!"
7842 local LDEVCONFPATH=$TMP/ldev.conf
7843 local NIDSPATH=$TMP/nids
7845 echo "Host is $(hostname)"
7847 generate_ldev_conf $LDEVCONFPATH
7848 generate_nids $NIDSPATH
7850 # echo the mgs nid and compare it to environment variable MGSNID
7851 local facets="$(get_facets OST),$(get_facets MDS),mgs"
7852 for facet in ${facets//,/ }; do
7853 local host=$(facet_host $facet)
7854 local output=$($LDEV -c $LDEVCONFPATH -H $host -n $NIDSPATH echo %m)
7856 echo "-- START OF LDEV OUTPUT --"
7858 echo "--- END OF LDEV OUTPUT ---"
7861 error "ldev failed to execute!"
7863 # need to process multiple lines because of
7864 # several targets on host
7865 echo -e $output | awk '{ print $2 }' | while read -r line ; do
7866 [ "$line" = "$MGSNID" ] ||
7867 error "ldev failed mgs nid '$line', \
7871 rm -f $LDEVCONFPATH $NIDSPATH
7873 run_test 92 "ldev returns MGS NID correctly in command substitution"
7876 [ $MDSCOUNT -lt 3 ] && skip "needs >= 3 MDTs"
7879 #start mgs or mgs/mdt0
7880 if ! combined_mgs_mds ; then
7887 start_ost || error "OST0 start fail"
7889 #define OBD_FAIL_MGS_WRITE_TARGET_DELAY 0x90e
7890 do_facet mgs "$LCTL set_param fail_val=10 fail_loc=0x8000090e"
7891 for num in $(seq 2 $MDSCOUNT); do
7895 mount_client $MOUNT || error "mount client fails"
7896 wait_osc_import_state mds ost FULL
7897 wait_osc_import_ready client ost
7898 check_mount || error "check_mount failed"
7900 cleanup || error "cleanup failed with $?"
7902 run_test 93 "register mulitple MDT at the same time"
7905 if [ -z "$LDEV" ]; then
7906 error "ldev is missing!"
7909 local LDEVCONFPATH=$TMP/ldev.conf
7910 local NIDSPATH=$TMP/nids
7912 generate_ldev_conf $LDEVCONFPATH
7913 generate_nids $NIDSPATH
7915 local LDEV_OUTPUT=$TMP/ldev-output.txt
7916 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME > $LDEV_OUTPUT
7918 # ldev failed, error
7919 if [ $? -ne 0 ]; then
7920 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
7921 error "ldev failed to execute!"
7925 local EXPECTED_OUTPUT=$TMP/ldev-expected.txt
7927 printf "%s-MGS0000\n" $FSNAME > $EXPECTED_OUTPUT
7929 for num in $(seq $MDSCOUNT); do
7930 printf "%s-MDT%04x\n" $FSNAME $((num - 1)) >> $EXPECTED_OUTPUT
7933 for num in $(seq $OSTCOUNT); do
7934 printf "%s-OST%04x\n" $FSNAME $((num - 1)) >> $EXPECTED_OUTPUT
7937 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7939 if [ $? -ne 0 ]; then
7940 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7941 error "ldev failed to produce the correct hostlist!"
7944 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7946 run_test 94 "ldev outputs correct labels for file system name query"
7949 if [ -z "$LDEV" ]; then
7950 error "ldev is missing!"
7953 local LDEVCONFPATH=$TMP/ldev.conf
7954 local NIDSPATH=$TMP/nids
7956 generate_ldev_conf $LDEVCONFPATH
7957 generate_nids $NIDSPATH
7961 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME &>/dev/null
7962 if [ $? -ne 0 ]; then
7963 rm $LDEVCONFPATH $NIDSPATH
7964 error "ldev label filtering w/ -F failed!"
7968 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -l &>/dev/null
7969 if [ $? -ne 0 ]; then
7970 rm $LDEVCONFPATH $NIDSPATH
7971 error "ldev label filtering w/ -l failed!"
7975 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -f &>/dev/null
7976 if [ $? -ne 0 ]; then
7977 rm $LDEVCONFPATH $NIDSPATH
7978 error "ldev label filtering w/ -f failed!"
7982 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a &>/dev/null
7983 if [ $? -ne 0 ]; then
7984 rm $LDEVCONFPATH $NIDSPATH
7985 error "ldev label filtering w/ -a failed!"
7990 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -F $FSNAME &>/dev/null
7991 if [ $? -eq 0 ]; then
7992 rm $LDEVCONFPATH $NIDSPATH
7993 error "ldev label filtering w/ -a and -F incorrectly succeeded"
7997 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -f &>/dev/null
7998 if [ $? -eq 0 ]; then
7999 rm $LDEVCONFPATH $NIDSPATH
8000 error "ldev label filtering w/ -a and -f incorrectly succeeded"
8004 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -l &>/dev/null
8005 if [ $? -eq 0 ]; then
8006 rm $LDEVCONFPATH $NIDSPATH
8007 error "ldev label filtering w/ -a and -l incorrectly succeeded"
8011 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -f -l &>/dev/null
8012 if [ $? -eq 0 ]; then
8013 rm $LDEVCONFPATH $NIDSPATH
8014 error "ldev label filtering w/ -f and -l incorrectly succeeded"
8018 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -l &>/dev/null
8019 if [ $? -eq 0 ]; then
8020 rm $LDEVCONFPATH $NIDSPATH
8021 error "ldev label filtering w/ -F and -l incorrectly succeeded"
8024 # file sys & foreign
8025 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -f &>/dev/null
8026 if [ $? -eq 0 ]; then
8027 rm $LDEVCONFPATH $NIDSPATH
8028 error "ldev label filtering w/ -F and -f incorrectly succeeded"
8031 rm $LDEVCONFPATH $NIDSPATH
8033 run_test 95 "ldev should only allow one label filter"
8036 if [ -z "$LDEV" ]; then
8037 error "ldev is missing!"
8040 local LDEVCONFPATH=$TMP/ldev.conf
8041 local NIDSPATH=$TMP/nids
8043 generate_ldev_conf $LDEVCONFPATH
8044 generate_nids $NIDSPATH
8046 local LDEV_OUTPUT=$TMP/ldev-output.txt
8047 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -H $mgs_HOST \
8049 awk '{print $2}' > $LDEV_OUTPUT
8051 # ldev failed, error
8052 if [ $? -ne 0 ]; then
8053 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
8054 error "ldev failed to execute!"
8058 local EXPECTED_OUTPUT=$TMP/ldev-expected-output.txt
8060 echo "$mgs_HOST-$(facet_fstype mgs)" > $EXPECTED_OUTPUT
8062 local facets="$(get_facets OST),$(get_facets MDS)"
8063 for facet in ${facets//,/ }; do
8064 local host=$(facet_host $facet)
8065 [ "$mgs_HOST" == "$host" ] &&
8066 echo "$host-$(facet_fstype $facet)" \
8070 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
8072 if [ $? -ne 0 ]; then
8073 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
8074 error "ldev failed to produce the correct output!"
8077 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
8079 run_test 96 "ldev returns hostname and backend fs correctly in command sub"
8082 if [ -z "$LDEV" ]; then
8083 error "ldev is missing!"
8086 local LDEVCONFPATH=$TMP/ldev.conf
8087 local NIDSPATH=$TMP/nids
8089 generate_ldev_conf $LDEVCONFPATH
8090 generate_nids $NIDSPATH
8092 local LDEV_OUTPUT=$TMP/ldev-output.txt
8093 local EXPECTED_OUTPUT=$TMP/ldev-expected-output.txt
8095 echo -e "\nMDT role"
8096 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R mdt > $LDEV_OUTPUT
8098 if [ $? -ne 0 ]; then
8099 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
8100 error "ldev failed to execute for mdt role!"
8103 for num in $(seq $MDSCOUNT); do
8104 printf "%s-MDT%04x\n" $FSNAME $((num - 1)) >> $EXPECTED_OUTPUT
8107 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
8109 if [ $? -ne 0 ]; then
8110 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
8111 error "ldev failed to produce the correct output for mdt role!"
8114 echo -e "\nOST role"
8115 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R ost > $LDEV_OUTPUT
8117 if [ $? -ne 0 ]; then
8118 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT $EXPECTED_OUTPUT
8119 error "ldev failed to execute for ost role!"
8123 for num in $(seq $OSTCOUNT); do
8124 printf "%s-OST%04x\n" $FSNAME $((num - 1)) >> $EXPECTED_OUTPUT
8127 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
8129 if [ $? -ne 0 ]; then
8130 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
8131 error "ldev failed to produce the correct output for ost role!"
8134 echo -e "\nMGS role"
8135 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R mgs > $LDEV_OUTPUT
8137 if [ $? -ne 0 ]; then
8138 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT $EXPECTED_OUTPUT
8139 error "ldev failed to execute for mgs role!"
8142 printf "%s-MGS0000\n" $FSNAME > $EXPECTED_OUTPUT
8144 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
8146 if [ $? -ne 0 ]; then
8147 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
8148 error "ldev failed to produce the correct output for mgs role!"
8151 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
8153 run_test 97 "ldev returns correct ouput when querying based on role"
8160 check_mount || error "mount failed"
8161 mountopt="user_xattr"
8162 for ((x = 1; x <= PAGE_SIZE/11; x++)); do
8163 mountopt="$mountopt,user_xattr"
8165 mount_client $MOUNT remount,$mountopt 2>&1 | grep "too long" ||
8166 error "Buffer overflow check failed"
8167 cleanup || error "cleanup failed"
8169 run_test 98 "Buffer-overflow check while parsing mount_opts"
8173 [[ "$ost1_FSTYPE" != ldiskfs ]] &&
8174 skip "ldiskfs only test"
8175 [[ "$OST1_VERSION" -ge $(version_code 2.8.57) ]] ||
8176 skip "Need OST version at least 2.8.57"
8178 local ost_opts="$(mkfs_opts ost1 $(ostdevname 1)) \
8179 --reformat $(ostdevname 1) $(ostvdevname 1)"
8180 do_facet ost1 $DEBUGFS -c -R stats `ostdevname 1` | grep "meta_bg" &&
8181 skip "meta_bg already set"
8184 if [[ ${!opts} != *mkfsoptions* ]]; then
8185 eval opts=\"${!opts} \
8186 --mkfsoptions='\\\"-O ^resize_inode,meta_bg\\\"'\"
8188 local val=${!opts//--mkfsoptions=\\\"/ \
8189 --mkfsoptions=\\\"-O ^resize_inode,meta_bg }
8193 echo "params: $opts"
8196 add ost1 $opts || error "add ost1 failed with new params"
8198 do_facet ost1 $DEBUGFS -c -R stats `ostdevname 1` | grep "meta_bg" ||
8199 error "meta_bg is not set"
8201 run_test 99 "Adding meta_bg option"
8206 start_mgsmds || error "MDS start failed"
8207 start_ost || error "unable to start OST"
8208 mount_client $MOUNT || error "client start failed"
8209 check_mount || error "check_mount failed"
8218 do_facet mgs 'lshowmount -v' | awk 'BEGIN {NR == 0; rc=1} /MGS:/ {rc=0}
8219 END {exit rc}' || error "lshowmount have no output MGS"
8221 do_facet mds1 'lshowmount -v' | awk 'BEGIN {NR == 2; rc=1} /-MDT0000:/
8222 {rc=0} END {exit rc}' || error "lshowmount have no output MDT0"
8224 do_facet ost1 'lshowmount -v' | awk 'BEGIN {NR == 4; rc=1} /-OST0000:/
8225 {rc=0} END {exit rc}' || error "lshowmount have no output OST0"
8227 cleanup || error "cleanup failed with $?"
8229 run_test 100 "check lshowmount lists MGS, MDT, OST and 0@lo"
8232 local createmany_pid
8233 local dev=$FSNAME-OST0000-osc-MDT0000
8237 do_nodes $(comma_list $(osts_nodes)) $LCTL set_param \
8238 seq.*OST*-super.width=$DATA_SEQ_MAX_WIDTH
8239 createmany -o $DIR1/$tdir/$tfile-%d 50000 &
8241 # MDT->OST reconnection causes MDT<->OST last_id synchornisation
8242 # via osp_precreate_cleanup_orphans.
8243 for ((i = 0; i < 100; i++)); do
8244 for ((k = 0; k < 10; k++)); do
8245 do_facet $SINGLEMDS "$LCTL --device $dev deactivate;" \
8246 "$LCTL --device $dev activate"
8249 ls -asl $MOUNT | grep '???' &&
8250 { kill -9 $createmany_pid &>/dev/null;
8251 error "File has no object on OST"; }
8253 kill -s 0 $createmany_pid || break
8255 wait $createmany_pid
8257 unlinkmany $DIR1/$tdir/$tfile-%d 50000
8260 run_test 101a "Race MDT->OST reconnection with create"
8263 local dev=$FSNAME-OST0000-osc-MDT0000
8264 local dir=$DIR1/$tdir
8268 $LFS setstripe -c 1 -i 0 $dir
8269 do_facet $SINGLEMDS "$LCTL --device $dev deactivate;"
8270 #define OBD_FAIL_OSP_CON_EVENT_DELAY 0x2107
8271 do_facet mds1 "$LCTL set_param fail_loc=0x80002107 fail_val=20"
8272 do_facet $SINGLEMDS "$LCTL --device $dev activate;"
8277 wait_osc_import_ready client ost1
8278 touch $dir/$tfile || error "Can't create file"
8282 run_test 101b "Race events DISCONNECT and ACTIVE in osp"
8285 [[ "$MDS1_VERSION" -gt $(version_code 2.9.53) ]] ||
8286 skip "Need server version greater than 2.9.53"
8287 [[ "$(mdsdevname 1)" != "$(mgsdevname)" ]] &&
8288 [[ "$(facet_host mds1)" == "$(facet_host mgs)" ]] &&
8289 skip "MGS must be on different node or combined"
8291 cleanup || error "cleanup failed with $?"
8293 local mds1dev=$(mdsdevname 1)
8294 local mds1mnt=$(facet_mntpt mds1)
8295 local mds1opts=$MDS_MOUNT_OPTS
8297 if [ "$mds1_FSTYPE" == ldiskfs ] &&
8298 ! do_facet mds1 test -b $mds1dev; then
8299 mds1opts=$(csa_add "$mds1opts" -o loop)
8301 if [[ "$mds1_FSTYPE" == zfs ]]; then
8302 import_zpool mds1 || return ${PIPESTATUS[0]}
8305 # unload all and only load libcfs to allow fail_loc setting
8306 do_facet mds1 $LUSTRE_RMMOD || error "unable to unload modules"
8307 do_rpc_nodes $(facet_active_host mds1) load_module ../libcfs/libcfs/libcfs
8308 do_facet mds1 lsmod | grep libcfs || error "libcfs not loaded"
8310 #define OBD_FAIL_OBDCLASS_MODULE_LOAD 0x60a
8311 do_facet mds1 "$LCTL set_param fail_loc=0x8000060a"
8313 do_facet mds1 $MOUNT_CMD $mds1dev $mds1mnt $mds1opts &&
8314 error "mdt start must fail" || log "mount failed as expected"
8315 do_facet mds1 lsmod | grep obdclass && error "obdclass must not load" ||
8316 log "obdclass not loaded as expected"
8318 do_facet mds1 "$LCTL set_param fail_loc=0x0"
8320 do_rpc_nodes $(facet_active_host mds1) load_modules
8321 do_facet mds1 $MOUNT_CMD $mds1dev $mds1mnt $mds1opts &&
8322 log "mds1 mounted properly" ||
8323 error "mdt start must not fail"
8325 cleanup || error "cleanup failed with $?"
8327 run_test 102 "obdclass module cleanup upon error"
8332 echo "rename $FSNAME to $newname"
8334 if ! combined_mgs_mds ; then
8335 local dev=$(mgsdevname)
8338 "$TUNEFS --fsname=$newname --rename=$FSNAME -v $dev" ||
8339 error "(7) Fail to rename MGS"
8340 if [ "$(facet_fstype mgs)" = "zfs" ]; then
8341 reimport_zpool mgs $newname-mgs
8345 for num in $(seq $MDSCOUNT); do
8346 local dev=$(mdsdevname $num)
8348 do_facet mds${num} \
8349 "$TUNEFS --fsname=$newname --rename=$FSNAME -v $dev" ||
8350 error "(8) Fail to rename MDT $num"
8351 if [ "$(facet_fstype mds${num})" = "zfs" ]; then
8352 reimport_zpool mds${num} $newname-mdt${num}
8356 for num in $(seq $OSTCOUNT); do
8357 local dev=$(ostdevname $num)
8359 do_facet ost${num} \
8360 "$TUNEFS --fsname=$newname --rename=$FSNAME -v $dev" ||
8361 error "(9) Fail to rename OST $num"
8362 if [ "$(facet_fstype ost${num})" = "zfs" ]; then
8363 reimport_zpool ost${num} $newname-ost${num}
8368 test_103_set_pool() {
8372 do_facet mgs $LCTL pool_add $FSNAME.$pname ${FSNAME}-$ost_x ||
8373 error "Fail to add $ost_x to $FSNAME.$pname"
8374 wait_update $HOSTNAME \
8375 "lctl get_param -n lov.$FSNAME-clilov-*.pools.$pname |
8376 grep $ost_x" "$FSNAME-${ost_x}_UUID" ||
8377 error "$ost_x is NOT in pool $FSNAME.$pname"
8380 test_103_check_pool() {
8381 local save_fsname=$1
8384 stat $DIR/$tdir/test-framework.sh ||
8385 error "($errno) Fail to stat"
8386 do_facet mgs $LCTL pool_list $FSNAME.pool1 ||
8387 error "($errno) Fail to list $FSNAME.pool1"
8388 do_facet mgs $LCTL pool_list $FSNAME.$save_fsname ||
8389 error "($errno) Fail to list $FSNAME.$save_fsname"
8390 do_facet mgs $LCTL pool_list $FSNAME.$save_fsname |
8391 grep ${FSNAME}-OST0000 ||
8392 error "($errno) List $FSNAME.$save_fsname is invalid"
8394 local pname=$($LFS getstripe --pool $DIR/$tdir/d0)
8395 [ "$pname" = "$save_fsname" ] ||
8396 error "($errno) Unexpected pool name $pname"
8400 check_mount_and_prep
8402 mkdir $DIR/$tdir || error "(1) Fail to mkdir $DIR/$tdir"
8403 cp $LUSTRE/tests/test-framework.sh $DIR/$tdir ||
8404 error "(2) Fail to copy test-framework.sh"
8406 do_facet mgs $LCTL pool_new $FSNAME.pool1 ||
8407 error "(3) Fail to create $FSNAME.pool1"
8408 # name the pool name as the fsname
8409 do_facet mgs $LCTL pool_new $FSNAME.$FSNAME ||
8410 error "(4) Fail to create $FSNAME.$FSNAME"
8412 test_103_set_pool $FSNAME OST0000
8414 $LFS setstripe -p $FSNAME $DIR/$tdir/d0 ||
8415 error "(6) Fail to setstripe on $DIR/$tdir/d0"
8420 test_renamefs mylustre
8422 local save_fsname=$FSNAME
8426 test_103_check_pool $save_fsname 7
8428 if [ $OSTCOUNT -ge 2 ]; then
8429 test_103_set_pool $save_fsname OST0001
8432 $LFS setstripe -p $save_fsname $DIR/$tdir/f0 ||
8433 error "(16) Fail to setstripe on $DIR/$tdir/f0"
8442 test_103_check_pool $save_fsname 17
8446 test_renamefs $save_fsname
8452 run_test 103 "rename filesystem name"
8454 test_104a() { # LU-6952
8455 local mds_mountopts=$MDS_MOUNT_OPTS
8456 local ost_mountopts=$OST_MOUNT_OPTS
8457 local mds_mountfsopts=$MDS_MOUNT_FS_OPTS
8458 local lctl_ver=$(do_facet $SINGLEMDS $LCTL --version |
8461 [[ $(version_code $lctl_ver) -lt $(version_code 2.9.55) ]] &&
8462 skip "this test needs utils above 2.9.55"
8464 # specify "acl" in mount options used by mkfs.lustre
8465 if [ -z "$MDS_MOUNT_FS_OPTS" ]; then
8466 MDS_MOUNT_FS_OPTS="acl,user_xattr"
8469 MDS_MOUNT_FS_OPTS="${MDS_MOUNT_FS_OPTS},acl,user_xattr"
8472 echo "mountfsopt: $MDS_MOUNT_FS_OPTS"
8474 #reformat/remount the MDT to apply the MDT_MOUNT_FS_OPT options
8476 if ! combined_mgs_mds ; then
8480 if [ -z "$MDS_MOUNT_OPTS" ]; then
8481 MDS_MOUNT_OPTS="-o noacl"
8483 MDS_MOUNT_OPTS="${MDS_MOUNT_OPTS},noacl"
8486 for num in $(seq $MDSCOUNT); do
8487 start mds$num $(mdsdevname $num) $MDS_MOUNT_OPTS ||
8488 error "Failed to start MDS"
8491 for num in $(seq $OSTCOUNT); do
8492 start ost$num $(ostdevname $num) $OST_MOUNT_OPTS ||
8493 error "Failed to start OST"
8497 setfacl -m "d:$RUNAS_ID:rwx" $MOUNT &&
8498 error "ACL is applied when FS is mounted with noacl."
8500 MDS_MOUNT_OPTS=$mds_mountopts
8501 OST_MOUNT_OPTS=$ost_mountopts
8502 MDS_MOUNT_FS_OPTS=$mds_mountfsopts
8504 run_test 104a "Make sure user defined options are reflected in mount"
8506 test_104b() { # LU-12859
8507 mount_client $MOUNT3 flock,localflock
8508 stack_trap "umount_client $MOUNT3" EXIT
8509 mount | grep "$MOUNT3 .*,flock" && error "flock is still set"
8510 mount | grep "$MOUNT3 .*,localflock" || error "localflock is not set"
8511 umount_client $MOUNT3
8512 mount_client $MOUNT3 localflock,flock
8513 mount | grep "$MOUNT3 .*,localflock" && error "localflock is still set"
8514 mount | grep "$MOUNT3 .*,flock" || error "flock is not set"
8515 umount_client $MOUNT3
8516 mount_client $MOUNT3 localflock,flock,noflock
8517 flock_is_enabled $MOUNT3 && error "some flock is still enabled" || true
8519 run_test 104b "Mount uses last flock argument"
8521 error_and_umount() {
8532 mount --bind $DIR $TMP/$tdir || error "mount bind mnt pt failed"
8533 rm -f $TMP/$tdir/$tfile
8534 rm -f $TMP/$tdir/${tfile}1
8536 # Files should not be created in ro bind mount point
8537 # remounting from rw to ro
8538 mount -o remount,ro $TMP/$tdir ||
8539 error_and_umount "readonly remount of bind mnt pt failed"
8540 touch $TMP/$tdir/$tfile &&
8541 error_and_umount "touch succeeds on ro bind mnt pt"
8542 [ -e $TMP/$tdir/$tfile ] &&
8543 error_and_umount "file created on ro bind mnt pt"
8545 # Files should be created in rw bind mount point
8546 # remounting from ro to rw
8547 mount -o remount,rw $TMP/$tdir ||
8548 error_and_umount "read-write remount of bind mnt pt failed"
8549 touch $TMP/$tdir/${tfile}1 ||
8550 error_and_umount "touch fails on rw bind mnt pt"
8551 [ -e $TMP/$tdir/${tfile}1 ] ||
8552 error_and_umount "file not created on rw bind mnt pt"
8553 umount $TMP/$tdir || error "umount of bind mnt pt failed"
8555 cleanup || error "cleanup failed with $?"
8557 run_test 105 "check file creation for ro and rw bind mnt pt"
8561 local creates=64768 # one full plain llog
8563 # ensure there are enough inodes in the filesystem
8564 (( OSTSIZE < (creates + 1024) * 8)) && OSTSIZE=$(((creates + 1024) * 8))
8568 mkdir -p $DIR/$tdir || error "create $tdir failed"
8569 do_nodes $(comma_list $(osts_nodes)) $LCTL set_param \
8570 seq.*OST*-super.width=$DATA_SEQ_MAX_WIDTH
8571 lfs setstripe -c 1 -i 0 $DIR/$tdir
8572 #define OBD_FAIL_CAT_RECORDS 0x1312
8573 do_facet mds1 $LCTL set_param fail_loc=0x1312 fail_val=$repeat
8575 for ((i = 1; i <= $repeat; i++)); do
8576 createmany -o $DIR/$tdir/f- $creates || lfs df -i
8577 createmany -u $DIR/$tdir/f- $creates
8578 wait_delete_completed $((TIMEOUT * 7))
8580 #ASSERTION osp_sync_thread() ( thread->t_flags != SVC_RUNNING ) failed
8581 #shows that osp code is buggy
8582 do_facet mds1 $LCTL set_param fail_loc=0 fail_val=0
8586 run_test 106 "check osp llog processing when catalog is wrapped"
8589 [[ "$MDS1_VERSION" -ge $(version_code 2.10.50) ]] ||
8590 skip "Need MDS version > 2.10.50"
8593 start_mgsmds || error "start_mgsmds failed"
8594 start_ost || error "unable to start OST"
8596 # add unknown configuration parameter.
8597 if [[ $PERM_CMD == *"set_param -P"* ]]; then
8598 cmd="$PERM_CMD ost.$FSNAME-OST0000*.unknown_param"
8600 cmd="$PERM_CMD $FSNAME-OST0000*.ost.unknown_param"
8602 do_facet mgs "$cmd=50"
8603 cleanup_nocli || error "cleanup_nocli failed with $?"
8606 # unknown param should be ignored while mounting.
8607 start_ost || error "unable to start OST after unknown param set"
8609 cleanup || error "cleanup failed with $?"
8611 run_test 107 "Unknown config param should not fail target mounting"
8616 $rcmd rm -rf $tmp > /dev/null 2>&1
8617 $rcmd mkdir -p $tmp/{mnt,images} || error "failed to mkdir remotely"
8619 for facet in $facets; do
8620 [ "$mds1_FSTYPE" = zfs ] &&
8621 $rcmd $ZPOOL -f export lustre-$facet > /dev/null 2>&1
8622 $rcmd mkdir $tmp/mnt/$facet ||
8623 error "failed to mkdir $tmp/mnt/$facet"
8624 $rcmd dd if=/dev/zero of=$tmp/images/$facet \
8625 seek=199 bs=1M count=1 ||
8626 error "failed to create $tmp/images/$facet"
8635 local facet=${role}$((idx + 1))
8637 [ $# -eq 5 ] && pool=$5
8639 do_facet $SINGLEMDS $MKFS --fsname=lustre --$mgs \
8640 --$role --index=$idx --replace --backfstype=$bkfs \
8641 --device-size=200000 --reformat $pool $tmp/images/$facet ||
8642 error "failed to mkfs for $facet"
8646 echo "mounting client..."
8647 mount -t lustre ${nid}:/lustre $MOUNT ||
8648 error "failed to mount lustre"
8651 ls -l $MOUNT/local_dir || error "failed to list"
8653 echo "check truncate && write"
8654 echo "dummmmmmmmmmmmm" > $MOUNT/remote_dir/fsx.c ||
8655 error "failed to tuncate & write"
8658 touch $MOUNT/foooo ||
8659 error "failed to create"
8661 echo "check read && write && append"
8662 sha1sum $MOUNT/conf-sanity.sh |
8663 awk '{ print $1 }' > $MOUNT/checksum.new ||
8664 error "failed to read(1)"
8665 sha1sum $MOUNT/remote_dir/unlinkmany.c |
8666 awk '{ print $1 }' >> $MOUNT/checksum.new ||
8667 error "failed to read(2)"
8668 sha1sum $MOUNT/striped_dir/lockahead_test.o |
8669 awk '{ print $1 }' >> $MOUNT/checksum.new ||
8670 error "failed to read(3)"
8673 diff $MOUNT/checksum.new $MOUNT/checksum.src ||
8674 error "failed to verify data"
8684 umount -f $MOUNT || error "failed to umount client"
8685 for facet in $facets; do
8686 $rcmd umount -f $tmp/mnt/$facet ||
8687 error "failed to umount $facet"
8688 if [ "$mds1_FSTYPE" = zfs ]; then
8689 $rcmd $ZPOOL export -f lustre-$facet ||
8690 error "failed to export lustre-$facet"
8694 $rcmd rm -rf $tmp || error "failed to rm the dir $tmp"
8698 [ "$CLIENTONLY" ] && skip "Client-only testing"
8699 [ "$mds1_FSTYPE" != zfs ] && skip "zfs only test"
8700 [ "$MDS1_VERSION" -lt $(version_code 2.10.58) ] &&
8701 skip "Need server version at least 2.10.58"
8706 local tmp=$TMP/$tdir
8707 local rcmd="do_facet $SINGLEMDS"
8708 local facets="mdt1 mdt2 ost1 ost2"
8709 local nid=$($rcmd $LCTL list_nids | head -1)
8712 trap t_108_cleanup EXIT ERR
8715 t_108_mkfs mdt 0 zfs mgs lustre-mdt1/mdt1
8716 t_108_mkfs mdt 1 zfs mgsnode=$nid lustre-mdt2/mdt2
8717 t_108_mkfs ost 0 zfs mgsnode=$nid lustre-ost1/ost1
8718 t_108_mkfs ost 1 zfs mgsnode=$nid lustre-ost2/ost2
8720 for facet in $facets; do
8721 $rcmd zfs set mountpoint=$tmp/mnt/$facet canmount=on \
8722 lustre-$facet/$facet ||
8723 error "failed to zfs set for $facet (1)"
8724 $rcmd zfs mount lustre-$facet/$facet ||
8725 error "failed to local mount $facet"
8726 $rcmd tar jxf $LUSTRE/tests/ldiskfs_${facet}_2_11.tar.bz2 \
8727 --xattrs --xattrs-include="trusted.*" \
8728 -C $tmp/mnt/$facet/ > /dev/null 2>&1 ||
8729 error "failed to untar image for $facet"
8730 $rcmd "cd $tmp/mnt/$facet && rm -rf oi.* OI_* lfsck_* LFSCK" ||
8731 error "failed to cleanup for $facet"
8732 $rcmd zfs umount lustre-$facet/$facet ||
8733 error "failed to local umount $facet"
8734 $rcmd zfs set canmount=off lustre-$facet/$facet ||
8735 error "failed to zfs set $facet (2)"
8738 echo "changing server nid..."
8739 $rcmd mount -t lustre -o nosvc lustre-mdt1/mdt1 $tmp/mnt/mdt1
8740 $rcmd lctl replace_nids $FSNAME-MDT0000 $nid
8741 $rcmd lctl replace_nids $FSNAME-MDT0001 $nid
8742 $rcmd lctl replace_nids $FSNAME-OST0000 $nid
8743 $rcmd lctl replace_nids $FSNAME-OST0001 $nid
8744 $rcmd umount $tmp/mnt/mdt1
8746 for facet in $facets; do
8747 echo "mounting $facet from backup..."
8748 $rcmd mount -t lustre -o abort_recov lustre-$facet/$facet \
8749 $tmp/mnt/$facet || error "failed to mount $facet"
8752 # ZFS backend can detect migration and trigger OI scrub automatically
8753 # sleep 3 seconds for scrub done
8759 run_test 108a "migrate from ldiskfs to ZFS"
8762 [ "$CLIENTONLY" ] && skip "Client-only testing"
8763 [ "$mds1_FSTYPE" != ldiskfs ] && skip "ldiskfs only test"
8764 [ "$MDS1_VERSION" -lt $(version_code 2.10.58) ] &&
8765 skip "Need server version at least 2.10.58"
8770 local tmp=$TMP/$tdir
8771 local rcmd="do_facet $SINGLEMDS"
8772 local facets="mdt1 mdt2 ost1 ost2"
8773 local scrub_list="MDT0000 MDT0001 OST0000 OST0001"
8774 local nid=$($rcmd $LCTL list_nids | head -1)
8777 trap t_108_cleanup EXIT ERR
8780 t_108_mkfs mdt 0 ldiskfs mgs
8781 t_108_mkfs mdt 1 ldiskfs mgsnode=$nid
8782 t_108_mkfs ost 0 ldiskfs mgsnode=$nid
8783 t_108_mkfs ost 1 ldiskfs mgsnode=$nid
8785 for facet in $facets; do
8786 $rcmd mount -t ldiskfs -o loop $tmp/images/$facet \
8788 error "failed to local mount $facet"
8790 $rcmd tar jxf $LUSTRE/tests/zfs_${facet}_2_11.tar.bz2 \
8791 --xattrs --xattrs-include="*.*" \
8792 -C $tmp/mnt/$facet/ > /dev/null 2>&1 ||
8793 error "failed to untar image for $facet"
8794 $rcmd "cd $tmp/mnt/$facet && rm -rf oi.* OI_* lfsck_* LFSCK" ||
8795 error "failed to cleanup for $facet"
8796 $rcmd umount $tmp/mnt/$facet ||
8797 error "failed to local umount $facet"
8800 echo "changing server nid..."
8801 $rcmd mount -t lustre -o nosvc,loop $tmp/images/mdt1 $tmp/mnt/mdt1
8802 $rcmd lctl replace_nids $FSNAME-MDT0000 $nid
8803 $rcmd lctl replace_nids $FSNAME-MDT0001 $nid
8804 $rcmd lctl replace_nids $FSNAME-OST0000 $nid
8805 $rcmd lctl replace_nids $FSNAME-OST0001 $nid
8806 $rcmd umount $tmp/mnt/mdt1
8808 for facet in $facets; do
8809 echo "mounting $facet from backup..."
8810 $rcmd mount -t lustre -o loop,abort_recov $tmp/images/$facet \
8811 $tmp/mnt/$facet || error "failed to mount $facet"
8814 for facet in $scrub_list; do
8815 $rcmd $LCTL lfsck_start -M $FSNAME-$facet -t scrub ||
8816 error "failed to start OI scrub on $facet"
8819 # sleep 3 seconds for scrub done
8825 run_test 108b "migrate from ZFS to ldiskfs"
8828 # set number of permanent parameters
8830 test_109_set_params() {
8833 set_persistent_param_and_check mds \
8834 "mdd.$fsname-MDT0000.atime_diff" \
8835 "$fsname-MDT0000.mdd.atime_diff" \
8837 set_persistent_param_and_check mds \
8838 "mdd.$fsname-MDT0000.atime_diff" \
8839 "$fsname-MDT0000.mdd.atime_diff" \
8841 set_persistent_param_and_check client \
8842 "llite.$fsname*.max_read_ahead_mb" \
8843 "$fsname.llite.max_read_ahead_mb" \
8845 set_persistent_param_and_check client \
8846 "llite.$fsname*.max_read_ahead_mb" \
8847 "$fsname.llite.max_read_ahead_mb" \
8849 create_pool $fsname.pool1 || error "create pool failed"
8850 do_facet mgs $LCTL pool_add $fsname.pool1 OST0000 ||
8851 error "pool_add failed"
8852 do_facet mgs $LCTL pool_remove $fsname.pool1 OST0000 ||
8853 error "pool_remove failed"
8854 do_facet mgs $LCTL pool_add $fsname.pool1 OST0000 ||
8855 error "pool_add failed"
8859 # check permanent parameters
8861 test_109_test_params() {
8864 local atime_diff=$(do_facet mds $LCTL \
8865 get_param -n mdd.$fsname-MDT0000.atime_diff)
8866 [ $atime_diff == 63 ] || error "wrong mdd parameter after clear_conf"
8867 local max_read_ahead_mb=$(do_facet client $LCTL \
8868 get_param -n llite.$fsname*.max_read_ahead_mb)
8869 [ $max_read_ahead_mb == 64 ] ||
8870 error "wrong llite parameter after clear_conf"
8871 local ost_in_pool=$(do_facet mds $LCTL pool_list $fsname.pool1 |
8872 grep -v "^Pool:" | sed 's/_UUID//')
8873 [ $ost_in_pool = "$fsname-OST0000" ] ||
8874 error "wrong pool after clear_conf"
8878 # run lctl clear_conf, store CONFIGS before and after that
8880 test_109_clear_conf()
8882 local clear_conf_arg=$1
8885 if ! combined_mgs_mds ; then
8886 mgsdev=$(mgsdevname)
8887 stop_mgs || error "stop_mgs failed"
8888 start_mgs "-o nosvc" || error "start_mgs nosvc failed"
8890 mgsdev=$(mdsdevname 1)
8891 start_mdt 1 "-o nosvc" || error "start_mdt 1 nosvc failed"
8894 do_facet mgs "rm -rf $TMP/${tdir}/conf1; mkdir -p $TMP/${tdir}/conf1;" \
8895 "$DEBUGFS -c -R \\\"rdump CONFIGS $TMP/${tdir}/conf1\\\" \
8899 # the command being tested
8901 do_facet mgs $LCTL clear_conf $clear_conf_arg ||
8902 error "clear_conf failed"
8903 if ! combined_mgs_mds ; then
8904 stop_mgs || error "stop_mgs failed"
8906 stop_mdt 1 || error "stop_mdt 1 failed"
8909 do_facet mgs "rm -rf $TMP/${tdir}/conf2; mkdir -p $TMP/${tdir}/conf2;" \
8910 "$DEBUGFS -c -R \\\"rdump CONFIGS $TMP/${tdir}/conf2\\\" \
8914 test_109_file_shortened() {
8916 local sizes=($(do_facet mgs "stat -c %s " \
8917 "$TMP/${tdir}/conf1/CONFIGS/$file" \
8918 "$TMP/${tdir}/conf2/CONFIGS/$file"))
8919 [ ${sizes[1]} -lt ${sizes[0]} ] && return 0
8925 [ $MDS1_VERSION -lt $(version_code 2.10.59) ] &&
8926 skip "Needs MDS version 2.10.59 or later."
8927 [ "$(facet_fstype mgs)" == zfs ] &&
8928 skip "LU-8727: no implementation for ZFS"
8933 client_up || error "client_up failed"
8936 # set number of permanent parameters
8938 test_109_set_params $FSNAME
8940 umount_client $MOUNT || error "umount_client failed"
8941 stop_ost || error "stop_ost failed"
8942 stop_mds || error "stop_mds failed"
8944 test_109_clear_conf $FSNAME
8946 # make sure that all configs are cleared
8948 test_109_file_shortened $FSNAME-MDT0000 ||
8949 error "failed to clear MDT0000 config"
8950 test_109_file_shortened $FSNAME-client ||
8951 error "failed to clear client config"
8956 # check that configurations are intact
8958 test_109_test_params $FSNAME
8963 destroy_test_pools || error "destroy test pools failed"
8967 run_test 109a "test lctl clear_conf fsname"
8971 [ $MDS1_VERSION -lt $(version_code 2.10.59) ] &&
8972 skip "Needs MDS version 2.10.59 or later."
8973 [ "$(facet_fstype mgs)" == zfs ] &&
8974 skip "LU-8727: no implementation for ZFS"
8979 client_up || error "client_up failed"
8982 # set number of permanent parameters
8984 test_109_set_params $FSNAME
8986 umount_client $MOUNT || error "umount_client failed"
8987 stop_ost || error "stop_ost failed"
8988 stop_mds || error "stop_mds failed"
8990 test_109_clear_conf $FSNAME-MDT0000
8992 # make sure that only one config is cleared
8994 test_109_file_shortened $FSNAME-MDT0000 ||
8995 error "failed to clear MDT0000 config"
8996 test_109_file_shortened $FSNAME-client &&
8997 error "failed to clear client config"
9001 # check that configurations are intact
9003 test_109_test_params $FSNAME
9008 destroy_test_pools || error "destroy test pools failed"
9012 run_test 109b "test lctl clear_conf one config"
9016 [[ "$mds1_FSTYPE" != ldiskfs ]] &&
9017 skip "Only applicable to ldiskfs-based MDTs"
9019 do_facet $SINGLEMDS $DEBUGFS -w -R supported_features |grep large_dir ||
9020 skip "large_dir option is not supported on MDS"
9021 do_facet ost1 $DEBUGFS -w -R supported_features | grep large_dir ||
9022 skip "large_dir option is not supported on OSS"
9024 stopall # stop all targets before modifying the target counts
9025 local old_mdscount=$MDSCOUNT
9026 local old_ostcount=$OSTCOUNT
9028 stack_trap "MDSCOUNT=$old_mdscount OSTCOUNT=$old_ostcount; reformat"
9032 # ext4_dir_entry_2 struct size:264
9033 # dx_root struct size:8
9034 # dx_node struct size:8
9035 # dx_entry struct size:8
9036 # For 1024 bytes block size.
9037 # First level directory entries: 126
9038 # Second level directory entries: 127
9039 # Entries in leaf: 3
9040 # For 2 levels limit: 48006
9041 # For 3 levels limit : 6096762
9042 # Create 80000 files to safely exceed 2-level htree limit.
9043 CONF_SANITY_110_LINKS=${CONF_SANITY_110_LINKS:-80000}
9045 # can fit at most 3 filenames per 1KB leaf block, but each
9046 # leaf/index block will only be 3/4 full before split at each level
9047 (( MDSSIZE < CONF_SANITY_110_LINKS / 3 * 4/3 * 4/3 )) &&
9048 CONF_SANITY_110_LINKS=$((MDSSIZE * 3 * 3/4 * 3/4))
9050 combined_mgs_mds || replace=" --replace "
9051 local opts="$(mkfs_opts mds1 $(mdsdevname 1)) \
9052 $replace --reformat $(mdsdevname 1) $(mdsvdevname 1)"
9053 if [[ $opts != *large_dir* ]]; then
9054 if [[ $opts != *mkfsoptions* ]]; then
9055 opts+=" --mkfsoptions=\\\"-O large_dir -b 1024 -i 65536\\\""
9057 opts="${opts//--mkfsoptions=\\\"/ \
9058 --mkfsoptions=\\\"-O large_dir -b 1024 -i 65536 }"
9061 echo "MDT params: $opts"
9063 combined_mgs_mds || start_mgs
9064 add mds1 $opts || error "add mds1 failed with new params"
9065 start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS
9067 opts="$(mkfs_opts ost1 $(ostdevname 1)) \
9068 $replace --reformat $(ostdevname 1) $(ostvdevname 1)"
9070 if [[ $opts != *large_dir* ]]; then
9071 if [[ $opts != *mkfsoptions* ]]; then
9072 opts+=" --mkfsoptions=\\\"-O large_dir\\\" "
9074 opts="${opts//--mkfsoptions=\\\"/ \
9075 --mkfsoptions=\\\"-O large_dir }"
9078 echo "OST params: $opts"
9079 add ost1 $opts || error "add ost1 failed with new params"
9080 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS
9082 MOUNT_2=yes mountcli || error "mount clients failed"
9084 mkdir -v $DIR/$tdir || error "cannot create $DIR/$tdir"
9085 local pids count=0 group=0
9087 echo "creating $CONF_SANITY_110_LINKS in total"
9088 while (( count < CONF_SANITY_110_LINKS )); do
9089 local len=$((253 - $(wc -c <<<"$tfile-$group-40000-")))
9090 local dir=DIR$((group % 2 + 1))
9091 local target=${!dir}/$tdir/$tfile-$group
9092 local long=$target-$(generate_name $len)-
9093 local create=$((CONF_SANITY_110_LINKS - count))
9095 (( create > 40000 )) && create=40000
9096 touch $target || error "creating $target failed"
9097 echo "creating $create hard links to $target"
9098 createmany -l $target $long $create &
9101 count=$((count + create))
9102 group=$((group + 1))
9104 echo "waiting for PIDs$pids to complete"
9105 wait $pids || error "createmany failed after $group groups"
9107 umount_client $MOUNT2 -f
9110 run_e2fsck $(facet_active_host mds1) $(mdsdevname 1) -n
9111 MDSCOUNT=$old_mdscount
9112 OSTCOUNT=$old_ostcount
9114 run_test 110 "Adding large_dir with 3-level htree"
9117 [[ "$mds1_FSTYPE" != ldiskfs ]] &&
9118 skip "Only applicable to ldiskfs-based MDTs"
9120 is_dm_flakey_dev $SINGLEMDS $(mdsdevname 1) &&
9121 skip "This test can not be executed on flakey dev"
9123 do_facet $SINGLEMDS $DEBUGFS -w -R supported_features |grep large_dir ||
9124 skip "large_dir option is not supported on MDS"
9126 do_facet ost1 $DEBUGFS -w -R supported_features | grep large_dir ||
9127 skip "large_dir option is not supported on OSS"
9129 # cleanup before changing target counts
9131 local old_mdscount=$MDSCOUNT
9132 local old_ostcount=$OSTCOUNT
9133 local old_mdssize=$MDSSIZE
9135 stack_trap "MDSSIZE=$old_mdssize MDSCOUNT=$old_mdscount \
9136 OSTCOUNT=$old_ostcount; reformat"
9139 (( MDSSIZE < 2400000 )) && MDSSIZE=2400000 # need at least 2.4GB
9141 local mdsdev=$(mdsdevname 1)
9142 combined_mgs_mds || replace=" --replace "
9143 local opts="$(mkfs_opts mds1 $(mdsdevname 1)) \
9144 $replace --reformat $(mdsdevname 1) $(mdsvdevname 1)"
9145 if [[ $opts != *large_dir* ]]; then
9146 if [[ $opts != *mkfsoptions* ]]; then
9147 opts+=" --mkfsoptions=\\\"-O large_dir -i 1048576 \\\" "
9149 opts="${opts//--mkfsoptions=\\\"/ \
9150 --mkfsoptions=\\\"-O large_dir -i 1048576 }"
9153 echo "MDT params: $opts"
9155 combined_mgs_mds || start_mgs
9156 __touch_device mds 1
9157 add mds1 $opts || error "add mds1 failed with new params"
9158 start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS
9160 opts="$(mkfs_opts ost1 $(ostdevname 1)) \
9161 $replace --reformat $(ostdevname 1) $(ostvdevname 1)"
9162 if [[ $opts != *large_dir* ]]; then
9163 if [[ $opts != *mkfsoptions* ]]; then
9164 opts+=" --mkfsoptions=\\\"-O large_dir \\\""
9166 opts="${opts//--mkfsoptions=\\\"/ --mkfsoptions=\\\"-O large_dir }"
9169 echo "OST params: $opts"
9170 __touch_device ost 1
9171 add ost1 $opts || error "add ost1 failed with new params"
9172 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS
9174 MOUNT_2=yes mountcli
9175 mkdir $DIR/$tdir || error "cannot create $DIR/$tdir"
9177 lfs df -i $DIR/$tdir
9181 local start=$SECONDS
9183 local dirmax=$((2 << 30))
9189 while (( !needskip & dirsize < dirmax )); do
9192 for cli in ${CLIENTS//,/ }; do
9193 local len=$((253 - $(wc -c <<<"$cli-$group-60000-")))
9194 local target=$cli-$group
9195 local long=$DIR/$tdir/$target-$(generate_name $len)-
9197 RPWD=$DIR/$tdir do_node $cli touch $target ||
9198 error "creating $target failed"
9199 echo "creating 60000 hardlinks to $target"
9200 RPWD=$DIR/$tdir do_node $cli createmany -l $target $long 60000 &
9203 group=$((group + 1))
9205 long=$DIR2/$tdir/$target-$(generate_name $len)-
9207 RPWD=$DIR2/$tdir do_node $cli touch $target ||
9208 error "creating $target failed"
9209 echo "creating 60000 hardlinks to $target"
9210 RPWD=$DIR2/$tdir do_node $cli createmany -l $target $long 60000 &
9213 group=$((group + 1))
9215 echo "waiting for PIDs$pids to complete"
9216 wait $pids || error "createmany failed after $group groups"
9217 dirsize=$(stat -c %s $DIR/$tdir)
9218 taken=$((SECONDS - start))
9219 rate=$((dirsize / taken))
9220 left=$(((dirmax - dirsize) / rate))
9221 num=$((group * 60000))
9222 echo "estimate ${left}s left after $num files / ${taken}s"
9223 # if the estimated time remaining is too large (it may change
9224 # over time as the create rate is not constant) then exit
9225 # without declaring a failure.
9226 (( left > 1200 )) && needskip=1
9229 umount_client $MOUNT2 -f
9232 ! (( $needskip )) ||
9233 echo "ETA ${left}s after $num files / ${taken}s is too long"
9235 run_e2fsck $(facet_active_host mds1) $(mdsdevname 1) -n
9236 MDSCOUNT=$old_mdscount
9237 OSTCOUNT=$old_ostcount
9238 MDSSIZE=$old_mdssize
9240 run_test 111 "Adding large_dir with over 2GB directory"
9243 local param="no_create"
9245 (( $OST1_VERSION > $(version_code 2.14.0) )) ||
9246 skip "need OSS at least 2.14.0"
9247 (( $OST1_VERSION >= $(version_code 2.15.56.125) )) ||
9248 param="no_precreate"
9250 start_mds || error "MDS start failed"
9251 start_ost || error "OSS start failed"
9252 echo "start ost2 service on $(facet_active_host ost2)"
9253 start ost2 $(ostdevname 2) $(csa_add "$OST_MOUNT_OPTS" -o $param) ||
9254 error "start ost2 facet failed"
9255 local val=$(do_facet ost2 \
9256 "$LCTL get_param -n obdfilter.$FSNAME-OST0001*.$param")
9257 (( $val == 1 )) || error "obdfilter.$FSNAME-OST0001*.$param=$val"
9259 mount_client $MOUNT || error "mount client failed"
9260 wait_osc_import_state mds1 ost1 FULL
9261 wait_osc_import_ready client ost1
9262 wait_osc_import_ready client ost2
9264 $LFS setstripe -i 0 $DIR/$tfile.0 ||
9265 error "problem creating $tfile.0 on OST0000"
9266 $LFS setstripe -i 1 $DIR/$tfile.1 && $LFS getstripe $DIR/$tfile.1 &&
9267 (( $($LFS getstripe -i $DIR/$tfile.1) == 1 )) &&
9268 error "allowed to create $tfile.1 on OST0001"
9270 $LFS df -v $MOUNT | grep -q "OST:1.*N" ||
9271 error "NOCREATE not in 'lfs df'"
9273 do_facet ost2 $LCTL set_param obdfilter.$FSNAME-OST0001*.$param=0
9275 $LFS setstripe -i 1 $DIR/$tfile.2 ||
9276 error "failed to create $tfile.2 on ost1 facet"
9277 # files not cleaned with ONLY_REPEAT because of client unmount below
9278 rm -f $DIR/$tfile.[012]
9279 stop_ost2 || error "stop ost2 facet failed"
9282 run_test 112a "mount OST with no_create option"
9285 (( MDSCOUNT >= 2 )) || skip "need at least 2 MDTs"
9286 (( $MDS1_VERSION >= $(version_code 2.15.56.125) )) ||
9287 skip "need MDS >= 2.15.56.125"
9288 local mdsnum=$MDSCOUNT
9289 local facet=mds$mdsnum
9290 local mdtidx=$((mdsnum - 1))
9291 local mdtname=$FSNAME-MDT$(printf %04x $mdtidx)
9293 start_mds --mdscount $((mdsnum - 1)) || error "MDS start failed"
9294 start_mdt $mdsnum -o no_create || error "start $facet failed"
9295 local val=$(do_facet $facet \
9296 "$LCTL get_param -n mdt.$mdtname*.no_create")
9297 (( $val == 1 )) || error "mdt.$mdtname*.no_create=$val"
9298 start_ost || error "ost1 start failed"
9299 start_ost2 || error "ost1 start failed"
9301 mount_client $MOUNT || error "mount client failed"
9302 wait_osc_import_ready $facet ost2
9305 $LFS df -v $MOUNT | grep -q "MDT:$mdtidx.*N" ||
9306 error "NOCREATE not in 'lfs df'"
9308 $LFS mkdir -i $mdtidx $DIR/$tdir ||
9309 $LFS setdirstripe -D -c 1 -i -1 --max-inherit-rr 2 $DIR/$tdir ||
9310 error "error creating $tdir on $mdtname"
9311 stack_trap "rm -rf $DIR/$tdir"
9313 mkdir $DIR/$tdir/d1.{1..100} || error "mkdir $tdir/d1.{1..100} failed"
9314 $LFS getdirstripe -i $DIR/$tdir/d1.* | sort | uniq -c
9315 do_facet $facet $LCTL set_param mdt.$mdtname*.no_create=0
9316 # allow one initial create for delayed statfs on client
9317 (( $($LFS getdirstripe -i $DIR/$tdir/d1.* | grep -c $mdtidx) < 2 )) ||
9318 error "allowed create on $mdtname"
9321 mkdir $DIR/$tdir/d2.{1..100} || error "mkdir $tdir/d2.{1..100} failed"
9322 $LFS getdirstripe -i $DIR/$tdir/d2.{1..100} | sort | uniq -c
9323 (( $($LFS getdirstripe -i $DIR/$tdir/d2.* | grep -c $mdtidx) > 10 )) ||
9324 error "no create on $mdtname"
9325 # files not cleaned with ONLY_REPEAT because of client unmount below
9327 stop_ost2 || error "ost1 start failed"
9330 run_test 112b "mount MDT with no_create option"
9333 SAVE_MGS_MOUNT_OPTS=$MGS_MOUNT_OPTS
9334 SAVE_MDS_MOUNT_OPTS=$MDS_MOUNT_OPTS
9335 SAVE_OST_MOUNT_OPTS=$OST_MOUNT_OPTS
9341 MGS_MOUNT_OPTS=$SAVE_MGS_MOUNT_OPTS
9342 MDS_MOUNT_OPTS=$SAVE_MDS_MOUNT_OPTS
9343 OST_MOUNT_OPTS=$SAVE_OST_MOUNT_OPTS
9344 # Revert old mount options back
9346 # Subsequent following test requires
9347 # conf-sanity to be in stopall state.
9348 # Force 'stopall' so others following
9353 # Error out with mount info
9355 local server_nodes=$(comma_list $(mdts_nodes) $(osts_nodes))
9358 echo "--Client Mount Info--"
9359 mount | grep -i lustre
9360 echo "--Server Mount Info--"
9361 do_nodes $server_nodes mount | grep -i lustre
9367 local ost_version="2.15.51" # Minimum version required
9369 (( OST1_VERSION >= $(version_code $ost_version) )) ||
9370 skip "Need server version at least $ost_version"
9372 stack_trap cleanup_113 EXIT
9374 # Reset before starting
9378 # Verify MDS's should start with "rw"
9379 do_facet $SINGLEMDS mount | grep "lustre.*rw,.*MDT" ||
9380 error_113 "$SINGLEMDS should be read-write"
9382 # Verify OST's should start with "rw"
9383 for (( i=1; i <= OSTCOUNT; i++ )); do
9384 do_facet ost$i mount | grep "lustre.*rw,.*OST" ||
9385 error_113 "ost$i should be read-write"
9388 # rdonly_dev does not currently work for ldiskfs
9389 # We skip the rdonly_dev check until then.
9390 if [[ $ost1_FSTYPE == ldiskfs ]]; then
9391 echo "Shadow Mountpoint correctly reports rw for ldiskfs"
9396 # Only ZFS specific tests below.
9399 # Must stop all (server+client) and restart to verify new
9403 # add rdonly_dev to mount option
9404 MGS_MOUNT_OPTS=$(csa_add "$MGS_MOUNT_OPTS" -o rdonly_dev)
9405 MDS_MOUNT_OPTS=$(csa_add "$MDS_MOUNT_OPTS" -o rdonly_dev)
9406 OST_MOUNT_OPTS=$(csa_add "$OST_MOUNT_OPTS" -o rdonly_dev)
9408 # Only restart server(mds/ost). Sufficient for test
9409 setupall server_only || error "Fail to start servers"
9411 # Verify MDS's should be "ro"
9412 do_facet $SINGLEMDS mount | grep "lustre.*ro,.*MDT.*rdonly_dev" ||
9413 error_113 "$SINGLEMDS should be read-only"
9415 # Verify OST's should be "ro"
9416 for (( i=1; i <= OSTCOUNT; i++ )); do
9417 do_facet ost$i mount | grep "lustre.*ro,.*OST.*rdonly_dev" ||
9418 error_113 "ost$i should be read-only"
9421 run_test 113 "Shadow mountpoint correctly report ro/rw for mounts"
9424 # Purpose: To verify dynamic thread (OSS) creation.
9425 # (This was sanity/115)
9428 [ $PARALLEL == "yes" ] && skip "skip parallel run"
9429 remote_ost_nodsh && skip "remote OST with nodsh"
9431 # Lustre does not stop service threads once they are started.
9432 # Reset number of running threads to default.
9437 local save_params="$TMP/sanity-$TESTNAME.parameters"
9439 # Get ll_ost_io count before I/O
9440 OSTIO_pre=$(do_facet ost1 \
9441 "$LCTL get_param ost.OSS.ost_io.threads_started | cut -d= -f2")
9442 # Exit if lustre is not running (ll_ost_io not running).
9443 [ -z "$OSTIO_pre" ] && error "no OSS threads"
9445 echo "Starting with $OSTIO_pre threads"
9446 local thread_max=$((OSTIO_pre * 2))
9447 local rpc_in_flight=$((thread_max * 2))
9449 # this is limited to OSC_MAX_RIF_MAX (256)
9450 [ $rpc_in_flight -gt 256 ] && rpc_in_flight=256
9451 thread_max=$((rpc_in_flight / 2))
9452 [ $thread_max -le $OSTIO_pre ] && skip "Too many ost_io threads" &&
9455 # Number of I/O Process proposed to be started.
9457 local facets=$(get_facets OST)
9459 save_lustre_params client "osc.*OST*.max_rpcs_in_flight" > $save_params
9460 save_lustre_params $facets "ost.OSS.ost_io.threads_max" >> $save_params
9462 # Set in_flight to $rpc_in_flight
9463 $LCTL set_param osc.*OST*.max_rpcs_in_flight=$rpc_in_flight ||
9464 error "Failed to set max_rpcs_in_flight to $rpc_in_flight"
9465 nfiles=${rpc_in_flight}
9466 # Set ost thread_max to $thread_max
9467 do_facet ost1 "$LCTL set_param ost.OSS.ost_io.threads_max=$thread_max"
9469 # 5 Minutes should be sufficient for max number of OSS
9470 # threads(thread_max) to be created.
9474 local wtl=${WTL:-"$LUSTRE/tests/write_time_limit"}
9476 test_mkdir $DIR/$tdir
9477 for ((i = 1; i <= nfiles; i++)); do
9478 local file=$DIR/$tdir/${tfile}-$i
9480 $LFS setstripe -c -1 -i 0 $file
9481 ($wtl $file $timeout)&
9484 # I/O Started - Wait for thread_started to reach thread_max or report
9485 # error if thread_started is more than thread_max.
9486 echo "Waiting for thread_started to reach thread_max"
9487 local thread_started=0
9488 local end_time=$((SECONDS + timeout))
9490 while [ $SECONDS -le $end_time ] ; do
9492 # Get ost i/o thread_started count.
9493 thread_started=$(do_facet ost1 \
9495 ost.OSS.ost_io.threads_started | cut -d= -f2")
9496 # Break out if thread_started is equal/greater than thread_max
9497 if (( $thread_started >= $thread_max )); then
9498 echo ll_ost_io thread_started $thread_started, \
9499 equal/greater than thread_max $thread_max
9505 # Cleanup - We have the numbers, Kill i/o jobs if running.
9506 jobcount=($(jobs -p))
9508 for ((i=0; i < ${#jobcount[*]}; i++)); do
9509 kill -9 ${jobcount[$i]}
9510 if [ $? -ne 0 ] ; then
9511 echo "warning: cannot kill WTL pid ${jobcount[$i]}"
9515 # Cleanup files left by WTL binary.
9516 for ((i = 1; i <= nfiles; i++)); do
9517 local file=$DIR/$tdir/${tfile}-$i
9520 if [ $? -ne 0 ] ; then
9521 echo "Warning: Failed to delete file $file"
9525 restore_lustre_params <$save_params
9526 rm -f $save_params || echo "Warning: delete file '$save_params' failed"
9528 # Error out if no new thread has started or Thread started is greater
9530 if (( $thread_started <= $OSTIO_pre ||
9531 $thread_started > $thread_max )); then
9532 error "ll_ost_io: thread_started $thread_started" \
9533 "OSTIO_pre $OSTIO_pre, thread_max $thread_max." \
9534 "No new thread started or thread started greater " \
9538 run_test 114 "verify dynamic thread creation===================="
9544 do_facet mds1 rm -f $1
9548 if [ "$mds1_FSTYPE" != ldiskfs ]; then
9549 skip "Only applicable to ldiskfs-based MDTs"
9551 [ -n "$FILESET" ] && skip "Not functional for FILESET set"
9553 local dbfs_ver=$(do_facet mds1 $DEBUGFS -V 2>&1)
9555 echo "debugfs version: $dbfs_ver"
9556 echo "$dbfs_ver" | egrep -w "1.44.3.wc1|1.44.5.wc1|1.45.2.wc1" &&
9557 skip_env "This version of debugfs doesn't show inode number"
9559 local IMAGESIZE=$((3072 << 30)) # 3072 GiB
9569 do_facet mds1 "hostname; $LCTL dl; mount"
9571 do_facet ost1 "hostname; $LCTL dl; mount"
9572 # We need MDT size 3072GB, because it is smallest
9573 # partition that can store 2B inodes
9574 do_facet mds1 "mkdir -p $TMP/$tdir"
9575 local mdsimgname=$TMP/$tdir/lustre-mdt
9577 do_facet mds1 "rm -f $mdsimgname"
9578 do_facet mds1 "touch $mdsimgname"
9579 stack_trap "cleanup_115 $mdsimgname" EXIT
9580 do_facet mds1 "$TRUNCATE $mdsimgname $IMAGESIZE" ||
9581 skip "Backend FS doesn't support sparse files"
9582 local mdsdev=$(do_facet mds1 "losetup -f")
9584 do_facet mds1 "losetup $mdsdev $mdsimgname"
9586 local mds_opts="$(mkfs_opts mds1 $(mdsdevname 1)) \
9587 --mkfsoptions='-O ea_inode,^resize_inode,meta_bg \
9588 -N 2247484000 -E lazy_itable_init' --device-size=$IMAGESIZE"
9589 add mds1 $mds_opts --mgs --reformat $mdsdev || {
9590 do_facet $SINGLEMDS \
9591 "losetup -d $mdsdev && rm -f $mdsimgname"
9592 skip_env "format large MDT failed"
9595 local ostdev=$(ostdevname 1)
9597 local opts="$(mkfs_opts ost1 $ostdev) \
9598 --reformat $ostdev $ostdev"
9599 add ost1 $opts || error "add ost1 failed with new params"
9600 start mds1 $mdsdev $MDS_MOUNT_OPTS || error "start MDS failed"
9601 start_ost || error "start OSS failed"
9602 mount_client $MOUNT || error "mount client failed"
9604 mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir fail"
9605 local goal="/sys/fs/ldiskfs/$(basename $mdsdev)/inode_goal"
9607 # 2147483648 is 0x80000000
9608 do_facet mds1 "echo 2147483648 >> $goal; grep . $goal"
9609 touch $DIR/$tdir/$tfile
9611 # attrs from 1 to 16 go to block, 17th - to inode
9614 for i in {1..17}; do
9615 local nm="trusted.ea$i"
9616 setfattr -n $nm -v $(printf "xattr%0250d" $i) $DIR/$tdir/$tfile
9619 do_facet mds1 "$DEBUGFS -c -R 'stat ROOT/$tdir/$tfile' $mdsdev"
9621 # inode <2147483649> trusted.ea16 (255)
9622 local inode_num=$(do_facet mds1 \
9623 "$DEBUGFS -c -R 'stat ROOT/$tdir/$tfile' $mdsdev" |
9624 awk '/ea17/ { print $2 }' |
9625 sed -e 's/>//' -e 's/<//' -e 's/\"//')
9626 echo "inode num: $inode_num"
9627 [ $inode_num -ge 2147483648 ] || error "inode $inode_num too small"
9628 do_facet mds1 "losetup -d $mdsdev"
9630 run_test 115 "Access large xattr with inodes number over 2TB"
9633 [ "$mds1_FSTYPE" != ldiskfs ] && skip "ldiskfs only test"
9634 [ "$MDS1_VERSION" -lt $(version_code 2.10.59) ] &&
9635 skip "Need server version at least 2.10.59"
9636 do_facet $SINGLEMDS which mkfs.xfs ||
9637 skip_env "No mkfs.xfs installed"
9642 local tmpmnt=$TMP/$tdir
9643 local mdtimg=$tfile-mdt0
9645 do_facet $SINGLEMDS mkdir -p $tmpmnt
9646 stack_trap "do_facet $SINGLEMDS rmdir $tmpmnt" EXIT
9648 do_facet $SINGLEMDS touch $TMP/$mdtimg
9649 stack_trap "do_facet $SINGLEMDS rm -f $TMP/$mdtimg" EXIT
9650 do_facet $SINGLEMDS mkfs -t xfs -d file,size=1t,name=$TMP/$mdtimg ||
9651 error "mkfs temporary xfs image"
9653 do_facet $SINGLEMDS mount $TMP/$mdtimg $tmpmnt ||
9654 error "mount temporary xfs image"
9655 stack_trap "do_facet $SINGLEMDS umount $tmpmnt" EXIT
9656 local old_mdssize=$MDSSIZE
9657 local old_mdsisize=$MDSISIZE
9659 MDSSIZE=$((17 * 1024 * 1024 * 1024)) # 17T MDT
9660 MDSISIZE=$((16 << 20))
9661 local opts17t="$(mkfs_opts $SINGLEMDS)"
9663 MDSSIZE=$old_mdssize
9664 MDSISIZE=$old_mdsisize
9666 do_facet $SINGLEMDS $MKFS \
9667 ${opts17t/-E /-E lazy_itable_init,lazy_journal_init,} \
9669 error "failed to mkfs for $tmpmnt/$mdtimg"
9671 do_facet $SINGLEMDS $TUNE2FS -l $tmpmnt/$mdtimg |
9672 grep -qw 'features.*extent' || error "extent should be enabled"
9675 run_test 116 "big size MDT support"
9678 # Call setup only if LustreFS is not mounted
9679 check_mount || setup
9681 do_facet ost1 "$LCTL set_param ost.OSS.ost_io.nrs_policies=fifo"
9682 do_facet ost1 "$LCTL get_param -n ost.OSS.ost_io.nrs_tbf_rule" &&
9683 error "get_param should fail"
9684 cleanup || error "cleanup failed with rc $?"
9686 run_test 117 "lctl get_param return errors properly"
9692 [[ "$MDSCOUNT" -ge 2 ]] || skip "Need more at least 2 MDTs"
9694 had_config=$(do_facet mds1 "$LCTL get_param debug | grep config")
9695 do_facet mds1 "$LCTL set_param debug=+config"
9696 do_facet mds1 "$LCTL clear"
9699 do_facet mds2 "$TUNEFS --writeconf $(mdsdevname 2)" &>/dev/null
9700 # mount after writeconf will make "add osp" added to mdt0 config:
9701 # 53 (224)marker 60 (flags=0x01, v2.5.1.0) lustre-MDT0001 'add osp'
9702 # 54 (080)add_uuid nid=... 0: 1:...
9703 # 55 (144)attach 0:lustre-MDT0001-osp-MDT0000 1:osp 2:...
9704 # 56 (144)setup 0:lustre-MDT0001-osp-MDT0000 1:... 2:...
9705 # 57 (136)modify_mdc_tgts add 0:lustre-MDT0000-mdtlov 1:... 2:1 3:1
9706 # duplicate modify_mdc_tgts caused crashes
9709 # using larger debug_mb size to avoid lctl dk log truncation
9710 size_mb=$((DEBUG_SIZE_SAVED * 4))
9713 # though config processing stops after failed attach and setup
9714 # it will proceed after the failed command after each writeconf
9715 # this is the original scenario of the issue
9716 do_facet mds2 "$TUNEFS --writeconf $(mdsdevname 2)" &>/dev/null
9717 do_facet mds1 "$LCTL set_param debug_mb=$size_mb"
9720 wait_update_facet_cond mds1 \
9721 "$LCTL dk | grep -c Processed.log.$FSNAME-MDT0000" \
9726 [[ -z "$had_config" ]] && do_facet mds1 lctl set_param debug=-config
9730 run_test 119 "writeconf on slave mdt shouldn't duplicate mdc/osp and crash"
9732 test_120() { # LU-11130
9733 [ "$MDSCOUNT" -lt 2 ] && skip "mdt count < 2"
9734 [ "$mds1_FSTYPE" != ldiskfs ] &&
9735 skip "ldiskfs only test"
9736 [ "$MDS1_VERSION" -lt $(version_code 2.11.56) ] &&
9737 skip "Need DNE2 capable MD target with LU-11130 fix"
9741 local mds1host=$(facet_active_host mds1)
9742 local mds1dev=$(mdsdevname 1)
9744 $LFS mkdir -i 1 $DIR/$tdir
9745 $LFS mkdir -i 0 $DIR/$tdir/mds1dir
9747 ln -s foo $DIR/$tdir/bar
9748 mv $DIR/$tdir/bar $DIR/$tdir/mds1dir/bar2 ||
9749 error "cross-target rename failed"
9753 run_e2fsck $mds1host $mds1dev "-n"
9755 run_test 120 "cross-target rename should not create bad symlinks"
9759 start_mgsmds || error "MGS MDS Start failed"
9761 stop_mds || error "Stopping MDSes failed"
9765 stop_mds || error "Stopping MDSes failed"
9767 run_test 121 "failover MGS"
9770 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
9771 [[ "$OST1_VERSION" -ge $(version_code 2.11.53) ]] ||
9772 skip "Need OST version at least 2.11.53"
9775 LOAD_MODULES_REMOTE=true load_modules
9776 #define OBD_FAIL_OFD_SET_OID 0x1e0
9777 do_facet ost1 $LCTL set_param fail_loc=0x00001e0
9780 $LFS mkdir -i1 -c1 $DIR/$tdir
9781 $LFS setstripe -i0 -c1 $DIR/$tdir
9782 do_facet ost1 $LCTL set_param fail_loc=0
9783 createmany -o $DIR/$tdir/file_ 1000 ||
9784 error "Fail to create a new sequence"
9788 run_test 122a "Check OST sequence update"
9791 remote_mgs_nodsh && skip "remote MGS with nodsh"
9792 [ -d $MOUNT/.lustre ] || setup
9794 # test old logid format until removal from llog_ioctl.c::str2logid()
9795 if (( $MGS_VERSION < $(version_code 2.99.53) )); then
9796 do_facet mgs $LCTL dl | grep MGS
9797 do_facet mgs "$LCTL --device %MGS llog_print \
9798 \\\\\\\$$FSNAME-client 1 10" ||
9799 error "old llog_print failed"
9802 # test new logid format
9803 if [ $MGS_VERSION -ge $(version_code 2.9.53) ]; then
9804 do_facet mgs "$LCTL --device MGS llog_print $FSNAME-client" ||
9805 error "new llog_print failed"
9808 run_test 123aa "llog_print works with FIDs and simple names"
9811 remote_mgs_nodsh && skip "remote MGS with nodsh"
9812 [[ $MGS_VERSION -gt $(version_code 2.11.51) ]] ||
9813 skip "Need server with working llog_print support"
9815 [ -d $MOUNT/.lustre ] || setup
9821 [[ $MGS_VERSION -gt $(version_code 2.13.54) ]] ||
9822 mgs_arg="--device MGS"
9824 orig_val=$(do_facet mgs $LCTL get_param jobid_name)
9825 do_facet mgs $LCTL set_param -P jobid_name="TESTNAME"
9827 yaml=$(do_facet mgs $LCTL $mgs_arg llog_print params |
9828 grep jobid_name | tail -n 1)
9830 local param=$(awk '{ print $10 }' <<< "$yaml")
9831 local val=$(awk '{ print $12 }' <<< "$yaml")
9832 #return to the default
9833 do_facet mgs $LCTL set_param -P jobid_name=$orig_val
9834 [ $val = "TESTNAME" ] || error "bad value: $val"
9835 [ $param = "jobid_name," ] || error "Bad param: $param"
9837 run_test 123ab "llog_print params output values from set_param -P"
9839 test_123ac() { # LU-11566
9840 remote_mgs_nodsh && skip "remote MGS with nodsh"
9841 do_facet mgs "$LCTL help llog_print" 2>&1 | grep -q -- --start ||
9842 skip "Need 'lctl llog_print --start' on MGS"
9848 [[ $MGS_VERSION -gt $(version_code 2.13.54) ]] ||
9849 mgs_arg="--device MGS"
9851 [ -d $MOUNT/.lustre ] || setup
9853 # - { index: 10, event: add_uuid, nid: 192.168.20.1@tcp(0x20000c0a81401,
9854 # node: 192.168.20.1@tcp }
9855 do_facet mgs $LCTL $mgs_arg \
9856 llog_print --start $start --end $end $FSNAME-client | tr -d , |
9857 while read DASH BRACE INDEX idx EVENT BLAH BLAH BLAH; do
9858 (( idx >= start )) || error "llog_print index $idx < $start"
9859 (( idx <= end )) || error "llog_print index $idx > $end"
9862 run_test 123ac "llog_print with --start and --end"
9864 test_123ad() { # LU-11566
9865 remote_mgs_nodsh && skip "remote MGS with nodsh"
9866 # older versions of lctl may not print all records properly
9867 do_facet mgs "$LCTL help llog_print" 2>&1 | grep -q -- --start ||
9868 skip "Need 'lctl llog_print --start' on MGS"
9870 [ -d $MOUNT/.lustre ] || setup
9872 # append a new record, to avoid issues if last record was cancelled
9873 local old=$($LCTL get_param -n osc.*-OST0000-*.max_dirty_mb | head -1)
9874 do_facet mgs $LCTL conf_param $FSNAME-OST0000.osc.max_dirty_mb=$old
9876 # logid: [0x3:0xa:0x0]:0
9880 local num=$(do_facet mgs $LCTL --device MGS llog_info $FSNAME-client |
9881 awk '/last_index:/ { print $2 - 1 }')
9883 # - { index: 71, event: set_timeout, num: 0x14, param: sys.timeout=20 }
9884 local last=$(do_facet mgs $LCTL --device MGS llog_print $FSNAME-client |
9885 tail -1 | awk '{ print $4 }' | tr -d , )
9886 (( last == num )) || error "llog_print only showed $last/$num records"
9888 run_test 123ad "llog_print shows all records"
9890 test_123ae() { # LU-11566
9898 remote_mgs_nodsh && skip "remote MGS with nodsh"
9899 [ -d $MOUNT/.lustre ] || setupall
9901 max=$($LCTL get_param -n osc.*-OST0000-*.max_dirty_mb | head -1)
9902 pgs=$($LCTL get_param -n osc.*-OST0000-*.max_pages_per_rpc | head -1)
9903 [[ $MGS_VERSION -gt $(version_code 2.13.54) ]] ||
9904 mgs_arg="--device MGS"
9906 if do_facet mgs "$LCTL help llog_cancel" 2>&1| grep -q -- --log_id; then
9907 # save one set_param -P record in case none exist
9909 do_facet mgs $LCTL set_param -P osc.*.max_pages_per_rpc=$pgs
9910 stack_trap "do_facet mgs $LCTL set_param -P -d \
9911 osc.*.max_pages_per_rpc"
9914 orig=$(do_facet mgs $LCTL $mgs_arg llog_print $log |
9915 tail -1 | awk '{ print $4 }' | tr -d , )
9916 do_facet mgs $LCTL set_param -P osc.*.max_dirty_mb=$max
9917 do_facet mgs $LCTL $mgs_arg llog_print $log | tail -1 |
9918 grep "parameter: osc.*.max_dirty_mb" ||
9919 error "new set_param -P wasn't stored in params log"
9921 # - { index: 71, event: set_param, device: general,
9922 # param: osc.*.max_dirty_mb, value: 256 }
9923 id=$(do_facet mgs $LCTL $mgs_arg llog_print $log |
9924 tail -1 | awk '{ print $4 }' | tr -d , )
9925 do_facet mgs $LCTL $mgs_arg llog_cancel $log --log_idx=$id
9926 local new=$(do_facet mgs $LCTL $mgs_arg llog_print $log |
9927 tail -1 | awk '{ print $4 }' | tr -d , )
9928 (( new == orig )) ||
9929 error "new llog_cancel now $new, not at $orig records"
9932 # test old positional parameters for a while still
9933 if [ "$MGS_VERSION" -le $(version_code 3.1.53) ]; then
9936 do_facet mgs $LCTL conf_param \
9937 $FSNAME-OST0000.osc.max_pages_per_rpc=$pgs
9938 stack_trap "do_facet mgs $LCTL conf_param -d \
9939 $FSNAME-OST0000.osc.max_pages_per_rpc"
9941 orig=$(do_facet mgs $LCTL --device MGS llog_print $log |
9942 tail -1 | awk '{ print $4 }' | tr -d , )
9943 do_facet mgs $LCTL conf_param $FSNAME-OST0000.osc.max_dirty_mb=$max
9944 do_facet mgs $LCTL --device MGS llog_print $log |
9945 tail -1 | grep "parameter: osc.max_dirty_mb" ||
9946 error "old conf_param wasn't stored in params log"
9947 do_facet mgs $LCTL --device MGS llog_print $log
9948 # - { index: 71, event: conf_param, device: testfs-OST0000-osc,
9949 # param: osc.max_dirty_mb=256 }
9950 id=$(do_facet mgs $LCTL --device MGS llog_print $log |
9951 tail -1 | awk '{ print $4 }' | tr -d , )
9952 do_facet mgs $LCTL --device MGS llog_cancel $log $id
9953 do_facet mgs $LCTL --device MGS llog_print $log
9954 new=$(do_facet mgs $LCTL --device MGS llog_print $log |
9955 tail -1 | awk '{ print $4 }' | tr -d , )
9956 (( new == orig )) ||
9957 error "old llog_cancel now $new, not at $orig records"
9960 run_test 123ae "llog_cancel can cancel requested record"
9962 test_123af() { #LU-13609
9963 [ "$MGS_VERSION" -ge $(version_code 2.13.54) -a \
9964 "$MDS1_VERSION" -ge $(version_code 2.13.54) ] ||
9965 skip "Need both MGS and MDS version at least 2.13.54"
9967 [ -d $MOUNT/.lustre ] || setupall
9968 stack_trap "do_facet mds1 $LCTL set_param fail_loc=0" EXIT
9978 for device in "MGS" "$FSNAME-MDT0000"; do
9979 cmd="--device $device llog_catlist"
9980 echo "lctl $cmd ..."
9981 if [ "$device" = "MGS" ]; then
9986 orig_clist=($(do_facet $facet $LCTL $cmd | awk '{ print $2 }'))
9987 orig_count=${#orig_clist[@]}
9988 echo "orig_clist: ${orig_clist[*]}"
9990 #define OBD_FAIL_CATLIST 0x131b
9991 #fetch to llog records from the second one
9992 do_facet $facet $LCTL set_param fail_loc=0x131b fail_val=2
9994 new_clist=($(do_facet $facet $LCTL $cmd | awk '{ print $2 }'))
9995 new_count=${#new_clist[@]}
9996 echo "new_clist: ${new_clist[*]}"
9998 [ $new_count -eq $((orig_count - 1)) ] ||
9999 error "$new_count != $orig_count - 1"
10000 for i in $(seq 0 $new_count); do
10002 [ "${orig_clist[$j]}" = "${new_clist[$i]}" ] ||
10003 error "${orig_clist[$j]} != ${new_clist[$i]}"
10005 do_facet mds1 $LCTL set_param fail_loc=0
10009 run_test 123af "llog_catlist can show all config files correctly"
10011 test_123ag() { # LU-15142
10015 remote_mgs_nodsh && skip "remote MGS with nodsh"
10016 (( $MGS_VERSION >= $(version_code 2.14.55) )) ||
10017 skip "Need server version least 2.14.55"
10019 [ -d $MOUNT/.lustre ] || setup
10021 orig_val=$(do_facet mgs $LCTL get_param jobid_name)
10022 stack_trap "do_facet mgs $LCTL set_param -P jobid_name=$orig_val"
10024 do_facet mgs $LCTL set_param -P jobid_name="TESTNAME1"
10025 do_facet mgs $LCTL set_param -P -d jobid_name
10026 rec=$(do_facet mgs $LCTL --device MGS llog_print params |
10027 grep -c jobid_name)
10028 (( rec == 0 )) || error "parameter was not deleted, check #1"
10029 do_facet mgs $LCTL set_param -P jobid_name="TESTNAME1"
10030 rec=$(do_facet mgs $LCTL --device MGS llog_print params |
10031 grep -c jobid_name)
10032 (( rec == 1)) || error "parameter is not set"
10033 # usage with ordinary set_param format works too
10034 do_facet mgs $LCTL set_param -P -d jobid_name="ANY"
10035 rec=$(do_facet mgs $LCTL --device MGS llog_print params |
10036 grep -c jobid_name)
10037 (( rec == 0 )) || error "parameter was not deleted, check #2"
10039 run_test 123ag "llog_print skips values deleted by set_param -P -d"
10041 test_123ah() { #LU-7668 del_ost
10042 (( "$MGS_VERSION" >= $(version_code 2.15.51) &&
10043 "$MDS1_VERSION" >= $(version_code 2.15.51) )) ||
10044 skip "Need MGS/MDS version >= 2.15.51 for del_ost"
10046 [ -d $MOUNT/.lustre ] || setupall
10047 stack_trap "do_facet mds1 $LCTL set_param fail_loc=0" EXIT
10049 local cmd="--device MGS llog_print"
10051 cli_llogcnt_orig=$(do_facet mgs $LCTL $cmd $FSNAME-client |
10052 grep -c $FSNAME-OST0000)
10053 mds1_llogcnt_orig=$(do_facet mgs $LCTL $cmd $FSNAME-MDT0000 |
10054 grep -c $FSNAME-OST0000)
10056 [ $cli_llogcnt_orig -gt 0 ] ||
10057 error "$FSNAME-OST0000 not found (client)"
10058 [ $mds1_llogcnt_orig -gt 0 ] || error "$FSNAME-OST0000 not found (MDT)"
10060 # -n/--dryrun should NOT modify catalog
10061 do_facet mgs "$LCTL del_ost -n -t $FSNAME-OST0000" ||
10062 error "del_ost --dryrun failed with $?"
10064 local cli_llogcnt=$(do_facet mgs $LCTL $cmd $FSNAME-client |
10065 grep -c $FSNAME-OST0000)
10066 local mds1_llogcnt=$(do_facet mgs $LCTL $cmd $FSNAME-MDT0000 |
10067 grep -c $FSNAME-OST0000)
10069 [ $cli_llogcnt -eq $cli_llogcnt_orig ] ||
10070 error "--dryrun error: $cli_llogcnt != $cli_llogcnt_orig"
10071 [ $mds1_llogcnt -eq $mds1_llogcnt_orig ] ||
10072 error "--dryrun error: $mds1_llogcnt != $mds1_llogcnt_orig"
10075 do_facet mgs "$LCTL del_ost --target $FSNAME-OST0000" ||
10076 error "del_ost failed with $?"
10078 local cli_llogcnt=$(do_facet mgs $LCTL $cmd $FSNAME-client |
10079 grep -c $FSNAME-OST0000)
10080 local mds1_llogcnt=$(do_facet mgs $LCTL $cmd $FSNAME-MDT0000 |
10081 grep -c $FSNAME-OST0000)
10083 # every catalog entry for OST0000 should have been cancelled
10084 [ $cli_llogcnt -eq 0 ] || error "$FSNAME-OST0000 not cancelled (cli)"
10085 [ $mds1_llogcnt -eq 0 ] || error "$FSNAME-OST0000 not cancelled (MDT)"
10087 umount_client $MOUNT
10088 mount_client $MOUNT
10090 $LFS df | grep -q OST0000 && error "del_ost did not remove OST0000!"
10092 reformat_and_config
10094 run_test 123ah "del_ost cancels config log entries correctly"
10099 echo "cleanup test 123ai"
10101 # cancel last timeout record
10102 do_facet mgs "$LCTL set_param -P -d timeout"
10104 # restore timeout value
10105 do_nodes $(comma_list $(all_nodes)) "$LCTL set_param timeout=$timeout"
10108 test_123ai() { #LU-16167
10114 remote_mgs_nodsh && skip "remote MGS with nodsh"
10115 (( MDS1_VERSION >= $(version_code 2.15.51) )) ||
10116 skip "Need MDS version at least 2.15.51"
10118 [ -d $MOUNT/.lustre ] || setup
10120 old_count=$(do_facet mgs "$LCTL --device MGS llog_print -r params" |
10121 grep -c "parameter: timeout")
10123 old_timeout=$($LCTL get_param -n timeout)
10124 stack_trap "cleanup_123ai $old_timeout" EXIT
10126 # add and cancel params (2 * MAX_IOC_BUFLEN / 128 + 1 = 129)
10127 for i in {1..129}; do
10128 do_facet mgs "$LCTL set_param -P timeout=$i" ||
10129 error "fail to set timeout=$i on MGS"
10132 count=$(do_facet mgs "$LCTL --device MGS llog_print -r params" |
10133 grep -c "parameter: timeout")
10135 ((count - old_count == 129)) ||
10136 error "number timeout record missmatch ($count - $old_count != 129)"
10138 do_facet mgs "$LCTL --device MGS llog_print params" |
10139 tail -1 | grep "timeout, value: 129" ||
10140 error "llog_print could not display the last record (timeout=129)"
10143 run_test 123ai "llog_print display all non skipped records"
10146 remote_mgs_nodsh && skip "remote MGS with nodsh"
10148 [ -d $MOUNT/.lustre ] || setup
10149 yaml_file="$TMP/$tfile.yaml"
10151 do_facet mgs rm "$yaml_file"
10152 cfgfiles=$(do_facet mgs "lctl --device MGS llog_catlist" |
10153 sed 's/config_log://')
10155 # set jobid_var to a different value for test
10156 orig_val=$(do_facet mgs $LCTL get_param jobid_var)
10158 do_facet mgs $LCTL set_param -P jobid_var="TESTNAME"
10160 for i in $cfgfiles params; do
10161 do_facet mgs "lctl --device MGS llog_print ${i} >> $yaml_file"
10164 echo "Unmounting FS"
10172 test_123_restore() {
10173 set_val=$(do_facet mgs $LCTL get_param jobid_var)
10175 do_facet mgs $LCTL set_param -P $orig_val
10177 [ $set_val == "jobid_var=TESTNAME" ] ||
10178 error "$set_val is not TESTNAME"
10180 do_facet mgs rm "$yaml_file"
10192 # Reapply the config from before
10193 echo "Setting configuration parameters"
10194 do_facet mgs "lctl set_param -F $yaml_file"
10198 run_test 123F "clear and reset all parameters using set_param -F"
10208 # Reapply the config from before
10209 echo "Setting configuration parameters"
10210 do_facet mgs "lctl apply_yaml $yaml_file"
10214 run_test 123G "clear and reset all parameters using apply_yaml"
10219 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
10220 [ -z $mds2failover_HOST ] && skip "needs MDT failover setup"
10223 do_facet mgs $LCTL --device MGS llog_print $FSNAME-client |
10224 grep 1.2.3.4@tcp && error "Should not be fake nid"
10225 do_facet mgs $LCTL conf_param $FSNAME-MDT0001.failover.node=1.2.3.4@tcp\
10226 || error "Set params error"
10227 do_facet mgs $LCTL --device MGS llog_print $FSNAME-client |
10228 grep 1.2.3.4@tcp || error "Fake nid should be added"
10232 if combined_mgs_mds; then
10233 start_mdt 1 "-o nosvc" ||
10234 error "starting mds with nosvc option failed"
10236 local nid=$(do_facet mds2 $LCTL list_nids | head -1)
10237 local failover_nid=$(do_node $mds2failover_HOST $LCTL list_nids | head -1)
10239 do_facet mgs $LCTL replace_nids $FSNAME-MDT0001 $nid:$failover_nid ||
10240 error "replace_nids execution error"
10242 if combined_mgs_mds; then
10248 echo "lfs setdirstripe"
10249 $LFS setdirstripe -i 1 $MOUNT/$tdir || error "setdirstirpe error"
10252 run_test 124 "check failover after replace_nids"
10254 get_max_sectors_kb() {
10257 local dev_base=$(basename $(do_facet ${facet} "readlink -f ${device}"))
10258 local max_sectors_path="/sys/block/${dev_base}/queue/max_sectors_kb"
10260 do_facet ${facet} "[[ -e ${max_sectors_path} ]] &&
10261 cat ${max_sectors_path}"
10264 get_max_hw_sectors_kb() {
10267 local dev_base=$(basename $(do_facet ${facet} "readlink -f ${device}"))
10268 local max_hw_path="/sys/block/${dev_base}/queue/max_hw_sectors_kb"
10270 do_facet ${facet} "[[ -e ${max_hw_path} ]] && cat ${max_hw_path}"
10273 set_max_sectors_kb() {
10277 local dev_base=$(basename $(do_facet ${facet} "readlink -f ${device}"))
10278 local max_sectors_path="/sys/block/${dev_base}/queue/max_sectors_kb"
10280 do_facet ${facet} "[[ -e ${max_sectors_path} ]] &&
10281 echo ${value} > ${max_sectors_path}"
10284 [[ $rc -ne 0 ]] && echo "Failed to set ${max_sectors_path} to ${value}"
10289 # Return 0 if all slave devices have max_sectors_kb == max_hw_sectors_kb
10290 # Otherwise return > 0
10291 check_slaves_max_sectors_kb()
10295 local dev_base=$(basename $(do_facet ${facet} "readlink -f ${device}"))
10296 local slaves_dir=/sys/block/${dev_base}/slaves
10297 local slave_devices=$(do_facet ${facet} "ls ${slaves_dir} 2>/dev/null")
10298 [[ -z ${slave_devices} ]] && return 0
10300 local slave max_sectors new_max_sectors max_hw_sectors path
10303 for slave in ${slave_devices}; do
10304 path="/dev/${slave}"
10305 ! is_blkdev ${facet} ${path} && continue
10306 max_sectors=$(get_max_sectors_kb ${facet} ${path})
10307 max_hw_sectors=$(get_max_hw_sectors_kb ${facet} ${path})
10308 new_max_sectors=${max_hw_sectors}
10309 [[ ${new_max_sectors} -gt ${RQ_SIZE_LIMIT} ]] &&
10310 new_max_sectors=${RQ_SIZE_LIMIT}
10312 if [[ ${max_sectors} -ne ${new_max_sectors} ]]; then
10313 echo "${path} ${max_sectors} ${new_max_sectors}"
10316 check_slaves_max_sectors_kb ${facet} ${path}
10325 local facet_list="mgs mds1 ost1"
10326 combined_mgs_mds && facet_list="mgs ost1"
10329 for facet in ${facet_list}; do
10330 [[ $(facet_fstype ${facet}) != ldiskfs ]] &&
10331 skip "ldiskfs only test" &&
10333 ! is_blkdev ${facet} $(facet_device ${facet}) &&
10334 skip "requires all real devices" &&
10339 # We don't increase IO request size limit past 16MB. See comments in
10340 # lustre/utils/libmount_utils_ldiskfs.c:tune_max_sectors_kb()
10341 RQ_SIZE_LIMIT=$((16 * 1024))
10342 local device old_max_sectors new_max_sectors max_hw_sectors
10343 for facet in ${facet_list}; do
10344 device=$(facet_device ${facet})
10345 old_max_sectors=$(get_max_sectors_kb ${facet} ${device})
10346 max_hw_sectors=$(get_max_hw_sectors_kb ${facet} ${device})
10348 # The expected value after l_tunedisk is executed
10349 new_max_sectors=$old_max_sectors
10350 [[ ${new_max_sectors_kb} -gt ${RQ_SIZE_LIMIT} ]] &&
10351 new_max_sectors_kb=${RQ_SIZE_LIMIT}
10353 # Ensure the current value of max_sectors_kb does not equal
10354 # max_hw_sectors_kb, so we can tell whether l_tunedisk did
10356 set_max_sectors_kb ${facet} ${device} $((new_max_sectors - 1))
10358 # Value before l_tunedisk
10359 local pre_max_sectors=$(get_max_sectors_kb ${facet} ${device})
10360 if [[ ${pre_max_sectors} -ne $((new_max_sectors - 1)) ]]; then
10361 echo "unable to satsify test pre-condition:"
10362 echo "${pre_max_sectors} != $((new_max_sectors - 1))"
10367 echo "Before: ${facet} ${device} ${pre_max_sectors} ${max_hw_sectors}"
10369 do_facet ${facet} "l_tunedisk ${device}"
10371 # Value after l_tunedisk
10372 local post_max_sectors=$(get_max_sectors_kb ${facet} ${device})
10374 echo "After: ${facet} ${device} ${post_max_sectors} ${max_hw_sectors}"
10376 if [[ ${facet} != ost1 ]]; then
10377 if [[ ${post_max_sectors} -ne ${pre_max_sectors} ]]; then
10378 echo "l_tunedisk modified max_sectors_kb of ${facet}"
10382 set_max_sectors_kb ${facet} ${device} ${old_max_sectors}
10384 if [[ ${post_max_sectors} -eq ${pre_max_sectors} ]]; then
10385 echo "l_tunedisk failed to modify max_sectors_kb of ${facet}"
10389 check_slaves_max_sectors_kb ${facet} ${device} ||
10396 run_test 125 "check l_tunedisk only tunes OSTs and their slave devices"
10399 [[ "$MDS1_VERSION" -ge $(version_code 2.13.52) ]] ||
10400 skip "Need MDS version at least 2.13.52"
10403 do_rpc_nodes $(facet_active_host $SINGLEMDS) load_module ../libcfs/libcfs/libcfs
10404 #define OBD_FAIL_OBD_SETUP 0x60d
10405 do_facet mds1 $LCTL set_param fail_loc=0x60d
10406 do_rpc_nodes $(facet_active_host $SINGLEMDS) load_modules &
10407 for i in {1..40}; do
10408 do_facet mds1 lsmod | grep -q osd_$mds1_FSTYPE && break
10411 clear_failloc $SINGLEMDS 20 &
10412 start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS
10414 run_test 126 "mount in parallel shouldn't cause a crash"
10417 [[ "$ost1_FSTYPE" == ldiskfs ]] || skip "ldiskfs only test"
10421 zconf_umount_clients $RCLIENTS $MOUNT
10423 wait_osp_active ost ${FSNAME}-OST0000 0 1
10424 local osc_tgt="$FSNAME-OST0000-osc-$($LFS getname -i $DIR)"
10425 local avail1=($($LCTL get_param -n osc.${osc_tgt}.kbytesavail))
10427 $LFS setstripe -i 0 $DIR/$tfile || error "failed creating $DIR/$tfile"
10428 dd if=/dev/zero of=$DIR/$tfile bs=1M oflag=direct || true
10430 local avail2=($($LCTL get_param -n osc.${osc_tgt}.kbytesavail))
10432 if ((avail2 * 100 / avail1 > 1)); then
10435 error "more than 1% space left: before=$avail1 after=$avail2"
10438 local mbs=$(($(stat -c %s $DIR/$tfile) / (1024 * 1024)))
10440 dd if=/dev/zero of=$DIR/$tfile bs=1M count=$mbs conv=notrunc \
10441 oflag=direct || error "overwrite failed"
10443 run_test 127 "direct io overwrite on full ost"
10447 combined_mgs_mds && skip "need separate mgs device"
10448 [ "$ost2_FSTYPE" == zfs ] && import_zpool ost2
10451 # Try to apply nolocallogs to the virgin OST. Should fail.
10452 do_facet ost2 "$TUNEFS --nolocallogs $(ostdevname 2)" &&
10453 error "nolocallogs should not be allowed on the virgin target"
10458 [ "$ost1_FSTYPE" == zfs ] && import_zpool ost1
10459 # Start OST without MGS (local configs)
10460 do_facet ost1 "$TUNEFS --dryrun $(ostdevname 1)"
10461 start_ost || error "unable to start OST1"
10462 stop_ost || error "Unable to stop OST1"
10464 [ "$ost1_FSTYPE" == zfs ] && import_zpool ost1
10465 # Do not allow reading local configs, should fail
10466 do_facet ost1 "$TUNEFS --nolocallogs $(ostdevname 1)" ||
10467 error "Can not set nolocallogs"
10468 start_ost && error "OST1 started, but should fail"
10470 # Connect to MGS successfully, reset nolocallogs flag
10471 [ "$ost1_FSTYPE" == zfs ] && import_zpool ost1
10472 start_mgs || error "unable to start MGS"
10473 start_ost || error "unable to start OST1"
10475 do_facet ost1 "$TUNEFS --dryrun $(ostdevname 1)" | grep "nolocallogs" &&
10476 error "nolocallogs expected to be reset"
10478 stop_ost || error "Unable to stop OST1"
10480 run_test 128 "Force using remote logs with --nolocallogs"
10484 (( MDS1_VERSION >= $(version_code 2.14.57) )) ||
10485 skip "Need MDS version at least 2.14.57"
10487 start_mgsmds || error "MGS/MDS start failed"
10489 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS &&
10490 error "start ost1 should fail" || true
10491 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS &&
10492 error "second start ost1 should fail" || true
10493 do_facet ost1 "$TUNEFS --writeconf $(ostdevname 1)"
10494 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS ||
10495 error "start ost1 failed"
10499 run_test 129 "attempt to connect an OST with the same index should fail"
10503 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
10505 stop_mdt 2 || error "mdt2 stop failed"
10506 do_facet mds2 "$TUNEFS --writeconf $(mdsdevname 2)"
10507 start_mdt 2 || error "mdt2 start failed"
10508 do_facet mds2 "$LCTL dl" | grep MDT0001-osp-MDT0001 &&
10509 error "Illegal OSP device created" || true
10511 run_test 130 "re-register an MDT after writeconf"
10514 [ "$mds1_FSTYPE" == "ldiskfs" ] || skip "ldiskfs only test"
10515 (( $MDS1_VERSION >= $(version_code 2.14.56.35) )) ||
10516 skip "Need MDS version at least 2.14.56.35"
10517 do_facet mds1 $DEBUGFS -R features $(mdsdevname 1) |
10518 grep -q project || skip "skip project quota not supported"
10523 test_mkdir -c $MDSCOUNT -p $DIR/$tdir
10524 $LFS project -p 1000 $DIR/$tdir || error "set dir project id failed"
10525 createmany -o $DIR/$tdir/f 512
10526 for ((i = 0; i < 512; ++i)); do
10527 $LFS project -p $i $DIR/$tdir/f${i} ||
10528 error "set f${i} project id failed"
10531 test_mkdir -c $MDSCOUNT -p $DIR/$tdir.inherit
10532 $LFS project -p 1001 -s $DIR/$tdir.inherit
10533 createmany -o $DIR/$tdir.inherit/f 128
10534 (( $($LFS project $DIR/$tdir.inherit/f* |
10535 awk '$1 == 1001 { print }' | wc -l) == 128 )) ||
10536 error "files did not inherit projid 1001"
10540 for i in $(seq $MDSCOUNT); do
10541 mds_backup_restore mds$i ||
10542 error "Backup/restore on mds$i failed"
10547 projid=($($LFS project -d $DIR/$tdir))
10548 [ ${projid[0]} == "1000" ] ||
10549 error "projid expected 1000 not ${projid[0]}"
10550 for ((i = 0; i < 512; ++i)); do
10551 projid=($($LFS project $DIR/$tdir/f${i}))
10552 [ ${projid[0]} == "$i" ] ||
10553 error "projid expected $i not ${projid[0]}"
10556 (( $($LFS project $DIR/$tdir.inherit/f* |
10557 awk '$1 == 1001 { print }' | wc -l) == 128 )) ||
10558 error "restore did not copy projid 1001"
10560 run_test 131 "MDT backup restore with project ID"
10566 (( MDS1_VERSION >= $(version_code 2.14.57) )) ||
10567 skip "Need MDS version at least 2.14.57"
10569 combined_mgs_mds || start_mgs || error "unable to start MGS"
10570 start_mdt 1 || error "unable to start mdt1"
10572 err_cnt=$(do_facet mds1 dmesg | grep -c "cannot take the layout locks")
10573 stop_mdt 1 || error "stop mdt1 failed"
10575 [ "$mds1_FSTYPE" == zfs ] && import_zpool mds1
10576 do_facet mds1 $TUNEFS --param mdt.hsm_control=enabled $(mdsdevname 1) ||
10577 error "tunefs failed"
10578 start_mdt 1 || error "cannot start mdt1"
10580 err_cnt2=$(do_facet mds1 dmesg | grep -c "cannot take the layout locks")
10581 [ $err_cnt -eq $err_cnt2 ] || error "Can not take the layout lock"
10582 stop_mdt 1 || error "stop mdt1 failed"
10584 run_test 132 "hsm_actions processed after failover"
10586 # This test verifies we do RR allocation within a pool even if there is a
10587 # significant imbalance vs an OST outside the pool
10589 [[ $OSTCOUNT -lt 4 ]] && skip_env "needs >= 4 OSTs"
10590 [[ "$OST1_VERSION" -ge $(version_code 2.15.51) ]] ||
10591 skip "Need OST version at least 2.15.51"
10592 # This is the easiest way to ensure OSTs start out balanced
10593 reformat_and_config
10596 check_set_fallocate_or_skip
10598 local testfile=$DIR/$tdir/$tfile
10599 local pool="testpool"
10600 local ostrange=$((OSTCOUNT - 1))
10601 # Select all but the last OST to add to the pool
10602 local poolostrange=$((OSTCOUNT - 2))
10610 [ $MINV -eq 0 ] && error "no free space in OST$MINI"
10611 [ $MAXV -gt $((2 * $MINV)) ] &&
10612 error "OSTs badly unbalanced after reformat"
10614 create_pool $FSNAME.$pool || error "failed to create a pool"
10615 do_facet mgs $LCTL pool_add $FSNAME.$pool OST[0-$poolostrange] ||
10616 error "failed to add OST[0-$poolostrange] to the pool"
10618 test_mkdir -p $DIR/$tdir || error "failed to mkdir $DIR/$tdir"
10619 # Consume space on the OSTs in the pool so they are unbalanced with the
10620 # OST outside of the pool
10621 # fill each OST 90% with fallocate so they are widely
10623 local size=$(((MINV * 9 / 10) * 1024))
10624 for ((i = 0; i <= poolostrange; i++)); do
10625 $LFS setstripe -c 1 -i $i $testfile$i ||
10626 error "failed to setstripe $testfile$i"
10627 fallocate -l $size $testfile$i || error "fallocate failed"
10633 # Create files in the pool now that there is an imbalance
10634 filecount=$(((OSTCOUNT - 1) * filenum))
10635 for ((i = 0; i < filecount; i++)); do
10636 $LFS setstripe -p $pool $testfile-$i ||
10637 error "failed to setstripe -p $pool $testfile-$i"
10639 $LFS getstripe -i $testfile-* > /tmp/$tfile.log
10640 # Count the number of files with a stripe on each OST to verify the
10641 # pool allocated with round-robin
10642 for ((i = 0; i <= poolostrange; i++)); do
10643 stripecount=$(grep -c $i /tmp/$tfile.log)
10644 # Allow a little leeway
10645 if (( stripecount < filenum - 1 ||
10646 stripecount > filenum + 1 )); then
10647 cat /tmp/$tfile.log
10648 error "$stripecount != $filenum files on OST$i"
10652 # Create files across the system now that there is an imbalance
10653 filecount=$((OSTCOUNT * filenum))
10654 for ((i = 1; i < filecount; i++)); do
10655 $LFS setstripe $testfile-$i.2 ||
10656 error "failed to setstripe $testfile-$i.2"
10658 $LFS getstripe -i $testfile-*.2 > /tmp/$tfile.log
10660 # Count the number of files with a stripe on each OST to verify the
10661 # files are *NOT* allocated with round-robin
10662 for ((i = 0; i <= ostrange; i++)); do
10663 stripecount=$(grep -c $i /tmp/$tfile.log)
10664 if [[ $stripecount -ne $filenum ]]; then
10666 echo "QOS: $stripecount != $filenum files on OST$i"
10669 if [ -z "$qos_used" ]; then
10670 error "QOS not used on imbalanced OSTs!"
10673 rm -rf /tmp/$tfile.log $DIR/$tdir
10674 do_facet mgs $LCTL pool_remove $FSNAME.$pool OST[0-$poolostrange] ||
10675 "failed to remove OST[0-$poolostrange] from the pool"
10676 do_facet mgs $LCTL pool_destroy $FSNAME.$pool ||
10677 error "failed to destroy pool"
10679 run_test 133 "stripe QOS: free space balance in a pool"
10682 [ "$mds1_FSTYPE" == "ldiskfs" ] || skip "ldiskfs only test"
10685 local mdt_dev=$(facet_device mds1)
10686 local tmp_dir=$TMP/$tdir
10687 local out=$tmp_dir/check_iam.txt
10688 local CHECK_IAM=${CHECK_IAM:-$(do_facet mds1 "which check_iam 2> /dev/null || true")}
10690 [[ -n "$CHECK_IAM" ]] || skip "check_iam not found"
10693 for ((i=0; i<64; i++)); do
10695 #cmd introduce a random corruption to IAM file
10696 local cmd="dd if=/dev/urandom of=$tmp_dir/$f bs=2 conv=notrunc count=1 seek=$((RANDOM % 36))"
10697 do_facet mds1 "mkdir -p $tmp_dir; \
10698 $DEBUGFS -c -R 'dump $f $tmp_dir/$f' $mdt_dev 2>&1; \
10699 $CHECK_IAM -v $tmp_dir/$f 2>&1; \
10700 echo $cmd; eval $cmd 2>/dev/null;
10701 $CHECK_IAM -v $tmp_dir/$f 2>&1; echo \\\$?" >> $out 2>&1
10706 stack_trap "rm -rf $tmp_dir && do_facet mds1 rm -rf $tmp_dir" EXIT
10708 rc=$(grep -c "fault\|except" $out)
10709 (( rc == 0 )) || { cat $out &&
10710 error "check_iam failed with fault or exception $rc"; }
10712 rc=$(grep -c "^255" $out)
10713 errors=$(grep -c "FINISHED WITH ERRORS" $out)
10715 (( rc == errors )) || { cat $out &&
10716 error "check_iam errcode does not fit with errors $rc $errors"; }
10718 run_test 134 "check_iam works without faults"
10720 cleanup_test_135(){
10723 printf "\nCleanup test_135\n" >&2
10724 do_facet mds1 "$LCTL set_param -n $oldgc"
10725 rm -rf $DIR/$tdir &> /dev/null
10729 __test_135_file_thread() {
10731 local init_time=$(awk '{print $1}' /proc/uptime)
10732 local awkcmd="/crosses index zero/ {if (\$1 > $init_time) exit(1);}"
10734 #Generate a full plain llogs
10735 while dmesg | sed -r 's/(\[|\])//g' | awk "$awkcmd" ; do
10736 createmany -o $DIR/$tdir/f 4500 >&2
10737 createmany -u $DIR/$tdir/f 4500 >&2
10741 __test_135_reader() {
10744 local firstidx=$(changelog_user_rec mds1 $cl_user)
10745 local oldidx=$firstidx
10750 while read -t10 -u$fd newidx other; do
10751 (( (newidx - oldidx) == 1 )) ||
10752 error "changelog jump detected (last: $oldidx, current: $newidx)"
10754 if (( (newidx - firstidx + 1) % 13000 == 0 )); then
10755 [[ $pid -eq 0 ]] ||
10756 wait $pid || error "changelog_clear failed"
10757 changelog_clear $((newidx - 1)) mds1 >&2 & pid=$!
10762 [[ $pid -eq 0 ]] ||
10763 wait $pid || error "changelog_clear failed"
10769 (( MDS1_VERSION >= $(version_code 2.15.52) )) ||
10770 skip "need MDS version at least 2.15.52"
10772 local service=$(facet_svc mds1)
10774 local lastread lastidx
10775 local files_pid reader_pid
10780 # Need to reformat because we are changing llog catalog sizes to 5.
10781 # Otherwise, processing could fail with existing catalogs (last_idx>5).
10785 # Disable changelog garbage colector
10786 local oldgc=$(do_facet mds1 "$LCTL get_param mdd.${service}.changelog_gc")
10787 do_facet mds1 "$LCTL set_param -n mdd.${service}.changelog_gc=0"
10788 stack_trap "cleanup_test_135 $oldgc" EXIT INT
10790 # change the changelog_catalog size to 5 entries for everybody
10791 #define OBD_FAIL_CAT_RECORDS 0x1312
10792 do_node $(comma_list $(all_nodes)) $LCTL set_param fail_loc=0x1312 fail_val=5
10794 # disable console ratelimit
10795 local rl=$(cat /sys/module/libcfs/parameters/libcfs_console_ratelimit)
10796 echo 0 > /sys/module/libcfs/parameters/libcfs_console_ratelimit
10797 stack_trap "echo $rl > /sys/module/libcfs/parameters/libcfs_console_ratelimit" EXIT
10799 test_mkdir -c 1 -i 0 $DIR/$tdir || error "Failed to create directory"
10800 changelog_chmask "ALL" || error "changelog_chmask failed"
10801 changelog_register || error "changelog_register failed"
10803 cl_user="${CL_USERS[mds1]%% *}"
10804 changelog_users mds1 | grep -q $cl_user ||
10805 error "User $cl_user not found in changelog_users"
10807 # Start reader thread
10808 coproc $LFS changelog --follow $service
10811 stack_trap "echo kill changelog reader; kill $reader_pid" EXIT
10813 echo -e "\nWrap arround changelog catalog"
10815 # Start file writer thread
10816 __test_135_file_thread "$service" & files_pid=$!
10817 stack_trap "(pkill -P$files_pid; kill $files_pid) &> /dev/null || true" EXIT
10819 # Check changelog entries
10820 lastread=$(__test_135_reader $fd $cl_user) || exit $?
10821 ! kill -0 $files_pid 2>/dev/null ||
10822 error "creation thread is running. Is changelog reader stuck?"
10824 lastidx=$(changelog_users mds1 | awk '/current_index/ {print $NF}' )
10825 [[ "$lastread" -eq "$lastidx" ]] ||
10826 error "invalid changelog lastidx (read: $lastread, mds: $lastidx)"
10828 run_test 135 "check the behavior when changelog is wrapped around"
10831 do_facet mds2 "$LCTL --device ec cleanup" || true
10832 do_facet mds2 "$LCTL --device ec detach" || true
10835 reformat_and_config
10839 (( MDSCOUNT >= 2 )) || skip "needs >= 2 MDTs"
10844 do_facet mds2 "$LCTL attach echo_client ec ec_uuid" ||
10845 error "echo attach fail"
10847 stack_trap cleanup_136 EXIT
10849 do_facet mds2 "$LCTL --device ec setup lustre-MDT0001 mdt" &&
10850 error "attach to MDT should fail!"
10852 do_facet mds2 "$LCTL --device ec setup lustre-MDT0001 mdd" ||
10853 error "attach to MDD should OK"
10854 do_facet mds2 "$LCTL --device ec test_mkdir /tt" &&
10855 error "mkdir test should fail with remote object"
10859 run_test 136 "don't panic with bad obdecho setup"
10861 wait_osp_import() {
10863 local remtgt=$(facet_svc $2)
10865 local loctgt=$(facet_svc $facet)
10866 local param="osp.$remtgt-os[pc]-${loctgt#*-}.*_server_uuid"
10868 do_rpc_nodes "$(facet_active_host $facet)" \
10869 wait_import_state $expected $param ||
10870 error "$param: import is not in expected state"
10874 (( MDS1_VERSION >= $(version_code 2.15.61) )) ||
10875 skip "need MDS version at least 2.15.61"
10877 (( $MDSCOUNT >= 3 )) || skip "needs >= 3 MDTs"
10879 local failnode=1.2.3.4@$NETTYPE
10880 local keep_zpool=$KEEP_ZPOOL
10883 #start mgs or mgs/mdt0
10884 if ! combined_mgs_mds ; then
10885 start_mgs || error "Fail to register mgs"
10886 start_mdt 1 || error "Fail to register mds1"
10888 start_mdt 1 || error "Fail to register mds1"
10891 start_ost || error "OST0 start fail"
10893 mount_client $MOUNT || error "mount client fails"
10894 wait_osc_import_ready client ost
10895 check_mount || error "check_mount failed"
10897 # Add failover node on OST0000
10899 [ "$ost1_FSTYPE" == zfs ] && import_zpool ost1
10900 do_facet ost1 "$TUNEFS --failnode=$failnode $(ostdevname 1)" ||
10901 error "ost1 tunefs failed"
10902 start_ost || error "OST0 start fail"
10904 # Add pool and parameters on MDT0000 to check the inheritance
10905 do_facet mgs $LCTL pool_new $FSNAME.pool1 || error "pool_new failed"
10906 do_facet mgs $LCTL pool_add $FSNAME.pool1 OST0000 ||
10907 error "pool_add failed"
10909 set_conf_param_and_check mds1 \
10910 "$LCTL get_param -n lod.$FSNAME-MDT0000*.dom_stripesize" \
10911 "$FSNAME-MDT0000.lod.dom_stripesize" \
10914 start_mdt 2 || error "Fail to register mds2"
10916 wait_osp_import mds1 mds2 FULL
10917 wait_osp_import mds2 mds1 FULL
10918 wait_osp_import mds2 ost1 FULL
10920 # Add failover node on MDT0001
10921 stop_mdt 2 || error "Fail to umount mds2"
10922 [ "$mds1_FSTYPE" == zfs ] && import_zpool mds2
10923 do_facet mds2 "$TUNEFS --failnode=$failnode $(mdsdevname 2)" ||
10924 error "mds2 tunefs failed"
10925 start_mdt 2 || error "Fail to mount mds2"
10927 wait_osp_import mds1 mds2 FULL
10928 wait_osp_import mds2 mds1 FULL
10929 wait_osp_import mds2 ost1 FULL
10932 for ((i=3; i <= MDSCOUNT; i++)); do
10933 start_mdt $i || error "Fail to register mds$i"
10936 wait_osc_import_state mds ost FULL
10938 for ((i=2; i <= MDSCOUNT; i++)); do
10941 local tgt=$(facet_svc $facet)
10942 local lod="lod.$tgt*"
10944 wait_osp_active mds $tgt $(( i - 1 )) 1
10946 do_facet $facet $LCTL get_param -n $lod.pools.pool1 |
10947 grep -q "OST0000" || error "pool1 should be inherited"
10949 val=$(do_facet $facet $LCTL get_param -n $lod.dom_stripesize)
10950 (( val == (2<<20) )) ||
10951 error "dom_stripesize should be inherited"
10953 import="osc.$FSNAME-OST0000-osc-${tgt#*-}.import"
10954 do_facet $facet $LCTL get_param -n $import |
10955 grep -q "failover_nids:.*$failnode" ||
10956 error "$failnode not found in $import"
10958 [[ "${tgt#*-}" != MDT0001 ]] || continue
10960 import="osp.$FSNAME-MDT0001-osp-${tgt#*-}.import"
10961 do_facet $facet $LCTL get_param -n $import |
10962 grep -q "failover_nids:.*$failnode" ||
10963 error "$failnode not found in $import"
10966 cleanup || error "cleanup failed with rc $?"
10967 reformat_and_config
10969 run_test 137 "a new MDT should inherit pools, parameters and failnode"
10972 (( MDS1_VERSION >= $(version_code 2.15.55) )) ||
10973 skip "need MDS version at least 2.15.55"
10974 (( MDSCOUNT >= 2 )) || skip "needs >= 2 MDTs"
10976 RM_UPDATELOG=$(do_facet mds2 "which remove_updatelog 2> /dev/null")
10977 RM_UPDATELOG=${RM_UPDATELOG:-"$LUSTRE/scripts/remove_updatelog"}
10979 [ -f "$RM_UPDATELOG" ] ||
10980 skip_env "remove_updatelog is not found on mds2"
10982 local mntpt=$(facet_mntpt mds2)
10985 test_mkdir -c $MDSCOUNT -p $DIR/$tdir ||
10986 error "mkdir $DIR/$tdir failed"
10987 mkdir $DIR/$tdir/d{1..256}
10992 mount_fstype mds2 || error "mount as fstype mds2 failed"
10993 do_facet mds2 $RM_UPDATELOG -n $mntpt
10994 MDTS=($(do_facet mds2 $RM_UPDATELOG -n $mntpt |
10995 grep -o "Processing MDT[0-9]*" | awk -F'MDT' '{print $2}'))
10996 (( ${#MDTS[@]} == MDSCOUNT )) ||
10997 error "Processed ${#MDTS[@]} from $MDSCOUNT"
10999 do_facet mds2 $RM_UPDATELOG -n -m 1,0 $mntpt
11000 MDTS=($(do_facet mds2 $RM_UPDATELOG -n -m 1,0 $mntpt |
11001 grep -o "Processing MDT[0-9]*" | awk -F'MDT' '{print $2}'))
11002 (( ${#MDTS[@]} == 2 )) ||
11003 error "Processed ${#MDTS[@]} instead of 2"
11004 (( ${MDTS[0]} == 1 && ${MDTS[1]} == 0 )) ||
11005 error "Processed: ${MDTS[*]}, expected: 1 0"
11007 do_facet mds2 $RM_UPDATELOG -m 0 $mntpt
11008 unmount_fstype mds2
11009 start_mdt 2 || error "mds2 start fail"
11010 start_mdt 1 || error "mds1 start fail"
11011 wait_clients_import_state ${CLIENTS:-$HOSTNAME} mds1 FULL
11012 wait_clients_import_state ${CLIENTS:-$HOSTNAME} mds2 FULL
11014 rm -rf $DIR/$tdir || error "Can't remove $tdir"
11016 reformat_and_config
11018 run_test 140 "remove_updatelog script actions"
11023 local max_cached_mb=$($LCTL get_param llite.*.max_cached_mb |
11024 awk '/^max_cached_mb/ { print $2 }')
11025 stack_trap "$LCTL set_param -n llite.*.max_cached_mb=$max_cached_mb"
11027 $LCTL set_param llite.*.max_cached_mb='100%'
11029 local new_max_cached_mb=$($LCTL get_param llite.*.max_cached_mb |
11030 awk '/^max_cached_mb/ { print $2 }')
11031 local total_ram_mb=$(free -m | grep 'Mem:' | awk '{print $2}')
11033 $LCTL get_param llite.*.max_cached_mb
11034 echo "total ram mb: $total_ram_mb"
11035 (( new_max_cached_mb == total_ram_mb )) ||
11036 error "setting cache to 100% not equal to total RAM"
11038 $LCTL set_param llite.*.max_cached_mb='50%'
11039 new_max_cached_mb=$($LCTL get_param llite.*.max_cached_mb |
11040 awk '/^max_cached_mb/ { print $2 }')
11042 $LCTL get_param llite.*.max_cached_mb
11043 (( new_max_cached_mb == $((total_ram_mb / 2)) )) ||
11044 error "setting cache to 50% not equal to 50% of RAM"
11046 $LCTL set_param llite.*.max_cached_mb='105%' &&
11047 error "should not be able to set insane value"
11049 $LCTL set_param llite.*.max_cached_mb='0%'
11050 new_max_cached_mb=$($LCTL get_param llite.*.max_cached_mb |
11051 awk '/^max_cached_mb/ { print $2 }')
11052 # Minimum cache size is 64 MiB
11053 $LCTL get_param llite.*.max_cached_mb
11054 (( new_max_cached_mb == 64 )) ||
11055 error "setting cache to 0% != minimum cache size"
11057 run_test 150 "test setting max_cached_mb to a %"
11060 (( MDS1_VERSION >= $(version_code 2.15.58) )) ||
11061 skip "need MDS version at least 2.15.58"
11062 [[ "$ost1_FSTYPE" == ldiskfs ]] || skip "ldiskfs only test"
11065 if ! combined_mgs_mds ; then
11069 echo "Damage ost1 local config log"
11070 do_facet ost1 "$DEBUGFS -w -R 'punch CONFIGS/$FSNAME-OST0000 0 1' \
11071 $(ostdevname 1) || return \$?" ||
11072 error "do_facet ost1 failed with $?"
11074 # expect OST to fail mount with no MGS and bad local config
11075 start_ost && error "OST start should fail"
11077 if ! combined_mgs_mds ; then
11080 start_mds || error "MDS start failed"
11081 # now it should start with MGS config
11082 start_ost || error "OST start failed"
11083 reformat_and_config
11085 run_test 151 "damaged local config doesn't prevent mounting"
11088 (( MDS1_VERSION >= $(version_code 2.15.59.53) )) ||
11089 skip "need MDS >= 2.15.59.53 for sequence allocation retry"
11090 (( MDSCOUNT >= 2 )) || skip "needs >= 2 MDTs"
11091 local tf=$DIR/$tdir/$tfile
11092 local nost=$((OSTCOUNT+1))
11093 local nostdevname=$(ostdevname $nost)
11096 test_mkdir -i 1 -c1 $DIR/$tdir || error "can't mkdir"
11099 add ost$nost $(mkfs_opts ost1 $nostdevname) --index=$nost \
11100 --reformat $nostdevname $(ostvdevname $nost)
11101 [[ -d "$nostdevname" ]] || stack_trap "do_facet mds1 rm -f $nostdevname"
11103 #define OBD_FAIL_OPS_FAIL_SEQ_ALLOC 0x2109
11104 do_facet mds1 $LCTL set_param fail_loc=0x80002109 fail_val=2
11105 echo "START OST$nost"
11106 stack_trap "stop ost$nost"
11107 start ost$nost $nostdevname $OST_MOUNT_OPTS &
11111 $LFS setstripe -c -1 $tf &
11115 log "STOP OST$nost"
11116 # probably mount hasn't completed yet, so stop races with it
11119 jobs -pr | grep -E "^$PID\$" && sleep 0.5 && continue
11124 do_facet mds1 $LCTL set_param fail_loc=0
11125 log "START OST$nost again"
11126 start ost$nost $nostdevname $OST_MOUNT_OPTS ||
11127 error "can't start ost$nost"
11129 $LFS setstripe -c -1 $tf-2 || error "can't touch $tf-2"
11130 $LFS getstripe -v $tf-2
11131 local stripes=$($LFS getstripe -c $tf-2)
11132 (( stripes == $nost )) || error "$tf-2 $stripes != $nost"
11134 run_test 152 "seq allocation error in OSP"
11137 reformat_and_config
11139 start_mds || error "MDS start failed"
11140 start_ost || error "OST start failed"
11142 local nid=$($LCTL list_nids | grep ${NETTYPE} | head -n1)
11143 local net=${nid#*@}
11144 local MGS_NID=$(do_facet mgs $LCTL list_nids | head -1)
11145 local OST1_NID=$(do_facet ost1 $LCTL list_nids | head -1)
11146 local FAKE_PNID="192.168.252.112@${net}"
11147 local FAKE_NIDS="${FAKE_PNID},${FAKE_PNID}2"
11148 local FAKE_FAILOVER="10.252.252.113@${net},10.252.252.113@${net}2"
11149 local NIDS_AND_FAILOVER="$FAKE_NIDS:$FAKE_FAILOVER:$OST1_NID:$MGS_NID"
11154 mount -t lustre $NIDS_AND_FAILOVER:/lustre $MOUNT &
11156 while (( period < 30 )); do
11157 [[ -n "$(ps -p $pid -o pid=)" ]] || break
11158 echo "waiting for mount ..."
11160 period=$((period + 5))
11162 $LCTL get_param mgc.MGC${FAKE_PNID}.import | grep "uptodate:"
11163 check_mount || error "check_mount failed"
11165 cleanup || error "cleanup failed with rc $?"
11167 run_test 153a "bypass invalid NIDs quickly"
11170 # (This was sanity/802a)
11172 saved_MGS_MOUNT_OPTS=$MGS_MOUNT_OPTS
11173 saved_MDS_MOUNT_OPTS=$MDS_MOUNT_OPTS
11174 saved_OST_MOUNT_OPTS=$OST_MOUNT_OPTS
11175 saved_MOUNT_OPTS=$MOUNT_OPTS
11179 MGS_MOUNT_OPTS=$saved_MGS_MOUNT_OPTS
11180 MDS_MOUNT_OPTS=$saved_MDS_MOUNT_OPTS
11181 OST_MOUNT_OPTS=$saved_OST_MOUNT_OPTS
11182 MOUNT_OPTS=$saved_MOUNT_OPTS
11187 [[ $mds1_FSTYPE = zfs ]] || skip "ZFS specific test"
11188 [[ $MDS1_VERSION -lt $(version_code 2.9.55) ]] ||
11189 [[ $OST1_VERSION -lt $(version_code 2.9.55) ]] &&
11190 skip "Need server version at least 2.9.55"
11192 [[ $ENABLE_QUOTA ]] && skip "Quota enabled for read-only test"
11194 # Reset before starting
11198 mkdir $DIR/$tdir || error "(1) fail to mkdir"
11200 cp $LUSTRE/tests/test-framework.sh $DIR/$tdir/ ||
11201 error "(2) Fail to copy"
11203 stack_trap cleanup_802a EXIT
11205 # sync by force before remount as readonly
11206 sync; sync_all_data; sleep 3; sync_all_data
11210 MGS_MOUNT_OPTS=$(csa_add "$MGS_MOUNT_OPTS" -o rdonly_dev)
11211 MDS_MOUNT_OPTS=$(csa_add "$MDS_MOUNT_OPTS" -o rdonly_dev)
11212 OST_MOUNT_OPTS=$(csa_add "$OST_MOUNT_OPTS" -o rdonly_dev)
11214 echo "Mount the server as read only"
11215 setupall server_only || error "(3) Fail to start servers"
11217 echo "Mount client without ro should fail"
11218 mount_client $MOUNT &&
11219 error "(4) Mount client without 'ro' should fail"
11221 echo "Mount client with ro should succeed"
11222 MOUNT_OPTS=$(csa_add "$MOUNT_OPTS" -o ro)
11223 mount_client $MOUNT ||
11224 error "(5) Mount client with 'ro' should succeed"
11226 echo "Modify should be refused"
11227 touch $DIR/$tdir/guard && error "(6) Touch should fail under ro mode"
11229 echo "Read should be allowed"
11230 diff $LUSTRE/tests/test-framework.sh $DIR/$tdir/test-framework.sh ||
11231 error "(7) Read should succeed under ro mode"
11233 run_test 802a "simulate readonly device"
11235 if ! combined_mgs_mds ; then
11241 # restore the values of MDSSIZE and OSTSIZE
11242 MDSSIZE=$STORED_MDSSIZE
11243 OSTSIZE=$STORED_OSTSIZE
11246 complete_test $SECONDS
11247 check_and_cleanup_lustre