Whamcloud - gitweb
b=4834
[fs/lustre-release.git] / lustre / tests / conf-sanity.sh
1 #!/bin/bash
2 # requirement:
3 #       add uml1 uml2 uml3 in your /etc/hosts
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 SRCDIR=`dirname $0`
13 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
14
15 LUSTRE=${LUSTRE:-`dirname $0`/..}
16 RLUSTRE=${RLUSTRE:-$LUSTRE}
17 MOUNTLUSTRE=${MOUNTLUSTRE:-/sbin/mount.lustre}
18
19 . $LUSTRE/tests/test-framework.sh
20
21 init_test_env $@
22
23 . ${CONFIG:=$LUSTRE/tests/cfg/local.sh}
24
25 gen_config() {
26         rm -f $XMLCONFIG
27
28         add_mds mds --dev $MDSDEV --size $MDSSIZE
29         add_lov lov1 mds --stripe_sz $STRIPE_BYTES\
30             --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
31         add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE
32         add_client client mds --lov lov1 --path $MOUNT
33 }
34
35 gen_second_config() {
36         rm -f $XMLCONFIG
37
38         add_mds mds2 --dev $MDSDEV --size $MDSSIZE
39         add_lov lov2 mds2 --stripe_sz $STRIPE_BYTES\
40             --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
41         add_ost ost2 --lov lov2 --dev $OSTDEV --size $OSTSIZE
42         add_client client mds2 --lov lov2 --path $MOUNT2
43 }
44
45 start_mds() {
46         echo "start mds service on `facet_active_host mds`"
47         start mds --reformat $MDSLCONFARGS  || return 94
48 }
49 stop_mds() {
50         echo "stop mds service on `facet_active_host mds`"
51         stop mds $@  || return 97
52 }
53
54 start_ost() {
55         echo "start ost service on `facet_active_host ost`"
56         start ost --reformat $OSTLCONFARGS  || return 95
57 }
58
59 stop_ost() {
60         echo "stop ost service on `facet_active_host ost`"
61         stop ost $@  || return 98
62 }
63
64 mount_client() {
65         local MOUNTPATH=$1
66         echo "mount lustre on ${MOUNTPATH}....."
67         zconf_mount `hostname`  $MOUNTPATH  || return 96
68 }
69
70 umount_client() {
71         local MOUNTPATH=$1
72         echo "umount lustre on ${MOUNTPATH}....."
73         zconf_umount `hostname`  $MOUNTPATH || return 97
74 }
75
76 manual_umount_client(){
77         echo "manual umount lustre on ${MOUNTPATH}...."
78         do_facet  client "umount $MOUNT"
79 }
80
81 setup() {
82         start_ost
83         start_mds
84         mount_client $MOUNT
85 }
86
87 cleanup() {
88         umount_client $MOUNT || return 200
89         stop_mds  || return 201
90         stop_ost || return 202
91         # catch case where these return just fine, but modules are still not unloaded
92         /sbin/lsmod | grep -q portals
93         if [ 1 -ne $? ]; then
94                 echo "modules still loaded..."
95                 return 203
96         fi
97 }
98
99 check_mount() {
100         do_facet client "touch $DIR/a" || return 71     
101         do_facet client "rm $DIR/a" || return 72        
102         echo "setup single mount lustre success"
103 }
104
105 check_mount2() {
106         do_facet client "touch $DIR/a" || return 71     
107         do_facet client "rm $DIR/a" || return 72        
108         do_facet client "touch $DIR2/a" || return 73    
109         do_facet client "rm $DIR2/a" || return 74       
110         echo "setup double mount lustre success"
111 }
112
113 build_test_filter
114
115 if [ "$ONLY" == "cleanup" ]; then
116         cleanup
117         exit
118 fi
119
120 #create single point mountpoint
121
122 gen_config
123
124
125 test_0() {
126         start_ost
127         start_mds       
128         mount_client $MOUNT
129         check_mount || return 41
130         cleanup || return $?
131 }
132 run_test 0 "single mount setup"
133
134 test_1() {
135         start_ost
136         echo "start ost second time..."
137         start ost --reformat $OSTLCONFARGS
138         start_mds       
139         mount_client $MOUNT
140         check_mount || return 42
141         cleanup || return $?
142 }
143 run_test 1 "start up ost twice"
144
145 test_2() {
146         start_ost
147         start_mds       
148         echo "start mds second time.."
149         start mds --reformat $MDSLCONFARGS
150         
151         mount_client $MOUNT
152         check_mount || return 43
153         cleanup || return $?
154 }
155 run_test 2 "start up mds twice"
156
157 test_3() {
158         setup
159         mount_client $MOUNT
160
161         check_mount || return 44
162         
163         umount_client $MOUNT    
164         cleanup  || return $?
165 }
166 run_test 3 "mount client twice"
167
168 test_4() {
169         setup
170         touch $DIR/$tfile || return 85
171         stop_ost --force
172         cleanup
173         eno=$?
174         # ok for ost to fail shutdown
175         if [ 202 -ne $eno ]; then
176                 return $eno;
177         fi
178         return 0
179 }
180 run_test 4 "force cleanup ost, then cleanup"
181
182 test_5() {
183         setup
184         touch $DIR/$tfile || return 1
185         stop_mds --force || return 2
186
187         # cleanup may return an error from the failed
188         # disconnects; for now I'll consider this successful
189         # if all the modules have unloaded.
190         umount $MOUNT &
191         UMOUNT_PID=$!
192         sleep 2
193         echo "killing umount"
194         kill -TERM $UMOUNT_PID
195         echo "waiting for umount to finish"
196         wait $UMOUNT_PID
197
198         # cleanup client modules
199         $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null
200         
201         # stop_mds is a no-op here, and should not fail
202         stop_mds  || return 4
203         stop_ost || return 5
204
205         lsmod | grep -q portals && return 6
206         return 0
207 }
208 run_test 5 "force cleanup mds, then cleanup"
209
210 test_5b() {
211         start_ost
212         start_mds
213         stop_mds
214
215         [ -d $MOUNT ] || mkdir -p $MOUNT
216         $LCONF --nosetup --node client_facet $XMLCONFIG > /dev/null
217         llmount -o nettype=$NETTYPE $mds_HOST://mds_svc/client_facet $MOUNT  && exit 1
218
219         # cleanup client modules
220         $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null
221         
222         # stop_mds is a no-op here, and should not fail
223         stop_mds || return 2
224         stop_ost || return 3
225
226         lsmod | grep -q portals && return 4
227         return 0
228
229 }
230 run_test 5b "mds down, cleanup after failed mount (bug 2712)"
231
232 test_5c() {
233         start_ost
234         start_mds
235
236         [ -d $MOUNT ] || mkdir -p $MOUNT
237         $LCONF --nosetup --node client_facet $XMLCONFIG > /dev/null
238         llmount -o nettype=$NETTYPE $mds_HOST://wrong_mds_svc/client_facet $MOUNT  && return 1
239
240         # cleanup client modules
241         $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null
242         
243         stop_mds || return 2
244         stop_ost || return 3
245
246         lsmod | grep -q portals && return 4
247         return 0
248
249 }
250 run_test 5c "cleanup after failed mount (bug 2712)"
251
252 test_5d() {
253         start_ost
254         start_mds
255         stop_ost --force
256
257         [ -d $MOUNT ] || mkdir -p $MOUNT
258         $LCONF --nosetup --node client_facet $XMLCONFIG > /dev/null
259         llmount -o nettype=$NETTYPE $mds_HOST://mds_svc/client_facet $MOUNT  || return 1 
260
261         umount $MOUNT || return 2
262         # cleanup client modules
263         $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null
264         
265         stop_mds || return 3
266
267         lsmod | grep -q portals && return 4
268         return 0
269
270 }
271 run_test 5d "ost down, don't crash during mount attempt"
272
273 test_6() {
274         setup
275         manual_umount_client
276         mount_client ${MOUNT} || return 87
277         touch $DIR/a || return 86
278         cleanup  || return $?
279 }
280 run_test 6 "manual umount, then mount again"
281
282 test_7() {
283         setup
284         manual_umount_client
285         cleanup || return $?
286 }
287 run_test 7 "manual umount, then cleanup"
288
289 test_8() {
290         start_ost
291         start_mds
292
293         mount_client $MOUNT
294         mount_client $MOUNT2
295
296         check_mount2 || return 45
297         umount $MOUNT
298         umount_client $MOUNT2
299         
300         stop_mds
301         stop_ost
302 }
303 run_test 8 "double mount setup"
304
305 test_9() {
306         # backup the old values of PTLDEBUG and SUBSYSTEM
307         OLDPTLDEBUG=$PTLDEBUG
308         OLDSUBSYSTEM=$SUBSYSTEM
309
310         # generate new configuration file with lmc --ptldebug and --subsystem
311         PTLDEBUG="trace"
312         SUBSYSTEM="mdc"
313         gen_config
314
315         # check the result of lmc --ptldebug/subsystem
316         start_ost
317         start_mds
318         mount_client $MOUNT
319         CHECK_PTLDEBUG="`cat /proc/sys/portals/debug`"
320         if [ $CHECK_PTLDEBUG = "1" ]; then
321            echo "lmc --debug success"
322         else
323            echo "lmc --debug: want 1, have $CHECK_PTLDEBUG"
324            return 1
325         fi
326         CHECK_SUBSYSTEM="`cat /proc/sys/portals/subsystem_debug`"
327         if [ $CHECK_SUBSYSTEM = "2" ]; then
328            echo "lmc --subsystem success"
329         else
330            echo "lmc --subsystem: want 2, have $CHECK_SUBSYSTEM"
331            return 1
332         fi
333         check_mount || return 41
334         cleanup || return $?
335
336         # the new PTLDEBUG/SUBSYSTEM used for lconf --ptldebug/subsystem
337         PTLDEBUG="inode+trace"
338         SUBSYSTEM="mds+ost"
339
340         # check lconf --ptldebug/subsystem overriding lmc --ptldebug/subsystem
341         start_ost
342         start_mds
343         CHECK_PTLDEBUG="`do_facet mds cat /proc/sys/portals/debug`"
344         if [ $CHECK_PTLDEBUG = "3" ]; then
345            echo "lconf --debug success"
346         else
347            echo "lconf --debug: want 3, have $CHECK_PTLDEBUG"
348            return 1
349         fi
350         CHECK_SUBSYSTEM="`do_facet mds cat /proc/sys/portals/subsystem_debug`"
351         if [ $CHECK_SUBSYSTEM = "20" ]; then
352            echo "lconf --subsystem success"
353         else
354            echo "lconf --subsystem: want 20, have $CHECK_SUBSYSTEM"
355            return 1
356         fi
357         mount_client $MOUNT
358         check_mount || return 41
359         cleanup || return $?
360
361         # resume the old configuration
362         PTLDEBUG=$OLDPTLDEBUG
363         SUBSYSTEM=$OLDSUBSYSTEM
364         gen_config
365 }
366
367 run_test 9 "test --ptldebug and --subsystem for lmc and lconf"
368
369 test_10() {
370         echo "generate configuration with the same name for node and mds"
371         OLDXMLCONFIG=$XMLCONFIG
372         XMLCONFIG="broken.xml"
373         [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
374         facet="mds"
375         rm -f ${facet}active
376         add_facet $facet
377         echo "the name for node and mds is the same"
378         do_lmc --add mds --node ${facet}_facet --mds ${facet}_facet \
379             --dev $MDSDEV --size $MDSSIZE || return $?
380         do_lmc --add lov --mds ${facet}_facet --lov lov1 --stripe_sz \
381             $STRIPE_BYTES --stripe_cnt $STRIPES_PER_OBJ \
382             --stripe_pattern 0 || return $?
383         add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE
384         facet="client"
385         add_facet $facet --lustre_upcall $UPCALL
386         do_lmc --add mtpt --node ${facet}_facet --mds mds_facet \
387             --lov lov1 --path $MOUNT
388
389         echo "mount lustre"
390         start_ost
391         start_mds
392         mount_client $MOUNT
393         check_mount || return 41
394         cleanup || return $?
395
396         echo "Success!"
397         XMLCONFIG=$OLDXMLCONFIG
398 }
399 run_test 10 "mount lustre with the same name for node and mds"
400
401 test_11() {
402         OLDXMLCONFIG=$XMLCONFIG
403         XMLCONFIG="conf11.xml"
404
405         [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
406         add_mds mds --dev $MDSDEV --size $MDSSIZE
407         add_ost ost --dev $OSTDEV --size $OSTSIZE
408         add_client client mds --path $MOUNT --ost ost_svc || return $?
409         echo "Default lov config success!"
410
411         [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
412         add_mds mds --dev $MDSDEV --size $MDSSIZE
413         add_ost ost --dev $OSTDEV --size $OSTSIZE
414         add_client client mds --path $MOUNT && return $?
415         echo "--add mtpt with neither --lov nor --ost will return error"
416
417         echo ""
418         echo "Success!"
419         XMLCONFIG=$OLDXMLCONFIG
420 }
421 run_test 11 "use default lov configuration (should return error)"
422
423 test_12() {
424         OLDXMLCONFIG=$XMLCONFIG
425         XMLCONFIG="batch.xml"
426         BATCHFILE="batchfile"
427
428         # test double quote
429         [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
430         [ -f "$BATCHFILE" ] && rm -f $BATCHFILE
431         echo "--add net --node  localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
432         echo "--add mds --node localhost --mds mds1 --mkfsoptions \"-I 128\"" >> $BATCHFILE
433         # --mkfsoptions "-I 128"
434         do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
435         if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
436                 echo "matched double quote success"
437         else
438                 echo "matched double quote fail"
439                 return 1
440         fi
441         rm -f $XMLCONFIG
442         rm -f $BATCHFILE
443         echo "--add net --node  localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
444         echo "--add mds --node localhost --mds mds1 --mkfsoptions \"-I 128" >> $BATCHFILE
445         # --mkfsoptions "-I 128
446         do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
447         echo "unmatched double quote should return error"
448
449         # test single quote
450         rm -f $BATCHFILE
451         echo "--add net --node  localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
452         echo "--add mds --node localhost --mds mds1 --mkfsoptions '-I 128'" >> $BATCHFILE
453         # --mkfsoptions '-I 128'
454         do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
455         if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
456                 echo "matched single quote success"
457         else
458                 echo "matched single quote fail"
459                 return 1
460         fi
461         rm -f $XMLCONFIG
462         rm -f $BATCHFILE
463         echo "--add net --node  localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
464         echo "--add mds --node localhost --mds mds1 --mkfsoptions '-I 128" >> $BATCHFILE
465         # --mkfsoptions '-I 128
466         do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
467         echo "unmatched single quote should return error"
468
469         # test backslash
470         rm -f $BATCHFILE
471         echo "--add net --node  localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
472         echo "--add mds --node localhost --mds mds1 --mkfsoptions \-\I\ \128" >> $BATCHFILE
473         # --mkfsoptions \-\I\ \128
474         do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
475         if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
476                 echo "backslash followed by a whitespace/letter success"
477         else
478                 echo "backslash followed by a whitespace/letter fail"
479                 return 1
480         fi
481         rm -f $XMLCONFIG
482         rm -f $BATCHFILE
483         echo "--add net --node  localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
484         echo "--add mds --node localhost --mds mds1 --mkfsoptions -I\ 128\\" >> $BATCHFILE
485         # --mkfsoptions -I\ 128\
486         do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
487         echo "backslash followed by nothing should return error"
488
489         rm -f $BATCHFILE
490         XMLCONFIG=$OLDXMLCONFIG
491 }
492 run_test 12 "lmc --batch, with single/double quote, backslash in batchfile"
493
494 test_13() {
495         OLDXMLCONFIG=$XMLCONFIG
496         XMLCONFIG="conf13-1.xml"
497         SECONDXMLCONFIG="conf13-2.xml"
498
499         # check long uuid will be truncated properly and uniquely
500         echo "To generate XML configuration file(with long ost name): $XMLCONFIG"
501         [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
502         do_lmc --add net --node localhost --nid localhost.localdomain --nettype tcp
503         do_lmc --add mds --node localhost --mds mds1_name_longer_than_31characters
504         do_lmc --add mds --node localhost --mds mds2_name_longer_than_31characters
505         if [ ! -f "$XMLCONFIG" ]; then
506                 echo "Error:no file $XMLCONFIG created!"
507                 return 1
508         fi
509         EXPECTEDMDS1UUID="e_longer_than_31characters_UUID"
510         EXPECTEDMDS2UUID="longer_than_31characters_UUID_2"
511         FOUNDMDS1UUID=`awk -F"'" '/<mds .*uuid=/' $XMLCONFIG | sed -n '1p' \
512                        | sed "s/ /\n\r/g" | awk -F"'" '/uuid=/{print $2}'`
513         FOUNDMDS2UUID=`awk -F"'" '/<mds .*uuid=/' $XMLCONFIG | sed -n '2p' \
514                        | sed "s/ /\n\r/g" | awk -F"'" '/uuid=/{print $2}'`
515         if ([ $EXPECTEDMDS1UUID = $FOUNDMDS1UUID ] && [ $EXPECTEDMDS2UUID = $FOUNDMDS2UUID ]) || \
516            ([ $EXPECTEDMDS1UUID = $FOUNDMDS2UUID ] && [ $EXPECTEDMDS2UUID = $FOUNDMDS1UUID ]); then
517                 echo "Success:long uuid truncated successfully and being unique."
518         else
519                 echo "Error:expected uuid for mds1 and mds2: $EXPECTEDMDS1UUID; $EXPECTEDMDS2UUID"
520                 echo "but:     found uuid for mds1 and mds2: $FOUNDMDS1UUID; $FOUNDMDS2UUID"
521                 return 1
522         fi
523
524         # check multiple invocations for lmc generate same XML configuration file
525         rm -f $XMLCONFIG
526         echo "Generate the first XML configuration file"
527         gen_config
528         echo "mv $XMLCONFIG to $SECONDXMLCONFIG"
529         mv $XMLCONFIG $SECONDXMLCONFIG || return $?
530         echo "Generate the second XML configuration file"
531         gen_config
532         if [ `diff $XMLCONFIG $SECONDXMLCONFIG | wc -l` -eq 0 ]; then
533                 echo "Success:multiple invocations for lmc generate same XML file"
534         else
535                 echo "Error: multiple invocations for lmc generate different XML file"
536                 return 1
537         fi
538
539         rm -f $XMLCONFIG
540         rm -f $SECONDXMLCONFIG
541         XMLCONFIG=$OLDXMLCONFIG
542 }
543 run_test 13 "check new_uuid of lmc operating correctly"
544
545 test_14() {
546         rm -f $XMLCONFIG
547
548         # create xml file with --mkfsoptions for ost
549         echo "create xml file with --mkfsoptions for ost"
550         add_mds mds --dev $MDSDEV --size $MDSSIZE
551         add_lov lov1 mds --stripe_sz $STRIPE_BYTES\
552             --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
553         add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE \
554             --mkfsoptions "-Llabel_conf_14"
555         add_client client mds --lov lov1 --path $MOUNT
556
557         FOUNDSTRING=`awk -F"<" '/<mkfsoptions>/{print $2}' $XMLCONFIG`
558         EXPECTEDSTRING="mkfsoptions>-Llabel_conf_14"
559         if [ $EXPECTEDSTRING != $FOUNDSTRING ]; then
560                 echo "Error: expected: $EXPECTEDSTRING; found: $FOUNDSTRING"
561                 return 1
562         fi
563         echo "Success:mkfsoptions for ost written to xml file correctly."
564
565         # mount lustre to test lconf mkfsoptions-parsing
566         echo "mount lustre"
567         start_ost
568         start_mds
569         mount_client $MOUNT || return $?
570         if [ -z "`dumpe2fs -h $OSTDEV | grep label_conf_14`" ]; then
571                 echo "Error: the mkoptions not applied to mke2fs of ost."
572                 return 1
573         fi
574         cleanup
575         echo "lconf mkfsoptions for ost success"
576
577         gen_config
578 }
579 run_test 14 "test mkfsoptions of ost for lmc and lconf"
580
581 cleanup_15() {
582         trap 0
583         [ -f $MOUNTLUSTRE ] && echo "remove $MOUNTLUSTRE" && rm -f $MOUNTLUSTRE
584         if [ -f $MOUNTLUSTRE.sav ]; then
585                 echo "return original $MOUNTLUSTRE.sav to $MOUNTLUSTRE"
586                 mv $MOUNTLUSTRE.sav $MOUNTLUSTRE
587         fi
588 }
589
590 test_15() {
591         start_ost
592         start_mds
593         echo "mount lustre on ${MOUNT} with $MOUNTLUSTRE....."
594         if [ -f "$MOUNTLUSTRE" ]; then
595                 echo "save $MOUNTLUSTRE to $MOUNTLUSTRE.sav"
596                 mv $MOUNTLUSTRE $MOUNTLUSTRE.sav
597         fi
598         [ -f "$MOUNTLUSTRE" ] && echo "can't move $MOUNTLUSTRE" && return 40
599         trap cleanup_15 EXIT INT
600         [ ! `cp $(which llmount) $MOUNTLUSTRE` ] || return $?
601         do_node `hostname` mkdir -p $MOUNT 2> /dev/null
602         # load llite module on the client if it isn't in /lib/modules
603         do_node `hostname` lconf --nosetup --node client_facet $XMLCONFIG
604         do_node `hostname` mount -t lustre -o nettype=$NETTYPE \
605                 `facet_active_host mds`:/mds_svc/client_facet $MOUNT ||return $?
606         echo "mount lustre on $MOUNT with $MOUNTLUSTRE: success"
607         [ -d /r ] && $LCTL modules > /r/tmp/ogdb-`hostname`
608         check_mount || return 41
609         do_node `hostname` umount $MOUNT
610
611         [ -f "$MOUNTLUSTRE" ] && rm -f $MOUNTLUSTRE
612         echo "mount lustre on ${MOUNT} without $MOUNTLUSTRE....."
613         do_node `hostname` mount -t lustre -o nettype=$NETTYPE \
614                 `facet_active_host mds`:/mds_svc/client_facet $MOUNT &&return $?
615         echo "mount lustre on $MOUNT without $MOUNTLUSTRE failed as expected"
616         cleanup || return $?
617         cleanup_15
618 }
619 run_test 15 "zconf-mount without /sbin/mount.lustre (should return error)"
620
621 test_16() {
622         TMPMTPT="/mnt/conf16"
623                                                                                                                              
624         if [ ! -f "$MDSDEV" ]; then
625             echo "no $MDSDEV existing, so mount Lustre to create one"
626             start_ost
627             start_mds
628             mount_client $MOUNT
629             check_mount || return 41
630             cleanup || return $?
631         fi
632                                                                                                                              
633         echo "change the mode of $MDSDEV/OBJECTS,LOGS,PENDING to 555"
634         [ -d $TMPMTPT ] || mkdir -p $TMPMTPT
635         mount -o loop -t ext3 $MDSDEV $TMPMTPT || return $?
636         chmod 555 $TMPMTPT/OBJECTS || return $?
637         chmod 555 $TMPMTPT/LOGS || return $?
638         chmod 555 $TMPMTPT/PENDING || return $?
639         umount $TMPMTPT || return $?
640                                                                                                                              
641         echo "mount Lustre to change the mode of OBJECTS/LOGS/PENDING, then umount Lustre"
642         start_ost
643         start_mds
644         mount_client $MOUNT
645         check_mount || return 41
646         cleanup || return $?
647                                                                                                                              
648         echo "read the mode of OBJECTS/LOGS/PENDING and check if they has been changed properly"
649         EXPECTEDOBJECTSMODE=`debugfs -R "stat OBJECTS" $MDSDEV 2> /dev/null | awk '/Mode: /{print $6}'`
650         EXPECTEDLOGSMODE=`debugfs -R "stat LOGS" $MDSDEV 2> /dev/null | awk '/Mode: /{print $6}'`
651         EXPECTEDPENDINGMODE=`debugfs -R "stat PENDING" $MDSDEV 2> /dev/null | awk '/Mode: /{print $6}'`
652
653         if [ "$EXPECTEDOBJECTSMODE" = "0777" ]; then
654                 echo "Success:Lustre change the mode of OBJECTS correctly"
655         else
656                 echo "Error: Lustre does not change the mode of OBJECTS properly"
657                 return 1
658         fi
659                                                                                                                              
660         if [ "$EXPECTEDLOGSMODE" = "0777" ]; then
661                 echo "Success:Lustre change the mode of LOGS correctly"
662         else
663                 echo "Error: Lustre does not change the mode of LOGS properly"
664                 return 1
665         fi
666                                                                                                                              
667         if [ "$EXPECTEDPENDINGMODE" = "0777" ]; then
668                 echo "Success:Lustre change the mode of PENDING correctly"
669         else
670                 echo "Error: Lustre does not change the mode of PENDING properly"
671                 return 1
672         fi
673 }
674 run_test 16 "verify that lustre will correct the mode of OBJECTS/LOGS/PENDING"
675
676 test_17() {
677         TMPMTPT="/mnt/conf17"
678
679         if [ ! -f "$MDSDEV" ]; then
680             echo "no $MDSDEV existing, so mount Lustre to create one"
681             start_ost
682             start_mds
683             mount_client $MOUNT
684             check_mount || return 41
685             cleanup || return $?
686         fi
687
688         echo "Remove mds config log"
689         [ -d $TMPMTPT ] || mkdir -p $TMPMTPT
690         mount -o loop -t ext3 $MDSDEV $TMPMTPT || return $?
691         rm -f $TMPMTPT/LOGS/mds_svc || return $?
692         umount $TMPMTPT || return $?
693
694         start_ost
695         start mds $MDSLCONFARGS && return 42
696         cleanup || return $?
697 }
698 run_test 17 "Verify failed mds_postsetup won't fail assertion (2936)"
699
700 test_18() {
701         [ -f $MDSDEV ] && echo "remove $MDSDEV" && rm -f $MDSDEV
702         echo "mount mds with large journal..."
703         OLDMDSSIZE=$MDSSIZE
704         MDSSIZE=2000000
705         gen_config
706                                                                                                                              
707         echo "mount lustre system..."
708         start_ost
709         start_mds
710         mount_client $MOUNT
711         check_mount || return 41
712                                                                                                                              
713         echo "check journal size..."
714         FOUNDJOURNALSIZE=`debugfs -R "stat <8>" $MDSDEV | awk '/Size: / { print $6; exit;}'`
715         if [ "$FOUNDJOURNALSIZE" = "79691776" ]; then
716                 echo "Success:lconf creates large journals"
717         else
718                 echo "Error:lconf not create large journals correctly"
719                 echo "expected journal size: 79691776(76M), found journal size: $FOUNDJOURNALSIZE"
720                 return 1
721         fi
722                                                                                                                              
723         cleanup || return $?
724                                                                                                                              
725         MDSSIZE=$OLDMDSSIZE
726         gen_config
727 }
728 run_test 18 "check lconf creates large journals"
729
730 equals_msg "Done"