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