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)"
7030 "-o recovery_time_hard=$time_min,recovery_time_soft=$time_min" $@ ||
7031 error "start MDS failed"
7033 start_ost || error "start OST0000 failed"
7034 wait_osc_import_state mds ost1 FULL
7035 start_ost2 || error "start OST0001 failed"
7036 wait_osc_import_state mds ost2 FULL
7038 echo "recovery_time=$time_min, timeout=$TIMEOUT, wrap_up=$wrap_up"
7040 mount_client $MOUNT1 || error "mount $MOUNT1 failed"
7041 mount_client $MOUNT2 || error "mount $MOUNT2 failed"
7042 # make sure new superblock labels are sync'd before disabling writes
7046 replay_barrier $SINGLEMDS
7047 createmany -o $DIR1/$tfile-%d 1000
7049 # We need to catch the end of recovery window to extend it.
7050 # Skip 5 requests and add delay to request handling.
7051 #define OBD_FAIL_TGT_REPLAY_DELAY 0x709 | FAIL_SKIP
7052 do_facet $SINGLEMDS "lctl set_param fail_loc=0x20000709 fail_val=5"
7054 facet_failover --fsck $SINGLEMDS || error "failover: $?"
7057 echo "recovery status"
7058 do_facet $SINGLEMDS \
7059 "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status"
7061 recovery_duration=$(do_facet $SINGLEMDS \
7062 "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status" |
7063 awk '/recovery_duration/ { print $2 }')
7064 (( $recovery_duration > $time_min + $wrap_up )) &&
7065 error "recovery_duration > recovery_time_hard + wrap up"
7066 completed_clients=$(do_facet $SINGLEMDS \
7067 "$LCTL get_param -n mdt.$FSNAME-MDT0000.recovery_status" |
7068 awk '/completed_clients/ { print $2 }')
7070 correct_clients="$MDSCOUNT/$((MDSCOUNT+1))"
7071 [ "$completed_clients" = "${correct_clients}" ] ||
7072 error "$completed_clients != $correct_clients"
7074 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
7075 umount_client $MOUNT1
7076 umount_client $MOUNT2
7082 run_test 84 "check recovery_hard_time"
7085 [[ "$OST1_VERSION" -ge $(version_code 2.7.55) ]] ||
7086 skip "Need OST version at least 2.7.55"
7087 ##define OBD_FAIL_OSD_OST_EA_FID_SET 0x197
7088 do_facet ost1 "lctl set_param fail_loc=0x197"
7092 run_test 85 "osd_ost init: fail ea_fid_set"
7097 # ost1 has already registered to the MGS before the reformat.
7098 # So after reformatting it with option "-G", it could not be
7099 # mounted to the MGS. Cleanup the system for subsequent tests.
7104 [ "$ost1_FSTYPE" = zfs ] &&
7105 skip "LU-6442: no such mkfs params for ZFS OSTs"
7106 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
7107 skip "Need server version newer than 2.7.55"
7110 local OLDSIZE=$(do_facet ost1 "$DEBUGFS -c -R stats $(ostdevname 1)" |
7111 awk '/Flex block group size: / { print $NF; exit; }')
7113 [ "$OLDSIZE" == "$NEWSIZE" ] && skip "$NEWSIZE groups already"
7115 local opts=" -O flex_bg -G $NEWSIZE"
7116 opts=$(OST_FS_MKFS_OPTS+="$opts" mkfs_opts ost1 $(ostdevname 1))
7117 opts+=" --reformat $(ostdevname 1) $(ostvdevname 1)"
7118 echo "params: $opts"
7120 trap cleanup_86 EXIT ERR
7123 add ost1 $opts || error "add ost1 failed with new params"
7125 local FOUNDSIZE=$(do_facet ost1 "$DEBUGFS -c -R stats $(ostdevname 1)" |
7126 awk '/Flex block group size: / { print $NF; exit; }')
7128 [[ $FOUNDSIZE == $NEWSIZE ]] ||
7129 error "Flex block group size: $FOUNDSIZE, expected: $NEWSIZE"
7133 run_test 86 "Replacing mkfs.lustre -G option"
7135 test_87() { #LU-6544
7136 [[ "$MDS1_VERSION" -ge $(version_code 2.9.51) ]] ||
7137 skip "Need MDS version at least 2.9.51"
7138 [[ "$mds1_FSTYPE" != ldiskfs ]] &&
7139 skip "ldiskfs only test"
7140 [[ $OSTCOUNT -gt 59 ]] &&
7141 skip "Ignore wide striping situation"
7142 [ -n "$FILESET" ] && skip "Not functional for FILESET set"
7144 local mdsdev=$(mdsdevname 1)
7145 local mdsvdev=$(mdsvdevname 1)
7146 local file=$DIR/$tfile
7147 local mntpt=$(facet_mntpt $SINGLEMDS)
7148 local used_xattr_blk=0
7149 local inode_size=${1:-1024}
7151 local xtest="trusted.test"
7155 local stripe_cnt=$(($OSTCOUNT + 2))
7157 #Please see ldiskfs_make_lustre() for MDT inode size calculation
7158 if [ $stripe_cnt -gt 16 ]; then
7161 left_size=$(expr $inode_size - \
7164 32 - 40 \* 3 - 32 \* 3 - $stripe_cnt \* 24 - 16 - 3 - \
7166 24 - 18 - $(expr length $tfile) - 16 - 4)
7167 if [ $left_size -le 0 ]; then
7168 echo "No space($left_size) is expected in inode."
7169 echo "Try 1-byte xattr instead to verify this."
7172 echo "Estimate: at most $left_size-byte space left in inode."
7178 if ! combined_mgs_mds ; then
7182 add mds1 $(mkfs_opts mds1 ${mdsdev}) --stripe-count-hint=$stripe_cnt \
7183 --reformat $mdsdev $mdsvdev || error "add mds1 failed"
7184 start_mdt 1 > /dev/null || error "start mdt1 failed"
7185 for i in $(seq $OSTCOUNT); do
7186 start ost$i $(ostdevname $i) $OST_MOUNT_OPTS > /dev/null ||
7187 error "start ost$i failed"
7189 mount_client $MOUNT > /dev/null || error "mount client $MOUNT failed"
7190 check_mount || error "check client $MOUNT failed"
7193 $LFS setstripe -E 1M -S 1M -c 1 -E 64M -c 1 -E -1 -c -1 $file ||
7194 error "Create file with 3 components failed"
7195 $TRUNCATE $file $((1024*1024*64+1)) || error "truncate file failed"
7196 i=$($LFS getstripe -I3 -c $file) || error "get 3rd stripe count failed"
7197 if [ $i -ne $OSTCOUNT ]; then
7198 left_size=$(expr $left_size + $(expr $OSTCOUNT - $i) \* 24)
7199 echo -n "Since only $i out $OSTCOUNT OSTs are used, "
7200 echo -n "the expected left space is changed to "
7201 echo "$left_size bytes at most."
7203 value=$(generate_string $left_size)
7204 setfattr -n $xtest -v $value $file
7205 orig=$(get_xattr_value $xtest $file)
7206 [[ "$orig" != "$value" ]] && error "$xtest changed"
7208 #Verify if inode has some expected space left
7209 umount $MOUNT > /dev/null || error "umount $MOUNT failed"
7210 stop_mdt 1 > /dev/null || error "stop mdt1 failed"
7211 mount_ldiskfs $SINGLEMDS || error "mount -t ldiskfs $SINGLEMDS failed"
7213 do_facet $SINGLEMDS ls -sal $mntpt/ROOT/$tfile
7214 used_xattr_blk=$(do_facet $SINGLEMDS ls -s $mntpt/ROOT/$tfile |
7216 [[ $used_xattr_blk -eq 0 ]] &&
7217 error "Please check MDS inode size calculation: \
7218 more than $left_size-byte space left in inode."
7219 echo "Verified: at most $left_size-byte space left in inode."
7221 unmount_ldiskfs $SINGLEMDS
7223 for i in $(seq $OSTCOUNT); do
7224 stop ost$i -f || error "stop ost$i failed"
7227 run_test 87 "check if MDT inode can hold EAs with N stripes properly"
7230 [ "$mds1_FSTYPE" == zfs ] &&
7231 skip "LU-6662: no implementation for ZFS"
7235 add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) \
7236 --reformat $(mdsdevname 1) || error "add mds1 failed"
7238 do_facet mds1 "$TUNEFS $(mdsdevname 1) |
7239 grep -e \".*opts:.*errors=remount-ro.*\"" ||
7240 error "default mount options is missing"
7242 add mds1 $(mkfs_opts mds1 $(mdsdevname 1)) \
7243 --mountfsoptions="user_xattr,errors=panic" \
7244 --reformat $(mdsdevname 1) || error "add mds1 failed"
7246 do_facet mds1 "$TUNEFS $(mdsdevname 1) |
7247 grep -e \".*opts:.*errors=panic.*\"" ||
7248 error "user can't override default mount options"
7250 run_test 88 "check the default mount options can be overridden"
7252 test_89() { # LU-7131
7253 [[ "$MDS1_VERSION" -ge $(version_code 2.9.54) ]] ||
7254 skip "Need MDT version at least 2.9.54"
7256 local key=failover.node
7257 local val1=192.0.2.254@tcp0 # Reserved IPs, see RFC 5735
7258 local val2=192.0.2.255@tcp0
7259 local mdsdev=$(mdsdevname 1)
7264 if [[ "$mds1_FSTYPE" == zfs ]]; then
7265 import_zpool mds1 || return ${PIPESTATUS[0]}
7268 # Check that parameters are added correctly
7269 echo "tunefs --param $key=$val1"
7270 do_facet mds1 "$TUNEFS --param $key=$val1 $mdsdev >/dev/null" ||
7271 error "tunefs --param $key=$val1 failed"
7272 params=$(do_facet mds1 $TUNEFS --dryrun $mdsdev) ||
7273 error "tunefs --dryrun failed"
7274 params=${params##*Parameters:}
7275 params=${params%%exiting*}
7276 [ $(echo $params | tr ' ' '\n' | grep -c $key=$val1) = "1" ] ||
7277 error "on-disk parameter not added correctly via tunefs"
7279 # Check that parameters replace existing instances when added
7280 echo "tunefs --param $key=$val2"
7281 do_facet mds1 "$TUNEFS --param $key=$val2 $mdsdev >/dev/null" ||
7282 error "tunefs --param $key=$val2 failed"
7283 params=$(do_facet mds1 $TUNEFS --dryrun $mdsdev) ||
7284 error "tunefs --dryrun failed"
7285 params=${params##*Parameters:}
7286 params=${params%%exiting*}
7287 [ $(echo $params | tr ' ' '\n' | grep -c $key=) = "1" ] ||
7288 error "on-disk parameter not replaced via tunefs"
7289 [ $(echo $params | tr ' ' '\n' | grep -c $key=$val2) = "1" ] ||
7290 error "on-disk parameter not replaced correctly via tunefs"
7292 # Check that a parameter is erased properly
7293 echo "tunefs --erase-param $key"
7294 do_facet mds1 "$TUNEFS --erase-param $key $mdsdev >/dev/null" ||
7295 error "tunefs --erase-param $key failed"
7296 params=$(do_facet mds1 $TUNEFS --dryrun $mdsdev) ||
7297 error "tunefs --dryrun failed"
7298 params=${params##*Parameters:}
7299 params=${params%%exiting*}
7300 [ $(echo $params | tr ' ' '\n' | grep -c $key=) = "0" ] ||
7301 error "on-disk parameter not erased correctly via tunefs"
7303 # Check that all the parameters are erased
7304 do_facet mds1 "$TUNEFS --param $key=$val1 $mdsdev >/dev/null" ||
7305 error "tunefs --param $key=$val1 failed"
7306 echo "tunefs --erase-params"
7307 do_facet mds1 "$TUNEFS --erase-params $mdsdev >/dev/null" ||
7308 error "tunefs --erase-params failed"
7309 params=$(do_facet mds1 $TUNEFS --dryrun $mdsdev) ||
7310 error "tunefs --dryrun failed"
7311 params=${params##*Parameters:}
7312 params=${params%%exiting*}
7313 params=$(echo $params | tr ' ' '\n')
7315 error "all on-disk parameters not erased correctly via tunefs $params"
7317 # Check the order of options --erase-params and --param
7318 echo "tunefs --param $key=$val1 --erase-params"
7320 "$TUNEFS --param $key=$val1 --erase-params $mdsdev >/dev/null"||
7321 error "tunefs --param $key=$val1 --erase-params failed"
7322 params=$(do_facet mds1 $TUNEFS --dryrun $mdsdev) ||
7323 error "tunefs --dryrun failed"
7324 params=${params##*Parameters:}
7325 params=${params%%exiting*}
7326 [ $(echo $params | tr ' ' '\n') == "$key=$val1" ] ||
7327 error "on-disk param not added correctly with --erase-params"
7331 run_test 89 "check tunefs --param and --erase-param{s} options"
7334 # $2 (optional) value of max_mod_rpcs_in_flight to set
7335 check_max_mod_rpcs_in_flight() {
7343 idx=$(printf "%04x" $($LFS getdirstripe -i $dir))
7344 facet="mds$((0x$idx + 1))"
7346 if [ -z "$mmr" ]; then
7347 # get value of max_mod_rcps_in_flight
7348 mmr=$($LCTL get_param -n \
7349 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight) ||
7350 error "Unable to get max_mod_rpcs_in_flight"
7351 echo "max_mod_rcps_in_flight is $mmr"
7353 # set value of max_mod_rpcs_in_flight
7355 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight=$mmr ||
7356 error "Unable to set max_mod_rpcs_in_flight to $mmr"
7357 echo "max_mod_rpcs_in_flight set to $mmr"
7360 # create mmr+1 files
7361 echo "creating $((mmr + 1)) files ..."
7363 for i in $(seq $((mmr + 1))); do
7369 # consumes mmr-1 modify RPC slots
7370 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
7371 # drop requests on MDT so that RPC slots are consumed
7372 # during all the request resend interval
7373 do_facet $facet "$LCTL set_param fail_loc=0x159"
7374 echo "launch $((mmr - 1)) chmod in parallel ..."
7375 for i in $(seq $((mmr - 1))); do
7376 chmod 0600 $dir/file-$i &
7380 # send one additional modify RPC
7381 do_facet $facet "$LCTL set_param fail_loc=0"
7382 echo "launch 1 additional chmod in parallel ..."
7383 chmod 0600 $dir/file-$mmr &
7386 # check this additional modify RPC get a modify RPC slot
7387 # and succeed its operation
7388 checkstat -vp 0600 $dir/file-$mmr ||
7389 error "Unable to send $mmr modify RPCs in parallel"
7394 # consumes mmr modify RPC slots
7395 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
7396 # drop requests on MDT so that RPC slots are consumed
7397 # during all the request resend interval
7398 do_facet $facet "$LCTL set_param fail_loc=0x159"
7399 echo "launch $mmr chmod in parallel ..."
7400 for i in $(seq $mmr); do
7401 chmod 0666 $dir/file-$i &
7405 # send one additional modify RPC
7406 do_facet $facet "$LCTL set_param fail_loc=0"
7407 echo "launch 1 additional chmod in parallel ..."
7408 chmod 0666 $dir/file-$((mmr + 1)) &
7411 # check this additional modify RPC blocked getting a modify RPC slot
7412 checkstat -vp 0644 $dir/file-$((mmr + 1)) ||
7413 error "Unexpectedly send $(($mmr + 1)) modify RPCs in parallel"
7417 get_mdt_max_mod_rpcs_in_flight_val() {
7421 # It will be enough to get one value from one MDT
7422 max_mrif=$(do_facet $facet \
7423 "$LCTL get_param -n \
7424 mdt.$FSNAME-MDT*.max_mod_rpcs_in_flight | head -n 1")
7425 if [[ $max_mrif ]]; then
7428 max_mrif=$(do_facet $facet \
7429 cat /sys/module/mdt/parameters/max_mod_rpcs_per_client)
7434 set_mdt_max_mod_rpcs_in_flight() {
7439 lctl_op=$($LCTL get_param \
7440 mdt.*.max_mod_rpcs_in_flight)
7441 if [[ $lctl_op ]]; then
7444 mdt.$FSNAME-MDT*.max_mod_rpcs_in_flight=$max_mrif"
7448 /sys/module/mdt/parameters/max_mod_rpcs_per_client"
7449 echo "the deprecated max_mod_rpcs_per_client \
7450 parameter was involved"
7457 [[ $($LCTL get_param mdc.*.import |
7458 grep "connect_flags:.*multi_mod_rpc") ]] ||
7459 skip "Need MDC with 'multi_mod_rpcs' feature"
7461 # check default value
7462 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
7463 check_max_mod_rpcs_in_flight $DIR/$tdir
7467 run_test 90a "check max_mod_rpcs_in_flight is enforced"
7477 [[ $($LCTL get_param mdc.*.import |
7478 grep "connect_flags:.*multi_mod_rpc") ]] ||
7479 skip "Need MDC with 'multi_mod_rpcs' feature"
7482 # update max_mod_rpcs_in_flight
7483 $LFS mkdir -c1 $DIR/${tdir}1 || error "mkdir $DIR/${tdir}1 failed"
7484 check_max_mod_rpcs_in_flight $DIR/${tdir}1 1
7487 # check client is able to send multiple modify RPCs in paralell
7488 tmp=$($LCTL get_param -n mdc.$FSNAME-MDT*-mdc-*.import |
7489 grep -c "multi_mod_rpcs")
7490 if [ "$tmp" -ne $MDSCOUNT ]; then
7492 skip "Client not able to send multiple modify RPCs in parallel"
7495 # update max_mod_rpcs_in_flight
7496 $LFS mkdir -c1 $DIR/${tdir}2 || error "mkdir $DIR/${tdir}2 failed"
7497 check_max_mod_rpcs_in_flight $DIR/${tdir}2 5
7500 $LFS mkdir -c1 $DIR/${tdir}3 || error "mkdir $DIR/${tdir}3 failed"
7501 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/${tdir}3))
7502 facet="mds$((0x$idx + 1))"
7504 mmrpc=$(get_mdt_max_mod_rpcs_in_flight_val $facet)
7505 echo "mdt_max_mod_rpcs_in_flight is $mmrpc"
7506 # update max_mod_rpcs_in_flight
7507 umount_client $MOUNT
7508 set_mdt_max_mod_rpcs_in_flight 16 $facet
7510 $LCTL set_param mdc.$FSNAME-MDT$idx-mdc-*.max_rpcs_in_flight=17
7511 check_max_mod_rpcs_in_flight $DIR/${tdir}3 16
7513 # restore MDT max_mod_rpcs_in_flight initial value
7514 set_mdt_max_mod_rpcs_in_flight $mmrpc $facet
7516 rm -rf $DIR/${tdir}?
7519 run_test 90b "check max_mod_rpcs_in_flight is enforced after update"
7522 # get max_rpcs_in_flight value
7523 mrif_90c=$($LCTL get_param -n \
7524 mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight)
7525 echo "max_rpcs_in_flight is $mrif_90c"
7527 # get MDC max_mod_rpcs_in_flight value
7528 mmrif_90c=$($LCTL get_param -n \
7529 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight)
7530 echo "MDC max_mod_rpcs_in_flight is $mmrif_90c"
7532 # get MDT max_mod_rpcs_in_flight value
7533 mmrpc_90c=$(get_mdt_max_mod_rpcs_in_flight_val "mds1")
7534 echo "mdt_max_mod_rpcs_in_flight is $mmrpc_90c"
7537 restore_params_90c() {
7540 # restore max_rpcs_in_flight value
7541 do_facet mgs $LCTL set_param -P \
7542 mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight=$mrif_90c
7544 # restore max_mod_rpcs_in_flight value
7545 do_facet mgs $LCTL set_param -P \
7546 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight=$mmrif_90c
7548 # restore MDT max_mod_rpcs_in_flight value
7549 set_mdt_max_mod_rpcs_in_flight $mmrpc_90c "mds1"
7557 [[ $($LCTL get_param mdc.*.import |
7558 grep "connect_flags:.*multi_mod_rpc") ]] ||
7559 skip "Need MDC with 'multi_mod_rpcs' feature"
7561 # check client is able to send multiple modify RPCs in paralell
7562 tmp=$($LCTL get_param -n mdc.$FSNAME-MDT*-mdc-*.import |
7563 grep -c "multi_mod_rpcs")
7564 if [ "$tmp" -ne $MDSCOUNT ]; then
7566 skip "Client not able to send multiple modify RPCs in parallel"
7570 stack_trap restore_params_90c
7573 # attempt to set max_mod_rpcs_in_flight to max_rpcs_in_flight value
7574 # prerequisite: set MDT max_mod_rpcs_in_flight to
7575 # max_rpcs_in_flight value
7576 set_mdt_max_mod_rpcs_in_flight $mrif_90c "mds1"
7578 # if max_mod_rpcs_in_flight is set to be equal to or larger than
7579 # max_rpcs_in_flight, then max_rpcs_in_flight will be increased
7580 if [[ "$CLIENT_VERSION" -ge $(version_code 2.13.53) ]]; then
7582 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight=$mrif_90c ||
7583 error "set max_mod_rpcs_in_flight to $mrif_90c failed"
7585 local new_mrif=$($LCTL get_param -n \
7586 mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight)
7587 ((new_mrif == mrif_90c + 1)) ||
7588 error "max_rpcs_in_flight was not increased"
7591 umount_client $MOUNT
7592 set_mdt_max_mod_rpcs_in_flight $mmrpc_90c "mds1"
7596 # attempt to set max_mod_rpcs_in_flight to MDT max_mod_rpcs_in_flight+1
7597 # prerequisite: set max_rpcs_in_flight to MDT max_mod_rpcs_in_flight+2
7599 mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight=$((mmrpc_90c + 2))
7602 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight=$((mmrpc_90c + 1)) &&
7603 error "set max_mod_rpcs_in_flight to $((mmrpc_90c + 1)) should fail"
7606 # attempt to set max_mod_rpcs_in_flight permanently
7607 do_facet mgs $LCTL set_param -P \
7608 mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight=$mrif_90c
7610 do_facet mgs $LCTL set_param -P \
7611 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight=$mrif_90c
7613 remount_client $MOUNT
7615 wait_update_facet --verbose client "$LCTL get_param -n \
7616 mdc.$FSNAME-MDT0000-mdc-*.max_rpcs_in_flight" \
7617 "$((mrif_90c + 1))" ||
7618 error "expected '$((mrif_90c + 1))' for max_rpcs_in_flight"
7620 wait_update_facet --verbose client "$LCTL get_param -n \
7621 mdc.$FSNAME-MDT0000-mdc-*.max_mod_rpcs_in_flight" \
7623 error "expected '$mrif_90c' for max_mod_rpcs_in_flight"
7628 run_test 90c "check max_mod_rpcs_in_flight update limits"
7639 [[ $($LCTL get_param mdc.*.import |
7640 grep "connect_flags:.*multi_mod_rpc") ]] ||
7641 skip "Need MDC with 'multi_mod_rpcs' feature"
7643 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
7644 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
7645 facet="mds$((0x$idx + 1))"
7647 # check client version supports multislots
7648 tmp=$($LCTL get_param -N \
7649 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
7650 if [ -z "$tmp" ]; then
7652 skip "Client does not support multiple modify RPCs in flight"
7655 # get current value of max_mod_rcps_in_flight
7656 mmr=$($LCTL get_param -n \
7657 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
7658 echo "max_mod_rcps_in_flight is $mmr"
7661 echo "creating $mmr files ..."
7663 for i in $(seq $mmr); do
7664 touch $DIR/$tdir/file-$i
7667 # prepare for close RPC
7668 multiop_bg_pause $DIR/$tdir/file-close O_c
7671 # consumes mmr modify RPC slots
7672 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
7673 # drop requests on MDT so that RPC slots are consumed
7674 # during all the request resend interval
7675 do_facet $facet "$LCTL set_param fail_loc=0x159"
7676 echo "launch $mmr chmod in parallel ..."
7677 for i in $(seq $mmr); do
7678 chmod 0600 $DIR/$tdir/file-$i &
7681 # send one additional close RPC
7682 do_facet $facet "$LCTL set_param fail_loc=0"
7683 echo "launch 1 additional close in parallel ..."
7685 cancel_lru_locks mdc
7688 # check this additional close RPC get a modify RPC slot
7689 # and multiop process completed
7690 [ -d /proc/$pid ] &&
7691 error "Unable to send the additional close RPC in parallel"
7696 run_test 90d "check one close RPC is allowed above max_mod_rpcs_in_flight"
7698 check_uuid_on_ost() {
7700 do_facet ost1 "$LCTL get_param obdfilter.${FSNAME}*.exports.'$nid'.uuid"
7703 check_uuid_on_mdt() {
7705 do_facet $SINGLEMDS "$LCTL get_param mdt.${mds1_svc}*.exports.'$nid'.uuid"
7713 [[ "$OST1_VERSION" -ge $(version_code 2.7.63) ]] ||
7714 skip "Need OST version at least 2.7.63"
7715 [[ "$MDS1_VERSION" -ge $(version_code 2.7.63) ]] ||
7716 skip "Need MDT version at least 2.7.63"
7718 start_mds || error "MDS start failed"
7719 start_ost || error "unable to start OST"
7720 mount_client $MOUNT || error "client start failed"
7721 check_mount || error "check_mount failed"
7724 nid=$($LCTL list_nids | head -1 | sed "s/\./\\\./g")
7728 uuid=$(get_client_uuid $MOUNT)
7730 echo "list nids on mdt:"
7731 do_facet $SINGLEMDS "$LCTL list_param mdt.${FSNAME}*.exports.*"
7732 echo "uuid from $nid:"
7733 do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.'$nid'.uuid"
7735 found=$(check_uuid_on_mdt $nid | grep $uuid)
7736 [ -z "$found" ] && error "can't find $uuid $nid on MDT"
7737 found=$(check_uuid_on_ost $nid | grep $uuid)
7738 [ -z "$found" ] && error "can't find $uuid $nid on OST"
7740 # umount the client so it won't reconnect
7741 manual_umount_client --force || error "failed to umount $?"
7742 # shouldn't disappear on MDS after forced umount
7743 found=$(check_uuid_on_mdt $nid | grep $uuid)
7744 [ -z "$found" ] && error "can't find $uuid $nid"
7747 do_facet $SINGLEMDS \
7748 "$LCTL set_param -n mdt.${mds1_svc}.evict_client nid:$nid"
7749 sleep 1 # eviction above is async, give it some time to proceed
7751 found=$(check_uuid_on_mdt $nid | grep $uuid)
7752 [ -n "$found" ] && error "found $uuid $nid on MDT"
7753 found=$(check_uuid_on_ost $nid | grep $uuid)
7754 [ -n "$found" ] && error "found $uuid $nid on OST"
7756 # check it didn't reconnect (being umounted)
7757 sleep $((TIMEOUT+1))
7758 found=$(check_uuid_on_mdt $nid | grep $uuid)
7759 [ -n "$found" ] && error "found $uuid $nid on MDT"
7760 found=$(check_uuid_on_ost $nid | grep $uuid)
7761 [ -n "$found" ] && error "found $uuid $nid on OST"
7765 run_test 91 "evict-by-nid support"
7767 generate_ldev_conf() {
7768 # generate an ldev.conf file
7769 local ldevconfpath=$1
7771 local fsldevformat=""
7774 local facets="mgs,$(get_facets OST),$(get_facets MDS)"
7775 for facet in ${facets//,/ }; do
7777 fstype=$(facet_fstype $facet)
7778 [ "$fstype" = zfs ] && fsldevformat="$fstype:"
7779 local host=$(facet_host $facet)
7781 local varfo=${facet}failover_HOST
7782 if [ $facet == mgs ] && combined_mgs_mds; then
7783 varfo=mds1failover_HOST
7785 [ -n "${!varfo}" ] && fo=${!varfo}
7786 local type=$(echo $facet | tr -d "[:digit:]" | \
7787 tr "[:lower:]" "[:upper:]" | sed s/MDS/MDT/ )
7789 [ ${facet} == mgs ] ||
7790 num=$(facet_number $facet)
7791 printf "%s\t%s\t%s-%s%04x\t%s%s\n" \
7798 $(facet_device $facet) >> $ldevconfpath
7801 echo "----- $ldevconfpath -----"
7803 echo "--- END $ldevconfpath ---"
7808 # generate a nids file (mapping between hostname to nid)
7809 # looks like we only have the MGS nid available to us
7810 # so just echo that to a file
7812 echo -e "${mgs_HOST}\t${MGSNID}" > $nidspath
7814 echo "----- $nidspath -----"
7816 echo "--- END $nidspath ---"
7819 compare_ldev_output() {
7820 local ldev_output=$1
7821 local expected_output=$2
7823 sort $expected_output -o $expected_output
7824 sort $ldev_output -o $ldev_output
7826 echo "-- START OF LDEV OUTPUT --"
7828 echo "--- END OF LDEV OUTPUT ---"
7830 echo "-- START OF EXPECTED OUTPUT --"
7831 cat $expected_output
7832 echo "--- END OF EXPECTED OUTPUT ---"
7834 diff $expected_output $ldev_output
7839 if [ -z "$LDEV" ]; then
7840 error "ldev is missing!"
7843 local LDEVCONFPATH=$TMP/ldev.conf
7844 local NIDSPATH=$TMP/nids
7846 echo "Host is $(hostname)"
7848 generate_ldev_conf $LDEVCONFPATH
7849 generate_nids $NIDSPATH
7851 # echo the mgs nid and compare it to environment variable MGSNID
7852 local facets="$(get_facets OST),$(get_facets MDS),mgs"
7853 for facet in ${facets//,/ }; do
7854 local host=$(facet_host $facet)
7855 local output=$($LDEV -c $LDEVCONFPATH -H $host -n $NIDSPATH echo %m)
7857 echo "-- START OF LDEV OUTPUT --"
7859 echo "--- END OF LDEV OUTPUT ---"
7862 error "ldev failed to execute!"
7864 # need to process multiple lines because of
7865 # several targets on host
7866 echo -e $output | awk '{ print $2 }' | while read -r line ; do
7867 [ "$line" = "$MGSNID" ] ||
7868 error "ldev failed mgs nid '$line', \
7872 rm -f $LDEVCONFPATH $NIDSPATH
7874 run_test 92 "ldev returns MGS NID correctly in command substitution"
7877 [ $MDSCOUNT -lt 3 ] && skip "needs >= 3 MDTs"
7880 #start mgs or mgs/mdt0
7881 if ! combined_mgs_mds ; then
7888 start_ost || error "OST0 start fail"
7890 #define OBD_FAIL_MGS_WRITE_TARGET_DELAY 0x90e
7891 do_facet mgs "$LCTL set_param fail_val=10 fail_loc=0x8000090e"
7892 for num in $(seq 2 $MDSCOUNT); do
7896 mount_client $MOUNT || error "mount client fails"
7897 wait_osc_import_state mds ost FULL
7898 wait_osc_import_ready client ost
7899 check_mount || error "check_mount failed"
7901 cleanup || error "cleanup failed with $?"
7903 run_test 93 "register mulitple MDT at the same time"
7906 if [ -z "$LDEV" ]; then
7907 error "ldev is missing!"
7910 local LDEVCONFPATH=$TMP/ldev.conf
7911 local NIDSPATH=$TMP/nids
7913 generate_ldev_conf $LDEVCONFPATH
7914 generate_nids $NIDSPATH
7916 local LDEV_OUTPUT=$TMP/ldev-output.txt
7917 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME > $LDEV_OUTPUT
7919 # ldev failed, error
7920 if [ $? -ne 0 ]; then
7921 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
7922 error "ldev failed to execute!"
7926 local EXPECTED_OUTPUT=$TMP/ldev-expected.txt
7928 printf "%s-MGS0000\n" $FSNAME > $EXPECTED_OUTPUT
7930 for num in $(seq $MDSCOUNT); do
7931 printf "%s-MDT%04x\n" $FSNAME $((num - 1)) >> $EXPECTED_OUTPUT
7934 for num in $(seq $OSTCOUNT); do
7935 printf "%s-OST%04x\n" $FSNAME $((num - 1)) >> $EXPECTED_OUTPUT
7938 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
7940 if [ $? -ne 0 ]; then
7941 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7942 error "ldev failed to produce the correct hostlist!"
7945 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
7947 run_test 94 "ldev outputs correct labels for file system name query"
7950 if [ -z "$LDEV" ]; then
7951 error "ldev is missing!"
7954 local LDEVCONFPATH=$TMP/ldev.conf
7955 local NIDSPATH=$TMP/nids
7957 generate_ldev_conf $LDEVCONFPATH
7958 generate_nids $NIDSPATH
7962 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME &>/dev/null
7963 if [ $? -ne 0 ]; then
7964 rm $LDEVCONFPATH $NIDSPATH
7965 error "ldev label filtering w/ -F failed!"
7969 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -l &>/dev/null
7970 if [ $? -ne 0 ]; then
7971 rm $LDEVCONFPATH $NIDSPATH
7972 error "ldev label filtering w/ -l failed!"
7976 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -f &>/dev/null
7977 if [ $? -ne 0 ]; then
7978 rm $LDEVCONFPATH $NIDSPATH
7979 error "ldev label filtering w/ -f failed!"
7983 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a &>/dev/null
7984 if [ $? -ne 0 ]; then
7985 rm $LDEVCONFPATH $NIDSPATH
7986 error "ldev label filtering w/ -a failed!"
7991 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -F $FSNAME &>/dev/null
7992 if [ $? -eq 0 ]; then
7993 rm $LDEVCONFPATH $NIDSPATH
7994 error "ldev label filtering w/ -a and -F incorrectly succeeded"
7998 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -f &>/dev/null
7999 if [ $? -eq 0 ]; then
8000 rm $LDEVCONFPATH $NIDSPATH
8001 error "ldev label filtering w/ -a and -f incorrectly succeeded"
8005 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -a -l &>/dev/null
8006 if [ $? -eq 0 ]; then
8007 rm $LDEVCONFPATH $NIDSPATH
8008 error "ldev label filtering w/ -a and -l incorrectly succeeded"
8012 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -f -l &>/dev/null
8013 if [ $? -eq 0 ]; then
8014 rm $LDEVCONFPATH $NIDSPATH
8015 error "ldev label filtering w/ -f and -l incorrectly succeeded"
8019 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -l &>/dev/null
8020 if [ $? -eq 0 ]; then
8021 rm $LDEVCONFPATH $NIDSPATH
8022 error "ldev label filtering w/ -F and -l incorrectly succeeded"
8025 # file sys & foreign
8026 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -f &>/dev/null
8027 if [ $? -eq 0 ]; then
8028 rm $LDEVCONFPATH $NIDSPATH
8029 error "ldev label filtering w/ -F and -f incorrectly succeeded"
8032 rm $LDEVCONFPATH $NIDSPATH
8034 run_test 95 "ldev should only allow one label filter"
8037 if [ -z "$LDEV" ]; then
8038 error "ldev is missing!"
8041 local LDEVCONFPATH=$TMP/ldev.conf
8042 local NIDSPATH=$TMP/nids
8044 generate_ldev_conf $LDEVCONFPATH
8045 generate_nids $NIDSPATH
8047 local LDEV_OUTPUT=$TMP/ldev-output.txt
8048 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -H $mgs_HOST \
8050 awk '{print $2}' > $LDEV_OUTPUT
8052 # ldev failed, error
8053 if [ $? -ne 0 ]; then
8054 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
8055 error "ldev failed to execute!"
8059 local EXPECTED_OUTPUT=$TMP/ldev-expected-output.txt
8061 echo "$mgs_HOST-$(facet_fstype mgs)" > $EXPECTED_OUTPUT
8063 local facets="$(get_facets OST),$(get_facets MDS)"
8064 for facet in ${facets//,/ }; do
8065 local host=$(facet_host $facet)
8066 [ "$mgs_HOST" == "$host" ] &&
8067 echo "$host-$(facet_fstype $facet)" \
8071 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
8073 if [ $? -ne 0 ]; then
8074 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
8075 error "ldev failed to produce the correct output!"
8078 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
8080 run_test 96 "ldev returns hostname and backend fs correctly in command sub"
8083 if [ -z "$LDEV" ]; then
8084 error "ldev is missing!"
8087 local LDEVCONFPATH=$TMP/ldev.conf
8088 local NIDSPATH=$TMP/nids
8090 generate_ldev_conf $LDEVCONFPATH
8091 generate_nids $NIDSPATH
8093 local LDEV_OUTPUT=$TMP/ldev-output.txt
8094 local EXPECTED_OUTPUT=$TMP/ldev-expected-output.txt
8096 echo -e "\nMDT role"
8097 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R mdt > $LDEV_OUTPUT
8099 if [ $? -ne 0 ]; then
8100 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT
8101 error "ldev failed to execute for mdt role!"
8104 for num in $(seq $MDSCOUNT); do
8105 printf "%s-MDT%04x\n" $FSNAME $((num - 1)) >> $EXPECTED_OUTPUT
8108 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
8110 if [ $? -ne 0 ]; then
8111 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
8112 error "ldev failed to produce the correct output for mdt role!"
8115 echo -e "\nOST role"
8116 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R ost > $LDEV_OUTPUT
8118 if [ $? -ne 0 ]; then
8119 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT $EXPECTED_OUTPUT
8120 error "ldev failed to execute for ost role!"
8124 for num in $(seq $OSTCOUNT); do
8125 printf "%s-OST%04x\n" $FSNAME $((num - 1)) >> $EXPECTED_OUTPUT
8128 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
8130 if [ $? -ne 0 ]; then
8131 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
8132 error "ldev failed to produce the correct output for ost role!"
8135 echo -e "\nMGS role"
8136 $LDEV -c $LDEVCONFPATH -n $NIDSPATH -F $FSNAME -R mgs > $LDEV_OUTPUT
8138 if [ $? -ne 0 ]; then
8139 rm $LDEVCONFPATH $NIDSPATH $LDEV_OUTPUT $EXPECTED_OUTPUT
8140 error "ldev failed to execute for mgs role!"
8143 printf "%s-MGS0000\n" $FSNAME > $EXPECTED_OUTPUT
8145 compare_ldev_output $LDEV_OUTPUT $EXPECTED_OUTPUT
8147 if [ $? -ne 0 ]; then
8148 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
8149 error "ldev failed to produce the correct output for mgs role!"
8152 rm $LDEVCONFPATH $NIDSPATH $EXPECTED_OUTPUT $LDEV_OUTPUT
8154 run_test 97 "ldev returns correct ouput when querying based on role"
8161 check_mount || error "mount failed"
8162 mountopt="user_xattr"
8163 for ((x = 1; x <= PAGE_SIZE/11; x++)); do
8164 mountopt="$mountopt,user_xattr"
8166 mount_client $MOUNT remount,$mountopt 2>&1 | grep "too long" ||
8167 error "Buffer overflow check failed"
8168 cleanup || error "cleanup failed"
8170 run_test 98 "Buffer-overflow check while parsing mount_opts"
8174 [[ "$ost1_FSTYPE" != ldiskfs ]] &&
8175 skip "ldiskfs only test"
8176 [[ "$OST1_VERSION" -ge $(version_code 2.8.57) ]] ||
8177 skip "Need OST version at least 2.8.57"
8179 local ost_opts="$(mkfs_opts ost1 $(ostdevname 1)) \
8180 --reformat $(ostdevname 1) $(ostvdevname 1)"
8181 do_facet ost1 $DEBUGFS -c -R stats `ostdevname 1` | grep "meta_bg" &&
8182 skip "meta_bg already set"
8185 if [[ ${!opts} != *mkfsoptions* ]]; then
8186 eval opts=\"${!opts} \
8187 --mkfsoptions='\\\"-O ^resize_inode,meta_bg\\\"'\"
8189 local val=${!opts//--mkfsoptions=\\\"/ \
8190 --mkfsoptions=\\\"-O ^resize_inode,meta_bg }
8194 echo "params: $opts"
8197 add ost1 $opts || error "add ost1 failed with new params"
8199 do_facet ost1 $DEBUGFS -c -R stats `ostdevname 1` | grep "meta_bg" ||
8200 error "meta_bg is not set"
8202 run_test 99 "Adding meta_bg option"
8207 start_mgsmds || error "MDS start failed"
8208 start_ost || error "unable to start OST"
8209 mount_client $MOUNT || error "client start failed"
8210 check_mount || error "check_mount failed"
8219 do_facet mgs 'lshowmount -v' | awk 'BEGIN {NR == 0; rc=1} /MGS:/ {rc=0}
8220 END {exit rc}' || error "lshowmount have no output MGS"
8222 do_facet mds1 'lshowmount -v' | awk 'BEGIN {NR == 2; rc=1} /-MDT0000:/
8223 {rc=0} END {exit rc}' || error "lshowmount have no output MDT0"
8225 do_facet ost1 'lshowmount -v' | awk 'BEGIN {NR == 4; rc=1} /-OST0000:/
8226 {rc=0} END {exit rc}' || error "lshowmount have no output OST0"
8228 cleanup || error "cleanup failed with $?"
8230 run_test 100 "check lshowmount lists MGS, MDT, OST and 0@lo"
8233 local createmany_pid
8234 local dev=$FSNAME-OST0000-osc-MDT0000
8238 do_nodes $(comma_list $(osts_nodes)) $LCTL set_param \
8239 seq.*OST*-super.width=$DATA_SEQ_MAX_WIDTH
8240 createmany -o $DIR1/$tdir/$tfile-%d 50000 &
8242 # MDT->OST reconnection causes MDT<->OST last_id synchornisation
8243 # via osp_precreate_cleanup_orphans.
8244 for ((i = 0; i < 100; i++)); do
8245 for ((k = 0; k < 10; k++)); do
8246 do_facet $SINGLEMDS "$LCTL --device $dev deactivate;" \
8247 "$LCTL --device $dev activate"
8250 ls -asl $MOUNT | grep '???' &&
8251 { kill -9 $createmany_pid &>/dev/null;
8252 error "File has no object on OST"; }
8254 kill -s 0 $createmany_pid || break
8256 wait $createmany_pid
8258 unlinkmany $DIR1/$tdir/$tfile-%d 50000
8261 run_test 101a "Race MDT->OST reconnection with create"
8264 local dev=$FSNAME-OST0000-osc-MDT0000
8265 local dir=$DIR1/$tdir
8269 $LFS setstripe -c 1 -i 0 $dir
8270 do_facet $SINGLEMDS "$LCTL --device $dev deactivate;"
8271 #define OBD_FAIL_OSP_CON_EVENT_DELAY 0x2107
8272 do_facet mds1 "$LCTL set_param fail_loc=0x80002107 fail_val=20"
8273 do_facet $SINGLEMDS "$LCTL --device $dev activate;"
8278 wait_osc_import_ready client ost1
8279 touch $dir/$tfile || error "Can't create file"
8283 run_test 101b "Race events DISCONNECT and ACTIVE in osp"
8286 [[ "$MDS1_VERSION" -gt $(version_code 2.9.53) ]] ||
8287 skip "Need server version greater than 2.9.53"
8288 [[ “$(mdsdevname 1)” != “$(mgsdevname)” ]] &&
8289 [[ “$(facet_host mds1)” = “$(facet_host mgs)” ]] &&
8290 skip "MGS must be on different node or combined"
8292 cleanup || error "cleanup failed with $?"
8294 local mds1dev=$(mdsdevname 1)
8295 local mds1mnt=$(facet_mntpt mds1)
8296 local mds1opts=$MDS_MOUNT_OPTS
8298 if [ "$mds1_FSTYPE" == ldiskfs ] &&
8299 ! do_facet mds1 test -b $mds1dev; then
8300 mds1opts=$(csa_add "$mds1opts" -o loop)
8302 if [[ "$mds1_FSTYPE" == zfs ]]; then
8303 import_zpool mds1 || return ${PIPESTATUS[0]}
8306 # unload all and only load libcfs to allow fail_loc setting
8307 do_facet mds1 $LUSTRE_RMMOD || error "unable to unload modules"
8308 do_facet mds1 modprobe libcfs || error "libcfs not loaded"
8309 do_facet mds1 lsmod \| grep libcfs || error "libcfs not loaded"
8311 #define OBD_FAIL_OBDCLASS_MODULE_LOAD 0x60a
8312 do_facet mds1 "$LCTL set_param fail_loc=0x8000060a"
8314 do_facet mds1 $MOUNT_CMD $mds1dev $mds1mnt $mds1opts &&
8315 error "mdt start must fail"
8316 do_facet mds1 lsmod \| grep obdclass && error "obdclass must not load"
8318 do_facet mds1 "$LCTL set_param fail_loc=0x0"
8320 do_facet mds1 $MOUNT_CMD $mds1dev $mds1mnt $mds1opts ||
8321 error "mdt start must not fail"
8323 cleanup || error "cleanup failed with $?"
8325 run_test 102 "obdclass module cleanup upon error"
8330 echo "rename $FSNAME to $newname"
8332 if ! combined_mgs_mds ; then
8333 local dev=$(mgsdevname)
8336 "$TUNEFS --fsname=$newname --rename=$FSNAME -v $dev" ||
8337 error "(7) Fail to rename MGS"
8338 if [ "$(facet_fstype mgs)" = "zfs" ]; then
8339 reimport_zpool mgs $newname-mgs
8343 for num in $(seq $MDSCOUNT); do
8344 local dev=$(mdsdevname $num)
8346 do_facet mds${num} \
8347 "$TUNEFS --fsname=$newname --rename=$FSNAME -v $dev" ||
8348 error "(8) Fail to rename MDT $num"
8349 if [ "$(facet_fstype mds${num})" = "zfs" ]; then
8350 reimport_zpool mds${num} $newname-mdt${num}
8354 for num in $(seq $OSTCOUNT); do
8355 local dev=$(ostdevname $num)
8357 do_facet ost${num} \
8358 "$TUNEFS --fsname=$newname --rename=$FSNAME -v $dev" ||
8359 error "(9) Fail to rename OST $num"
8360 if [ "$(facet_fstype ost${num})" = "zfs" ]; then
8361 reimport_zpool ost${num} $newname-ost${num}
8366 test_103_set_pool() {
8370 do_facet mgs $LCTL pool_add $FSNAME.$pname ${FSNAME}-$ost_x ||
8371 error "Fail to add $ost_x to $FSNAME.$pname"
8372 wait_update $HOSTNAME \
8373 "lctl get_param -n lov.$FSNAME-clilov-*.pools.$pname |
8374 grep $ost_x" "$FSNAME-${ost_x}_UUID" ||
8375 error "$ost_x is NOT in pool $FSNAME.$pname"
8378 test_103_check_pool() {
8379 local save_fsname=$1
8382 stat $DIR/$tdir/test-framework.sh ||
8383 error "($errno) Fail to stat"
8384 do_facet mgs $LCTL pool_list $FSNAME.pool1 ||
8385 error "($errno) Fail to list $FSNAME.pool1"
8386 do_facet mgs $LCTL pool_list $FSNAME.$save_fsname ||
8387 error "($errno) Fail to list $FSNAME.$save_fsname"
8388 do_facet mgs $LCTL pool_list $FSNAME.$save_fsname |
8389 grep ${FSNAME}-OST0000 ||
8390 error "($errno) List $FSNAME.$save_fsname is invalid"
8392 local pname=$($LFS getstripe --pool $DIR/$tdir/d0)
8393 [ "$pname" = "$save_fsname" ] ||
8394 error "($errno) Unexpected pool name $pname"
8398 check_mount_and_prep
8400 mkdir $DIR/$tdir || error "(1) Fail to mkdir $DIR/$tdir"
8401 cp $LUSTRE/tests/test-framework.sh $DIR/$tdir ||
8402 error "(2) Fail to copy test-framework.sh"
8404 do_facet mgs $LCTL pool_new $FSNAME.pool1 ||
8405 error "(3) Fail to create $FSNAME.pool1"
8406 # name the pool name as the fsname
8407 do_facet mgs $LCTL pool_new $FSNAME.$FSNAME ||
8408 error "(4) Fail to create $FSNAME.$FSNAME"
8410 test_103_set_pool $FSNAME OST0000
8412 $LFS setstripe -p $FSNAME $DIR/$tdir/d0 ||
8413 error "(6) Fail to setstripe on $DIR/$tdir/d0"
8418 test_renamefs mylustre
8420 local save_fsname=$FSNAME
8424 test_103_check_pool $save_fsname 7
8426 if [ $OSTCOUNT -ge 2 ]; then
8427 test_103_set_pool $save_fsname OST0001
8430 $LFS setstripe -p $save_fsname $DIR/$tdir/f0 ||
8431 error "(16) Fail to setstripe on $DIR/$tdir/f0"
8440 test_103_check_pool $save_fsname 17
8444 test_renamefs $save_fsname
8450 run_test 103 "rename filesystem name"
8452 test_104a() { # LU-6952
8453 local mds_mountopts=$MDS_MOUNT_OPTS
8454 local ost_mountopts=$OST_MOUNT_OPTS
8455 local mds_mountfsopts=$MDS_MOUNT_FS_OPTS
8456 local lctl_ver=$(do_facet $SINGLEMDS $LCTL --version |
8459 [[ $(version_code $lctl_ver) -lt $(version_code 2.9.55) ]] &&
8460 skip "this test needs utils above 2.9.55"
8462 # specify "acl" in mount options used by mkfs.lustre
8463 if [ -z "$MDS_MOUNT_FS_OPTS" ]; then
8464 MDS_MOUNT_FS_OPTS="acl,user_xattr"
8467 MDS_MOUNT_FS_OPTS="${MDS_MOUNT_FS_OPTS},acl,user_xattr"
8470 echo "mountfsopt: $MDS_MOUNT_FS_OPTS"
8472 #reformat/remount the MDT to apply the MDT_MOUNT_FS_OPT options
8474 if ! combined_mgs_mds ; then
8478 if [ -z "$MDS_MOUNT_OPTS" ]; then
8479 MDS_MOUNT_OPTS="-o noacl"
8481 MDS_MOUNT_OPTS="${MDS_MOUNT_OPTS},noacl"
8484 for num in $(seq $MDSCOUNT); do
8485 start mds$num $(mdsdevname $num) $MDS_MOUNT_OPTS ||
8486 error "Failed to start MDS"
8489 for num in $(seq $OSTCOUNT); do
8490 start ost$num $(ostdevname $num) $OST_MOUNT_OPTS ||
8491 error "Failed to start OST"
8495 setfacl -m "d:$RUNAS_ID:rwx" $MOUNT &&
8496 error "ACL is applied when FS is mounted with noacl."
8498 MDS_MOUNT_OPTS=$mds_mountopts
8499 OST_MOUNT_OPTS=$ost_mountopts
8500 MDS_MOUNT_FS_OPTS=$mds_mountfsopts
8502 run_test 104a "Make sure user defined options are reflected in mount"
8504 test_104b() { # LU-12859
8505 mount_client $MOUNT3 flock,localflock
8506 stack_trap "umount_client $MOUNT3" EXIT
8507 mount | grep "$MOUNT3 .*,flock" && error "flock is still set"
8508 mount | grep "$MOUNT3 .*,localflock" || error "localflock is not set"
8509 umount_client $MOUNT3
8510 mount_client $MOUNT3 localflock,flock
8511 mount | grep "$MOUNT3 .*,localflock" && error "localflock is still set"
8512 mount | grep "$MOUNT3 .*,flock" || error "flock is not set"
8513 umount_client $MOUNT3
8514 mount_client $MOUNT3 localflock,flock,noflock
8515 flock_is_enabled $MOUNT3 && error "some flock is still enabled" || true
8517 run_test 104b "Mount uses last flock argument"
8519 error_and_umount() {
8530 mount --bind $DIR $TMP/$tdir || error "mount bind mnt pt failed"
8531 rm -f $TMP/$tdir/$tfile
8532 rm -f $TMP/$tdir/${tfile}1
8534 # Files should not be created in ro bind mount point
8535 # remounting from rw to ro
8536 mount -o remount,ro $TMP/$tdir ||
8537 error_and_umount "readonly remount of bind mnt pt failed"
8538 touch $TMP/$tdir/$tfile &&
8539 error_and_umount "touch succeeds on ro bind mnt pt"
8540 [ -e $TMP/$tdir/$tfile ] &&
8541 error_and_umount "file created on ro bind mnt pt"
8543 # Files should be created in rw bind mount point
8544 # remounting from ro to rw
8545 mount -o remount,rw $TMP/$tdir ||
8546 error_and_umount "read-write remount of bind mnt pt failed"
8547 touch $TMP/$tdir/${tfile}1 ||
8548 error_and_umount "touch fails on rw bind mnt pt"
8549 [ -e $TMP/$tdir/${tfile}1 ] ||
8550 error_and_umount "file not created on rw bind mnt pt"
8551 umount $TMP/$tdir || error "umount of bind mnt pt failed"
8553 cleanup || error "cleanup failed with $?"
8555 run_test 105 "check file creation for ro and rw bind mnt pt"
8559 local creates=64768 # one full plain llog
8561 # ensure there are enough inodes in the filesystem
8562 (( OSTSIZE < (creates + 1024) * 8)) && OSTSIZE=$(((creates + 1024) * 8))
8566 mkdir -p $DIR/$tdir || error "create $tdir failed"
8567 do_nodes $(comma_list $(osts_nodes)) $LCTL set_param \
8568 seq.*OST*-super.width=$DATA_SEQ_MAX_WIDTH
8569 lfs setstripe -c 1 -i 0 $DIR/$tdir
8570 #define OBD_FAIL_CAT_RECORDS 0x1312
8571 do_facet mds1 $LCTL set_param fail_loc=0x1312 fail_val=$repeat
8573 for ((i = 1; i <= $repeat; i++)); do
8574 createmany -o $DIR/$tdir/f- $creates || lfs df -i
8575 createmany -u $DIR/$tdir/f- $creates
8576 wait_delete_completed $((TIMEOUT * 7))
8578 #ASSERTION osp_sync_thread() ( thread->t_flags != SVC_RUNNING ) failed
8579 #shows that osp code is buggy
8580 do_facet mds1 $LCTL set_param fail_loc=0 fail_val=0
8584 run_test 106 "check osp llog processing when catalog is wrapped"
8587 [[ "$MDS1_VERSION" -ge $(version_code 2.10.50) ]] ||
8588 skip "Need MDS version > 2.10.50"
8591 start_mgsmds || error "start_mgsmds failed"
8592 start_ost || error "unable to start OST"
8594 # add unknown configuration parameter.
8595 if [[ $PERM_CMD == *"set_param -P"* ]]; then
8596 cmd="$PERM_CMD ost.$FSNAME-OST0000*.unknown_param"
8598 cmd="$PERM_CMD $FSNAME-OST0000*.ost.unknown_param"
8600 do_facet mgs "$cmd=50"
8601 cleanup_nocli || error "cleanup_nocli failed with $?"
8604 # unknown param should be ignored while mounting.
8605 start_ost || error "unable to start OST after unknown param set"
8607 cleanup || error "cleanup failed with $?"
8609 run_test 107 "Unknown config param should not fail target mounting"
8614 $rcmd rm -rf $tmp > /dev/null 2>&1
8615 $rcmd mkdir -p $tmp/{mnt,images} || error "failed to mkdir remotely"
8617 for facet in $facets; do
8618 [ "$mds1_FSTYPE" = zfs ] &&
8619 $rcmd $ZPOOL -f export lustre-$facet > /dev/null 2>&1
8620 $rcmd mkdir $tmp/mnt/$facet ||
8621 error "failed to mkdir $tmp/mnt/$facet"
8622 $rcmd dd if=/dev/zero of=$tmp/images/$facet \
8623 seek=199 bs=1M count=1 ||
8624 error "failed to create $tmp/images/$facet"
8633 local facet=${role}$((idx + 1))
8635 [ $# -eq 5 ] && pool=$5
8637 do_facet $SINGLEMDS $MKFS --fsname=lustre --$mgs \
8638 --$role --index=$idx --replace --backfstype=$bkfs \
8639 --device-size=200000 --reformat $pool $tmp/images/$facet ||
8640 error "failed to mkfs for $facet"
8644 echo "mounting client..."
8645 mount -t lustre ${nid}:/lustre $MOUNT ||
8646 error "failed to mount lustre"
8649 ls -l $MOUNT/local_dir || error "failed to list"
8651 echo "check truncate && write"
8652 echo "dummmmmmmmmmmmm" > $MOUNT/remote_dir/fsx.c ||
8653 error "failed to tuncate & write"
8656 touch $MOUNT/foooo ||
8657 error "failed to create"
8659 echo "check read && write && append"
8660 sha1sum $MOUNT/conf-sanity.sh |
8661 awk '{ print $1 }' > $MOUNT/checksum.new ||
8662 error "failed to read(1)"
8663 sha1sum $MOUNT/remote_dir/unlinkmany.c |
8664 awk '{ print $1 }' >> $MOUNT/checksum.new ||
8665 error "failed to read(2)"
8666 sha1sum $MOUNT/striped_dir/lockahead_test.o |
8667 awk '{ print $1 }' >> $MOUNT/checksum.new ||
8668 error "failed to read(3)"
8671 diff $MOUNT/checksum.new $MOUNT/checksum.src ||
8672 error "failed to verify data"
8682 umount -f $MOUNT || error "failed to umount client"
8683 for facet in $facets; do
8684 $rcmd umount -f $tmp/mnt/$facet ||
8685 error "failed to umount $facet"
8686 if [ "$mds1_FSTYPE" = zfs ]; then
8687 $rcmd $ZPOOL export -f lustre-$facet ||
8688 error "failed to export lustre-$facet"
8692 $rcmd rm -rf $tmp || error "failed to rm the dir $tmp"
8696 [ "$CLIENTONLY" ] && skip "Client-only testing"
8697 [ "$mds1_FSTYPE" != zfs ] && skip "zfs only test"
8698 [ "$MDS1_VERSION" -lt $(version_code 2.10.58) ] &&
8699 skip "Need server version at least 2.10.58"
8704 local tmp=$TMP/$tdir
8705 local rcmd="do_facet $SINGLEMDS"
8706 local facets="mdt1 mdt2 ost1 ost2"
8707 local nid=$($rcmd $LCTL list_nids | head -1)
8710 trap t_108_cleanup EXIT ERR
8713 t_108_mkfs mdt 0 zfs mgs lustre-mdt1/mdt1
8714 t_108_mkfs mdt 1 zfs mgsnode=$nid lustre-mdt2/mdt2
8715 t_108_mkfs ost 0 zfs mgsnode=$nid lustre-ost1/ost1
8716 t_108_mkfs ost 1 zfs mgsnode=$nid lustre-ost2/ost2
8718 for facet in $facets; do
8719 $rcmd zfs set mountpoint=$tmp/mnt/$facet canmount=on \
8720 lustre-$facet/$facet ||
8721 error "failed to zfs set for $facet (1)"
8722 $rcmd zfs mount lustre-$facet/$facet ||
8723 error "failed to local mount $facet"
8724 $rcmd tar jxf $LUSTRE/tests/ldiskfs_${facet}_2_11.tar.bz2 \
8725 --xattrs --xattrs-include="trusted.*" \
8726 -C $tmp/mnt/$facet/ > /dev/null 2>&1 ||
8727 error "failed to untar image for $facet"
8728 $rcmd "cd $tmp/mnt/$facet && rm -rf oi.* OI_* lfsck_* LFSCK" ||
8729 error "failed to cleanup for $facet"
8730 $rcmd zfs umount lustre-$facet/$facet ||
8731 error "failed to local umount $facet"
8732 $rcmd zfs set canmount=off lustre-$facet/$facet ||
8733 error "failed to zfs set $facet (2)"
8736 echo "changing server nid..."
8737 $rcmd mount -t lustre -o nosvc lustre-mdt1/mdt1 $tmp/mnt/mdt1
8738 $rcmd lctl replace_nids $FSNAME-MDT0000 $nid
8739 $rcmd lctl replace_nids $FSNAME-MDT0001 $nid
8740 $rcmd lctl replace_nids $FSNAME-OST0000 $nid
8741 $rcmd lctl replace_nids $FSNAME-OST0001 $nid
8742 $rcmd umount $tmp/mnt/mdt1
8744 for facet in $facets; do
8745 echo "mounting $facet from backup..."
8746 $rcmd mount -t lustre -o abort_recov lustre-$facet/$facet \
8747 $tmp/mnt/$facet || error "failed to mount $facet"
8750 # ZFS backend can detect migration and trigger OI scrub automatically
8751 # sleep 3 seconds for scrub done
8757 run_test 108a "migrate from ldiskfs to ZFS"
8760 [ "$CLIENTONLY" ] && skip "Client-only testing"
8761 [ "$mds1_FSTYPE" != ldiskfs ] && skip "ldiskfs only test"
8762 [ "$MDS1_VERSION" -lt $(version_code 2.10.58) ] &&
8763 skip "Need server version at least 2.10.58"
8768 local tmp=$TMP/$tdir
8769 local rcmd="do_facet $SINGLEMDS"
8770 local facets="mdt1 mdt2 ost1 ost2"
8771 local scrub_list="MDT0000 MDT0001 OST0000 OST0001"
8772 local nid=$($rcmd $LCTL list_nids | head -1)
8775 trap t_108_cleanup EXIT ERR
8778 t_108_mkfs mdt 0 ldiskfs mgs
8779 t_108_mkfs mdt 1 ldiskfs mgsnode=$nid
8780 t_108_mkfs ost 0 ldiskfs mgsnode=$nid
8781 t_108_mkfs ost 1 ldiskfs mgsnode=$nid
8783 for facet in $facets; do
8784 $rcmd mount -t ldiskfs -o loop $tmp/images/$facet \
8786 error "failed to local mount $facet"
8788 $rcmd tar jxf $LUSTRE/tests/zfs_${facet}_2_11.tar.bz2 \
8789 --xattrs --xattrs-include="*.*" \
8790 -C $tmp/mnt/$facet/ > /dev/null 2>&1 ||
8791 error "failed to untar image for $facet"
8792 $rcmd "cd $tmp/mnt/$facet && rm -rf oi.* OI_* lfsck_* LFSCK" ||
8793 error "failed to cleanup for $facet"
8794 $rcmd umount $tmp/mnt/$facet ||
8795 error "failed to local umount $facet"
8798 echo "changing server nid..."
8799 $rcmd mount -t lustre -o nosvc,loop $tmp/images/mdt1 $tmp/mnt/mdt1
8800 $rcmd lctl replace_nids $FSNAME-MDT0000 $nid
8801 $rcmd lctl replace_nids $FSNAME-MDT0001 $nid
8802 $rcmd lctl replace_nids $FSNAME-OST0000 $nid
8803 $rcmd lctl replace_nids $FSNAME-OST0001 $nid
8804 $rcmd umount $tmp/mnt/mdt1
8806 for facet in $facets; do
8807 echo "mounting $facet from backup..."
8808 $rcmd mount -t lustre -o loop,abort_recov $tmp/images/$facet \
8809 $tmp/mnt/$facet || error "failed to mount $facet"
8812 for facet in $scrub_list; do
8813 $rcmd $LCTL lfsck_start -M $FSNAME-$facet -t scrub ||
8814 error "failed to start OI scrub on $facet"
8817 # sleep 3 seconds for scrub done
8823 run_test 108b "migrate from ZFS to ldiskfs"
8826 # set number of permanent parameters
8828 test_109_set_params() {
8831 set_persistent_param_and_check mds \
8832 "mdd.$fsname-MDT0000.atime_diff" \
8833 "$fsname-MDT0000.mdd.atime_diff" \
8835 set_persistent_param_and_check mds \
8836 "mdd.$fsname-MDT0000.atime_diff" \
8837 "$fsname-MDT0000.mdd.atime_diff" \
8839 set_persistent_param_and_check client \
8840 "llite.$fsname*.max_read_ahead_mb" \
8841 "$fsname.llite.max_read_ahead_mb" \
8843 set_persistent_param_and_check client \
8844 "llite.$fsname*.max_read_ahead_mb" \
8845 "$fsname.llite.max_read_ahead_mb" \
8847 create_pool $fsname.pool1 || error "create pool failed"
8848 do_facet mgs $LCTL pool_add $fsname.pool1 OST0000 ||
8849 error "pool_add failed"
8850 do_facet mgs $LCTL pool_remove $fsname.pool1 OST0000 ||
8851 error "pool_remove failed"
8852 do_facet mgs $LCTL pool_add $fsname.pool1 OST0000 ||
8853 error "pool_add failed"
8857 # check permanent parameters
8859 test_109_test_params() {
8862 local atime_diff=$(do_facet mds $LCTL \
8863 get_param -n mdd.$fsname-MDT0000.atime_diff)
8864 [ $atime_diff == 63 ] || error "wrong mdd parameter after clear_conf"
8865 local max_read_ahead_mb=$(do_facet client $LCTL \
8866 get_param -n llite.$fsname*.max_read_ahead_mb)
8867 [ $max_read_ahead_mb == 64 ] ||
8868 error "wrong llite parameter after clear_conf"
8869 local ost_in_pool=$(do_facet mds $LCTL pool_list $fsname.pool1 |
8870 grep -v "^Pool:" | sed 's/_UUID//')
8871 [ $ost_in_pool = "$fsname-OST0000" ] ||
8872 error "wrong pool after clear_conf"
8876 # run lctl clear_conf, store CONFIGS before and after that
8878 test_109_clear_conf()
8880 local clear_conf_arg=$1
8883 if ! combined_mgs_mds ; then
8884 mgsdev=$(mgsdevname)
8885 stop_mgs || error "stop_mgs failed"
8886 start_mgs "-o nosvc" || error "start_mgs nosvc failed"
8888 mgsdev=$(mdsdevname 1)
8889 start_mdt 1 "-o nosvc" || error "start_mdt 1 nosvc failed"
8892 do_facet mgs "rm -rf $TMP/${tdir}/conf1; mkdir -p $TMP/${tdir}/conf1;" \
8893 "$DEBUGFS -c -R \\\"rdump CONFIGS $TMP/${tdir}/conf1\\\" \
8897 # the command being tested
8899 do_facet mgs $LCTL clear_conf $clear_conf_arg ||
8900 error "clear_conf failed"
8901 if ! combined_mgs_mds ; then
8902 stop_mgs || error "stop_mgs failed"
8904 stop_mdt 1 || error "stop_mdt 1 failed"
8907 do_facet mgs "rm -rf $TMP/${tdir}/conf2; mkdir -p $TMP/${tdir}/conf2;" \
8908 "$DEBUGFS -c -R \\\"rdump CONFIGS $TMP/${tdir}/conf2\\\" \
8912 test_109_file_shortened() {
8914 local sizes=($(do_facet mgs "stat -c %s " \
8915 "$TMP/${tdir}/conf1/CONFIGS/$file" \
8916 "$TMP/${tdir}/conf2/CONFIGS/$file"))
8917 [ ${sizes[1]} -lt ${sizes[0]} ] && return 0
8923 [ $MDS1_VERSION -lt $(version_code 2.10.59) ] &&
8924 skip "Needs MDS version 2.10.59 or later."
8925 [ "$(facet_fstype mgs)" == zfs ] &&
8926 skip "LU-8727: no implementation for ZFS"
8931 client_up || error "client_up failed"
8934 # set number of permanent parameters
8936 test_109_set_params $FSNAME
8938 umount_client $MOUNT || error "umount_client failed"
8939 stop_ost || error "stop_ost failed"
8940 stop_mds || error "stop_mds failed"
8942 test_109_clear_conf $FSNAME
8944 # make sure that all configs are cleared
8946 test_109_file_shortened $FSNAME-MDT0000 ||
8947 error "failed to clear MDT0000 config"
8948 test_109_file_shortened $FSNAME-client ||
8949 error "failed to clear client config"
8954 # check that configurations are intact
8956 test_109_test_params $FSNAME
8961 destroy_test_pools || error "destroy test pools failed"
8965 run_test 109a "test lctl clear_conf fsname"
8969 [ $MDS1_VERSION -lt $(version_code 2.10.59) ] &&
8970 skip "Needs MDS version 2.10.59 or later."
8971 [ "$(facet_fstype mgs)" == zfs ] &&
8972 skip "LU-8727: no implementation for ZFS"
8977 client_up || error "client_up failed"
8980 # set number of permanent parameters
8982 test_109_set_params $FSNAME
8984 umount_client $MOUNT || error "umount_client failed"
8985 stop_ost || error "stop_ost failed"
8986 stop_mds || error "stop_mds failed"
8988 test_109_clear_conf $FSNAME-MDT0000
8990 # make sure that only one config is cleared
8992 test_109_file_shortened $FSNAME-MDT0000 ||
8993 error "failed to clear MDT0000 config"
8994 test_109_file_shortened $FSNAME-client &&
8995 error "failed to clear client config"
8999 # check that configurations are intact
9001 test_109_test_params $FSNAME
9006 destroy_test_pools || error "destroy test pools failed"
9010 run_test 109b "test lctl clear_conf one config"
9014 [[ "$mds1_FSTYPE" != ldiskfs ]] &&
9015 skip "Only applicable to ldiskfs-based MDTs"
9017 do_facet $SINGLEMDS $DEBUGFS -w -R supported_features |grep large_dir ||
9018 skip "large_dir option is not supported on MDS"
9019 do_facet ost1 $DEBUGFS -w -R supported_features | grep large_dir ||
9020 skip "large_dir option is not supported on OSS"
9022 stopall # stop all targets before modifying the target counts
9023 local old_mdscount=$MDSCOUNT
9024 local old_ostcount=$OSTCOUNT
9026 stack_trap "MDSCOUNT=$old_mdscount OSTCOUNT=$old_ostcount; reformat"
9030 # ext4_dir_entry_2 struct size:264
9031 # dx_root struct size:8
9032 # dx_node struct size:8
9033 # dx_entry struct size:8
9034 # For 1024 bytes block size.
9035 # First level directory entries: 126
9036 # Second level directory entries: 127
9037 # Entries in leaf: 3
9038 # For 2 levels limit: 48006
9039 # For 3 levels limit : 6096762
9040 # Create 80000 files to safely exceed 2-level htree limit.
9041 CONF_SANITY_110_LINKS=${CONF_SANITY_110_LINKS:-80000}
9043 # can fit at most 3 filenames per 1KB leaf block, but each
9044 # leaf/index block will only be 3/4 full before split at each level
9045 (( MDSSIZE < CONF_SANITY_110_LINKS / 3 * 4/3 * 4/3 )) &&
9046 CONF_SANITY_110_LINKS=$((MDSSIZE * 3 * 3/4 * 3/4))
9048 combined_mgs_mds || replace=" --replace "
9049 local opts="$(mkfs_opts mds1 $(mdsdevname 1)) \
9050 $replace --reformat $(mdsdevname 1) $(mdsvdevname 1)"
9051 if [[ $opts != *large_dir* ]]; then
9052 if [[ $opts != *mkfsoptions* ]]; then
9053 opts+=" --mkfsoptions=\\\"-O large_dir -b 1024 -i 65536\\\""
9055 opts="${opts//--mkfsoptions=\\\"/ \
9056 --mkfsoptions=\\\"-O large_dir -b 1024 -i 65536 }"
9059 echo "MDT params: $opts"
9061 combined_mgs_mds || start_mgs
9062 add mds1 $opts || error "add mds1 failed with new params"
9063 start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS
9065 opts="$(mkfs_opts ost1 $(ostdevname 1)) \
9066 $replace --reformat $(ostdevname 1) $(ostvdevname 1)"
9068 if [[ $opts != *large_dir* ]]; then
9069 if [[ $opts != *mkfsoptions* ]]; then
9070 opts+=" --mkfsoptions=\\\"-O large_dir\\\" "
9072 opts="${opts//--mkfsoptions=\\\"/ \
9073 --mkfsoptions=\\\"-O large_dir }"
9076 echo "OST params: $opts"
9077 add ost1 $opts || error "add ost1 failed with new params"
9078 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS
9080 MOUNT_2=yes mountcli || error "mount clients failed"
9082 mkdir -v $DIR/$tdir || error "cannot create $DIR/$tdir"
9083 local pids count=0 group=0
9085 echo "creating $CONF_SANITY_110_LINKS in total"
9086 while (( count < CONF_SANITY_110_LINKS )); do
9087 local len=$((253 - $(wc -c <<<"$tfile-$group-40000-")))
9088 local dir=DIR$((group % 2 + 1))
9089 local target=${!dir}/$tdir/$tfile-$group
9090 local long=$target-$(generate_name $len)-
9091 local create=$((CONF_SANITY_110_LINKS - count))
9093 (( create > 40000 )) && create=40000
9094 touch $target || error "creating $target failed"
9095 echo "creating $create hard links to $target"
9096 createmany -l $target $long $create &
9099 count=$((count + create))
9100 group=$((group + 1))
9102 echo "waiting for PIDs$pids to complete"
9103 wait $pids || error "createmany failed after $group groups"
9105 umount_client $MOUNT2 -f
9108 run_e2fsck $(facet_active_host mds1) $(mdsdevname 1) -n
9109 MDSCOUNT=$old_mdscount
9110 OSTCOUNT=$old_ostcount
9112 run_test 110 "Adding large_dir with 3-level htree"
9115 [[ "$mds1_FSTYPE" != ldiskfs ]] &&
9116 skip "Only applicable to ldiskfs-based MDTs"
9118 is_dm_flakey_dev $SINGLEMDS $(mdsdevname 1) &&
9119 skip "This test can not be executed on flakey dev"
9121 do_facet $SINGLEMDS $DEBUGFS -w -R supported_features |grep large_dir ||
9122 skip "large_dir option is not supported on MDS"
9124 do_facet ost1 $DEBUGFS -w -R supported_features | grep large_dir ||
9125 skip "large_dir option is not supported on OSS"
9127 # cleanup before changing target counts
9129 local old_mdscount=$MDSCOUNT
9130 local old_ostcount=$OSTCOUNT
9131 local old_mdssize=$MDSSIZE
9133 stack_trap "MDSSIZE=$old_mdssize MDSCOUNT=$old_mdscount \
9134 OSTCOUNT=$old_ostcount; reformat"
9137 (( MDSSIZE < 2400000 )) && MDSSIZE=2400000 # need at least 2.4GB
9139 local mdsdev=$(mdsdevname 1)
9140 combined_mgs_mds || replace=" --replace "
9141 local opts="$(mkfs_opts mds1 $(mdsdevname 1)) \
9142 $replace --reformat $(mdsdevname 1) $(mdsvdevname 1)"
9143 if [[ $opts != *large_dir* ]]; then
9144 if [[ $opts != *mkfsoptions* ]]; then
9145 opts+=" --mkfsoptions=\\\"-O large_dir -i 1048576 \\\" "
9147 opts="${opts//--mkfsoptions=\\\"/ \
9148 --mkfsoptions=\\\"-O large_dir -i 1048576 }"
9151 echo "MDT params: $opts"
9153 combined_mgs_mds || start_mgs
9154 __touch_device mds 1
9155 add mds1 $opts || error "add mds1 failed with new params"
9156 start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS
9158 opts="$(mkfs_opts ost1 $(ostdevname 1)) \
9159 $replace --reformat $(ostdevname 1) $(ostvdevname 1)"
9160 if [[ $opts != *large_dir* ]]; then
9161 if [[ $opts != *mkfsoptions* ]]; then
9162 opts+=" --mkfsoptions=\\\"-O large_dir \\\""
9164 opts="${opts//--mkfsoptions=\\\"/ --mkfsoptions=\\\"-O large_dir }"
9167 echo "OST params: $opts"
9168 __touch_device ost 1
9169 add ost1 $opts || error "add ost1 failed with new params"
9170 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS
9172 MOUNT_2=yes mountcli
9173 mkdir $DIR/$tdir || error "cannot create $DIR/$tdir"
9175 lfs df -i $DIR/$tdir
9179 local start=$SECONDS
9181 local dirmax=$((2 << 30))
9187 while (( !needskip & dirsize < dirmax )); do
9190 for cli in ${CLIENTS//,/ }; do
9191 local len=$((253 - $(wc -c <<<"$cli-$group-60000-")))
9192 local target=$cli-$group
9193 local long=$DIR/$tdir/$target-$(generate_name $len)-
9195 RPWD=$DIR/$tdir do_node $cli touch $target ||
9196 error "creating $target failed"
9197 echo "creating 60000 hardlinks to $target"
9198 RPWD=$DIR/$tdir do_node $cli createmany -l $target $long 60000 &
9201 group=$((group + 1))
9203 long=$DIR2/$tdir/$target-$(generate_name $len)-
9205 RPWD=$DIR2/$tdir do_node $cli touch $target ||
9206 error "creating $target failed"
9207 echo "creating 60000 hardlinks to $target"
9208 RPWD=$DIR2/$tdir do_node $cli createmany -l $target $long 60000 &
9211 group=$((group + 1))
9213 echo "waiting for PIDs$pids to complete"
9214 wait $pids || error "createmany failed after $group groups"
9215 dirsize=$(stat -c %s $DIR/$tdir)
9216 taken=$((SECONDS - start))
9217 rate=$((dirsize / taken))
9218 left=$(((dirmax - dirsize) / rate))
9219 num=$((group * 60000))
9220 echo "estimate ${left}s left after $num files / ${taken}s"
9221 # if the estimated time remaining is too large (it may change
9222 # over time as the create rate is not constant) then exit
9223 # without declaring a failure.
9224 (( left > 1200 )) && needskip=1
9227 umount_client $MOUNT2 -f
9230 ! (( $needskip )) ||
9231 echo "ETA ${left}s after $num files / ${taken}s is too long"
9233 run_e2fsck $(facet_active_host mds1) $(mdsdevname 1) -n
9234 MDSCOUNT=$old_mdscount
9235 OSTCOUNT=$old_ostcount
9236 MDSSIZE=$old_mdssize
9238 run_test 111 "Adding large_dir with over 2GB directory"
9241 local param="no_create"
9243 (( $OST1_VERSION > $(version_code 2.14.0) )) ||
9244 skip "need OSS at least 2.14.0"
9245 (( $OST1_VERSION >= $(version_code 2.15.56.125) )) ||
9246 param="no_precreate"
9248 start_mds || error "MDS start failed"
9249 start_ost || error "OSS start failed"
9250 echo "start ost2 service on $(facet_active_host ost2)"
9251 start ost2 $(ostdevname 2) $(csa_add "$OST_MOUNT_OPTS" -o $param) ||
9252 error "start ost2 facet failed"
9253 local val=$(do_facet ost2 \
9254 "$LCTL get_param -n obdfilter.$FSNAME-OST0001*.$param")
9255 (( $val == 1 )) || error "obdfilter.$FSNAME-OST0001*.$param=$val"
9257 mount_client $MOUNT || error "mount client failed"
9258 wait_osc_import_state mds1 ost1 FULL
9259 wait_osc_import_ready client ost1
9260 wait_osc_import_ready client ost2
9262 $LFS setstripe -i 0 $DIR/$tfile.0 ||
9263 error "problem creating $tfile.0 on OST0000"
9264 $LFS setstripe -i 1 $DIR/$tfile.1 && $LFS getstripe $DIR/$tfile.1 &&
9265 (( $($LFS getstripe -i $DIR/$tfile.1) == 1 )) &&
9266 error "allowed to create $tfile.1 on OST0001"
9268 $LFS df -v $MOUNT | grep -q "OST:1.*N" ||
9269 error "NOCREATE not in 'lfs df'"
9271 do_facet ost2 $LCTL set_param obdfilter.$FSNAME-OST0001*.$param=0
9273 $LFS setstripe -i 1 $DIR/$tfile.2 ||
9274 error "failed to create $tfile.2 on ost1 facet"
9275 # files not cleaned with ONLY_REPEAT because of client unmount below
9276 rm -f $DIR/$tfile.[012]
9277 stop_ost2 || error "stop ost2 facet failed"
9280 run_test 112a "mount OST with no_create option"
9283 (( MDSCOUNT >= 2 )) || skip "need at least 2 MDTs"
9284 (( $MDS1_VERSION >= $(version_code 2.15.56.125) )) ||
9285 skip "need MDS >= 2.15.56.125"
9286 local mdsnum=$MDSCOUNT
9287 local facet=mds$mdsnum
9288 local mdtidx=$((mdsnum - 1))
9289 local mdtname=$FSNAME-MDT$(printf %04x $mdtidx)
9291 start_mds --mdscount $((mdsnum - 1)) || error "MDS start failed"
9292 start_mdt $mdsnum -o no_create || error "start $facet failed"
9293 local val=$(do_facet $facet \
9294 "$LCTL get_param -n mdt.$mdtname*.no_create")
9295 (( $val == 1 )) || error "mdt.$mdtname*.no_create=$val"
9296 start_ost || error "ost1 start failed"
9297 start_ost2 || error "ost1 start failed"
9299 mount_client $MOUNT || error "mount client failed"
9300 wait_osc_import_ready $facet ost2
9303 $LFS df -v $MOUNT | grep -q "MDT:$mdtidx.*N" ||
9304 error "NOCREATE not in 'lfs df'"
9306 $LFS mkdir -i $mdtidx $DIR/$tdir ||
9307 $LFS setdirstripe -D -c 1 -i -1 --max-inherit-rr 2 $DIR/$tdir ||
9308 error "error creating $tdir on $mdtname"
9309 stack_trap "rm -rf $DIR/$tdir"
9311 mkdir $DIR/$tdir/d1.{1..100} || error "mkdir $tdir/d1.{1..100} failed"
9312 $LFS getdirstripe -i $DIR/$tdir/d1.* | sort | uniq -c
9313 do_facet $facet $LCTL set_param mdt.$mdtname*.no_create=0
9314 # allow one initial create for delayed statfs on client
9315 (( $($LFS getdirstripe -i $DIR/$tdir/d1.* | grep -c $mdtidx) < 2 )) ||
9316 error "allowed create on $mdtname"
9319 mkdir $DIR/$tdir/d2.{1..100} || error "mkdir $tdir/d2.{1..100} failed"
9320 $LFS getdirstripe -i $DIR/$tdir/d2.{1..100} | sort | uniq -c
9321 (( $($LFS getdirstripe -i $DIR/$tdir/d2.* | grep -c $mdtidx) > 10 )) ||
9322 error "no create on $mdtname"
9323 # files not cleaned with ONLY_REPEAT because of client unmount below
9325 stop_ost2 || error "ost1 start failed"
9328 run_test 112b "mount MDT with no_create option"
9331 SAVE_MGS_MOUNT_OPTS=$MGS_MOUNT_OPTS
9332 SAVE_MDS_MOUNT_OPTS=$MDS_MOUNT_OPTS
9333 SAVE_OST_MOUNT_OPTS=$OST_MOUNT_OPTS
9339 MGS_MOUNT_OPTS=$SAVE_MGS_MOUNT_OPTS
9340 MDS_MOUNT_OPTS=$SAVE_MDS_MOUNT_OPTS
9341 OST_MOUNT_OPTS=$SAVE_OST_MOUNT_OPTS
9342 # Revert old mount options back
9344 # Subsequent following test requires
9345 # conf-sanity to be in stopall state.
9346 # Force 'stopall' so others following
9351 # Error out with mount info
9353 local server_nodes=$(comma_list $(mdts_nodes) $(osts_nodes))
9356 echo "--Client Mount Info--"
9357 mount | grep -i lustre
9358 echo "--Server Mount Info--"
9359 do_nodes $server_nodes mount | grep -i lustre
9365 local ost_version="2.15.51" # Minimum version required
9367 (( OST1_VERSION >= $(version_code $ost_version) )) ||
9368 skip "Need server version at least $ost_version"
9370 stack_trap cleanup_113 EXIT
9372 # Reset before starting
9376 # Verify MDS's should start with "rw"
9377 do_facet $SINGLEMDS mount | grep "lustre.*rw,.*MDT" ||
9378 error_113 "$SINGLEMDS should be read-write"
9380 # Verify OST's should start with "rw"
9381 for (( i=1; i <= OSTCOUNT; i++ )); do
9382 do_facet ost$i mount | grep "lustre.*rw,.*OST" ||
9383 error_113 "ost$i should be read-write"
9386 # rdonly_dev does not currently work for ldiskfs
9387 # We skip the rdonly_dev check until then.
9388 if [[ $ost1_FSTYPE == ldiskfs ]]; then
9389 echo "Shadow Mountpoint correctly reports rw for ldiskfs"
9394 # Only ZFS specific tests below.
9397 # Must stop all (server+client) and restart to verify new
9401 # add rdonly_dev to mount option
9402 MGS_MOUNT_OPTS=$(csa_add "$MGS_MOUNT_OPTS" -o rdonly_dev)
9403 MDS_MOUNT_OPTS=$(csa_add "$MDS_MOUNT_OPTS" -o rdonly_dev)
9404 OST_MOUNT_OPTS=$(csa_add "$OST_MOUNT_OPTS" -o rdonly_dev)
9406 # Only restart server(mds/ost). Sufficient for test
9407 setupall server_only || error "Fail to start servers"
9409 # Verify MDS's should be "ro"
9410 do_facet $SINGLEMDS mount | grep "lustre.*ro,.*MDT.*rdonly_dev" ||
9411 error_113 "$SINGLEMDS should be read-only"
9413 # Verify OST's should be "ro"
9414 for (( i=1; i <= OSTCOUNT; i++ )); do
9415 do_facet ost$i mount | grep "lustre.*ro,.*OST.*rdonly_dev" ||
9416 error_113 "ost$i should be read-only"
9419 run_test 113 "Shadow mountpoint correctly report ro/rw for mounts"
9422 # Purpose: To verify dynamic thread (OSS) creation.
9423 # (This was sanity/115)
9426 [ $PARALLEL == "yes" ] && skip "skip parallel run"
9427 remote_ost_nodsh && skip "remote OST with nodsh"
9429 # Lustre does not stop service threads once they are started.
9430 # Reset number of running threads to default.
9435 local save_params="$TMP/sanity-$TESTNAME.parameters"
9437 # Get ll_ost_io count before I/O
9438 OSTIO_pre=$(do_facet ost1 \
9439 "$LCTL get_param ost.OSS.ost_io.threads_started | cut -d= -f2")
9440 # Exit if lustre is not running (ll_ost_io not running).
9441 [ -z "$OSTIO_pre" ] && error "no OSS threads"
9443 echo "Starting with $OSTIO_pre threads"
9444 local thread_max=$((OSTIO_pre * 2))
9445 local rpc_in_flight=$((thread_max * 2))
9447 # this is limited to OSC_MAX_RIF_MAX (256)
9448 [ $rpc_in_flight -gt 256 ] && rpc_in_flight=256
9449 thread_max=$((rpc_in_flight / 2))
9450 [ $thread_max -le $OSTIO_pre ] && skip "Too many ost_io threads" &&
9453 # Number of I/O Process proposed to be started.
9455 local facets=$(get_facets OST)
9457 save_lustre_params client "osc.*OST*.max_rpcs_in_flight" > $save_params
9458 save_lustre_params $facets "ost.OSS.ost_io.threads_max" >> $save_params
9460 # Set in_flight to $rpc_in_flight
9461 $LCTL set_param osc.*OST*.max_rpcs_in_flight=$rpc_in_flight ||
9462 error "Failed to set max_rpcs_in_flight to $rpc_in_flight"
9463 nfiles=${rpc_in_flight}
9464 # Set ost thread_max to $thread_max
9465 do_facet ost1 "$LCTL set_param ost.OSS.ost_io.threads_max=$thread_max"
9467 # 5 Minutes should be sufficient for max number of OSS
9468 # threads(thread_max) to be created.
9472 local wtl=${WTL:-"$LUSTRE/tests/write_time_limit"}
9474 test_mkdir $DIR/$tdir
9475 for ((i = 1; i <= nfiles; i++)); do
9476 local file=$DIR/$tdir/${tfile}-$i
9478 $LFS setstripe -c -1 -i 0 $file
9479 ($wtl $file $timeout)&
9482 # I/O Started - Wait for thread_started to reach thread_max or report
9483 # error if thread_started is more than thread_max.
9484 echo "Waiting for thread_started to reach thread_max"
9485 local thread_started=0
9486 local end_time=$((SECONDS + timeout))
9488 while [ $SECONDS -le $end_time ] ; do
9490 # Get ost i/o thread_started count.
9491 thread_started=$(do_facet ost1 \
9493 ost.OSS.ost_io.threads_started | cut -d= -f2")
9494 # Break out if thread_started is equal/greater than thread_max
9495 if (( $thread_started >= $thread_max )); then
9496 echo ll_ost_io thread_started $thread_started, \
9497 equal/greater than thread_max $thread_max
9503 # Cleanup - We have the numbers, Kill i/o jobs if running.
9504 jobcount=($(jobs -p))
9506 for ((i=0; i < ${#jobcount[*]}; i++)); do
9507 kill -9 ${jobcount[$i]}
9508 if [ $? -ne 0 ] ; then
9509 echo "warning: cannot kill WTL pid ${jobcount[$i]}"
9513 # Cleanup files left by WTL binary.
9514 for ((i = 1; i <= nfiles; i++)); do
9515 local file=$DIR/$tdir/${tfile}-$i
9518 if [ $? -ne 0 ] ; then
9519 echo "Warning: Failed to delete file $file"
9523 restore_lustre_params <$save_params
9524 rm -f $save_params || echo "Warning: delete file '$save_params' failed"
9526 # Error out if no new thread has started or Thread started is greater
9528 if (( $thread_started <= $OSTIO_pre ||
9529 $thread_started > $thread_max )); then
9530 error "ll_ost_io: thread_started $thread_started" \
9531 "OSTIO_pre $OSTIO_pre, thread_max $thread_max." \
9532 "No new thread started or thread started greater " \
9536 run_test 114 "verify dynamic thread creation===================="
9542 do_facet mds1 rm -f $1
9546 if [ "$mds1_FSTYPE" != ldiskfs ]; then
9547 skip "Only applicable to ldiskfs-based MDTs"
9549 [ -n "$FILESET" ] && skip "Not functional for FILESET set"
9551 local dbfs_ver=$(do_facet mds1 $DEBUGFS -V 2>&1)
9553 echo "debugfs version: $dbfs_ver"
9554 echo "$dbfs_ver" | egrep -w "1.44.3.wc1|1.44.5.wc1|1.45.2.wc1" &&
9555 skip_env "This version of debugfs doesn't show inode number"
9557 local IMAGESIZE=$((3072 << 30)) # 3072 GiB
9567 do_facet mds1 "hostname; $LCTL dl; mount"
9569 do_facet ost1 "hostname; $LCTL dl; mount"
9570 # We need MDT size 3072GB, because it is smallest
9571 # partition that can store 2B inodes
9572 do_facet mds1 "mkdir -p $TMP/$tdir"
9573 local mdsimgname=$TMP/$tdir/lustre-mdt
9575 do_facet mds1 "rm -f $mdsimgname"
9576 do_facet mds1 "touch $mdsimgname"
9577 stack_trap "cleanup_115 $mdsimgname" EXIT
9578 do_facet mds1 "$TRUNCATE $mdsimgname $IMAGESIZE" ||
9579 skip "Backend FS doesn't support sparse files"
9580 local mdsdev=$(do_facet mds1 "losetup -f")
9582 do_facet mds1 "losetup $mdsdev $mdsimgname"
9584 local mds_opts="$(mkfs_opts mds1 $(mdsdevname 1)) \
9585 --mkfsoptions='-O ea_inode,^resize_inode,meta_bg \
9586 -N 2247484000 -E lazy_itable_init' --device-size=$IMAGESIZE"
9587 add mds1 $mds_opts --mgs --reformat $mdsdev || {
9588 do_facet $SINGLEMDS \
9589 "losetup -d $mdsdev && rm -f $mdsimgname"
9590 skip_env "format large MDT failed"
9593 local ostdev=$(ostdevname 1)
9595 local opts="$(mkfs_opts ost1 $ostdev) \
9596 --reformat $ostdev $ostdev"
9597 add ost1 $opts || error "add ost1 failed with new params"
9598 start mds1 $mdsdev $MDS_MOUNT_OPTS || error "start MDS failed"
9599 start_ost || error "start OSS failed"
9600 mount_client $MOUNT || error "mount client failed"
9602 mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir fail"
9603 local goal="/sys/fs/ldiskfs/$(basename $mdsdev)/inode_goal"
9605 # 2147483648 is 0x80000000
9606 do_facet mds1 "echo 2147483648 >> $goal; grep . $goal"
9607 touch $DIR/$tdir/$tfile
9609 # attrs from 1 to 16 go to block, 17th - to inode
9612 for i in {1..17}; do
9613 local nm="trusted.ea$i"
9614 setfattr -n $nm -v $(printf "xattr%0250d" $i) $DIR/$tdir/$tfile
9617 do_facet mds1 "$DEBUGFS -c -R 'stat ROOT/$tdir/$tfile' $mdsdev"
9619 # inode <2147483649> trusted.ea16 (255)
9620 local inode_num=$(do_facet mds1 \
9621 "$DEBUGFS -c -R 'stat ROOT/$tdir/$tfile' $mdsdev" |
9622 awk '/ea17/ { print $2 }' |
9623 sed -e 's/>//' -e 's/<//' -e 's/\"//')
9624 echo "inode num: $inode_num"
9625 [ $inode_num -ge 2147483648 ] || error "inode $inode_num too small"
9626 do_facet mds1 "losetup -d $mdsdev"
9628 run_test 115 "Access large xattr with inodes number over 2TB"
9631 [ "$mds1_FSTYPE" != ldiskfs ] && skip "ldiskfs only test"
9632 [ "$MDS1_VERSION" -lt $(version_code 2.10.59) ] &&
9633 skip "Need server version at least 2.10.59"
9634 do_facet $SINGLEMDS which mkfs.xfs ||
9635 skip_env "No mkfs.xfs installed"
9640 local tmpmnt=$TMP/$tdir
9641 local mdtimg=$tfile-mdt0
9643 do_facet $SINGLEMDS mkdir -p $tmpmnt
9644 stack_trap "do_facet $SINGLEMDS rmdir $tmpmnt" EXIT
9646 do_facet $SINGLEMDS touch $TMP/$mdtimg
9647 stack_trap "do_facet $SINGLEMDS rm -f $TMP/$mdtimg" EXIT
9648 do_facet $SINGLEMDS mkfs -t xfs -d file,size=1t,name=$TMP/$mdtimg ||
9649 error "mkfs temporary xfs image"
9651 do_facet $SINGLEMDS mount $TMP/$mdtimg $tmpmnt ||
9652 error "mount temporary xfs image"
9653 stack_trap "do_facet $SINGLEMDS umount $tmpmnt" EXIT
9654 local old_mdssize=$MDSSIZE
9655 local old_mdsisize=$MDSISIZE
9657 MDSSIZE=$((17 * 1024 * 1024 * 1024)) # 17T MDT
9658 MDSISIZE=$((16 << 20))
9659 local opts17t="$(mkfs_opts $SINGLEMDS)"
9661 MDSSIZE=$old_mdssize
9662 MDSISIZE=$old_mdsisize
9664 do_facet $SINGLEMDS $MKFS \
9665 ${opts17t/-E /-E lazy_itable_init,lazy_journal_init,} \
9667 error "failed to mkfs for $tmpmnt/$mdtimg"
9669 do_facet $SINGLEMDS $TUNE2FS -l $tmpmnt/$mdtimg |
9670 grep -qw 'features.*extent' || error "extent should be enabled"
9673 run_test 116 "big size MDT support"
9676 # Call setup only if LustreFS is not mounted
9677 check_mount || setup
9679 do_facet ost1 "$LCTL set_param ost.OSS.ost_io.nrs_policies=fifo"
9680 do_facet ost1 "$LCTL get_param -n ost.OSS.ost_io.nrs_tbf_rule" &&
9681 error "get_param should fail"
9682 cleanup || error "cleanup failed with rc $?"
9684 run_test 117 "lctl get_param return errors properly"
9690 [[ "$MDSCOUNT" -ge 2 ]] || skip "Need more at least 2 MDTs"
9692 had_config=$(do_facet mds1 "$LCTL get_param debug | grep config")
9693 do_facet mds1 "$LCTL set_param debug=+config"
9694 do_facet mds1 "$LCTL clear"
9697 do_facet mds2 "$TUNEFS --writeconf $(mdsdevname 2)" &>/dev/null
9698 # mount after writeconf will make "add osp" added to mdt0 config:
9699 # 53 (224)marker 60 (flags=0x01, v2.5.1.0) lustre-MDT0001 'add osp'
9700 # 54 (080)add_uuid nid=... 0: 1:...
9701 # 55 (144)attach 0:lustre-MDT0001-osp-MDT0000 1:osp 2:...
9702 # 56 (144)setup 0:lustre-MDT0001-osp-MDT0000 1:... 2:...
9703 # 57 (136)modify_mdc_tgts add 0:lustre-MDT0000-mdtlov 1:... 2:1 3:1
9704 # duplicate modify_mdc_tgts caused crashes
9707 # using larger debug_mb size to avoid lctl dk log truncation
9708 size_mb=$((DEBUG_SIZE_SAVED * 4))
9711 # though config processing stops after failed attach and setup
9712 # it will proceed after the failed command after each writeconf
9713 # this is the original scenario of the issue
9714 do_facet mds2 "$TUNEFS --writeconf $(mdsdevname 2)" &>/dev/null
9715 do_facet mds1 "$LCTL set_param debug_mb=$size_mb"
9718 wait_update_facet_cond mds1 \
9719 "$LCTL dk | grep -c Processed.log.$FSNAME-MDT0000" \
9724 [[ -z "$had_config" ]] && do_facet mds1 lctl set_param debug=-config
9728 run_test 119 "writeconf on slave mdt shouldn't duplicate mdc/osp and crash"
9730 test_120() { # LU-11130
9731 [ "$MDSCOUNT" -lt 2 ] && skip "mdt count < 2"
9732 [ "$mds1_FSTYPE" != ldiskfs ] &&
9733 skip "ldiskfs only test"
9734 [ "$MDS1_VERSION" -lt $(version_code 2.11.56) ] &&
9735 skip "Need DNE2 capable MD target with LU-11130 fix"
9739 local mds1host=$(facet_active_host mds1)
9740 local mds1dev=$(mdsdevname 1)
9742 $LFS mkdir -i 1 $DIR/$tdir
9743 $LFS mkdir -i 0 $DIR/$tdir/mds1dir
9745 ln -s foo $DIR/$tdir/bar
9746 mv $DIR/$tdir/bar $DIR/$tdir/mds1dir/bar2 ||
9747 error "cross-target rename failed"
9751 run_e2fsck $mds1host $mds1dev "-n"
9753 run_test 120 "cross-target rename should not create bad symlinks"
9757 start_mgsmds || error "MGS MDS Start failed"
9759 stop_mds || error "Stopping MDSes failed"
9763 stop_mds || error "Stopping MDSes failed"
9765 run_test 121 "failover MGS"
9768 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
9769 [[ "$OST1_VERSION" -ge $(version_code 2.11.53) ]] ||
9770 skip "Need OST version at least 2.11.53"
9773 LOAD_MODULES_REMOTE=true load_modules
9774 #define OBD_FAIL_OFD_SET_OID 0x1e0
9775 do_facet ost1 $LCTL set_param fail_loc=0x00001e0
9778 $LFS mkdir -i1 -c1 $DIR/$tdir
9779 $LFS setstripe -i0 -c1 $DIR/$tdir
9780 do_facet ost1 $LCTL set_param fail_loc=0
9781 createmany -o $DIR/$tdir/file_ 1000 ||
9782 error "Fail to create a new sequence"
9786 run_test 122a "Check OST sequence update"
9789 remote_mgs_nodsh && skip "remote MGS with nodsh"
9790 [ -d $MOUNT/.lustre ] || setup
9792 # test old logid format until removal from llog_ioctl.c::str2logid()
9793 if (( $MGS_VERSION < $(version_code 2.99.53) )); then
9794 do_facet mgs $LCTL dl | grep MGS
9795 do_facet mgs "$LCTL --device %MGS llog_print \
9796 \\\\\\\$$FSNAME-client 1 10" ||
9797 error "old llog_print failed"
9800 # test new logid format
9801 if [ $MGS_VERSION -ge $(version_code 2.9.53) ]; then
9802 do_facet mgs "$LCTL --device MGS llog_print $FSNAME-client" ||
9803 error "new llog_print failed"
9806 run_test 123aa "llog_print works with FIDs and simple names"
9809 remote_mgs_nodsh && skip "remote MGS with nodsh"
9810 [[ $MGS_VERSION -gt $(version_code 2.11.51) ]] ||
9811 skip "Need server with working llog_print support"
9813 [ -d $MOUNT/.lustre ] || setup
9819 [[ $MGS_VERSION -gt $(version_code 2.13.54) ]] ||
9820 mgs_arg="--device MGS"
9822 orig_val=$(do_facet mgs $LCTL get_param jobid_name)
9823 do_facet mgs $LCTL set_param -P jobid_name="TESTNAME"
9825 yaml=$(do_facet mgs $LCTL $mgs_arg llog_print params |
9826 grep jobid_name | tail -n 1)
9828 local param=$(awk '{ print $10 }' <<< "$yaml")
9829 local val=$(awk '{ print $12 }' <<< "$yaml")
9830 #return to the default
9831 do_facet mgs $LCTL set_param -P jobid_name=$orig_val
9832 [ $val = "TESTNAME" ] || error "bad value: $val"
9833 [ $param = "jobid_name," ] || error "Bad param: $param"
9835 run_test 123ab "llog_print params output values from set_param -P"
9837 test_123ac() { # LU-11566
9838 remote_mgs_nodsh && skip "remote MGS with nodsh"
9839 do_facet mgs "$LCTL help llog_print" 2>&1 | grep -q -- --start ||
9840 skip "Need 'lctl llog_print --start' on MGS"
9846 [[ $MGS_VERSION -gt $(version_code 2.13.54) ]] ||
9847 mgs_arg="--device MGS"
9849 [ -d $MOUNT/.lustre ] || setup
9851 # - { index: 10, event: add_uuid, nid: 192.168.20.1@tcp(0x20000c0a81401,
9852 # node: 192.168.20.1@tcp }
9853 do_facet mgs $LCTL $mgs_arg \
9854 llog_print --start $start --end $end $FSNAME-client | tr -d , |
9855 while read DASH BRACE INDEX idx EVENT BLAH BLAH BLAH; do
9856 (( idx >= start )) || error "llog_print index $idx < $start"
9857 (( idx <= end )) || error "llog_print index $idx > $end"
9860 run_test 123ac "llog_print with --start and --end"
9862 test_123ad() { # LU-11566
9863 remote_mgs_nodsh && skip "remote MGS with nodsh"
9864 # older versions of lctl may not print all records properly
9865 do_facet mgs "$LCTL help llog_print" 2>&1 | grep -q -- --start ||
9866 skip "Need 'lctl llog_print --start' on MGS"
9868 [ -d $MOUNT/.lustre ] || setup
9870 # append a new record, to avoid issues if last record was cancelled
9871 local old=$($LCTL get_param -n osc.*-OST0000-*.max_dirty_mb | head -1)
9872 do_facet mgs $LCTL conf_param $FSNAME-OST0000.osc.max_dirty_mb=$old
9874 # logid: [0x3:0xa:0x0]:0
9878 local num=$(do_facet mgs $LCTL --device MGS llog_info $FSNAME-client |
9879 awk '/last_index:/ { print $2 - 1 }')
9881 # - { index: 71, event: set_timeout, num: 0x14, param: sys.timeout=20 }
9882 local last=$(do_facet mgs $LCTL --device MGS llog_print $FSNAME-client |
9883 tail -1 | awk '{ print $4 }' | tr -d , )
9884 (( last == num )) || error "llog_print only showed $last/$num records"
9886 run_test 123ad "llog_print shows all records"
9888 test_123ae() { # LU-11566
9896 remote_mgs_nodsh && skip "remote MGS with nodsh"
9897 [ -d $MOUNT/.lustre ] || setupall
9899 max=$($LCTL get_param -n osc.*-OST0000-*.max_dirty_mb | head -1)
9900 pgs=$($LCTL get_param -n osc.*-OST0000-*.max_pages_per_rpc | head -1)
9901 [[ $MGS_VERSION -gt $(version_code 2.13.54) ]] ||
9902 mgs_arg="--device MGS"
9904 if do_facet mgs "$LCTL help llog_cancel" 2>&1| grep -q -- --log_id; then
9905 # save one set_param -P record in case none exist
9907 do_facet mgs $LCTL set_param -P osc.*.max_pages_per_rpc=$pgs
9908 stack_trap "do_facet mgs $LCTL set_param -P -d \
9909 osc.*.max_pages_per_rpc"
9912 orig=$(do_facet mgs $LCTL $mgs_arg llog_print $log |
9913 tail -1 | awk '{ print $4 }' | tr -d , )
9914 do_facet mgs $LCTL set_param -P osc.*.max_dirty_mb=$max
9915 do_facet mgs $LCTL $mgs_arg llog_print $log | tail -1 |
9916 grep "parameter: osc.*.max_dirty_mb" ||
9917 error "new set_param -P wasn't stored in params log"
9919 # - { index: 71, event: set_param, device: general,
9920 # param: osc.*.max_dirty_mb, value: 256 }
9921 id=$(do_facet mgs $LCTL $mgs_arg llog_print $log |
9922 tail -1 | awk '{ print $4 }' | tr -d , )
9923 do_facet mgs $LCTL $mgs_arg llog_cancel $log --log_idx=$id
9924 local new=$(do_facet mgs $LCTL $mgs_arg llog_print $log |
9925 tail -1 | awk '{ print $4 }' | tr -d , )
9926 (( new == orig )) ||
9927 error "new llog_cancel now $new, not at $orig records"
9930 # test old positional parameters for a while still
9931 if [ "$MGS_VERSION" -le $(version_code 3.1.53) ]; then
9934 do_facet mgs $LCTL conf_param \
9935 $FSNAME-OST0000.osc.max_pages_per_rpc=$pgs
9936 stack_trap "do_facet mgs $LCTL conf_param -d \
9937 $FSNAME-OST0000.osc.max_pages_per_rpc"
9939 orig=$(do_facet mgs $LCTL --device MGS llog_print $log |
9940 tail -1 | awk '{ print $4 }' | tr -d , )
9941 do_facet mgs $LCTL conf_param $FSNAME-OST0000.osc.max_dirty_mb=$max
9942 do_facet mgs $LCTL --device MGS llog_print $log |
9943 tail -1 | grep "parameter: osc.max_dirty_mb" ||
9944 error "old conf_param wasn't stored in params log"
9945 do_facet mgs $LCTL --device MGS llog_print $log
9946 # - { index: 71, event: conf_param, device: testfs-OST0000-osc,
9947 # param: osc.max_dirty_mb=256 }
9948 id=$(do_facet mgs $LCTL --device MGS llog_print $log |
9949 tail -1 | awk '{ print $4 }' | tr -d , )
9950 do_facet mgs $LCTL --device MGS llog_cancel $log $id
9951 do_facet mgs $LCTL --device MGS llog_print $log
9952 new=$(do_facet mgs $LCTL --device MGS llog_print $log |
9953 tail -1 | awk '{ print $4 }' | tr -d , )
9954 (( new == orig )) ||
9955 error "old llog_cancel now $new, not at $orig records"
9958 run_test 123ae "llog_cancel can cancel requested record"
9960 test_123af() { #LU-13609
9961 [ "$MGS_VERSION" -ge $(version_code 2.13.54) -a \
9962 "$MDS1_VERSION" -ge $(version_code 2.13.54) ] ||
9963 skip "Need both MGS and MDS version at least 2.13.54"
9965 [ -d $MOUNT/.lustre ] || setupall
9966 stack_trap "do_facet mds1 $LCTL set_param fail_loc=0" EXIT
9976 for device in "MGS" "$FSNAME-MDT0000"; do
9977 cmd="--device $device llog_catlist"
9978 echo "lctl $cmd ..."
9979 if [ "$device" = "MGS" ]; then
9984 orig_clist=($(do_facet $facet $LCTL $cmd | awk '{ print $2 }'))
9985 orig_count=${#orig_clist[@]}
9986 echo "orig_clist: ${orig_clist[*]}"
9988 #define OBD_FAIL_CATLIST 0x131b
9989 #fetch to llog records from the second one
9990 do_facet $facet $LCTL set_param fail_loc=0x131b fail_val=2
9992 new_clist=($(do_facet $facet $LCTL $cmd | awk '{ print $2 }'))
9993 new_count=${#new_clist[@]}
9994 echo "new_clist: ${new_clist[*]}"
9996 [ $new_count -eq $((orig_count - 1)) ] ||
9997 error "$new_count != $orig_count - 1"
9998 for i in $(seq 0 $new_count); do
10000 [ "${orig_clist[$j]}" = "${new_clist[$i]}" ] ||
10001 error "${orig_clist[$j]} != ${new_clist[$i]}"
10003 do_facet mds1 $LCTL set_param fail_loc=0
10007 run_test 123af "llog_catlist can show all config files correctly"
10009 test_123ag() { # LU-15142
10013 remote_mgs_nodsh && skip "remote MGS with nodsh"
10014 (( $MGS_VERSION >= $(version_code 2.14.55) )) ||
10015 skip "Need server version least 2.14.55"
10017 [ -d $MOUNT/.lustre ] || setup
10019 orig_val=$(do_facet mgs $LCTL get_param jobid_name)
10020 stack_trap "do_facet mgs $LCTL set_param -P jobid_name=$orig_val"
10022 do_facet mgs $LCTL set_param -P jobid_name="TESTNAME1"
10023 do_facet mgs $LCTL set_param -P -d jobid_name
10024 rec=$(do_facet mgs $LCTL --device MGS llog_print params |
10025 grep -c jobid_name)
10026 (( rec == 0 )) || error "parameter was not deleted, check #1"
10027 do_facet mgs $LCTL set_param -P jobid_name="TESTNAME1"
10028 rec=$(do_facet mgs $LCTL --device MGS llog_print params |
10029 grep -c jobid_name)
10030 (( rec == 1)) || error "parameter is not set"
10031 # usage with ordinary set_param format works too
10032 do_facet mgs $LCTL set_param -P -d jobid_name="ANY"
10033 rec=$(do_facet mgs $LCTL --device MGS llog_print params |
10034 grep -c jobid_name)
10035 (( rec == 0 )) || error "parameter was not deleted, check #2"
10037 run_test 123ag "llog_print skips values deleted by set_param -P -d"
10039 test_123ah() { #LU-7668 del_ost
10040 (( "$MGS_VERSION" >= $(version_code 2.15.51) &&
10041 "$MDS1_VERSION" >= $(version_code 2.15.51) )) ||
10042 skip "Need MGS/MDS version >= 2.15.51 for del_ost"
10044 [ -d $MOUNT/.lustre ] || setupall
10045 stack_trap "do_facet mds1 $LCTL set_param fail_loc=0" EXIT
10047 local cmd="--device MGS llog_print"
10049 cli_llogcnt_orig=$(do_facet mgs $LCTL $cmd $FSNAME-client |
10050 grep -c $FSNAME-OST0000)
10051 mds1_llogcnt_orig=$(do_facet mgs $LCTL $cmd $FSNAME-MDT0000 |
10052 grep -c $FSNAME-OST0000)
10054 [ $cli_llogcnt_orig -gt 0 ] ||
10055 error "$FSNAME-OST0000 not found (client)"
10056 [ $mds1_llogcnt_orig -gt 0 ] || error "$FSNAME-OST0000 not found (MDT)"
10058 # -n/--dryrun should NOT modify catalog
10059 do_facet mgs "$LCTL del_ost -n -t $FSNAME-OST0000" ||
10060 error "del_ost --dryrun failed with $?"
10062 local cli_llogcnt=$(do_facet mgs $LCTL $cmd $FSNAME-client |
10063 grep -c $FSNAME-OST0000)
10064 local mds1_llogcnt=$(do_facet mgs $LCTL $cmd $FSNAME-MDT0000 |
10065 grep -c $FSNAME-OST0000)
10067 [ $cli_llogcnt -eq $cli_llogcnt_orig ] ||
10068 error "--dryrun error: $cli_llogcnt != $cli_llogcnt_orig"
10069 [ $mds1_llogcnt -eq $mds1_llogcnt_orig ] ||
10070 error "--dryrun error: $mds1_llogcnt != $mds1_llogcnt_orig"
10073 do_facet mgs "$LCTL del_ost --target $FSNAME-OST0000" ||
10074 error "del_ost failed with $?"
10076 local cli_llogcnt=$(do_facet mgs $LCTL $cmd $FSNAME-client |
10077 grep -c $FSNAME-OST0000)
10078 local mds1_llogcnt=$(do_facet mgs $LCTL $cmd $FSNAME-MDT0000 |
10079 grep -c $FSNAME-OST0000)
10081 # every catalog entry for OST0000 should have been cancelled
10082 [ $cli_llogcnt -eq 0 ] || error "$FSNAME-OST0000 not cancelled (cli)"
10083 [ $mds1_llogcnt -eq 0 ] || error "$FSNAME-OST0000 not cancelled (MDT)"
10085 umount_client $MOUNT
10086 mount_client $MOUNT
10088 $LFS df | grep -q OST0000 && error "del_ost did not remove OST0000!"
10090 reformat_and_config
10092 run_test 123ah "del_ost cancels config log entries correctly"
10097 echo "cleanup test 123ai"
10099 # cancel last timeout record
10100 do_facet mgs "$LCTL set_param -P -d timeout"
10102 # restore timeout value
10103 do_nodes $(comma_list $(all_nodes)) "$LCTL set_param timeout=$timeout"
10106 test_123ai() { #LU-16167
10112 remote_mgs_nodsh && skip "remote MGS with nodsh"
10113 (( MDS1_VERSION >= $(version_code 2.15.51) )) ||
10114 skip "Need MDS version at least 2.15.51"
10116 [ -d $MOUNT/.lustre ] || setup
10118 old_count=$(do_facet mgs "$LCTL --device MGS llog_print -r params" |
10119 grep -c "parameter: timeout")
10121 old_timeout=$($LCTL get_param -n timeout)
10122 stack_trap "cleanup_123ai $old_timeout" EXIT
10124 # add and cancel params (2 * MAX_IOC_BUFLEN / 128 + 1 = 129)
10125 for i in {1..129}; do
10126 do_facet mgs "$LCTL set_param -P timeout=$i" ||
10127 error "fail to set timeout=$i on MGS"
10130 count=$(do_facet mgs "$LCTL --device MGS llog_print -r params" |
10131 grep -c "parameter: timeout")
10133 ((count - old_count == 129)) ||
10134 error "number timeout record missmatch ($count - $old_count != 129)"
10136 do_facet mgs "$LCTL --device MGS llog_print params" |
10137 tail -1 | grep "timeout, value: 129" ||
10138 error "llog_print could not display the last record (timeout=129)"
10141 run_test 123ai "llog_print display all non skipped records"
10144 remote_mgs_nodsh && skip "remote MGS with nodsh"
10146 [ -d $MOUNT/.lustre ] || setup
10147 yaml_file="$TMP/$tfile.yaml"
10149 do_facet mgs rm "$yaml_file"
10150 cfgfiles=$(do_facet mgs "lctl --device MGS llog_catlist" |
10151 sed 's/config_log://')
10153 # set jobid_var to a different value for test
10154 orig_val=$(do_facet mgs $LCTL get_param jobid_var)
10156 do_facet mgs $LCTL set_param -P jobid_var="TESTNAME"
10158 for i in $cfgfiles params; do
10159 do_facet mgs "lctl --device MGS llog_print ${i} >> $yaml_file"
10162 echo "Unmounting FS"
10170 test_123_restore() {
10171 set_val=$(do_facet mgs $LCTL get_param jobid_var)
10173 do_facet mgs $LCTL set_param -P $orig_val
10175 [ $set_val == "jobid_var=TESTNAME" ] ||
10176 error "$set_val is not TESTNAME"
10178 do_facet mgs rm "$yaml_file"
10190 # Reapply the config from before
10191 echo "Setting configuration parameters"
10192 do_facet mgs "lctl set_param -F $yaml_file"
10196 run_test 123F "clear and reset all parameters using set_param -F"
10206 # Reapply the config from before
10207 echo "Setting configuration parameters"
10208 do_facet mgs "lctl apply_yaml $yaml_file"
10212 run_test 123G "clear and reset all parameters using apply_yaml"
10217 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
10218 [ -z $mds2failover_HOST ] && skip "needs MDT failover setup"
10221 do_facet mgs $LCTL --device MGS llog_print $FSNAME-client |
10222 grep 1.2.3.4@tcp && error "Should not be fake nid"
10223 do_facet mgs $LCTL conf_param $FSNAME-MDT0001.failover.node=1.2.3.4@tcp\
10224 || error "Set params error"
10225 do_facet mgs $LCTL --device MGS llog_print $FSNAME-client |
10226 grep 1.2.3.4@tcp || error "Fake nid should be added"
10230 if combined_mgs_mds; then
10231 start_mdt 1 "-o nosvc" ||
10232 error "starting mds with nosvc option failed"
10234 local nid=$(do_facet mds2 $LCTL list_nids | head -1)
10235 local failover_nid=$(do_node $mds2failover_HOST $LCTL list_nids | head -1)
10237 do_facet mgs $LCTL replace_nids $FSNAME-MDT0001 $nid:$failover_nid ||
10238 error "replace_nids execution error"
10240 if combined_mgs_mds; then
10246 echo "lfs setdirstripe"
10247 $LFS setdirstripe -i 1 $MOUNT/$tdir || error "setdirstirpe error"
10250 run_test 124 "check failover after replace_nids"
10252 get_max_sectors_kb() {
10255 local dev_base=$(basename $(do_facet ${facet} "readlink -f ${device}"))
10256 local max_sectors_path="/sys/block/${dev_base}/queue/max_sectors_kb"
10258 do_facet ${facet} "[[ -e ${max_sectors_path} ]] &&
10259 cat ${max_sectors_path}"
10262 get_max_hw_sectors_kb() {
10265 local dev_base=$(basename $(do_facet ${facet} "readlink -f ${device}"))
10266 local max_hw_path="/sys/block/${dev_base}/queue/max_hw_sectors_kb"
10268 do_facet ${facet} "[[ -e ${max_hw_path} ]] && cat ${max_hw_path}"
10271 set_max_sectors_kb() {
10275 local dev_base=$(basename $(do_facet ${facet} "readlink -f ${device}"))
10276 local max_sectors_path="/sys/block/${dev_base}/queue/max_sectors_kb"
10278 do_facet ${facet} "[[ -e ${max_sectors_path} ]] &&
10279 echo ${value} > ${max_sectors_path}"
10282 [[ $rc -ne 0 ]] && echo "Failed to set ${max_sectors_path} to ${value}"
10287 # Return 0 if all slave devices have max_sectors_kb == max_hw_sectors_kb
10288 # Otherwise return > 0
10289 check_slaves_max_sectors_kb()
10293 local dev_base=$(basename $(do_facet ${facet} "readlink -f ${device}"))
10294 local slaves_dir=/sys/block/${dev_base}/slaves
10295 local slave_devices=$(do_facet ${facet} "ls ${slaves_dir} 2>/dev/null")
10296 [[ -z ${slave_devices} ]] && return 0
10298 local slave max_sectors new_max_sectors max_hw_sectors path
10301 for slave in ${slave_devices}; do
10302 path="/dev/${slave}"
10303 ! is_blkdev ${facet} ${path} && continue
10304 max_sectors=$(get_max_sectors_kb ${facet} ${path})
10305 max_hw_sectors=$(get_max_hw_sectors_kb ${facet} ${path})
10306 new_max_sectors=${max_hw_sectors}
10307 [[ ${new_max_sectors} -gt ${RQ_SIZE_LIMIT} ]] &&
10308 new_max_sectors=${RQ_SIZE_LIMIT}
10310 if [[ ${max_sectors} -ne ${new_max_sectors} ]]; then
10311 echo "${path} ${max_sectors} ${new_max_sectors}"
10314 check_slaves_max_sectors_kb ${facet} ${path}
10323 local facet_list="mgs mds1 ost1"
10324 combined_mgs_mds && facet_list="mgs ost1"
10327 for facet in ${facet_list}; do
10328 [[ $(facet_fstype ${facet}) != ldiskfs ]] &&
10329 skip "ldiskfs only test" &&
10331 ! is_blkdev ${facet} $(facet_device ${facet}) &&
10332 skip "requires all real devices" &&
10337 # We don't increase IO request size limit past 16MB. See comments in
10338 # lustre/utils/libmount_utils_ldiskfs.c:tune_max_sectors_kb()
10339 RQ_SIZE_LIMIT=$((16 * 1024))
10340 local device old_max_sectors new_max_sectors max_hw_sectors
10341 for facet in ${facet_list}; do
10342 device=$(facet_device ${facet})
10343 old_max_sectors=$(get_max_sectors_kb ${facet} ${device})
10344 max_hw_sectors=$(get_max_hw_sectors_kb ${facet} ${device})
10346 # The expected value after l_tunedisk is executed
10347 new_max_sectors=$old_max_sectors
10348 [[ ${new_max_sectors_kb} -gt ${RQ_SIZE_LIMIT} ]] &&
10349 new_max_sectors_kb=${RQ_SIZE_LIMIT}
10351 # Ensure the current value of max_sectors_kb does not equal
10352 # max_hw_sectors_kb, so we can tell whether l_tunedisk did
10354 set_max_sectors_kb ${facet} ${device} $((new_max_sectors - 1))
10356 # Value before l_tunedisk
10357 local pre_max_sectors=$(get_max_sectors_kb ${facet} ${device})
10358 if [[ ${pre_max_sectors} -ne $((new_max_sectors - 1)) ]]; then
10359 echo "unable to satsify test pre-condition:"
10360 echo "${pre_max_sectors} != $((new_max_sectors - 1))"
10365 echo "Before: ${facet} ${device} ${pre_max_sectors} ${max_hw_sectors}"
10367 do_facet ${facet} "l_tunedisk ${device}"
10369 # Value after l_tunedisk
10370 local post_max_sectors=$(get_max_sectors_kb ${facet} ${device})
10372 echo "After: ${facet} ${device} ${post_max_sectors} ${max_hw_sectors}"
10374 if [[ ${facet} != ost1 ]]; then
10375 if [[ ${post_max_sectors} -ne ${pre_max_sectors} ]]; then
10376 echo "l_tunedisk modified max_sectors_kb of ${facet}"
10380 set_max_sectors_kb ${facet} ${device} ${old_max_sectors}
10382 if [[ ${post_max_sectors} -eq ${pre_max_sectors} ]]; then
10383 echo "l_tunedisk failed to modify max_sectors_kb of ${facet}"
10387 check_slaves_max_sectors_kb ${facet} ${device} ||
10394 run_test 125 "check l_tunedisk only tunes OSTs and their slave devices"
10397 [[ "$MDS1_VERSION" -ge $(version_code 2.13.52) ]] ||
10398 skip "Need MDS version at least 2.13.52"
10401 do_rpc_nodes $(facet_active_host $SINGLEMDS) load_module ../libcfs/libcfs/libcfs
10402 #define OBD_FAIL_OBD_SETUP 0x60d
10403 do_facet mds1 $LCTL set_param fail_loc=0x60d
10404 do_rpc_nodes $(facet_active_host $SINGLEMDS) load_modules &
10405 for i in {1..40}; do
10406 do_facet mds1 lsmod | grep -q osd_$mds1_FSTYPE && break
10409 clear_failloc $SINGLEMDS 20 &
10410 start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS
10412 run_test 126 "mount in parallel shouldn't cause a crash"
10415 [[ "$ost1_FSTYPE" == ldiskfs ]] || skip "ldiskfs only test"
10419 zconf_umount_clients $RCLIENTS $MOUNT
10421 wait_osp_active ost ${FSNAME}-OST0000 0 1
10422 local osc_tgt="$FSNAME-OST0000-osc-$($LFS getname -i $DIR)"
10423 local avail1=($($LCTL get_param -n osc.${osc_tgt}.kbytesavail))
10425 $LFS setstripe -i 0 $DIR/$tfile || error "failed creating $DIR/$tfile"
10426 dd if=/dev/zero of=$DIR/$tfile bs=1M oflag=direct || true
10428 local avail2=($($LCTL get_param -n osc.${osc_tgt}.kbytesavail))
10430 if ((avail2 * 100 / avail1 > 1)); then
10433 error "more than 1% space left: before=$avail1 after=$avail2"
10436 local mbs=$(($(stat -c %s $DIR/$tfile) / (1024 * 1024)))
10438 dd if=/dev/zero of=$DIR/$tfile bs=1M count=$mbs conv=notrunc \
10439 oflag=direct || error "overwrite failed"
10441 run_test 127 "direct io overwrite on full ost"
10445 combined_mgs_mds && skip "need separate mgs device"
10446 [ "$ost2_FSTYPE" == zfs ] && import_zpool ost2
10449 # Try to apply nolocallogs to the virgin OST. Should fail.
10450 do_facet ost2 "$TUNEFS --nolocallogs $(ostdevname 2)" &&
10451 error "nolocallogs should not be allowed on the virgin target"
10456 [ "$ost1_FSTYPE" == zfs ] && import_zpool ost1
10457 # Start OST without MGS (local configs)
10458 do_facet ost1 "$TUNEFS --dryrun $(ostdevname 1)"
10459 start_ost || error "unable to start OST1"
10460 stop_ost || error "Unable to stop OST1"
10462 [ "$ost1_FSTYPE" == zfs ] && import_zpool ost1
10463 # Do not allow reading local configs, should fail
10464 do_facet ost1 "$TUNEFS --nolocallogs $(ostdevname 1)" ||
10465 error "Can not set nolocallogs"
10466 start_ost && error "OST1 started, but should fail"
10468 # Connect to MGS successfully, reset nolocallogs flag
10469 [ "$ost1_FSTYPE" == zfs ] && import_zpool ost1
10470 start_mgs || error "unable to start MGS"
10471 start_ost || error "unable to start OST1"
10473 do_facet ost1 "$TUNEFS --dryrun $(ostdevname 1)" | grep "nolocallogs" &&
10474 error "nolocallogs expected to be reset"
10476 stop_ost || error "Unable to stop OST1"
10478 run_test 128 "Force using remote logs with --nolocallogs"
10482 (( MDS1_VERSION >= $(version_code 2.14.57) )) ||
10483 skip "Need MDS version at least 2.14.57"
10485 start_mgsmds || error "MGS/MDS start failed"
10487 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS &&
10488 error "start ost1 should fail" || true
10489 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS &&
10490 error "second start ost1 should fail" || true
10491 do_facet ost1 "$TUNEFS --writeconf $(ostdevname 1)"
10492 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS ||
10493 error "start ost1 failed"
10497 run_test 129 "attempt to connect an OST with the same index should fail"
10501 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
10503 stop_mdt 2 || error "mdt2 stop failed"
10504 do_facet mds2 "$TUNEFS --writeconf $(mdsdevname 2)"
10505 start_mdt 2 || error "mdt2 start failed"
10506 do_facet mds2 "$LCTL dl" | grep MDT0001-osp-MDT0001 &&
10507 error "Illegal OSP device created" || true
10509 run_test 130 "re-register an MDT after writeconf"
10512 [ "$mds1_FSTYPE" == "ldiskfs" ] || skip "ldiskfs only test"
10513 (( $MDS1_VERSION >= $(version_code 2.14.56.35) )) ||
10514 skip "Need MDS version at least 2.14.56.35"
10515 do_facet mds1 $DEBUGFS -R features $(mdsdevname 1) |
10516 grep -q project || skip "skip project quota not supported"
10521 test_mkdir -c $MDSCOUNT -p $DIR/$tdir
10522 $LFS project -p 1000 $DIR/$tdir || error "set dir project id failed"
10523 createmany -o $DIR/$tdir/f 512
10524 for ((i = 0; i < 512; ++i)); do
10525 $LFS project -p $i $DIR/$tdir/f${i} ||
10526 error "set f${i} project id failed"
10529 test_mkdir -c $MDSCOUNT -p $DIR/$tdir.inherit
10530 $LFS project -p 1001 -s $DIR/$tdir.inherit
10531 createmany -o $DIR/$tdir.inherit/f 128
10532 (( $($LFS project $DIR/$tdir.inherit/f* |
10533 awk '$1 == 1001 { print }' | wc -l) == 128 )) ||
10534 error "files did not inherit projid 1001"
10538 for i in $(seq $MDSCOUNT); do
10539 mds_backup_restore mds$i ||
10540 error "Backup/restore on mds$i failed"
10545 projid=($($LFS project -d $DIR/$tdir))
10546 [ ${projid[0]} == "1000" ] ||
10547 error "projid expected 1000 not ${projid[0]}"
10548 for ((i = 0; i < 512; ++i)); do
10549 projid=($($LFS project $DIR/$tdir/f${i}))
10550 [ ${projid[0]} == "$i" ] ||
10551 error "projid expected $i not ${projid[0]}"
10554 (( $($LFS project $DIR/$tdir.inherit/f* |
10555 awk '$1 == 1001 { print }' | wc -l) == 128 )) ||
10556 error "restore did not copy projid 1001"
10558 run_test 131 "MDT backup restore with project ID"
10564 (( MDS1_VERSION >= $(version_code 2.14.57) )) ||
10565 skip "Need MDS version at least 2.14.57"
10567 combined_mgs_mds || start_mgs || error "unable to start MGS"
10568 start_mdt 1 || error "unable to start mdt1"
10570 err_cnt=$(do_facet mds1 dmesg | grep -c "cannot take the layout locks")
10571 stop_mdt 1 || error "stop mdt1 failed"
10573 [ "$mds1_FSTYPE" == zfs ] && import_zpool mds1
10574 do_facet mds1 $TUNEFS --param mdt.hsm_control=enabled $(mdsdevname 1) ||
10575 error "tunefs failed"
10576 start_mdt 1 || error "cannot start mdt1"
10578 err_cnt2=$(do_facet mds1 dmesg | grep -c "cannot take the layout locks")
10579 [ $err_cnt -eq $err_cnt2 ] || error "Can not take the layout lock"
10580 stop_mdt 1 || error "stop mdt1 failed"
10582 run_test 132 "hsm_actions processed after failover"
10584 # This test verifies we do RR allocation within a pool even if there is a
10585 # significant imbalance vs an OST outside the pool
10587 [[ $OSTCOUNT -lt 4 ]] && skip_env "needs >= 4 OSTs"
10588 [[ "$OST1_VERSION" -ge $(version_code 2.15.51) ]] ||
10589 skip "Need OST version at least 2.15.51"
10590 # This is the easiest way to ensure OSTs start out balanced
10591 reformat_and_config
10594 check_set_fallocate_or_skip
10596 local testfile=$DIR/$tdir/$tfile
10597 local pool="testpool"
10598 local ostrange=$((OSTCOUNT - 1))
10599 # Select all but the last OST to add to the pool
10600 local poolostrange=$((OSTCOUNT - 2))
10608 [ $MINV -eq 0 ] && error "no free space in OST$MINI"
10609 [ $MAXV -gt $((2 * $MINV)) ] &&
10610 error "OSTs badly unbalanced after reformat"
10612 create_pool $FSNAME.$pool || error "failed to create a pool"
10613 do_facet mgs $LCTL pool_add $FSNAME.$pool OST[0-$poolostrange] ||
10614 error "failed to add OST[0-$poolostrange] to the pool"
10616 test_mkdir -p $DIR/$tdir || error "failed to mkdir $DIR/$tdir"
10617 # Consume space on the OSTs in the pool so they are unbalanced with the
10618 # OST outside of the pool
10619 # fill each OST 90% with fallocate so they are widely
10621 local size=$(((MINV * 9 / 10) * 1024))
10622 for ((i = 0; i <= poolostrange; i++)); do
10623 $LFS setstripe -c 1 -i $i $testfile$i ||
10624 error "failed to setstripe $testfile$i"
10625 fallocate -l $size $testfile$i || error "fallocate failed"
10631 # Create files in the pool now that there is an imbalance
10632 filecount=$(((OSTCOUNT - 1) * filenum))
10633 for ((i = 0; i < filecount; i++)); do
10634 $LFS setstripe -p $pool $testfile-$i ||
10635 error "failed to setstripe -p $pool $testfile-$i"
10637 $LFS getstripe -i $testfile-* > /tmp/$tfile.log
10638 # Count the number of files with a stripe on each OST to verify the
10639 # pool allocated with round-robin
10640 for ((i = 0; i <= poolostrange; i++)); do
10641 stripecount=$(grep -c $i /tmp/$tfile.log)
10642 # Allow a little leeway
10643 if (( stripecount < filenum - 1 ||
10644 stripecount > filenum + 1 )); then
10645 cat /tmp/$tfile.log
10646 error "$stripecount != $filenum files on OST$i"
10650 # Create files across the system now that there is an imbalance
10651 filecount=$((OSTCOUNT * filenum))
10652 for ((i = 1; i < filecount; i++)); do
10653 $LFS setstripe $testfile-$i.2 ||
10654 error "failed to setstripe $testilfe-$i.2"
10656 $LFS getstripe -i $testfile-*.2 > /tmp/$tfile.log
10658 # Count the number of files with a stripe on each OST to verify the
10659 # files are *NOT* allocated with round-robin
10660 for ((i = 0; i <= ostrange; i++)); do
10661 stripecount=$(grep -c $i /tmp/$tfile.log)
10662 if [[ $stripecount -ne $filenum ]]; then
10664 echo "QOS: $stripecount != $filenum files on OST$i"
10667 if [ -z "$qos_used" ]; then
10668 error "QOS not used on imbalanced OSTs!"
10671 rm -rf /tmp/$tfile.log $DIR/$tdir
10672 do_facet mgs $LCTL pool_remove $FSNAME.$pool OST[0-$poolostrange] ||
10673 "failed to remove OST[0-$poolostrange] from the pool"
10674 do_facet mgs $LCTL pool_destroy $FSNAME.$pool ||
10675 error "failed to destroy pool"
10677 run_test 133 "stripe QOS: free space balance in a pool"
10680 [ "$mds1_FSTYPE" == "ldiskfs" ] || skip "ldiskfs only test"
10683 local mdt_dev=$(facet_device mds1)
10684 local tmp_dir=$TMP/$tdir
10685 local out=$tmp_dir/check_iam.txt
10686 local CHECK_IAM=${CHECK_IAM:-$(do_facet mds1 "which check_iam 2> /dev/null || true")}
10688 [[ -n "$CHECK_IAM" ]] || skip "check_iam not found"
10691 for ((i=0; i<64; i++)); do
10693 #cmd introduce a random corruption to IAM file
10694 local cmd="dd if=/dev/urandom of=$tmp_dir/$f bs=2 conv=notrunc count=1 seek=$((RANDOM % 36))"
10695 do_facet mds1 "mkdir -p $tmp_dir; \
10696 $DEBUGFS -c -R 'dump $f $tmp_dir/$f' $mdt_dev 2>&1; \
10697 $CHECK_IAM -v $tmp_dir/$f 2>&1; \
10698 echo $cmd; eval $cmd 2>/dev/null;
10699 $CHECK_IAM -v $tmp_dir/$f 2>&1; echo \\\$?" >> $out 2>&1
10704 stack_trap "rm -rf $tmp_dir && do_facet mds1 rm -rf $tmp_dir" EXIT
10706 rc=$(grep -c "fault\|except" $out)
10707 (( rc == 0 )) || { cat $out &&
10708 error "check_iam failed with fault or exception $rc"; }
10710 rc=$(grep -c "^255" $out)
10711 errors=$(grep -c "FINISHED WITH ERRORS" $out)
10713 (( rc == errors )) || { cat $out &&
10714 error "check_iam errcode does not fit with errors $rc $errors"; }
10716 run_test 134 "check_iam works without faults"
10718 cleanup_test_135(){
10721 printf "\nCleanup test_135\n" >&2
10722 do_facet mds1 "$LCTL set_param -n $oldgc"
10723 rm -rf $DIR/$tdir &> /dev/null
10727 __test_135_file_thread() {
10729 local init_time=$(awk '{print $1}' /proc/uptime)
10730 local awkcmd="/crosses index zero/ {if (\$1 > $init_time) exit(1);}"
10732 #Generate a full plain llogs
10733 while dmesg | sed -r 's/(\[|\])//g' | awk "$awkcmd" ; do
10734 createmany -o $DIR/$tdir/f 4500 >&2
10735 createmany -u $DIR/$tdir/f 4500 >&2
10739 __test_135_reader() {
10742 local firstidx=$(changelog_user_rec mds1 $cl_user)
10743 local oldidx=$firstidx
10748 while read -t10 -u$fd newidx other; do
10749 (( (newidx - oldidx) == 1 )) ||
10750 error "changelog jump detected (last: $oldidx, current: $newidx)"
10752 if (( (newidx - firstidx + 1) % 13000 == 0 )); then
10753 [[ $pid -eq 0 ]] ||
10754 wait $pid || error "changelog_clear failed"
10755 changelog_clear $((newidx - 1)) mds1 >&2 & pid=$!
10760 [[ $pid -eq 0 ]] ||
10761 wait $pid || error "changelog_clear failed"
10767 (( MDS1_VERSION >= $(version_code 2.15.52) )) ||
10768 skip "need MDS version at least 2.15.52"
10770 local service=$(facet_svc mds1)
10772 local lastread lastidx
10773 local files_pid reader_pid
10778 # Need to reformat because we are changing llog catalog sizes to 5.
10779 # Otherwise, processing could fail with existing catalogs (last_idx>5).
10783 # Disable changelog garbage colector
10784 local oldgc=$(do_facet mds1 "$LCTL get_param mdd.${service}.changelog_gc")
10785 do_facet mds1 "$LCTL set_param -n mdd.${service}.changelog_gc=0"
10786 stack_trap "cleanup_test_135 $oldgc" EXIT INT
10788 # change the changelog_catalog size to 5 entries for everybody
10789 #define OBD_FAIL_CAT_RECORDS 0x1312
10790 do_node $(comma_list $(all_nodes)) $LCTL set_param fail_loc=0x1312 fail_val=5
10792 # disable console ratelimit
10793 local rl=$(cat /sys/module/libcfs/parameters/libcfs_console_ratelimit)
10794 echo 0 > /sys/module/libcfs/parameters/libcfs_console_ratelimit
10795 stack_trap "echo $rl > /sys/module/libcfs/parameters/libcfs_console_ratelimit" EXIT
10797 test_mkdir -c 1 -i 0 $DIR/$tdir || error "Failed to create directory"
10798 changelog_chmask "ALL" || error "changelog_chmask failed"
10799 changelog_register || error "changelog_register failed"
10801 cl_user="${CL_USERS[mds1]%% *}"
10802 changelog_users mds1 | grep -q $cl_user ||
10803 error "User $cl_user not found in changelog_users"
10805 # Start reader thread
10806 coproc $LFS changelog --follow $service
10809 stack_trap "echo kill changelog reader; kill $reader_pid" EXIT
10811 echo -e "\nWrap arround changelog catalog"
10813 # Start file writer thread
10814 __test_135_file_thread "$service" & files_pid=$!
10815 stack_trap "(pkill -P$files_pid; kill $files_pid) &> /dev/null || true" EXIT
10817 # Check changelog entries
10818 lastread=$(__test_135_reader $fd $cl_user) || exit $?
10819 ! kill -0 $files_pid 2>/dev/null ||
10820 error "creation thread is running. Is changelog reader stuck?"
10822 lastidx=$(changelog_users mds1 | awk '/current_index/ {print $NF}' )
10823 [[ "$lastread" -eq "$lastidx" ]] ||
10824 error "invalid changelog lastidx (read: $lastread, mds: $lastidx)"
10826 run_test 135 "check the behavior when changelog is wrapped around"
10829 do_facet mds2 "$LCTL --device ec cleanup" || true
10830 do_facet mds2 "$LCTL --device ec detach" || true
10833 reformat_and_config
10837 (( MDSCOUNT >= 2 )) || skip "needs >= 2 MDTs"
10842 do_facet mds2 "$LCTL attach echo_client ec ec_uuid" ||
10843 error "echo attach fail"
10845 stack_trap cleanup_136 EXIT
10847 do_facet mds2 "$LCTL --device ec setup lustre-MDT0001 mdt" &&
10848 error "attach to MDT should fail!"
10850 do_facet mds2 "$LCTL --device ec setup lustre-MDT0001 mdd" ||
10851 error "attach to MDD should OK"
10852 do_facet mds2 "$LCTL --device ec test_mkdir /tt" &&
10853 error "mkdir test should fail with remote object"
10857 run_test 136 "don't panic with bad obdecho setup"
10859 wait_osp_import() {
10861 local remtgt=$(facet_svc $2)
10863 local loctgt=$(facet_svc $facet)
10864 local param="osp.$remtgt-os[pc]-${loctgt#*-}.*_server_uuid"
10866 do_rpc_nodes "$(facet_active_host $facet)" \
10867 wait_import_state $expected $param ||
10868 error "$param: import is not in expected state"
10872 (( MDS1_VERSION >= $(version_code 2.15.61) )) ||
10873 skip "need MDS version at least 2.15.61"
10875 (( $MDSCOUNT >= 3 )) || skip "needs >= 3 MDTs"
10877 local failnode=1.2.3.4@$NETTYPE
10878 local keep_zpool=$KEEP_ZPOOL
10881 #start mgs or mgs/mdt0
10882 if ! combined_mgs_mds ; then
10883 start_mgs || error "Fail to register mgs"
10884 start_mdt 1 || error "Fail to register mds1"
10886 start_mdt 1 || error "Fail to register mds1"
10889 start_ost || error "OST0 start fail"
10891 mount_client $MOUNT || error "mount client fails"
10892 wait_osc_import_ready client ost
10893 check_mount || error "check_mount failed"
10895 # Add failover node on OST0000
10897 [ "$ost1_FSTYPE" == zfs ] && import_zpool ost1
10898 do_facet ost1 "$TUNEFS --failnode=$failnode $(ostdevname 1)" ||
10899 error "ost1 tunefs failed"
10900 start_ost || error "OST0 start fail"
10902 # Add pool and parameters on MDT0000 to check the inheritance
10903 do_facet mgs $LCTL pool_new $FSNAME.pool1 || error "pool_new failed"
10904 do_facet mgs $LCTL pool_add $FSNAME.pool1 OST0000 ||
10905 error "pool_add failed"
10907 set_conf_param_and_check mds1 \
10908 "$LCTL get_param -n lod.$FSNAME-MDT0000*.dom_stripesize" \
10909 "$FSNAME-MDT0000.lod.dom_stripesize" \
10912 start_mdt 2 || error "Fail to register mds2"
10914 wait_osp_import mds1 mds2 FULL
10915 wait_osp_import mds2 mds1 FULL
10916 wait_osp_import mds2 ost1 FULL
10918 # Add failover node on MDT0001
10919 stop_mdt 2 || error "Fail to umount mds2"
10920 [ "$mds1_FSTYPE" == zfs ] && import_zpool mds2
10921 do_facet mds2 "$TUNEFS --failnode=$failnode $(mdsdevname 2)" ||
10922 error "mds2 tunefs failed"
10923 start_mdt 2 || error "Fail to mount mds2"
10925 wait_osp_import mds1 mds2 FULL
10926 wait_osp_import mds2 mds1 FULL
10927 wait_osp_import mds2 ost1 FULL
10930 for ((i=3; i <= MDSCOUNT; i++)); do
10931 start_mdt $i || error "Fail to register mds$i"
10934 wait_osc_import_state mds ost FULL
10936 for ((i=2; i <= MDSCOUNT; i++)); do
10939 local tgt=$(facet_svc $facet)
10940 local lod="lod.$tgt*"
10942 wait_osp_active mds $tgt $(( i - 1 )) 1
10944 do_facet $facet $LCTL get_param -n $lod.pools.pool1 |
10945 grep -q "OST0000" || error "pool1 should be inherited"
10947 val=$(do_facet $facet $LCTL get_param -n $lod.dom_stripesize)
10948 (( val == (2<<20) )) ||
10949 error "dom_stripesize should be inherited"
10951 import="osc.$FSNAME-OST0000-osc-${tgt#*-}.import"
10952 do_facet $facet $LCTL get_param -n $import |
10953 grep -q "failover_nids:.*$failnode" ||
10954 error "$failnode not found in $import"
10956 [[ "${tgt#*-}" != MDT0001 ]] || continue
10958 import="osp.$FSNAME-MDT0001-osp-${tgt#*-}.import"
10959 do_facet $facet $LCTL get_param -n $import |
10960 grep -q "failover_nids:.*$failnode" ||
10961 error "$failnode not found in $import"
10964 cleanup || error "cleanup failed with rc $?"
10965 reformat_and_config
10967 run_test 137 "a new MDT should inherit pools, parameters and failnode"
10970 (( MDS1_VERSION >= $(version_code 2.15.55) )) ||
10971 skip "need MDS version at least 2.15.55"
10972 (( MDSCOUNT >= 2 )) || skip "needs >= 2 MDTs"
10974 RM_UPDATELOG=$(do_facet mds2 "which remove_updatelog 2> /dev/null")
10975 RM_UPDATELOG=${RM_UPDATELOG:-"$LUSTRE/scripts/remove_updatelog"}
10977 [ -f "$RM_UPDATELOG" ] ||
10978 skip_env "remove_updatelog is not found on mds2"
10980 local mntpt=$(facet_mntpt mds2)
10983 test_mkdir -c $MDSCOUNT -p $DIR/$tdir ||
10984 error "mkdir $DIR/$tdir failed"
10985 mkdir $DIR/$tdir/d{1..256}
10990 mount_fstype mds2 || error "mount as fstype mds2 failed"
10991 do_facet mds2 $RM_UPDATELOG -n $mntpt
10992 MDTS=($(do_facet mds2 $RM_UPDATELOG -n $mntpt |
10993 grep -o "Processing MDT[0-9]*" | awk -F'MDT' '{print $2}'))
10994 (( ${#MDTS[@]} == MDSCOUNT )) ||
10995 error "Processed ${#MDTS[@]} from $MDSCOUNT"
10997 do_facet mds2 $RM_UPDATELOG -n -m 1,0 $mntpt
10998 MDTS=($(do_facet mds2 $RM_UPDATELOG -n -m 1,0 $mntpt |
10999 grep -o "Processing MDT[0-9]*" | awk -F'MDT' '{print $2}'))
11000 (( ${#MDTS[@]} == 2 )) ||
11001 error "Processed ${#MDTS[@]} instead of 2"
11002 (( ${MDTS[0]} == 1 && ${MDTS[1]} == 0 )) ||
11003 error "Processed: ${MDTS[*]}, expected: 1 0"
11005 do_facet mds2 $RM_UPDATELOG -m 0 $mntpt
11006 unmount_fstype mds2
11007 start_mdt 2 || error "mds2 start fail"
11008 start_mdt 1 || error "mds1 start fail"
11009 wait_clients_import_state ${CLIENTS:-$HOSTNAME} mds1 FULL
11010 wait_clients_import_state ${CLIENTS:-$HOSTNAME} mds2 FULL
11012 rm -rf $DIR/$tdir || error "Can't remove $tdir"
11014 reformat_and_config
11016 run_test 140 "remove_updatelog script actions"
11021 local max_cached_mb=$($LCTL get_param llite.*.max_cached_mb |
11022 awk '/^max_cached_mb/ { print $2 }')
11023 stack_trap "$LCTL set_param -n llite.*.max_cached_mb=$max_cached_mb"
11025 $LCTL set_param llite.*.max_cached_mb='100%'
11027 local new_max_cached_mb=$($LCTL get_param llite.*.max_cached_mb |
11028 awk '/^max_cached_mb/ { print $2 }')
11029 local total_ram_mb=$(free -m | grep 'Mem:' | awk '{print $2}')
11031 $LCTL get_param llite.*.max_cached_mb
11032 echo "total ram mb: $total_ram_mb"
11033 (( new_max_cached_mb == total_ram_mb )) ||
11034 error "setting cache to 100% not equal to total RAM"
11036 $LCTL set_param llite.*.max_cached_mb='50%'
11037 new_max_cached_mb=$($LCTL get_param llite.*.max_cached_mb |
11038 awk '/^max_cached_mb/ { print $2 }')
11040 $LCTL get_param llite.*.max_cached_mb
11041 (( new_max_cached_mb == $((total_ram_mb / 2)) )) ||
11042 error "setting cache to 50% not equal to 50% of RAM"
11044 $LCTL set_param llite.*.max_cached_mb='105%' &&
11045 error "should not be able to set insane value"
11047 $LCTL set_param llite.*.max_cached_mb='0%'
11048 new_max_cached_mb=$($LCTL get_param llite.*.max_cached_mb |
11049 awk '/^max_cached_mb/ { print $2 }')
11050 # Minimum cache size is 64 MiB
11051 $LCTL get_param llite.*.max_cached_mb
11052 (( new_max_cached_mb == 64 )) ||
11053 error "setting cache to 0% != minimum cache size"
11055 run_test 150 "test setting max_cached_mb to a %"
11058 (( MDS1_VERSION >= $(version_code 2.15.58) )) ||
11059 skip "need MDS version at least 2.15.58"
11060 [[ "$ost1_FSTYPE" == ldiskfs ]] || skip "ldiskfs only test"
11063 if ! combined_mgs_mds ; then
11067 echo "Damage ost1 local config log"
11068 do_facet ost1 "$DEBUGFS -w -R 'punch CONFIGS/$FSNAME-OST0000 0 1' \
11069 $(ostdevname 1) || return \$?" ||
11070 error "do_facet ost1 failed with $?"
11072 # expect OST to fail mount with no MGS and bad local config
11073 start_ost && error "OST start should fail"
11075 if ! combined_mgs_mds ; then
11078 start_mds || error "MDS start failed"
11079 # now it should start with MGS config
11080 start_ost || error "OST start failed"
11081 reformat_and_config
11083 run_test 151 "damaged local config doesn't prevent mounting"
11086 (( MDS1_VERSION >= $(version_code 2.15.59.53) )) ||
11087 skip "need MDS >= 2.15.59.53 for sequence allocation retry"
11088 (( MDSCOUNT >= 2 )) || skip "needs >= 2 MDTs"
11089 local tf=$DIR/$tdir/$tfile
11090 local nost=$((OSTCOUNT+1))
11091 local nostdevname=$(ostdevname $nost)
11094 test_mkdir -i 1 -c1 $DIR/$tdir || error "can't mkdir"
11097 add ost$nost $(mkfs_opts ost1 $nostdevname) --index=$nost \
11098 --reformat $nostdevname $(ostvdevname $nost)
11099 [[ -d "$nostdevname" ]] || stack_trap "do_facet mds1 rm -f $nostdevname"
11101 #define OBD_FAIL_OPS_FAIL_SEQ_ALLOC 0x2109
11102 do_facet mds1 $LCTL set_param fail_loc=0x80002109 fail_val=2
11103 echo "START OST$nost"
11104 stack_trap "stop ost$nost"
11105 start ost$nost $nostdevname $OST_MOUNT_OPTS &
11109 $LFS setstripe -c -1 $tf &
11113 log "STOP OST$nost"
11114 # probably mount hasn't completed yet, so stop races with it
11117 jobs -pr | grep -E "^$PID\$" && sleep 0.5 && continue
11122 do_facet mds1 $LCTL set_param fail_loc=0
11123 log "START OST$nost again"
11124 start ost$nost $nostdevname $OST_MOUNT_OPTS ||
11125 error "can't start ost$nost"
11127 $LFS setstripe -c -1 $tf-2 || error "can't touch $tf-2"
11128 $LFS getstripe -v $tf-2
11129 local stripes=$($LFS getstripe -c $tf-2)
11130 (( stripes == $nost )) || error "$tf-2 $stripes != $nost"
11132 run_test 152 "seq allocation error in OSP"
11135 reformat_and_config
11137 start_mds || error "MDS start failed"
11138 start_ost || error "OST start failed"
11140 local nid=$($LCTL list_nids | grep ${NETTYPE} | head -n1)
11141 local net=${nid#*@}
11142 local MGS_NID=$(do_facet mgs $LCTL list_nids | head -1)
11143 local OST1_NID=$(do_facet ost1 $LCTL list_nids | head -1)
11144 local FAKE_PNID="192.168.252.112@${net}"
11145 local FAKE_NIDS="${FAKE_PNID},${FAKE_PNID}2"
11146 local FAKE_FAILOVER="10.252.252.113@${net},10.252.252.113@${net}2"
11147 local NIDS_AND_FAILOVER="$FAKE_NIDS:$FAKE_FAILOVER:$OST1_NID:$MGS_NID"
11152 mount -t lustre $NIDS_AND_FAILOVER:/lustre $MOUNT &
11154 while (( period < 30 )); do
11155 [[ -n "$(ps -p $pid -o pid=)" ]] || break
11156 echo "waiting for mount ..."
11158 period=$((period + 5))
11160 $LCTL get_param mgc.MGC${FAKE_PNID}.import | grep "uptodate:"
11161 check_mount || error "check_mount failed"
11163 cleanup || error "cleanup failed with rc $?"
11165 run_test 153a "bypass invalid NIDs quickly"
11168 # (This was sanity/802a)
11170 saved_MGS_MOUNT_OPTS=$MGS_MOUNT_OPTS
11171 saved_MDS_MOUNT_OPTS=$MDS_MOUNT_OPTS
11172 saved_OST_MOUNT_OPTS=$OST_MOUNT_OPTS
11173 saved_MOUNT_OPTS=$MOUNT_OPTS
11177 MGS_MOUNT_OPTS=$saved_MGS_MOUNT_OPTS
11178 MDS_MOUNT_OPTS=$saved_MDS_MOUNT_OPTS
11179 OST_MOUNT_OPTS=$saved_OST_MOUNT_OPTS
11180 MOUNT_OPTS=$saved_MOUNT_OPTS
11185 [[ $mds1_FSTYPE = zfs ]] || skip "ZFS specific test"
11186 [[ $MDS1_VERSION -lt $(version_code 2.9.55) ]] ||
11187 [[ $OST1_VERSION -lt $(version_code 2.9.55) ]] &&
11188 skip "Need server version at least 2.9.55"
11190 [[ $ENABLE_QUOTA ]] && skip "Quota enabled for read-only test"
11192 # Reset before starting
11196 mkdir $DIR/$tdir || error "(1) fail to mkdir"
11198 cp $LUSTRE/tests/test-framework.sh $DIR/$tdir/ ||
11199 error "(2) Fail to copy"
11201 stack_trap cleanup_802a EXIT
11203 # sync by force before remount as readonly
11204 sync; sync_all_data; sleep 3; sync_all_data
11208 MGS_MOUNT_OPTS=$(csa_add "$MGS_MOUNT_OPTS" -o rdonly_dev)
11209 MDS_MOUNT_OPTS=$(csa_add "$MDS_MOUNT_OPTS" -o rdonly_dev)
11210 OST_MOUNT_OPTS=$(csa_add "$OST_MOUNT_OPTS" -o rdonly_dev)
11212 echo "Mount the server as read only"
11213 setupall server_only || error "(3) Fail to start servers"
11215 echo "Mount client without ro should fail"
11216 mount_client $MOUNT &&
11217 error "(4) Mount client without 'ro' should fail"
11219 echo "Mount client with ro should succeed"
11220 MOUNT_OPTS=$(csa_add "$MOUNT_OPTS" -o ro)
11221 mount_client $MOUNT ||
11222 error "(5) Mount client with 'ro' should succeed"
11224 echo "Modify should be refused"
11225 touch $DIR/$tdir/guard && error "(6) Touch should fail under ro mode"
11227 echo "Read should be allowed"
11228 diff $LUSTRE/tests/test-framework.sh $DIR/$tdir/test-framework.sh ||
11229 error "(7) Read should succeed under ro mode"
11231 run_test 802a "simulate readonly device"
11233 if ! combined_mgs_mds ; then
11239 # restore the values of MDSSIZE and OSTSIZE
11240 MDSSIZE=$STORED_MDSSIZE
11241 OSTSIZE=$STORED_OSTSIZE
11244 complete_test $SECONDS
11245 check_and_cleanup_lustre