Whamcloud - gitweb
fbe96bbaa8171d58d0982da84316adbd894447b3
[fs/lustre-release.git] / lustre / tests / conf-sanity.sh
1 #!/bin/bash
2 # -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*-
3 # vim:autoindent:shiftwidth=4:tabstop=4:
4
5 # FIXME - there is no reason to use all of these different
6 #   return codes, espcially when most of them are mapped to something
7 #   else anyway.  The combination of test number and return code
8 #   figure out what failed.
9
10 set -e
11
12 ONLY=${ONLY:-"$*"}
13
14 # bug number for skipped test:
15 #               15977
16 ALWAYS_EXCEPT="$CONF_SANITY_EXCEPT"
17 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
18
19 SRCDIR=`dirname $0`
20 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
21
22 PTLDEBUG=${PTLDEBUG:--1}
23 SAVE_PWD=$PWD
24 LUSTRE=${LUSTRE:-`dirname $0`/..}
25 RLUSTRE=${RLUSTRE:-$LUSTRE}
26
27 . $LUSTRE/tests/test-framework.sh
28 init_test_env $@
29 init_logging
30 # STORED_MDSSIZE is used in test_18
31 if [ -n "$MDSSIZE" ]; then
32     STORED_MDSSIZE=$MDSSIZE
33 fi
34 # use small MDS + OST size to speed formatting time
35 MDSSIZE=40000
36 OSTSIZE=40000
37 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
38
39 require_dsh_mds || exit 0
40 require_dsh_ost || exit 0
41
42 [ "$SLOW" = "no" ] && EXCEPT_SLOW="0 1 2 3 6 7 15 18 24b 25 30 31 32 33 34a 45"
43
44 assert_DIR
45
46 reformat() {
47         formatall
48 }
49
50 writeconf() {
51         local facet=$SINGLEMDS
52         local dev=${facet}_dev
53         shift
54         stop ${facet} -f
55         rm -f ${facet}active
56         # who knows if/where $TUNEFS is installed?  Better reformat if it fails...
57         do_facet ${facet} "$TUNEFS --writeconf ${!dev}" ||
58                 echo "tunefs failed, reformatting instead" && reformat_and_config
59
60 }
61
62 gen_config() {
63         # The MGS must be started before the OSTs for a new fs, so start
64         # and stop to generate the startup logs.
65         start_mds
66         start_ost
67         wait_osc_import_state mds ost FULL
68         stop_ost
69         stop_mds
70 }
71
72 reformat_and_config() {
73         reformat
74         if ! combined_mgs_mds ; then
75                 start_mgs
76         fi
77         gen_config
78 }
79
80 start_mgs () {
81         echo "start mgs"
82         start mgs $MGSDEV $mgs_MOUNT_OPTS
83 }
84
85 start_mds() {
86         local facet=$SINGLEMDS
87         # we can not use MDSDEV1 here because SINGLEMDS could be set not to mds1 only
88         local num=$(echo $facet | tr -d "mds")
89         local dev=$(mdsdevname $num)
90         echo "start mds service on `facet_active_host $facet`"
91         start $facet ${dev} $MDS_MOUNT_OPTS || return 94
92 }
93
94 stop_mds() {
95         echo "stop mds service on `facet_active_host $SINGLEMDS`"
96         # These tests all use non-failover stop
97         stop $SINGLEMDS -f  || return 97
98 }
99
100 start_ost() {
101         echo "start ost1 service on `facet_active_host ost1`"
102         start ost1 `ostdevname 1` $OST_MOUNT_OPTS || return 95
103 }
104
105 stop_ost() {
106         echo "stop ost1 service on `facet_active_host ost1`"
107         # These tests all use non-failover stop
108         stop ost1 -f  || return 98
109 }
110
111 start_ost2() {
112         echo "start ost2 service on `facet_active_host ost2`"
113         start ost2 `ostdevname 2` $OST_MOUNT_OPTS || return 92
114 }
115
116 stop_ost2() {
117         echo "stop ost2 service on `facet_active_host ost2`"
118         # These tests all use non-failover stop
119         stop ost2 -f  || return 93
120 }
121
122 mount_client() {
123         local MOUNTPATH=$1
124         echo "mount $FSNAME on ${MOUNTPATH}....."
125         zconf_mount `hostname` $MOUNTPATH  || return 96
126 }
127
128 remount_client() {
129         local SAVEMOUNTOPT=$MOUNTOPT
130         MOUNTOPT="remount,$1"
131         local MOUNTPATH=$2
132         echo "remount '$1' lustre on ${MOUNTPATH}....."
133         zconf_mount `hostname`  $MOUNTPATH  || return 96
134         MOUNTOPT=$SAVEMOUNTOPT
135 }
136
137 umount_client() {
138         local MOUNTPATH=$1
139         echo "umount lustre on ${MOUNTPATH}....."
140         zconf_umount `hostname` $MOUNTPATH || return 97
141 }
142
143 manual_umount_client(){
144         local rc
145         local FORCE=$1
146         echo "manual umount lustre on ${MOUNT}...."
147         do_facet client "umount -d ${FORCE} $MOUNT"
148         rc=$?
149         return $rc
150 }
151
152 setup() {
153         start_ost
154         start_mds
155         mount_client $MOUNT
156 }
157
158 setup_noconfig() {
159         if ! combined_mgs_mds ; then
160                 start_mgs
161         fi
162
163         start_mds
164         start_ost
165         mount_client $MOUNT
166 }
167
168 cleanup_nocli() {
169         stop_mds || return 201
170         stop_ost || return 202
171         unload_modules || return 203
172 }
173
174 cleanup() {
175         umount_client $MOUNT || return 200
176         cleanup_nocli || return $?
177 }
178
179 check_mount() {
180         do_facet client "cp /etc/passwd $DIR/a" || return 71
181         do_facet client "rm $DIR/a" || return 72
182         # make sure lustre is actually mounted (touch will block,
183         # but grep won't, so do it after)
184         do_facet client "grep $MOUNT' ' /proc/mounts > /dev/null" || return 73
185         echo "setup single mount lustre success"
186 }
187
188 check_mount2() {
189         do_facet client "touch $DIR/a" || return 71
190         do_facet client "rm $DIR/a" || return 72
191         do_facet client "touch $DIR2/a" || return 73
192         do_facet client "rm $DIR2/a" || return 74
193         echo "setup double mount lustre success"
194 }
195
196 build_test_filter
197
198 if [ "$ONLY" == "setup" ]; then
199         setup
200         exit
201 fi
202
203 if [ "$ONLY" == "cleanup" ]; then
204         cleanup
205         exit
206 fi
207
208 init_gss
209
210 #create single point mountpoint
211
212 reformat_and_config
213
214 test_0() {
215         setup
216         check_mount || return 41
217         cleanup || return $?
218 }
219 run_test 0 "single mount setup"
220
221 test_1() {
222         start_ost
223         echo "start ost second time..."
224         setup
225         check_mount || return 42
226         cleanup || return $?
227 }
228 run_test 1 "start up ost twice (should return errors)"
229
230 test_2() {
231         start_ost
232         start_mds
233         echo "start mds second time.."
234         start_mds
235         mount_client $MOUNT
236         check_mount || return 43
237         cleanup || return $?
238 }
239 run_test 2 "start up mds twice (should return err)"
240
241 test_3() {
242         setup
243         #mount.lustre returns an error if already in mtab
244         mount_client $MOUNT && return $?
245         check_mount || return 44
246         cleanup || return $?
247 }
248 run_test 3 "mount client twice (should return err)"
249
250 test_4() {
251         setup
252         touch $DIR/$tfile || return 85
253         stop_ost -f
254         cleanup
255         eno=$?
256         # ok for ost to fail shutdown
257         if [ 202 -ne $eno ]; then
258                 return $eno;
259         fi
260         return 0
261 }
262 run_test 4 "force cleanup ost, then cleanup"
263
264 test_5a() {     # was test_5
265         setup
266         touch $DIR/$tfile || return 1
267         fuser -m -v $MOUNT && echo "$MOUNT is in use by user space process."
268
269         stop_mds -f || return 2
270
271         # cleanup may return an error from the failed
272         # disconnects; for now I'll consider this successful
273         # if all the modules have unloaded.
274         umount -d $MOUNT &
275         UMOUNT_PID=$!
276         sleep 6
277         echo "killing umount"
278         kill -TERM $UMOUNT_PID
279         echo "waiting for umount to finish"
280         wait $UMOUNT_PID
281         if grep " $MOUNT " /proc/mounts; then
282                 echo "test 5: /proc/mounts after failed umount"
283                 umount $MOUNT &
284                 UMOUNT_PID=$!
285                 sleep 2
286                 echo "killing umount"
287                 kill -TERM $UMOUNT_PID
288                 echo "waiting for umount to finish"
289                 wait $UMOUNT_PID
290                 grep " $MOUNT " /proc/mounts && echo "test 5: /proc/mounts after second umount" && return 11
291         fi
292
293         manual_umount_client
294         # stop_mds is a no-op here, and should not fail
295         cleanup_nocli || return $?
296         # df may have lingering entry
297         manual_umount_client
298         # mtab may have lingering entry
299         local WAIT=0
300         local MAX_WAIT=20
301         local sleep=1
302         while [ "$WAIT" -ne "$MAX_WAIT" ]; do
303                 sleep $sleep
304                 grep -q $MOUNT" " /etc/mtab || break
305                 echo "Waiting /etc/mtab updated ... "
306                 WAIT=$(( WAIT + sleep))
307         done
308         [ "$WAIT" -eq "$MAX_WAIT" ] && error "/etc/mtab is not updated in $WAIT secs"
309         echo "/etc/mtab updated in $WAIT secs"
310 }
311 run_test 5a "force cleanup mds, then cleanup"
312
313 test_5b() {
314         start_ost
315         [ -d $MOUNT ] || mkdir -p $MOUNT
316         grep " $MOUNT " /etc/mtab && echo "test 5b: mtab before mount" && return 10
317         mount_client $MOUNT && return 1
318         grep " $MOUNT " /etc/mtab && echo "test 5b: mtab after failed mount" && return 11
319         umount_client $MOUNT
320         # stop_mds is a no-op here, and should not fail
321         cleanup_nocli || return $?
322         return 0
323 }
324 run_test 5b "mds down, cleanup after failed mount (bug 2712) (should return errs)"
325
326 test_5c() {
327         start_ost
328         start_mds
329         [ -d $MOUNT ] || mkdir -p $MOUNT
330         grep " $MOUNT " /etc/mtab && echo "test 5c: mtab before mount" && return 10
331         local oldfs="${FSNAME}"
332         FSNAME="wrong.${FSNAME}"
333         mount_client $MOUNT || :
334         FSNAME=${oldfs}
335         grep " $MOUNT " /etc/mtab && echo "test 5c: mtab after failed mount" && return 11
336         umount_client $MOUNT
337         cleanup_nocli  || return $?
338 }
339 run_test 5c "cleanup after failed mount (bug 2712) (should return errs)"
340
341 test_5d() {
342         start_ost
343         start_mds
344         stop_ost -f
345         grep " $MOUNT " /etc/mtab && echo "test 5d: mtab before mount" && return 10
346         mount_client $MOUNT || return 1
347         cleanup  || return $?
348         grep " $MOUNT " /etc/mtab && echo "test 5d: mtab after unmount" && return 11
349         return 0
350 }
351 run_test 5d "mount with ost down"
352
353 test_5e() {
354         start_ost
355         start_mds
356
357 #define OBD_FAIL_PTLRPC_DELAY_SEND       0x506
358         do_facet client "lctl set_param fail_loc=0x80000506"
359         grep " $MOUNT " /etc/mtab && echo "test 5e: mtab before mount" && return 10
360         mount_client $MOUNT || echo "mount failed (not fatal)"
361         cleanup  || return $?
362         grep " $MOUNT " /etc/mtab && echo "test 5e: mtab after unmount" && return 11
363         return 0
364 }
365 run_test 5e "delayed connect, don't crash (bug 10268)"
366
367 test_6() {
368         setup
369         manual_umount_client
370         mount_client ${MOUNT} || return 87
371         touch $DIR/a || return 86
372         cleanup  || return $?
373 }
374 run_test 6 "manual umount, then mount again"
375
376 test_7() {
377         setup
378         manual_umount_client
379         cleanup_nocli || return $?
380 }
381 run_test 7 "manual umount, then cleanup"
382
383 test_8() {
384         setup
385         mount_client $MOUNT2
386         check_mount2 || return 45
387         umount_client $MOUNT2
388         cleanup  || return $?
389 }
390 run_test 8 "double mount setup"
391
392 test_9() {
393         start_ost
394
395         do_facet ost1 lctl set_param debug=\'inode trace\' || return 1
396         do_facet ost1 lctl set_param subsystem_debug=\'mds ost\' || return 1
397
398         CHECK_PTLDEBUG="`do_facet ost1 lctl get_param -n debug`"
399         if [ "$CHECK_PTLDEBUG" ] && { \
400            [ "$CHECK_PTLDEBUG" = "trace inode warning error emerg console" ] ||
401            [ "$CHECK_PTLDEBUG" = "trace inode" ]; }; then
402            echo "lnet.debug success"
403         else
404            echo "lnet.debug: want 'trace inode', have '$CHECK_PTLDEBUG'"
405            return 1
406         fi
407         CHECK_SUBSYS="`do_facet ost1 lctl get_param -n subsystem_debug`"
408         if [ "$CHECK_SUBSYS" ] && [ "$CHECK_SUBSYS" = "mds ost" ]; then
409            echo "lnet.subsystem_debug success"
410         else
411            echo "lnet.subsystem_debug: want 'mds ost', have '$CHECK_SUBSYS'"
412            return 1
413         fi
414         stop_ost || return $?
415 }
416
417 run_test 9 "test ptldebug and subsystem for mkfs"
418
419 # LOGS/PENDING do not exist anymore since CMD3
420 test_16() {
421         local TMPMTPT="${TMP}/conf16"
422         local dev=${SINGLEMDS}_dev
423         local MDSDEV=${!dev}
424         if [ ! -e "$MDSDEV" ]; then
425             log "no $MDSDEV existing, so mount Lustre to create one"
426             setup
427             check_mount || return 41
428             cleanup || return $?
429         fi
430
431         [ -f "$MDSDEV" ] && LOOPOPT="-o loop"
432
433         log "change the mode of $MDSDEV/OBJECTS to 555"
434         do_facet $SINGLEMDS "mkdir -p $TMPMTPT &&
435                       mount $LOOPOPT -t $FSTYPE $MDSDEV $TMPMTPT &&
436                       chmod 555 $TMPMTPT/OBJECTS &&
437                       umount $TMPMTPT" || return $?
438
439         log "mount Lustre to change the mode of OBJECTS, then umount Lustre"
440         setup
441         check_mount || return 41
442         cleanup || return $?
443
444         log "read the mode of OBJECTS and check if they has been changed properly"
445         EXPECTEDOBJECTSMODE=`do_facet $SINGLEMDS "$DEBUGFS -R 'stat OBJECTS' $MDSDEV 2> /dev/null" | grep 'Mode: ' | sed -e "s/.*Mode: *//" -e "s/ *Flags:.*//"`
446
447         if [ "$EXPECTEDOBJECTSMODE" = "0777" ]; then
448                 log "Success:Lustre change the mode of OBJECTS correctly"
449         else
450                 error "Lustre does not change mode of OBJECTS properly"
451         fi
452 }
453 run_test 16 "verify that lustre will correct the mode of OBJECTS"
454
455 test_17() {
456         local dev=${SINGLEMDS}_dev
457         local MDSDEV=${!dev}
458
459         if [ ! -e "$MDSDEV" ]; then
460             echo "no $MDSDEV existing, so mount Lustre to create one"
461             setup
462             check_mount || return 41
463             cleanup || return $?
464         fi
465
466         echo "Remove mds config log"
467         do_facet $SINGLEMDS "$DEBUGFS -w -R 'unlink CONFIGS/$FSNAME-MDT0000' $MDSDEV || return \$?" || return $?
468
469         start_ost
470         start_mds && return 42
471         reformat_and_config
472 }
473 run_test 17 "Verify failed mds_postsetup won't fail assertion (2936) (should return errs)"
474
475 test_18() {
476         [ "$FSTYPE" != "ldiskfs" ] && skip "not needed for FSTYPE=$FSTYPE" && return
477
478         local dev=${SINGLEMDS}_dev
479         local MDSDEV=${!dev}
480
481         local MIN=2000000
482
483         local OK=
484         # check if current MDSSIZE is large enough
485         [ $MDSSIZE -ge $MIN ] && OK=1 && myMDSSIZE=$MDSSIZE && \
486                 log "use MDSSIZE=$MDSSIZE"
487
488         # check if the global config has a large enough MDSSIZE
489         [ -z "$OK" -a ! -z "$STORED_MDSSIZE" ] && [ $STORED_MDSSIZE -ge $MIN ] && \
490                 OK=1 && myMDSSIZE=$STORED_MDSSIZE && \
491                 log "use STORED_MDSSIZE=$STORED_MDSSIZE"
492
493         # check if the block device is large enough
494         [ -z "$OK" -a -b $MDSDEV ] && \
495                 [ "$(dd if=$MDSDEV of=/dev/null bs=1k count=1 skip=$MIN 2>&1 |
496                      awk '($3 == "in") { print $1 }')" = "1+0" ] && OK=1 && \
497                 myMDSSIZE=$MIN && log "use device $MDSDEV with MIN=$MIN"
498
499         # check if a loopback device has enough space for fs metadata (5%)
500         [ -z "$OK" ] && [ -f $MDSDEV -o ! -e $MDSDEV ] &&
501                 SPACE=$(df -P $(dirname $MDSDEV) |
502                         awk '($1 != "Filesystem") {print $4}') &&
503                 [ $SPACE -gt $((MIN / 20)) ] && OK=1 && myMDSSIZE=$MIN && \
504                         log "use file $MDSDEV with MIN=$MIN"
505
506         [ -z "$OK" ] && skip_env "$MDSDEV too small for ${MIN}kB MDS" && return
507
508
509         echo "mount mds with large journal..."
510         local OLD_MDS_MKFS_OPTS=$MDS_MKFS_OPTS
511
512         MDS_MKFS_OPTS="--mgs --mdt --fsname=$FSNAME --device-size=$myMDSSIZE --param sys.timeout=$TIMEOUT $MDSOPT"
513
514         reformat_and_config
515         echo "mount lustre system..."
516         setup
517         check_mount || return 41
518
519         echo "check journal size..."
520         local FOUNDSIZE=`do_facet mds "$DEBUGFS -c -R 'stat <8>' $MDSDEV" | awk '/Size: / { print $NF; exit;}'`
521         if [ $FOUNDSIZE -gt $((32 * 1024 * 1024)) ]; then
522                 log "Success: mkfs creates large journals. Size: $((FOUNDSIZE >> 20))M"
523         else
524                 error "expected journal size > 32M, found $((FOUNDSIZE >> 20))M"
525         fi
526
527         cleanup || return $?
528
529         MDS_MKFS_OPTS=$OLD_MDS_MKFS_OPTS
530         reformat_and_config
531 }
532 run_test 18 "check mkfs creates large journals"
533
534 test_19a() {
535         start_mds || return 1
536         stop_mds -f || return 2
537 }
538 run_test 19a "start/stop MDS without OSTs"
539
540 test_19b() {
541         start_ost || return 1
542         stop_ost -f || return 2
543 }
544 run_test 19b "start/stop OSTs without MDS"
545
546 test_20() {
547         # first format the ost/mdt
548         start_ost
549         start_mds
550         mount_client $MOUNT
551         check_mount || return 43
552         rm -f $DIR/$tfile
553         remount_client ro $MOUNT || return 44
554         touch $DIR/$tfile && echo "$DIR/$tfile created incorrectly" && return 45
555         [ -e $DIR/$tfile ] && echo "$DIR/$tfile exists incorrectly" && return 46
556         remount_client rw $MOUNT || return 47
557         touch $DIR/$tfile
558         [ ! -f $DIR/$tfile ] && echo "$DIR/$tfile missing" && return 48
559         MCNT=`grep -c $MOUNT /etc/mtab`
560         [ "$MCNT" -ne 1 ] && echo "$MOUNT in /etc/mtab $MCNT times" && return 49
561         umount_client $MOUNT
562         stop_mds
563         stop_ost
564 }
565 run_test 20 "remount ro,rw mounts work and doesn't break /etc/mtab"
566
567 test_21a() {
568         start_mds
569         start_ost
570         wait_osc_import_state mds ost FULL
571         stop_ost
572         stop_mds
573 }
574 run_test 21a "start mds before ost, stop ost first"
575
576 test_21b() {
577         start_ost
578         start_mds
579         wait_osc_import_state mds ost FULL
580         stop_mds
581         stop_ost
582 }
583 run_test 21b "start ost before mds, stop mds first"
584
585 test_21c() {
586         start_ost
587         start_mds
588         start_ost2
589         wait_osc_import_state mds ost2 FULL
590         stop_ost
591         stop_ost2
592         stop_mds
593         #writeconf to remove all ost2 traces for subsequent tests
594         writeconf
595 }
596 run_test 21c "start mds between two osts, stop mds last"
597
598 test_22() {
599         start_mds
600
601         echo Client mount with ost in logs, but none running
602         start_ost
603         # wait until mds connected to ost and open client connection
604         wait_osc_import_state mds ost FULL
605         stop_ost
606         mount_client $MOUNT
607         # check_mount will block trying to contact ost
608         mcreate $DIR/$tfile || return 40
609         rm -f $DIR/$tfile || return 42
610         umount_client $MOUNT
611         pass
612
613         echo Client mount with a running ost
614         start_ost
615         if $GSS; then
616                 # if gss enabled, wait full time to let connection from
617                 # mds to ost be established, due to the mismatch between
618                 # initial connect timeout and gss context negotiation timeout.
619                 # This perhaps could be remove after AT landed.
620                 echo "sleep $((TIMEOUT + TIMEOUT + TIMEOUT))s"
621                 sleep $((TIMEOUT + TIMEOUT + TIMEOUT))
622         fi
623         mount_client $MOUNT
624         check_mount || return 41
625         pass
626
627         cleanup
628 }
629 run_test 22 "start a client before osts (should return errs)"
630
631 test_23a() {    # was test_23
632         setup
633         # fail mds
634         stop $SINGLEMDS
635         # force down client so that recovering mds waits for reconnect
636         local running=$(grep -c $MOUNT /proc/mounts) || true
637         if [ $running -ne 0 ]; then
638                 echo "Stopping client $MOUNT (opts: -f)"
639                 umount -f $MOUNT
640         fi
641
642         # enter recovery on mds
643         start_mds
644         # try to start a new client
645         mount_client $MOUNT &
646         sleep 5
647         MOUNT_PID=$(ps -ef | grep "t lustre" | grep -v grep | awk '{print $2}')
648         MOUNT_LUSTRE_PID=`ps -ef | grep mount.lustre | grep -v grep | awk '{print $2}'`
649         echo mount pid is ${MOUNT_PID}, mount.lustre pid is ${MOUNT_LUSTRE_PID}
650         ps --ppid $MOUNT_PID
651         ps --ppid $MOUNT_LUSTRE_PID
652         # FIXME why o why can't I kill these? Manual "ctrl-c" works...
653         kill -TERM $MOUNT_LUSTRE_PID
654         echo "waiting for mount to finish"
655         ps -ef | grep mount
656         # we can not wait $MOUNT_PID because it is not a child of this shell
657         local PID1
658         local PID2
659         local WAIT=0
660         local MAX_WAIT=30
661         local sleep=1
662         while [ "$WAIT" -lt "$MAX_WAIT" ]; do
663                 sleep $sleep
664                 PID1=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_PID)
665                 PID2=$(ps -ef | awk '{print $2}' | grep -w $MOUNT_LUSTRE_PID)
666                 echo PID1=$PID1
667                 echo PID2=$PID2
668                 [ -z "$PID1" -a -z "$PID2" ] && break
669                 echo "waiting for mount to finish ... "
670                 WAIT=$(( WAIT + sleep))
671         done
672         if [ "$WAIT" -eq "$MAX_WAIT" ]; then
673                 error "MOUNT_PID $MOUNT_PID and "\
674                 "MOUNT_LUSTRE_PID $MOUNT_LUSTRE_PID still not killed in $WAIT secs"
675                 ps -ef | grep mount
676         fi
677         stop_mds || error
678         stop_ost || error
679 }
680 run_test 23a "interrupt client during recovery mount delay"
681
682 umount_client $MOUNT
683 cleanup_nocli
684
685 test_23b() {    # was test_23
686         start_ost
687         start_mds
688         # Simulate -EINTR during mount OBD_FAIL_LDLM_CLOSE_THREAD
689         lctl set_param fail_loc=0x80000313
690         mount_client $MOUNT
691         cleanup
692 }
693 run_test 23b "Simulate -EINTR during mount"
694
695 fs2mds_HOST=$mds_HOST
696 fs2ost_HOST=$ost_HOST
697
698 cleanup_24a() {
699         trap 0
700         echo "umount $MOUNT2 ..."
701         umount $MOUNT2 || true
702         echo "stopping fs2mds ..."
703         stop fs2mds -f || true
704         echo "stopping fs2ost ..."
705         stop fs2ost -f || true
706 }
707
708 test_24a() {
709         #set up fs1
710         gen_config
711         #set up fs2
712         [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
713         if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
714                 do_facet $SINGLEMDS [ -b "$MDSDEV" ] && \
715                 skip_env "mixed loopback and real device not working" && return
716         fi
717
718         local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
719         local fs2ostdev=${fs2ost_DEV:-$(ostdevname 1)_2}
720
721         # test 8-char fsname as well
722         local FSNAME2=test1234
723         add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME2} --nomgs --mgsnode=$MGSNID --reformat $fs2mdsdev || exit 10
724
725         add fs2ost $OST_MKFS_OPTS --fsname=${FSNAME2} --reformat $fs2ostdev || exit 10
726
727         setup
728         start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
729         start fs2ost $fs2ostdev $OST_MOUNT_OPTS
730         mkdir -p $MOUNT2
731         mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
732         # 1 still works
733         check_mount || return 2
734         # files written on 1 should not show up on 2
735         cp /etc/passwd $DIR/$tfile
736         sleep 10
737         [ -e $MOUNT2/$tfile ] && error "File bleed" && return 7
738         # 2 should work
739         sleep 5
740         cp /etc/passwd $MOUNT2/b || return 3
741         rm $MOUNT2/b || return 4
742         # 2 is actually mounted
743         grep $MOUNT2' ' /proc/mounts > /dev/null || return 5
744         # failover
745         facet_failover fs2mds
746         facet_failover fs2ost
747         df
748         umount_client $MOUNT
749         # the MDS must remain up until last MDT
750         stop_mds
751         MDS=$(do_facet $SINGLEMDS "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
752         [ -z "$MDS" ] && error "No MDT" && return 8
753         cleanup_24a
754         cleanup_nocli || return 6
755 }
756 run_test 24a "Multiple MDTs on a single node"
757
758 test_24b() {
759         if [ -z "$fs2mds_DEV" ]; then
760                 do_facet $SINGLEMDS [ -b "$MDSDEV" ] && \
761                 skip_env "mixed loopback and real device not working" && return
762         fi
763
764         local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
765
766         add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME}2 --mgs --reformat $fs2mdsdev || exit 10
767         setup
768         start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && return 2
769         cleanup || return 6
770 }
771 run_test 24b "Multiple MGSs on a single node (should return err)"
772
773 test_25() {
774         setup
775         check_mount || return 2
776         local MODULES=$($LCTL modules | awk '{ print $2 }')
777         rmmod $MODULES 2>/dev/null || true
778         cleanup || return 6
779 }
780 run_test 25 "Verify modules are referenced"
781
782 test_26() {
783     load_modules
784     # we need modules before mount for sysctl, so make sure...
785     do_facet $SINGLEMDS "lsmod | grep -q lustre || modprobe lustre"
786 #define OBD_FAIL_MDS_FS_SETUP            0x135
787     do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000135"
788     start_mds && echo MDS started && return 1
789     lctl get_param -n devices
790     DEVS=$(lctl get_param -n devices | wc -l)
791     [ $DEVS -gt 0 ] && return 2
792     unload_modules || return 203
793 }
794 run_test 26 "MDT startup failure cleans LOV (should return errs)"
795
796 set_and_check() {
797         local myfacet=$1
798         local TEST=$2
799         local PARAM=$3
800         local ORIG=$(do_facet $myfacet "$TEST")
801         if [ $# -gt 3 ]; then
802             local FINAL=$4
803         else
804             local -i FINAL
805             FINAL=$(($ORIG + 5))
806         fi
807         echo "Setting $PARAM from $ORIG to $FINAL"
808         do_facet $SINGLEMDS "$LCTL conf_param $PARAM='$FINAL'" || error conf_param failed
809
810         wait_update $(facet_host $myfacet) "$TEST" "$FINAL" || error check failed!
811 }
812
813 test_27a() {
814         start_ost || return 1
815         start_mds || return 2
816         echo "Requeue thread should have started: "
817         ps -e | grep ll_cfg_requeue
818         set_and_check ost1 "lctl get_param -n obdfilter.$FSNAME-OST0000.client_cache_seconds" "$FSNAME-OST0000.ost.client_cache_seconds" || return 3
819         cleanup_nocli
820 }
821 run_test 27a "Reacquire MGS lock if OST started first"
822
823 test_27b() {
824         # FIXME. ~grev
825         setup
826         local device=$(do_facet $SINGLEMDS "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }')
827
828         facet_failover $SINGLEMDS
829         set_and_check $SINGLEMDS "lctl get_param -n mdt.$device.identity_acquire_expire" "$device.mdt.identity_acquire_expire" || return 3
830         set_and_check client "lctl get_param -n mdc.$device-mdc-*.max_rpcs_in_flight" "$device.mdc.max_rpcs_in_flight" || return 4
831         check_mount
832         cleanup
833 }
834 run_test 27b "Reacquire MGS lock after failover"
835
836 test_28() {
837         setup
838         TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
839         PARAM="$FSNAME.llite.max_read_ahead_whole_mb"
840         ORIG=$($TEST)
841         FINAL=$(($ORIG + 1))
842         set_and_check client "$TEST" "$PARAM" $FINAL || return 3
843         FINAL=$(($FINAL + 1))
844         set_and_check client "$TEST" "$PARAM" $FINAL || return 4
845         umount_client $MOUNT || return 200
846         mount_client $MOUNT
847         RESULT=$($TEST)
848         if [ $RESULT -ne $FINAL ]; then
849             echo "New config not seen: wanted $FINAL got $RESULT"
850             return 4
851         else
852             echo "New config success: got $RESULT"
853         fi
854         set_and_check client "$TEST" "$PARAM" $ORIG || return 5
855         cleanup
856 }
857 run_test 28 "permanent parameter setting"
858
859 test_29() {
860         [ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2, skipping" && return
861         setup > /dev/null 2>&1
862         start_ost2
863         sleep 10
864
865         local PARAM="$FSNAME-OST0001.osc.active"
866         local PROC_ACT="osc.$FSNAME-OST0001-osc-[^M]*.active"
867         local PROC_UUID="osc.$FSNAME-OST0001-osc-[^M]*.ost_server_uuid"
868
869         ACTV=$(lctl get_param -n $PROC_ACT)
870         DEAC=$((1 - $ACTV))
871         set_and_check client "lctl get_param -n $PROC_ACT" "$PARAM" $DEAC || return 2
872         # also check ost_server_uuid status
873         RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV)
874         if [ -z "$RESULT" ]; then
875             echo "Live client not deactivated: $(lctl get_param -n $PROC_UUID)"
876             return 3
877         else
878             echo "Live client success: got $RESULT"
879         fi
880
881         # check MDT too
882         local MPROC="osc.$FSNAME-OST0001-osc-[M]*.active"
883         local MAX=30
884         local WAIT=0
885         while [ 1 ]; do
886             sleep 5
887             RESULT=`do_facet $SINGLEMDS " lctl get_param -n $MPROC"`
888             [ ${PIPESTATUS[0]} = 0 ] || error "Can't read $MPROC"
889             if [ $RESULT -eq $DEAC ]; then
890                 echo "MDT deactivated also after $WAIT sec (got $RESULT)"
891                 break
892             fi
893             WAIT=$((WAIT + 5))
894             if [ $WAIT -eq $MAX ]; then
895                 echo "MDT not deactivated: wanted $DEAC got $RESULT"
896                 return 4
897             fi
898             echo "Waiting $(($MAX - $WAIT)) secs for MDT deactivated"
899         done
900
901         # test new client starts deactivated
902         umount_client $MOUNT || return 200
903         mount_client $MOUNT
904         RESULT=$(lctl get_param -n $PROC_UUID | grep DEACTIV | grep NEW)
905         if [ -z "$RESULT" ]; then
906             echo "New client not deactivated from start: $(lctl get_param -n $PROC_UUID)"
907             return 5
908         else
909             echo "New client success: got $RESULT"
910         fi
911
912         # make sure it reactivates
913         set_and_check client "lctl get_param -n $PROC_ACT" "$PARAM" $ACTV || return 6
914
915         umount_client $MOUNT
916         stop_ost2
917         cleanup_nocli
918         #writeconf to remove all ost2 traces for subsequent tests
919         writeconf
920 }
921 run_test 29 "permanently remove an OST"
922
923 test_30() {
924         setup
925
926         TEST="lctl get_param -n llite.$FSNAME-*.max_read_ahead_whole_mb"
927         ORIG=$($TEST)
928         LIST=(1 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5)
929         for i in ${LIST[@]}; do
930             set_and_check client "$TEST" "$FSNAME.llite.max_read_ahead_whole_mb" $i || return 3
931         done
932         # make sure client restart still works
933         umount_client $MOUNT
934         mount_client $MOUNT || return 4
935         [ "$($TEST)" -ne "$i" ] && return 5
936         set_and_check client "$TEST" "$FSNAME.llite.max_read_ahead_whole_mb" $ORIG || return 6
937         cleanup
938 }
939 run_test 30 "Big config llog"
940
941 test_31() { # bug 10734
942         # ipaddr must not exist
943         mount -t lustre 4.3.2.1@tcp:/lustre $MOUNT || true
944         cleanup
945 }
946 run_test 31 "Connect to non-existent node (shouldn't crash)"
947
948 # Use these start32/stop32 fn instead of t-f start/stop fn,
949 # for local devices, to skip global facet vars init
950 stop32 () {
951         local facet=$1
952         shift
953         echo "Stopping local ${MOUNT%/*}/${facet} (opts:$@)"
954         umount -d $@ ${MOUNT%/*}/${facet}
955         losetup -a
956 }
957
958 start32 () {
959         local facet=$1
960         shift
961         local device=$1
962         shift
963         mkdir -p ${MOUNT%/*}/${facet}
964
965         echo "Starting local ${facet}: $@ $device ${MOUNT%/*}/${facet}"
966         mount -t lustre $@ ${device} ${MOUNT%/*}/${facet}
967         local RC=$?
968         if [ $RC -ne 0 ]; then
969                 echo "mount -t lustre $@ ${device} ${MOUNT%/*}/${facet}"
970                 echo "Start of ${device} of local ${facet} failed ${RC}"
971         fi
972         losetup -a
973         return $RC
974 }
975
976 cleanup_nocli32 () {
977         stop32 mds1 -f
978         stop32 ost1 -f
979         wait_exit_ST client
980 }
981
982 cleanup_32() {
983         trap 0
984         echo "Cleanup test_32 umount $MOUNT ..."
985         umount -f $MOUNT || true
986         echo "Cleanup local mds ost1 ..."
987         cleanup_nocli32
988         unload_modules
989 }
990
991 test_32a() {
992         client_only && skip "client only testing" && return 0
993         [ "$NETTYPE" = "tcp" ] || { skip "NETTYPE != tcp" && return 0; }
994         [ -z "$TUNEFS" ] && skip_env "No tunefs" && return 0
995
996         local DISK1_8=$LUSTRE/tests/disk1_8.tar.bz2
997         [ ! -r $DISK1_8 ] && skip_env "Cannot find $DISK1_8" && return 0
998         local tmpdir=$TMP/conf32a
999         mkdir -p $tmpdir
1000         tar xjvf $DISK1_8 -C $tmpdir || \
1001                 { skip_env "Cannot untar $DISK1_8" && return 0; }
1002
1003         load_modules
1004         $LCTL set_param debug=$PTLDEBUG
1005
1006         $TUNEFS $tmpdir/mds || error "tunefs failed"
1007
1008         # nids are wrong, so client wont work, but server should start
1009         start32 mds1 $tmpdir/mds "-o loop,exclude=lustre-OST0000" && \
1010                 trap cleanup_32 EXIT INT || return 3
1011
1012         local UUID=$($LCTL get_param -n mdt.lustre-MDT0000.uuid)
1013         echo MDS uuid $UUID
1014         [ "$UUID" == "lustre-MDT0000_UUID" ] || error "UUID is wrong: $UUID"
1015
1016         $TUNEFS --mgsnode=$HOSTNAME $tmpdir/ost1 || error "tunefs failed"
1017         start32 ost1 $tmpdir/ost1 "-o loop" || return 5
1018         UUID=$($LCTL get_param -n obdfilter.lustre-OST0000.uuid)
1019         echo OST uuid $UUID
1020         [ "$UUID" == "lustre-OST0000_UUID" ] || error "UUID is wrong: $UUID"
1021
1022         local NID=$($LCTL list_nids | head -1)
1023
1024         echo "OSC changes should succeed:"
1025         $LCTL conf_param lustre-OST0000.osc.max_dirty_mb=15 || return 7
1026         $LCTL conf_param lustre-OST0000.failover.node=$NID || return 8
1027         echo "ok."
1028
1029         echo "MDC changes should succeed:"
1030         $LCTL conf_param lustre-MDT0000.mdc.max_rpcs_in_flight=9 || return 9
1031         $LCTL conf_param lustre-MDT0000.failover.node=$NID || return 10
1032         echo "ok."
1033
1034         echo "LOV changes should succeed:"
1035         $LCTL pool_new lustre.interop || return 11
1036         $LCTL conf_param lustre-MDT0000.lov.stripesize=4M || return 12
1037         echo "ok."
1038
1039         cleanup_32
1040
1041         # mount a second time to make sure we didnt leave upgrade flag on
1042         load_modules
1043         $TUNEFS --dryrun $tmpdir/mds || error "tunefs failed"
1044         start32 mds1 $tmpdir/mds "-o loop,exclude=lustre-OST0000" && \
1045                 trap cleanup_32 EXIT INT || return 12
1046
1047         cleanup_32
1048
1049         rm -rf $tmpdir || true  # true is only for TMP on NFS
1050 }
1051 run_test 32a "Upgrade from 1.8 (not live)"
1052
1053 test_32b() {
1054         client_only && skip "client only testing" && return 0
1055         [ "$NETTYPE" = "tcp" ] || { skip "NETTYPE != tcp" && return 0; }
1056         [ -z "$TUNEFS" ] && skip_env "No tunefs" && return
1057
1058         local DISK1_8=$LUSTRE/tests/disk1_8.tar.bz2
1059         [ ! -r $DISK1_8 ] && skip_env "Cannot find $DISK1_8" && return 0
1060         local tmpdir=$TMP/conf32b
1061         mkdir -p $tmpdir
1062         tar xjvf $DISK1_8 -C $tmpdir || \
1063                 { skip_env "Cannot untar $DISK1_8" && return ; }
1064
1065         load_modules
1066         $LCTL set_param debug="config"
1067         local NEWNAME=lustre
1068
1069         # writeconf will cause servers to register with their current nids
1070         $TUNEFS --writeconf --fsname=$NEWNAME $tmpdir/mds || error "tunefs failed"
1071         start32 mds1 $tmpdir/mds "-o loop" && \
1072                 trap cleanup_32 EXIT INT || return 3
1073
1074         local UUID=$($LCTL get_param -n mdt.${NEWNAME}-MDT0000.uuid)
1075         echo MDS uuid $UUID
1076         [ "$UUID" == "${NEWNAME}-MDT0000_UUID" ] || error "UUID is wrong: $UUID"
1077
1078         $TUNEFS --mgsnode=$HOSTNAME --writeconf --fsname=$NEWNAME $tmpdir/ost1 ||\
1079             error "tunefs failed"
1080         start32 ost1 $tmpdir/ost1 "-o loop" || return 5
1081         UUID=$($LCTL get_param -n obdfilter.${NEWNAME}-OST0000.uuid)
1082         echo OST uuid $UUID
1083         [ "$UUID" == "${NEWNAME}-OST0000_UUID" ] || error "UUID is wrong: $UUID"
1084
1085         local NID=$($LCTL list_nids | head -1)
1086
1087         echo "OSC changes should succeed:"
1088         $LCTL conf_param ${NEWNAME}-OST0000.osc.max_dirty_mb=15 || return 7
1089         $LCTL conf_param ${NEWNAME}-OST0000.failover.node=$NID || return 8
1090         echo "ok."
1091
1092         echo "MDC changes should succeed:"
1093         $LCTL conf_param ${NEWNAME}-MDT0000.mdc.max_rpcs_in_flight=9 || return 9
1094         $LCTL conf_param ${NEWNAME}-MDT0000.failover.node=$NID || return 10
1095         echo "ok."
1096
1097         echo "LOV changes should succeed:"
1098         $LCTL pool_new ${NEWNAME}.interop || return 11
1099         $LCTL conf_param ${NEWNAME}-MDT0000.lov.stripesize=4M || return 12
1100         echo "ok."
1101
1102         # MDT and OST should have registered with new nids, so we should have
1103         # a fully-functioning client
1104         echo "Check client and old fs contents"
1105
1106         local device=`h2$NETTYPE $HOSTNAME`:/$NEWNAME
1107         echo "Starting local client: $HOSTNAME: $device $MOUNT"
1108         mount -t lustre $device $MOUNT || return 1
1109
1110         local old=$($LCTL get_param -n mdc.*.max_rpcs_in_flight)
1111         local new=$((old + 5))
1112         $LCTL conf_param ${NEWNAME}-MDT0000.mdc.max_rpcs_in_flight=$new
1113         wait_update $HOSTNAME "$LCTL get_param -n mdc.*.max_rpcs_in_flight" $new || return 11
1114
1115         [ "$(cksum $MOUNT/passwd | cut -d' ' -f 1,2)" == "94306271 1478" ] || return 12
1116         echo "ok."
1117
1118         cleanup_32
1119
1120         rm -rf $tmpdir || true  # true is only for TMP on NFS
1121 }
1122 run_test 32b "Upgrade from 1.8 with writeconf"
1123
1124 test_33a() { # bug 12333, was test_33
1125         local rc=0
1126         local FSNAME2=test-123
1127         [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST
1128
1129         if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" ]; then
1130                 do_facet $SINGLEMDS [ -b "$MDSDEV" ] && \
1131                 skip_env "mixed loopback and real device not working" && return
1132         fi
1133
1134         local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
1135         local fs2ostdev=${fs2ost_DEV:-$(ostdevname 1)_2}
1136         add fs2mds $MDS_MKFS_OPTS --mkfsoptions='\"-J size=8\"' --fsname=${FSNAME2} --reformat $fs2mdsdev || exit 10
1137         add fs2ost $OST_MKFS_OPTS --fsname=${FSNAME2} --index=8191 --mgsnode=$MGSNID --reformat $fs2ostdev || exit 10
1138
1139         start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS && trap cleanup_24a EXIT INT
1140         start fs2ost $fs2ostdev $OST_MOUNT_OPTS
1141         do_facet $SINGLEMDS "$LCTL conf_param $FSNAME2.sys.timeout=200" || rc=1
1142         mkdir -p $MOUNT2
1143         mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || rc=2
1144         echo "ok."
1145
1146         cp /etc/hosts $MOUNT2/ || rc=3
1147         $LFS getstripe $MOUNT2/hosts
1148
1149         umount -d $MOUNT2
1150         stop fs2ost -f
1151         stop fs2mds -f
1152         rm -rf $MOUNT2 $fs2mdsdev $fs2ostdev
1153         cleanup_nocli || rc=6
1154         return $rc
1155 }
1156 run_test 33a "Mount ost with a large index number"
1157
1158 test_33b() {    # was test_34
1159         setup
1160
1161         do_facet client dd if=/dev/zero of=$MOUNT/24 bs=1024k count=1
1162         # Drop lock cancelation reply during umount
1163         #define OBD_FAIL_LDLM_CANCEL             0x304
1164         do_facet client lctl set_param fail_loc=0x80000304
1165         #lctl set_param debug=-1
1166         umount_client $MOUNT
1167         cleanup
1168 }
1169 run_test 33b "Drop cancel during umount"
1170
1171 test_34a() {
1172         setup
1173         do_facet client "sh runmultiop_bg_pause $DIR/file O_c"
1174         manual_umount_client
1175         rc=$?
1176         do_facet client killall -USR1 multiop
1177         if [ $rc -eq 0 ]; then
1178                 error "umount not fail!"
1179         fi
1180         sleep 1
1181         cleanup
1182 }
1183 run_test 34a "umount with opened file should be fail"
1184
1185
1186 test_34b() {
1187         setup
1188         touch $DIR/$tfile || return 1
1189         stop_mds --force || return 2
1190
1191         manual_umount_client --force
1192         rc=$?
1193         if [ $rc -ne 0 ]; then
1194                 error "mtab after failed umount - rc $rc"
1195         fi
1196
1197         cleanup
1198         return 0
1199 }
1200 run_test 34b "force umount with failed mds should be normal"
1201
1202 test_34c() {
1203         setup
1204         touch $DIR/$tfile || return 1
1205         stop_ost --force || return 2
1206
1207         manual_umount_client --force
1208         rc=$?
1209         if [ $rc -ne 0 ]; then
1210                 error "mtab after failed umount - rc $rc"
1211         fi
1212
1213         cleanup
1214         return 0
1215 }
1216 run_test 34c "force umount with failed ost should be normal"
1217
1218 test_35a() { # bug 12459
1219         setup
1220
1221         DBG_SAVE="`lctl get_param -n debug`"
1222         lctl set_param debug="ha"
1223
1224         log "Set up a fake failnode for the MDS"
1225         FAKENID="127.0.0.2"
1226         local device=$(do_facet $SINGLEMDS "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
1227         do_facet $SINGLEMDS $LCTL conf_param ${device}.failover.node=$FAKENID || return 4
1228
1229         log "Wait for RECONNECT_INTERVAL seconds (10s)"
1230         sleep 10
1231
1232         MSG="conf-sanity.sh test_35a `date +%F%kh%Mm%Ss`"
1233         $LCTL clear
1234         log "$MSG"
1235         log "Stopping the MDT:"
1236         stop_mds || return 5
1237
1238         df $MOUNT > /dev/null 2>&1 &
1239         DFPID=$!
1240         log "Restarting the MDT:"
1241         start_mds || return 6
1242         log "Wait for df ($DFPID) ... "
1243         wait $DFPID
1244         log "done"
1245         lctl set_param debug="$DBG_SAVE"
1246
1247         # retrieve from the log the first server that the client tried to
1248         # contact after the connection loss
1249         $LCTL dk $TMP/lustre-log-$TESTNAME.log
1250         NEXTCONN=`awk "/${MSG}/ {start = 1;}
1251                        /import_select_connection.*$device-mdc.* using connection/ {
1252                                 if (start) {
1253                                         if (\\\$NF ~ /$FAKENID/)
1254                                                 print \\\$NF;
1255                                         else
1256                                                 print 0;
1257                                         exit;
1258                                 }
1259                        }" $TMP/lustre-log-$TESTNAME.log`
1260         [ "$NEXTCONN" != "0" ] && log "The client didn't try to reconnect to the last active server (tried ${NEXTCONN} instead)" && return 7
1261         cleanup
1262 }
1263 run_test 35a "Reconnect to the last active server first"
1264
1265 test_35b() { # bug 18674
1266         remote_mds || { skip "local MDS" && return 0; }
1267         setup
1268
1269         debugsave
1270         $LCTL set_param debug="ha"
1271         $LCTL clear
1272         MSG="conf-sanity.sh test_35b `date +%F%kh%Mm%Ss`"
1273         log "$MSG"
1274
1275         log "Set up a fake failnode for the MDS"
1276         FAKENID="127.0.0.2"
1277         local device=$(do_facet mds "$LCTL get_param -n devices" | \
1278                         awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' | head -1)
1279         do_facet mds "$LCTL conf_param ${device}.failover.node=$FAKENID" || \
1280                 return 1
1281
1282         local at_max_saved=0
1283         # adaptive timeouts may prevent seeing the issue 
1284         if at_is_enabled; then
1285                 at_max_saved=$(at_max_get mds)
1286                 at_max_set 0 mds client
1287         fi
1288
1289         mkdir -p $MOUNT/testdir
1290         touch $MOUNT/testdir/test
1291
1292         log "Injecting EBUSY on MDS"
1293         # Setting OBD_FAIL_MDS_RESEND=0x136
1294         do_facet mds "$LCTL set_param fail_loc=0x80000136" || return 2
1295
1296         log "Stat on a test file"
1297         stat $MOUNT/testdir/test
1298
1299         log "Stop injecting EBUSY on MDS"
1300         do_facet mds "$LCTL set_param fail_loc=0" || return 3
1301         rm -f $MOUNT/testdir/test
1302
1303         log "done"
1304         # restore adaptive timeout
1305         [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds client
1306
1307         $LCTL dk $TMP/lustre-log-$TESTNAME.log
1308
1309         # retrieve from the log if the client has ever tried to
1310         # contact the fake server after the loss of connection
1311         FAILCONN=`awk "BEGIN {ret = 0;}
1312                        /import_select_connection.*${FSNAME}-MDT0000-mdc.* using connection/ {
1313                                 ret = 1;
1314                                 if (\\\$NF ~ /$FAKENID/) {
1315                                         ret = 2;
1316                                         exit;
1317                                 }
1318                        }
1319                        END {print ret}" $TMP/lustre-log-$TESTNAME.log`
1320
1321         [ "$FAILCONN" == "0" ] && \
1322                 log "ERROR: The client reconnection has not been triggered" && \
1323                 return 4
1324         [ "$FAILCONN" == "2" ] && \
1325                 log "ERROR: The client tried to reconnect to the failover server while the primary was busy" && \
1326                 return 5
1327
1328         cleanup
1329 }
1330 run_test 35b "Continue reconnection retries, if the active server is busy"
1331
1332 test_36() { # 12743
1333         local rc
1334         local FSNAME2=test1234
1335         local fs3ost_HOST=$ost_HOST
1336
1337         [ -n "$ost1_HOST" ] && fs2ost_HOST=$ost1_HOST && fs3ost_HOST=$ost1_HOST
1338         rc=0
1339
1340         if [ -z "$fs2ost_DEV" -o -z "$fs2mds_DEV" -o -z "$fs3ost_DEV" ]; then
1341                 do_facet $SINGLEMDS [ -b "$MDSDEV" ] && \
1342                 skip_env "mixed loopback and real device not working" && return
1343         fi
1344         [ $OSTCOUNT -lt 2 ] && skip_env "skipping test for single OST" && return
1345
1346         [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] || \
1347                 { skip "remote OST" && return 0; }
1348
1349         local fs2mdsdev=${fs2mds_DEV:-${MDSDEV}_2}
1350         local fs2ostdev=${fs2ost_DEV:-$(ostdevname 1)_2}
1351         local fs3ostdev=${fs3ost_DEV:-$(ostdevname 2)_2}
1352         add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME2} --reformat $fs2mdsdev || exit 10
1353         # XXX after we support non 4K disk blocksize, change following --mkfsoptions with
1354         # other argument
1355         add fs2ost $OST_MKFS_OPTS --mkfsoptions='-b4096' --fsname=${FSNAME2} --mgsnode=$MGSNID --reformat $fs2ostdev || exit 10
1356         add fs3ost $OST_MKFS_OPTS --mkfsoptions='-b4096' --fsname=${FSNAME2} --mgsnode=$MGSNID --reformat $fs3ostdev || exit 10
1357
1358         start fs2mds $fs2mdsdev $MDS_MOUNT_OPTS
1359         start fs2ost $fs2ostdev $OST_MOUNT_OPTS
1360         start fs3ost $fs3ostdev $OST_MOUNT_OPTS
1361         mkdir -p $MOUNT2
1362         mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
1363
1364         sleep 5 # until 11778 fixed
1365
1366         dd if=/dev/zero of=$MOUNT2/$tfile bs=1M count=7 || return 2
1367
1368         BKTOTAL=`lctl get_param -n obdfilter.*.kbytestotal | awk 'BEGIN{total=0}; {total+=$1}; END{print total}'`
1369         BKFREE=`lctl get_param -n obdfilter.*.kbytesfree | awk 'BEGIN{free=0}; {free+=$1}; END{print free}'`
1370         BKAVAIL=`lctl get_param -n obdfilter.*.kbytesavail | awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}'`
1371         STRING=`df -P $MOUNT2 | tail -n 1 | awk '{print $2","$3","$4}'`
1372         DFTOTAL=`echo $STRING | cut -d, -f1`
1373         DFUSED=`echo $STRING  | cut -d, -f2`
1374         DFAVAIL=`echo $STRING | cut -d, -f3`
1375         DFFREE=$(($DFTOTAL - $DFUSED))
1376
1377         ALLOWANCE=$((64 * $OSTCOUNT))
1378
1379         if [ $DFTOTAL -lt $(($BKTOTAL - $ALLOWANCE)) ] ||
1380            [ $DFTOTAL -gt $(($BKTOTAL + $ALLOWANCE)) ] ; then
1381                 echo "**** FAIL: df total($DFTOTAL) mismatch OST total($BKTOTAL)"
1382                 rc=1
1383         fi
1384         if [ $DFFREE -lt $(($BKFREE - $ALLOWANCE)) ] ||
1385            [ $DFFREE -gt $(($BKFREE + $ALLOWANCE)) ] ; then
1386                 echo "**** FAIL: df free($DFFREE) mismatch OST free($BKFREE)"
1387                 rc=2
1388         fi
1389         if [ $DFAVAIL -lt $(($BKAVAIL - $ALLOWANCE)) ] ||
1390            [ $DFAVAIL -gt $(($BKAVAIL + $ALLOWANCE)) ] ; then
1391                 echo "**** FAIL: df avail($DFAVAIL) mismatch OST avail($BKAVAIL)"
1392                 rc=3
1393        fi
1394
1395         umount -d $MOUNT2
1396         stop fs3ost -f || return 200
1397         stop fs2ost -f || return 201
1398         stop fs2mds -f || return 202
1399         rm -rf $MOUNT2 $fs2mdsdev $fs2ostdev $fs3ostdev
1400         unload_modules || return 203
1401         return $rc
1402 }
1403 run_test 36 "df report consistency on OSTs with different block size"
1404
1405 test_37() {
1406         client_only && skip "client only testing" && return 0
1407         LOCAL_MDSDEV="$TMP/mdt.img"
1408         SYM_MDSDEV="$TMP/sym_mdt.img"
1409
1410         echo "MDS :     $LOCAL_MDSDEV"
1411         echo "SYMLINK : $SYM_MDSDEV"
1412         rm -f $LOCAL_MDSDEV
1413
1414         touch $LOCAL_MDSDEV
1415         mkfs.lustre --reformat --fsname=lustre --mdt --mgs --device-size=9000 $LOCAL_MDSDEV ||
1416                 error "mkfs.lustre $LOCAL_MDSDEV failed"
1417         ln -s $LOCAL_MDSDEV $SYM_MDSDEV
1418
1419         echo "mount symlink device - $SYM_MDSDEV"
1420
1421         mount_op=`mount -v -t lustre -o loop $SYM_MDSDEV ${MOUNT%/*}/mds 2>&1 | grep "unable to set tunable"`
1422         umount -d ${MOUNT%/*}/mds
1423         rm -f $LOCAL_MDSDEV $SYM_MDSDEV
1424
1425         if [ -n "$mount_op" ]; then
1426                 error "**** FAIL: set tunables failed for symlink device"
1427         fi
1428         return 0
1429 }
1430 run_test 37 "verify set tunables works for symlink device"
1431
1432 test_38() { # bug 14222
1433         setup
1434         # like runtests
1435         COUNT=10
1436         SRC="/etc /bin"
1437         FILES=`find $SRC -type f -mtime +1 | head -n $COUNT`
1438         log "copying $(echo $FILES | wc -w) files to $DIR/$tdir"
1439         mkdir -p $DIR/$tdir
1440         tar cf - $FILES | tar xf - -C $DIR/$tdir || \
1441                 error "copying $SRC to $DIR/$tdir"
1442         sync
1443         umount_client $MOUNT
1444         stop_mds
1445         log "rename lov_objid file on MDS"
1446         rm -f $TMP/lov_objid.orig
1447
1448         local dev=${SINGLEMDS}_dev
1449         local MDSDEV=${!dev}
1450         do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.orig\\\" $MDSDEV"
1451         do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"rm lov_objid\\\" $MDSDEV"
1452
1453         do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.orig"
1454         # check create in mds_lov_connect
1455         start_mds
1456         mount_client $MOUNT
1457         for f in $FILES; do
1458                 [ $V ] && log "verifying $DIR/$tdir/$f"
1459                 diff -q $f $DIR/$tdir/$f || ERROR=y
1460         done
1461         do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.new\\\"  $MDSDEV"
1462         do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.new"
1463         [ "$ERROR" = "y" ] && error "old and new files are different after connect" || true
1464
1465         # check it's updates in sync
1466         umount_client $MOUNT
1467         stop_mds
1468
1469         do_facet $SINGLEMDS dd if=/dev/zero of=$TMP/lov_objid.clear bs=4096 count=1
1470         do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"rm lov_objid\\\" $MDSDEV"
1471         do_facet $SINGLEMDS "$DEBUGFS -w -R \\\"write $TMP/lov_objid.clear lov_objid\\\" $MDSDEV "
1472
1473         start_mds
1474         mount_client $MOUNT
1475         for f in $FILES; do
1476                 [ $V ] && log "verifying $DIR/$tdir/$f"
1477                 diff -q $f $DIR/$tdir/$f || ERROR=y
1478         done
1479         do_facet $SINGLEMDS "$DEBUGFS -c -R \\\"dump lov_objid $TMP/lov_objid.new1\\\" $MDSDEV"
1480         do_facet $SINGLEMDS "od -Ax -td8 $TMP/lov_objid.new1"
1481         umount_client $MOUNT
1482         stop_mds
1483         [ "$ERROR" = "y" ] && error "old and new files are different after sync" || true
1484
1485         log "files compared the same"
1486         cleanup
1487 }
1488 run_test 38 "MDS recreates missing lov_objid file from OST data"
1489
1490 test_39() {
1491         PTLDEBUG=+malloc
1492         setup
1493         cleanup
1494         perl $SRCDIR/leak_finder.pl $TMP/debug 2>&1 | egrep '*** Leak:' &&
1495                 error "memory leak detected" || true
1496 }
1497 run_test 39 "leak_finder recognizes both LUSTRE and LNET malloc messages"
1498
1499 test_40() { # bug 15759
1500         start_ost
1501         #define OBD_FAIL_TGT_TOOMANY_THREADS     0x706
1502         do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000706"
1503         start_mds
1504         cleanup
1505 }
1506 run_test 40 "race during service thread startup"
1507
1508 test_41() { #bug 14134
1509         local rc
1510         local dev=${SINGLEMDS}_dev
1511         local MDSDEV=${!dev}
1512
1513         start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nosvc -n
1514         start ost1 `ostdevname 1` $OST_MOUNT_OPTS
1515         start $SINGLEMDS $MDSDEV $MDS_MOUNT_OPTS -o nomgs,force
1516         mkdir -p $MOUNT
1517         mount_client $MOUNT || return 1
1518         sleep 5
1519
1520         echo "blah blah" > $MOUNT/$tfile
1521         cat $MOUNT/$tfile
1522
1523         umount_client $MOUNT
1524         stop ost1 -f || return 201
1525         stop_mds -f || return 202
1526         stop_mds -f || return 203
1527         unload_modules || return 204
1528         return $rc
1529 }
1530 run_test 41 "mount mds with --nosvc and --nomgs"
1531
1532 test_42() { #bug 14693
1533         setup
1534         check_mount || return 2
1535         do_facet mgs $LCTL conf_param lustre.llite.some_wrong_param=10
1536         umount_client $MOUNT
1537         mount_client $MOUNT || return 1
1538         cleanup
1539         return 0
1540 }
1541 run_test 42 "invalid config param should not prevent client from mounting"
1542
1543 test_43() {
1544     [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root"
1545     setup
1546     chmod ugo+x $DIR || error "chmod 0 failed"
1547     set_and_check mds                                        \
1548         "lctl get_param -n mdt.$FSNAME-MDT0000.root_squash"  \
1549         "$FSNAME.mdt.root_squash"                            \
1550         "0:0"
1551     set_and_check mds                                        \
1552        "lctl get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
1553        "$FSNAME.mdt.nosquash_nids"                           \
1554        "NONE"
1555
1556     #
1557     # create set of test files
1558     #
1559     echo "111" > $DIR/$tfile-userfile || error "write 1 failed"
1560     chmod go-rw $DIR/$tfile-userfile  || error "chmod 1 failed"
1561     chown $RUNAS_ID.$RUNAS_ID $DIR/$tfile-userfile || error "chown failed"
1562
1563     echo "222" > $DIR/$tfile-rootfile || error "write 2 failed"
1564     chmod go-rw $DIR/$tfile-rootfile  || error "chmod 2 faield"
1565
1566     mkdir $DIR/$tdir-rootdir -p       || error "mkdir failed"
1567     chmod go-rwx $DIR/$tdir-rootdir   || error "chmod 3 failed"
1568     touch $DIR/$tdir-rootdir/tfile-1  || error "touch failed"
1569
1570     #
1571     # check root_squash:
1572     #   set root squash UID:GID to RUNAS_ID
1573     #   root should be able to access only files owned by RUNAS_ID
1574     #
1575     set_and_check mds                                        \
1576        "lctl get_param -n mdt.$FSNAME-MDT0000.root_squash"   \
1577        "$FSNAME.mdt.root_squash"                             \
1578        "$RUNAS_ID:$RUNAS_ID"
1579
1580     ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-userfile)
1581     dd if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null || \
1582         error "$ST: root read permission is denied"
1583     echo "$ST: root read permission is granted - ok"
1584
1585     echo "444" | \
1586     dd conv=notrunc if=$DIR/$tfile-userfile 1>/dev/null 2>/dev/null || \
1587         error "$ST: root write permission is denied"
1588     echo "$ST: root write permission is granted - ok"
1589
1590     ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
1591     dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null && \
1592         error "$ST: root read permission is granted"
1593     echo "$ST: root read permission is denied - ok"
1594
1595     echo "555" | \
1596     dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null && \
1597         error "$ST: root write permission is granted"
1598     echo "$ST: root write permission is denied - ok"
1599
1600     ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
1601     rm $DIR/$tdir-rootdir/tfile-1 1>/dev/null 2>/dev/null && \
1602         error "$ST: root unlink permission is granted"
1603     echo "$ST: root unlink permission is denied - ok"
1604
1605     touch $DIR/tdir-rootdir/tfile-2 1>/dev/null 2>/dev/null && \
1606         error "$ST: root create permission is granted"
1607     echo "$ST: root create permission is denied - ok"
1608
1609     #
1610     # check nosquash_nids:
1611     #   put client's NID into nosquash_nids list,
1612     #   root should be able to access root file after that
1613     #
1614     local NIDLIST=$(lctl list_nids all | tr '\n' ' ')
1615     NIDLIST="2@elan $NIDLIST 192.168.0.[2,10]@tcp"
1616     NIDLIST=$(echo $NIDLIST | tr -s ' ' ' ')
1617     set_and_check mds                                        \
1618        "lctl get_param -n mdt.$FSNAME-MDT0000.nosquash_nids" \
1619        "$FSNAME-MDTall.mdt.nosquash_nids"                    \
1620        "$NIDLIST"
1621
1622     ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tfile-rootfile)
1623     dd if=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null || \
1624         error "$ST: root read permission is denied"
1625     echo "$ST: root read permission is granted - ok"
1626
1627     echo "666" | \
1628     dd conv=notrunc of=$DIR/$tfile-rootfile 1>/dev/null 2>/dev/null || \
1629         error "$ST: root write permission is denied"
1630     echo "$ST: root write permission is granted - ok"
1631
1632     ST=$(stat -c "%n: owner uid %u (%A)" $DIR/$tdir-rootdir)
1633     rm $DIR/$tdir-rootdir/tfile-1 || \
1634         error "$ST: root unlink permission is denied"
1635     echo "$ST: root unlink permission is granted - ok"
1636     touch $DIR/$tdir-rootdir/tfile-2 || \
1637         error "$ST: root create permission is denied"
1638     echo "$ST: root create permission is granted - ok"
1639
1640     return 0
1641 }
1642 run_test 43 "check root_squash and nosquash_nids"
1643
1644 umount_client $MOUNT
1645 cleanup_nocli
1646
1647 test_44() { # 16317
1648         setup
1649         check_mount || return 2
1650         UUID=$($LCTL get_param llite.${FSNAME}*.uuid | cut -d= -f2)
1651         STATS_FOUND=no
1652         UUIDS=$(do_facet mds "$LCTL get_param mdt.${FSNAME}*.exports.*.uuid")
1653         for VAL in $UUIDS; do
1654                 NID=$(echo $VAL | cut -d= -f1)
1655                 CLUUID=$(echo $VAL | cut -d= -f2)
1656                 [ "$UUID" = "$CLUUID" ] && STATS_FOUND=yes && break
1657         done
1658         [ "$STATS_FOUND" = "no" ] && error "stats not found for client"
1659         cleanup
1660         return 0
1661 }
1662 run_test 44 "mounted client proc entry exists"
1663
1664 test_45() { #17310
1665         setup
1666         check_mount || return 2
1667         stop_mds
1668         df -h $MOUNT &
1669         log "sleep 60 sec"
1670         sleep 60
1671 #define OBD_FAIL_PTLRPC_LONG_UNLINK   0x50f
1672         do_facet client "lctl set_param fail_loc=0x50f"
1673         log "sleep 10 sec"
1674         sleep 10
1675         manual_umount_client --force || return 3
1676         do_facet client "lctl set_param fail_loc=0x0"
1677         start_mds
1678         mount_client $MOUNT || return 4
1679         cleanup
1680         return 0
1681 }
1682 run_test 45 "long unlink handling in ptlrpcd"
1683
1684 cleanup_46a() {
1685         trap 0
1686         local rc=0
1687         local count=$1
1688
1689         umount_client $MOUNT2 || rc=$?
1690         umount_client $MOUNT || rc=$?
1691         while [ $count -gt 0 ]; do
1692                 stop ost${count} -f || rc=$?
1693                 let count=count-1
1694         done    
1695         stop_mds || rc=$? 
1696         # writeconf is needed after the test, otherwise,
1697         # we might end up with extra OSTs
1698         writeconf || rc=$?
1699         cleanup_nocli || rc=$?
1700         return $rc
1701 }
1702
1703 test_46a() {
1704         echo "Testing with $OSTCOUNT OSTs"
1705         reformat_and_config
1706         start_mds || return 1
1707         #first client should see only one ost
1708         start_ost || return 2
1709         wait_osc_import_state mds ost FULL
1710         #start_client
1711         mount_client $MOUNT || return 3
1712         trap "cleanup_46a $OSTCOUNT" EXIT ERR
1713
1714         local i 
1715         for (( i=2; i<=$OSTCOUNT; i++ )); do
1716             start ost$i `ostdevname $i` $OST_MOUNT_OPTS || return $((i+2))
1717         done
1718
1719         # wait until osts in sync
1720         for (( i=2; i<=$OSTCOUNT; i++ )); do
1721             wait_osc_import_state mds ost$i FULL
1722         done
1723
1724
1725         #second client see all ost's
1726
1727         mount_client $MOUNT2 || return 8
1728         $LFS setstripe $MOUNT2 -c -1 || return 9
1729         $LFS getstripe $MOUNT2 || return 10
1730
1731         echo "ok" > $MOUNT2/widestripe
1732         $LFS getstripe $MOUNT2/widestripe || return 11
1733         # fill acl buffer for avoid expand lsm to them
1734         awk -F : '{if (FNR < 25) { print "u:"$1":rwx" }}' /etc/passwd | while read acl; do
1735             setfacl -m $acl $MOUNT2/widestripe
1736         done
1737
1738         # will be deadlock
1739         stat $MOUNT/widestripe || return 12
1740
1741         cleanup_46a $OSTCOUNT || { echo "cleanup_46a failed!" && return 13; }
1742         return 0
1743 }
1744 run_test 46a "handle ost additional - wide striped file"
1745
1746 test_47() { #17674
1747         reformat
1748         setup_noconfig
1749         check_mount || return 2
1750         $LCTL set_param ldlm.namespaces.$FSNAME-*-*-*.lru_size=100
1751
1752         local lru_size=[]
1753         local count=0
1754         for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
1755             if echo $ns | grep "MDT[[:digit:]]*"; then
1756                 continue
1757             fi
1758             lrs=$(echo $ns | sed 's/.*lru_size=//')
1759             lru_size[count]=$lrs
1760             let count=count+1
1761         done
1762
1763         facet_failover ost1
1764         facet_failover $SINGLEMDS
1765         client_up || return 3
1766
1767         count=0
1768         for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do
1769             if echo $ns | grep "MDT[[:digit:]]*"; then
1770                 continue
1771             fi
1772             lrs=$(echo $ns | sed 's/.*lru_size=//')
1773             if ! test "$lrs" -eq "${lru_size[count]}"; then
1774                 n=$(echo $ns | sed -e 's/ldlm.namespaces.//' -e 's/.lru_size=.*//')
1775                 error "$n has lost lru_size: $lrs vs. ${lru_size[count]}"
1776             fi
1777             let count=count+1
1778         done
1779
1780         cleanup
1781         return 0
1782 }
1783 run_test 47 "server restart does not make client loss lru_resize settings"
1784
1785 cleanup_48() {
1786         trap 0
1787
1788         # reformat after this test is needed - if test will failed
1789         # we will have unkillable file at FS
1790         reformat_and_config
1791 }
1792
1793 test_48() { # bug 17636
1794         reformat
1795         setup_noconfig
1796         check_mount || return 2
1797
1798         $LFS setstripe $MOUNT -c -1 || return 9
1799         $LFS getstripe $MOUNT || return 10
1800
1801         echo "ok" > $MOUNT/widestripe
1802         $LFS getstripe $MOUNT/widestripe || return 11
1803
1804         trap cleanup_48 EXIT ERR
1805
1806         # fill acl buffer for avoid expand lsm to them
1807         getent passwd | awk -F : '{ print "u:"$1":rwx" }' |  while read acl; do
1808             setfacl -m $acl $MOUNT/widestripe
1809         done
1810
1811         stat $MOUNT/widestripe || return 12
1812
1813         cleanup_48
1814         return 0
1815 }
1816 run_test 48 "too many acls on file"
1817
1818 # check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE
1819 test_49() { # bug 17710
1820         local OLD_MDS_MKFS_OPTS=$MDS_MKFS_OPTS
1821         local OLD_OST_MKFS_OPTS=$OST_MKFS_OPTS
1822         local LOCAL_TIMEOUT=20
1823
1824
1825         OST_MKFS_OPTS="--ost --fsname=$FSNAME --device-size=$OSTSIZE --mgsnode=$MGSNID --param sys.timeout=$LOCAL_TIMEOUT --param sys.ldlm_timeout=$LOCAL_TIMEOUT $MKFSOPT $OSTOPT"
1826
1827         reformat
1828         setup_noconfig
1829         check_mount || return 1
1830
1831         echo "check ldlm_timout..."
1832         LDLM_MDS="`do_facet mds lctl get_param -n ldlm_timeout`"
1833         LDLM_OST1="`do_facet ost1 lctl get_param -n ldlm_timeout`"
1834         LDLM_CLIENT="`do_facet client lctl get_param -n ldlm_timeout`"
1835
1836         if [ $LDLM_MDS -ne $LDLM_OST1 ] || [ $LDLM_MDS -ne $LDLM_CLIENT ]; then
1837                 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
1838         fi
1839
1840         if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT / 3)) ]; then
1841                 error "LDLM_TIMEOUT($LDLM_MDS) is not correct"
1842         fi
1843
1844         umount_client $MOUNT
1845         stop_ost || return 2
1846         stop_mds || return 3
1847
1848         OST_MKFS_OPTS="--ost --fsname=$FSNAME --device-size=$OSTSIZE --mgsnode=$MGSNID --param sys.timeout=$LOCAL_TIMEOUT --param sys.ldlm_timeout=$((LOCAL_TIMEOUT - 1)) $MKFSOPT $OSTOPT"
1849
1850         reformat
1851         setup_noconfig
1852         check_mount || return 7
1853
1854         LDLM_MDS="`do_facet mds lctl get_param -n ldlm_timeout`"
1855         LDLM_OST1="`do_facet ost1 lctl get_param -n ldlm_timeout`"
1856         LDLM_CLIENT="`do_facet client lctl get_param -n ldlm_timeout`"
1857
1858         if [ $LDLM_MDS -ne $LDLM_OST1 ] || [ $LDLM_MDS -ne $LDLM_CLIENT ]; then
1859                 error "Different LDLM_TIMEOUT:$LDLM_MDS $LDLM_OST1 $LDLM_CLIENT"
1860         fi
1861
1862         if [ $LDLM_MDS -ne $((LOCAL_TIMEOUT - 1)) ]; then
1863                 error "LDLM_TIMEOUT($LDLM_MDS) is not correct"
1864         fi
1865
1866         cleanup || return $?
1867
1868         MDS_MKFS_OPTS=$OLD_MDS_MKFS_OPTS
1869         OST_MKFS_OPTS=$OLD_OST_MKFS_OPTS
1870 }
1871 run_test 49 "check PARAM_SYS_LDLM_TIMEOUT option of MKFS.LUSTRE"
1872
1873 lazystatfs() {
1874         # Test both statfs and lfs df and fail if either one fails
1875         multiop_bg_pause $1 f_
1876         RC1=$?
1877         PID=$!
1878         killall -USR1 multiop
1879         [ $RC1 -ne 0 ] && log "lazystatfs multiop failed"
1880         wait $PID || { RC1=$?; log "multiop return error "; }
1881
1882         $LFS df &
1883         PID=$!
1884         sleep 5
1885         kill -s 0 $PID
1886         RC2=$?
1887         if [ $RC2 -eq 0 ]; then
1888             kill -s 9 $PID
1889             log "lazystatfs df failed"
1890         fi
1891
1892         RC=0
1893         [[ $RC1 -ne 0 || $RC2 -eq 0 ]] && RC=1
1894         return $RC
1895 }
1896
1897 test_50a() {
1898         setup
1899         lctl set_param llite.$FSNAME-*.lazystatfs=1
1900         touch $DIR/$tfile
1901
1902         lazystatfs $MOUNT || error "lazystatfs failed but no down servers"
1903
1904         cleanup || return $?
1905 }
1906 run_test 50a "lazystatfs all servers available =========================="
1907
1908 test_50b() {
1909         setup
1910         lctl set_param llite.$FSNAME-*.lazystatfs=1
1911         touch $DIR/$tfile
1912
1913         # Wait for client to detect down OST
1914         stop_ost || error "Unable to stop OST1"
1915         wait_osc_import_state mds ost DISCONN
1916
1917         lazystatfs $MOUNT || error "lazystatfs should don't have returned EIO"
1918
1919         umount_client $MOUNT || error "Unable to unmount client"
1920         stop_mds || error "Unable to stop MDS"
1921 }
1922 run_test 50b "lazystatfs all servers down =========================="
1923
1924 test_50c() {
1925         start_mds || error "Unable to start MDS"
1926         start_ost || error "Unable to start OST1"
1927         start_ost2 || error "Unable to start OST2"
1928         mount_client $MOUNT || error "Unable to mount client"
1929         lctl set_param llite.$FSNAME-*.lazystatfs=1
1930         touch $DIR/$tfile
1931
1932         # Wait for client to detect down OST
1933         stop_ost || error "Unable to stop OST1"
1934         wait_osc_import_state mds ost DISCONN
1935         lazystatfs $MOUNT || error "lazystatfs failed with one down server"
1936
1937         umount_client $MOUNT || error "Unable to unmount client"
1938         stop_ost2 || error "Unable to stop OST2"
1939         stop_mds || error "Unable to stop MDS"
1940 }
1941 run_test 50c "lazystatfs one server down =========================="
1942
1943 test_50d() {
1944         start_mds || error "Unable to start MDS"
1945         start_ost || error "Unable to start OST1"
1946         start_ost2 || error "Unable to start OST2"
1947         mount_client $MOUNT || error "Unable to mount client"
1948         lctl set_param llite.$FSNAME-*.lazystatfs=1
1949         touch $DIR/$tfile
1950
1951         # Issue the statfs during the window where the client still
1952         # belives the OST to be available but it is in fact down.
1953         # No failure just a statfs which hangs for a timeout interval.
1954         stop_ost || error "Unable to stop OST1"
1955         lazystatfs $MOUNT || error "lazystatfs failed with one down server"
1956
1957         umount_client $MOUNT || error "Unable to unmount client"
1958         stop_ost2 || error "Unable to stop OST2"
1959         stop_mds || error "Unable to stop MDS"
1960 }
1961 run_test 50d "lazystatfs client/server conn race =========================="
1962
1963 test_50e() {
1964         local RC1
1965         local pid
1966
1967         reformat_and_config
1968         start_mds || return 1
1969         #first client should see only one ost
1970         start_ost || return 2
1971         wait_osc_import_state mds ost FULL
1972
1973         # Wait for client to detect down OST
1974         stop_ost || error "Unable to stop OST1"
1975         wait_osc_import_state mds ost DISCONN
1976
1977         mount_client $MOUNT || error "Unable to mount client"
1978         lctl set_param llite.$FSNAME-*.lazystatfs=0
1979
1980         multiop_bg_pause $MOUNT _f
1981         RC1=$?
1982         pid=$!
1983
1984         if [ $RC1 -ne 0 ]; then
1985                 log "multiop failed $RC1"
1986         else
1987             kill -USR1 $pid
1988             sleep $(( $TIMEOUT+1 ))
1989             kill -0 $pid
1990             [ $? -ne 0 ] && error "process isn't sleep"
1991             start_ost || error "Unable to start OST1"
1992             wait $pid || error "statfs failed"
1993         fi
1994
1995         umount_client $MOUNT || error "Unable to unmount client"
1996         stop_ost || error "Unable to stop OST1"
1997         stop_mds || error "Unable to stop MDS"
1998 }
1999 run_test 50e "normal statfs all servers down =========================="
2000
2001 test_50f() {
2002         local RC1
2003         local pid
2004         CONN_PROC="osc.$FSNAME-OST0001-osc-[M]*.ost_server_uuid"
2005
2006         start_mds || error "Unable to start mds"
2007         #first client should see only one ost
2008         start_ost || error "Unable to start OST1"
2009         wait_osc_import_state mds ost FULL
2010
2011         start_ost2 || error "Unable to start OST2"
2012         wait_osc_import_state mds ost2 FULL
2013
2014         # Wait for client to detect down OST
2015         stop_ost2 || error "Unable to stop OST2"
2016
2017         wait_osc_import_state mds ost2 DISCONN
2018         mount_client $MOUNT || error "Unable to mount client"
2019         lctl set_param llite.$FSNAME-*.lazystatfs=0
2020
2021         multiop_bg_pause $MOUNT _f
2022         RC1=$?
2023         pid=$!
2024
2025         if [ $RC1 -ne 0 ]; then
2026                 log "lazystatfs multiop failed $RC1"
2027         else
2028             kill -USR1 $pid
2029             sleep $(( $TIMEOUT+1 ))
2030             kill -0 $pid
2031             [ $? -ne 0 ] && error "process isn't sleep"
2032             start_ost2 || error "Unable to start OST2"
2033             wait $pid || error "statfs failed"
2034             stop_ost2 || error "Unable to stop OST2"
2035         fi
2036
2037         umount_client $MOUNT || error "Unable to unmount client"
2038         stop_ost || error "Unable to stop OST1"
2039         stop_mds || error "Unable to stop MDS"
2040         writeconf
2041 }
2042 run_test 50f "normal statfs one server in down =========================="
2043
2044 test_50g() {
2045         [ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2, skipping" && return
2046         setup
2047         start_ost2 || error "Unable to start OST2"
2048
2049         local PARAM="${FSNAME}-OST0001.osc.active"
2050
2051         $LFS setstripe -c -1 $DIR/$tfile || error "Unable to lfs setstripe"
2052         do_facet mgs $LCTL conf_param $PARAM=0 || error "Unable to deactivate OST"
2053
2054         umount_client $MOUNT || error "Unable to unmount client"
2055         mount_client $MOUNT || error "Unable to mount client"
2056         # This df should not cause a panic
2057         df -k $MOUNT
2058
2059         do_facet mgs $LCTL conf_param $PARAM=1 || error "Unable to activate OST"
2060         rm -f $DIR/$tfile
2061         umount_client $MOUNT || error "Unable to unmount client"
2062         stop_ost2 || error "Unable to stop OST2"
2063         stop_ost || error "Unable to stop OST1"
2064         stop_mds || error "Unable to stop MDS"
2065         writeconf
2066 }
2067 run_test 50g "deactivated OST should not cause panic====================="
2068
2069 test_51() {
2070         local LOCAL_TIMEOUT=20
2071
2072         reformat
2073         setup_noconfig
2074         check_mount || return 1
2075
2076         mkdir $MOUNT/d1
2077         $LFS setstripe -c -1 $MOUNT/d1
2078         #define OBD_FAIL_MDS_REINT_DELAY         0x142
2079         do_facet $SINGLEMDS "lctl set_param fail_loc=0x142"
2080         touch $MOUNT/d1/f1 &
2081         local pid=$!
2082         sleep 2
2083         start_ost2 || return 2
2084         wait $pid
2085         stop_ost2 || return 3
2086         cleanup
2087 }
2088 run_test 51 "Verify that mdt_reint handles RMF_MDT_MD correctly when an OST is added"
2089
2090 copy_files_xattrs()
2091 {
2092         local node=$1
2093         local dest=$2
2094         local xattrs=$3
2095         shift 3
2096
2097         do_node $node mkdir -p $dest
2098         [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
2099
2100         do_node $node  'tar cf - '$@' | tar xf - -C '$dest';
2101                         [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
2102         [ $? -eq 0 ] || { error "Unable to tar files"; return 2; }
2103
2104         do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs
2105         [ $? -eq 0 ] || { error "Unable to read xattrs"; return 3; }
2106 }
2107
2108 diff_files_xattrs()
2109 {
2110         local node=$1
2111         local backup=$2
2112         local xattrs=$3
2113         shift 3
2114
2115         local backup2=${TMP}/backup2
2116
2117         do_node $node mkdir -p $backup2
2118         [ $? -eq 0 ] || { error "Unable to create directory"; return 1; }
2119
2120         do_node $node  'tar cf - '$@' | tar xf - -C '$backup2';
2121                         [ \"\${PIPESTATUS[*]}\" = \"0 0\" ] || exit 1'
2122         [ $? -eq 0 ] || { error "Unable to tar files to diff"; return 2; }
2123
2124         do_node $node "diff -rq $backup $backup2"
2125         [ $? -eq 0 ] || { error "contents differ"; return 3; }
2126
2127         local xattrs2=${TMP}/xattrs2
2128         do_node $node 'getfattr -d -m "[a-z]*\\." '$@' > '$xattrs2
2129         [ $? -eq 0 ] || { error "Unable to read xattrs to diff"; return 4; }
2130
2131         do_node $node "diff $xattrs $xattrs2"
2132         [ $? -eq 0 ] || { error "xattrs differ"; return 5; }
2133
2134         do_node $node "rm -rf $backup2 $xattrs2"
2135         [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 6; }
2136 }
2137
2138 test_52() {
2139         start_mds
2140         [ $? -eq 0 ] || { error "Unable to start MDS"; return 1; }
2141         start_ost
2142         [ $? -eq 0 ] || { error "Unable to start OST1"; return 2; }
2143         mount_client $MOUNT
2144         [ $? -eq 0 ] || { error "Unable to mount client"; return 3; }
2145
2146         local nrfiles=8
2147         local ost1mnt=${MOUNT%/*}/ost1
2148         local ost1node=$(facet_active_host ost1)
2149         local ost1tmp=$TMP/conf52
2150
2151         mkdir -p $DIR/$tdir
2152         [ $? -eq 0 ] || { error "Unable to create tdir"; return 4; }
2153         touch $TMP/modified_first
2154         [ $? -eq 0 ] || { error "Unable to create temporary file"; return 5; }
2155         do_node $ost1node "mkdir -p $ost1tmp && touch $ost1tmp/modified_first"
2156         [ $? -eq 0 ] || { error "Unable to create temporary file"; return 6; }
2157         sleep 1
2158
2159         $LFS setstripe $DIR/$tdir -c -1 -s 1M
2160         [ $? -eq 0 ] || { error "lfs setstripe failed"; return 7; }
2161
2162         for (( i=0; i < nrfiles; i++ )); do
2163                 multiop $DIR/$tdir/$tfile-$i Ow1048576w1048576w524288c
2164                 [ $? -eq 0 ] || { error "multiop failed"; return 8; }
2165                 echo -n .
2166         done
2167         echo
2168
2169         # backup files
2170         echo backup files to $TMP/files
2171         local files=$(find $DIR/$tdir -type f -newer $TMP/modified_first)
2172         copy_files_xattrs `hostname` $TMP/files $TMP/file_xattrs $files
2173         [ $? -eq 0 ] || { error "Unable to copy files"; return 9; }
2174
2175         umount_client $MOUNT
2176         [ $? -eq 0 ] || { error "Unable to umount client"; return 10; }
2177         stop_ost
2178         [ $? -eq 0 ] || { error "Unable to stop ost1"; return 11; }
2179
2180         echo mount ost1 as ldiskfs
2181         do_node $ost1node mount -t $FSTYPE $ost1_dev $ost1mnt $OST_MOUNT_OPTS
2182         [ $? -eq 0 ] || { error "Unable to mount ost1 as ldiskfs"; return 12; }
2183
2184         # backup objects
2185         echo backup objects to $ost1tmp/objects
2186         local objects=$(do_node $ost1node 'find '$ost1mnt'/O/0 -type f -size +0'\
2187                         '-newer '$ost1tmp'/modified_first -regex ".*\/[0-9]+"')
2188         copy_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs $objects
2189         [ $? -eq 0 ] || { error "Unable to copy objects"; return 13; }
2190
2191         # move objects to lost+found
2192         do_node $ost1node 'mv '$objects' '${ost1mnt}'/lost+found'
2193         [ $? -eq 0 ] || { error "Unable to move objects"; return 14; }
2194
2195         # recover objects
2196         do_node $ost1node "ll_recover_lost_found_objs -d $ost1mnt/lost+found"
2197         [ $? -eq 0 ] || { error "ll_recover_lost_found_objs failed"; return 15; }
2198
2199         # compare restored objects against saved ones
2200         diff_files_xattrs $ost1node $ost1tmp/objects $ost1tmp/object_xattrs $objects
2201         [ $? -eq 0 ] || { error "Unable to diff objects"; return 16; }
2202
2203         do_node $ost1node "umount $ost1_dev"
2204         [ $? -eq 0 ] || { error "Unable to umount ost1 as ldiskfs"; return 17; }
2205
2206         start_ost
2207         [ $? -eq 0 ] || { error "Unable to start ost1"; return 18; }
2208         mount_client $MOUNT
2209         [ $? -eq 0 ] || { error "Unable to mount client"; return 19; }
2210
2211         # compare files
2212         diff_files_xattrs `hostname` $TMP/files $TMP/file_xattrs $files
2213         [ $? -eq 0 ] || { error "Unable to diff files"; return 20; }
2214
2215         rm -rf $TMP/files $TMP/file_xattrs
2216         [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 21; }
2217         do_node $ost1node "rm -rf $ost1tmp"
2218         [ $? -eq 0 ] || { error "Unable to delete temporary files"; return 22; }
2219         cleanup
2220 }
2221 run_test 52 "check recovering objects from lost+found"
2222
2223 # Checks threads_min/max/started for some service
2224 #
2225 # Arguments: service name (OST or MDT), facet (e.g., ost1, $SINGLEMDS), and a
2226 # parameter pattern prefix like 'ost.*.ost'.
2227 thread_sanity() {
2228         local modname=$1
2229         local facet=$2
2230         local parampat=$3
2231         local opts=$4
2232         local tmin
2233         local tmin2
2234         local tmax
2235         local tmax2
2236         local tstarted
2237         local paramp
2238         local msg="Insane $modname thread counts"
2239         shift 4
2240
2241         setup
2242         check_mount || return 41
2243
2244         # We need to expand $parampat, but it may match multiple parameters, so
2245         # we'll pick the first one
2246         if ! paramp=$(do_facet $facet "lctl get_param -N ${parampat}.threads_min"|head -1); then
2247                 error "Couldn't expand ${parampat}.threads_min parameter name"
2248                 return 22
2249         fi
2250
2251         # Remove the .threads_min part
2252         paramp=${paramp%.threads_min}
2253
2254         # Check for sanity in defaults
2255         tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2256         tmax=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
2257         tstarted=$(do_facet $facet "lctl get_param -n ${paramp}.threads_started" || echo 0)
2258         lassert 23 "$msg (PDSH problems?)" '(($tstarted && $tmin && $tmax))' || return $?
2259         lassert 24 "$msg" '(($tstarted >= $tmin && $tstarted <= tmax ))' || return $?
2260
2261         # Check that we can lower min/max
2262         do_facet $facet "lctl set_param ${paramp}.threads_min=$((tmin - 1))"
2263         do_facet $facet "lctl set_param ${paramp}.threads_max=$((tmax - 10))"
2264         tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2265         tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
2266         lassert 25 "$msg" '(($tmin2 == ($tmin - 1) && $tmax2 == ($tmax -10)))' || return $?
2267
2268         # Check that we can set min/max to the same value
2269         do_facet $facet "lctl set_param ${paramp}.threads_min=$tmin"
2270         do_facet $facet "lctl set_param ${paramp}.threads_max=$tmin"
2271         tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2272         tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
2273         lassert 26 "$msg" '(($tmin2 == $tmin && $tmax2 == $tmin))' || return $?
2274
2275         # Check that we can't set max < min
2276         do_facet $facet "lctl set_param ${paramp}.threads_max=$((tmin - 1))"
2277         tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
2278         tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
2279         lassert 27 "$msg" '(($tmin <= $tmax2))' || return $?
2280
2281         # We need to ensure that we get the module options desired; to do this
2282         # we set LOAD_MODULES_REMOTE=true and we call setmodopts below.
2283         LOAD_MODULES_REMOTE=true
2284         cleanup
2285         local oldvalue
2286         setmodopts -a $modname "$opts" oldvalue
2287
2288         load_modules
2289         setup
2290         check_mount || return 41
2291
2292         # Restore previous setting of MODOPTS_*
2293         setmodopts $modname "$oldvalue"
2294
2295         # Check that $opts took
2296         tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min")
2297         tmax=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max")
2298         tstarted=$(do_facet $facet "lctl get_param -n ${paramp}.threads_started")
2299         lassert 28 "$msg" '(($tstarted == $tmin && $tstarted == $tmax ))' || return $?
2300         cleanup
2301
2302         # Workaround a YALA bug where YALA expects that modules will remain
2303         # loaded on the servers
2304         LOAD_MODULES_REMOTE=false
2305         setup
2306         cleanup
2307 }
2308
2309 test_53a() {
2310         thread_sanity OST ost1 'ost.*.ost' 'oss_num_threads=64'
2311 }
2312 run_test 53a "check OSS thread count params"
2313
2314 test_53b() {
2315         thread_sanity MDT $SINGLEMDS 'mdt.*.*.' 'mdt_num_threads=64'
2316 }
2317 run_test 53b "check MDT thread count params"
2318
2319 if ! combined_mgs_mds ; then
2320         stop mgs
2321 fi
2322
2323 run_llverfs()
2324 {
2325         local dir=$1
2326         local partial_arg=""
2327         local size=$(df -B G $dir | tail -1 | awk '{print $2}' | sed 's/G//') # Gb
2328
2329         # Run in partial (fast) mode if the size
2330         # of a partition > 10 GB
2331         [ $size -gt 10 ] && partial_arg="-p"
2332
2333         llverfs $partial_arg $dir
2334 }
2335
2336 test_54a() {
2337     do_rpc_nodes $(facet_host ost1) run_llverdev $(ostdevname 1)
2338     [ $? -eq 0 ] || error "llverdev failed!"
2339     reformat_and_config
2340 }
2341 run_test 54a "llverdev"
2342
2343 test_54b() {
2344     setup
2345     run_llverfs $MOUNT
2346     [ $? -eq 0 ] || error "llverfs failed!"
2347     cleanup
2348 }
2349 run_test 54b "llverfs"
2350
2351 cleanup_gss
2352 equals_msg `basename $0`: test complete
2353 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true