Whamcloud - gitweb
- fixes in insanity.sh
[fs/lustre-release.git] / lustre / tests / sanityN.sh
1 #!/bin/bash
2
3 set -e
4
5 ONLY=${ONLY:-"$*"}
6 # bug number for skipped test:  3192 4035
7 ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"14b  14c"}
8 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
9
10 # Tests that fail on uml
11 [ "$UML" = "true" ] && EXCEPT="$EXCEPT 7"
12
13 SRCDIR=`dirname $0`
14 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
15
16 SIZE=${SIZE:-40960}
17 CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
18 CREATETEST=${CREATETEST:-createtest}
19 GETSTRIPE=${GETSTRIPE:-lfs getstripe}
20 SETSTRIPE=${SETSTRIPE:-lstripe}
21 LCTL=${LCTL:-lctl}
22 MCREATE=${MCREATE:-mcreate}
23 OPENFILE=${OPENFILE:-openfile}
24 OPENUNLINK=${OPENUNLINK:-openunlink}
25 TOEXCL=${TOEXCL:-toexcl}
26 TRUNCATE=${TRUNCATE:-truncate}
27 export TMP=${TMP:-/tmp}
28
29 if [ $UID -ne 0 ]; then
30         RUNAS_ID="$UID"
31         RUNAS=""
32 else
33         RUNAS_ID=${RUNAS_ID:-500}
34         RUNAS=${RUNAS:-"runas -u $RUNAS_ID"}
35 fi
36
37 SAVE_PWD=$PWD
38
39 LUSTRE=${LUSTRE:-`dirname $0`/..}
40 . $LUSTRE/tests/test-framework.sh
41 init_test_env $@
42 . ${CONFIG:=$LUSTRE/tests/cfg/local.sh}
43
44 if [ ! -z "$USING_KRB5" ]; then
45     $RUNAS krb5_login.sh || exit 1
46 fi
47
48 cleanup() {
49         echo -n "cln.."
50         grep " $MOUNT2 " /proc/mounts && zconf_umount `hostname` $MOUNT2 ${FORCE}
51         cleanupall ${FORCE} > /dev/null || { echo "FAILed to clean up"; exit 20; }
52 }
53 CLEANUP=${CLEANUP:-:}
54
55 setup() {
56         echo -n "mnt.."
57         setupall || exit 10
58         echo "done"
59 }
60 SETUP=${SETUP:-:}
61
62 log() {
63         echo "$*"
64         lctl mark "$*" 2> /dev/null || true
65 }
66
67 trace() {
68         log "STARTING: $*"
69         strace -o $TMP/$1.strace -ttt $*
70         RC=$?
71         log "FINISHED: $*: rc $RC"
72         return 1
73 }
74 TRACE=${TRACE:-""}
75
76 LPROC=/proc/fs/lustre
77
78 run_one() {
79         if ! grep -q $DIR /proc/mounts; then
80                 $SETUP
81         fi
82         testnum=$1
83         message=$2
84         BEFORE=`date +%s`
85         log "== test $testnum: $message= `date +%H:%M:%S` ($BEFORE)"
86         export TESTNAME=test_$testnum
87         export tfile=f${testnum}
88         export tdir=d${base}
89         test_$1 || error "exit with rc=$?"
90         unset TESTNAME
91         pass "($((`date +%s` - $BEFORE))s)"
92         cd $SAVE_PWD
93         $CLEANUP
94 }
95
96 build_test_filter() {
97         [ "$ALWAYS_EXCEPT$EXCEPT$SANITYN_EXCEPT" ] && \
98             echo "Skipping tests: `echo $ALWAYS_EXCEPT $EXCEPT $SANITYN_EXCEPT`"
99
100         for O in $ONLY; do
101             eval ONLY_${O}=true
102         done
103         for E in $EXCEPT $ALWAYS_EXCEPT $SANITY_EXCEPT; do
104             eval EXCEPT_${E}=true
105         done
106 }
107
108 _basetest() {
109     echo $*
110 }
111
112 basetest() {
113     IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
114 }
115
116 build_test_filter() {
117         [ "$ALWAYS_EXCEPT$EXCEPT$SANITYN_EXCEPT" ] && \
118             echo "Skipping tests: `echo $ALWAYS_EXCEPT $EXCEPT $SANITYN_EXCEPT`"
119
120         for O in $ONLY; do
121             eval ONLY_${O}=true
122         done
123         for E in $EXCEPT $ALWAYS_EXCEPT $SANITYN_EXCEPT; do
124             eval EXCEPT_${E}=true
125         done
126 }
127
128 _basetest() {
129     echo $*
130 }
131
132 basetest() {
133     IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
134 }
135
136 run_test() {
137          export base=`basetest $1`
138          if [ "$ONLY" ]; then
139                  testname=ONLY_$1
140                  if [ ${!testname}x != x ]; then
141                         run_one $1 "$2"
142                         return $?
143                  fi
144                  testname=ONLY_$base
145                  if [ ${!testname}x != x ]; then
146                          run_one $1 "$2"
147                          return $?
148                  fi
149                  echo -n "."
150                  return 0
151         fi
152         testname=EXCEPT_$1
153         if [ ${!testname}x != x ]; then
154                  echo "skipping excluded test $1"
155                  return 0
156         fi
157         testname=EXCEPT_$base
158         if [ ${!testname}x != x ]; then
159                  echo "skipping excluded test $1 (base $base)"
160                  return 0
161         fi
162         run_one $1 "$2"
163         return $?
164 }
165
166 [ "$SANITYLOG" ] && rm -f $SANITYLOG || true
167
168 error () {
169         log "FAIL: $TESTNAME $@"
170         if [ "$SANITYLOG" ]; then
171                 echo "FAIL: $TESTNAME $@" >> $SANITYLOG
172         else
173                 exit 1
174         fi
175 }
176
177 pass() {
178         echo PASS $@
179 }
180
181 mounted_lustre_filesystems() {
182         awk '($3 ~ "lustre" && $1 ~ ":") { print $2 }' /proc/mounts
183 }
184 MOUNTED="`mounted_lustre_filesystems`"
185 if [ -z "$MOUNTED" ]; then
186     formatall
187     setupall
188     mount_client $MOUNT2
189     MOUNTED="`mounted_lustre_filesystems`"
190     [ -z "$MOUNTED" ] && error "NAME=$NAME not mounted"
191     I_MOUNTED=yes
192 fi
193 export MOUNT1=`mounted_lustre_filesystems | head -n 1`
194 [ -z "$MOUNT1" ] && error "NAME=$NAME not mounted once"
195 export MOUNT2=`mounted_lustre_filesystems | tail -n 1`
196 [ "$MOUNT1" = "$MOUNT2" ] && error "NAME=$NAME not mounted twice"
197 [ `mounted_lustre_filesystems | wc -l` -ne 2 ] && \
198         error "NAME=$NAME mounted more than twice"
199
200 export DIR1=${DIR1:-$MOUNT1}
201 export DIR2=${DIR2:-$MOUNT2}
202 [ -z "`echo $DIR1 | grep $MOUNT1`" ] && echo "$DIR1 not in $MOUNT1" && exit 96
203 [ -z "`echo $DIR2 | grep $MOUNT2`" ] && echo "$DIR2 not in $MOUNT2" && exit 95
204
205 rm -rf $DIR1/[df][0-9]* $DIR1/lnk
206
207 build_test_filter
208
209 test_1a() {
210         touch $DIR1/f1
211         [ -f $DIR2/f1 ] || error
212 }
213 run_test 1a "check create on 2 mtpt's =========================="
214
215 test_1b() {
216         chmod 777 $DIR2/f1
217         $CHECKSTAT -t file -p 0777 $DIR1/f1 || error
218         chmod a-x $DIR2/f1
219 }
220 run_test 1b "check attribute updates on 2 mtpt's ==============="
221
222 test_1c() {
223         $CHECKSTAT -t file -p 0666 $DIR1/f1 || error
224 }
225 run_test 1c "check after remount attribute updates on 2 mtpt's ="
226
227 test_1d() {
228         rm $DIR2/f1
229         $CHECKSTAT -a $DIR1/f1 || error
230 }
231 run_test 1d "unlink on one mountpoint removes file on other ===="
232
233 test_2a() {
234         touch $DIR1/f2a
235         ls -l $DIR2/f2a
236         chmod 777 $DIR2/f2a
237         $CHECKSTAT -t file -p 0777 $DIR1/f2a || error
238 }
239 run_test 2a "check cached attribute updates on 2 mtpt's ========"
240
241 test_2b() {
242         touch $DIR1/f2b
243         ls -l $DIR2/f2b
244         chmod 777 $DIR1/f2b
245         $CHECKSTAT -t file -p 0777 $DIR2/f2b || error
246 }
247 run_test 2b "check cached attribute updates on 2 mtpt's ========"
248
249 # NEED TO SAVE ROOT DIR MODE
250 test_2c() {
251         chmod 777 $DIR1
252         $CHECKSTAT -t dir -p 0777 $DIR2 || error
253 }
254 run_test 2c "check cached attribute updates on 2 mtpt's root ==="
255
256 test_2d() {
257         chmod 755 $DIR1
258         $CHECKSTAT -t dir -p 0755 $DIR2 || error
259 }
260 run_test 2d "check cached attribute updates on 2 mtpt's root ==="
261
262 test_3() {
263         ( cd $DIR1 ; ln -s this/is/good lnk )
264         [ "this/is/good" = "`perl -e 'print readlink("'$DIR2/lnk'");'`" ] || \
265                 error
266 }
267 run_test 3 "symlink on one mtpt, readlink on another ==========="
268
269 test_4() {
270         multifstat $DIR1/f4 $DIR2/f4
271 }
272 run_test 4 "fstat validation on multiple mount points =========="
273
274 test_5() {
275         mcreate $DIR1/f5
276         truncate $DIR2/f5 100
277         $CHECKSTAT -t file -s 100 $DIR1/f5 || error
278         rm $DIR1/f5
279 }
280 run_test 5 "create a file on one mount, truncate it on the other"
281
282 test_6() {
283         openunlink $DIR1/f6 $DIR2/f6 || error
284 }
285 run_test 6 "remove of open file on other node =================="
286
287 test_7() {
288         opendirunlink $DIR1/d7 $DIR2/d7 || error
289 }
290 run_test 7 "remove of open directory on other node ============="
291
292 test_8() {
293         opendevunlink $DIR1/dev8 $DIR2/dev8 || error
294 }
295 run_test 8 "remove of open special file on other node =========="
296
297 test_9() {
298         MTPT=1
299         > $DIR2/f9
300         for C in a b c d e f g h i j k l; do
301                 DIR=`eval echo \\$DIR$MTPT`
302                 echo -n $C >> $DIR/f9
303                 [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1
304         done
305         [ "`cat $DIR1/f9`" = "abcdefghijkl" ] || \
306                 error "`od -a $DIR1/f9` != abcdefghijkl"
307 }
308 run_test 9 "append of file with sub-page size on multiple mounts"
309
310 test_10a() {
311         MTPT=1
312         OFFSET=0
313         > $DIR2/f10
314         for C in a b c d e f g h i j k l; do
315                 DIR=`eval echo \\$DIR$MTPT`
316                 echo -n $C | dd of=$DIR/f10 bs=1 seek=$OFFSET count=1
317                 [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1
318                 OFFSET=`expr $OFFSET + 1`
319         done
320         [ "`cat $DIR1/f10`" = "abcdefghijkl" ] || \
321                 error "`od -a $DIR1/f10` != abcdefghijkl"
322 }
323 run_test 10a "write of file with sub-page size on multiple mounts "
324
325 test_10b() {
326         yes "R" | dd of=$DIR1/f10b bs=3k count=1 || error "dd $DIR1"
327
328         truncate $DIR1/f10b 4096 || error "truncate 4096"
329
330         dd if=$DIR2/f10b of=$TMP/f10b-lustre bs=4k count=1 || error "dd $DIR2"
331
332         # create a test file locally to compare
333         yes "R" | dd of=$TMP/f10b bs=3k count=1 || error "dd random"
334         truncate $TMP/f10b 4096 || error "truncate 4096"
335         cmp $TMP/f10b $TMP/f10b-lustre || error "file miscompare"
336         rm $TMP/f10b $TMP/f10b-lustre
337 }
338 run_test 10b "write of file with sub-page size on multiple mounts "
339
340 test_11() {
341         mkdir $DIR1/d11
342         multiop $DIR1/d11/f O_c &
343         MULTIPID=$!
344         usleep 200
345         cp -p /bin/ls $DIR1/d11/f
346         $DIR2/d11/f
347         RC=$?
348         kill -USR1 $MULTIPID
349         wait $MULTIPID || error
350         [ $RC -eq 0 ] && error || true
351 }
352 run_test 11 "execution of file opened for write should return error ===="
353
354 test_12() {
355        sh lockorder.sh
356 }
357 run_test 12 "test lock ordering (link, stat, unlink) ==========="
358
359 test_13() {     # bug 2451 - directory coherency
360        rm -rf $DIR1/d13
361        mkdir $DIR1/d13 || error
362        cd $DIR1/d13 || error
363        ls
364        ( touch $DIR1/d13/f13 ) # needs to be a separate shell
365        ls
366        rm -f $DIR2/d13/f13 || error
367        ls 2>&1 | grep f13 && error "f13 shouldn't return an error (1)" || true
368        # need to run it twice
369        ( touch $DIR1/d13/f13 ) # needs to be a separate shell
370        ls
371        rm -f $DIR2/d13/f13 || error
372        ls 2>&1 | grep f13 && error "f13 shouldn't return an error (2)" || true
373 }
374 run_test 13 "test directory page revocation ===================="
375
376 test_14() {
377         mkdir $DIR1/d14
378         cp -p /bin/ls $DIR1/d14/ls
379         exec 100>> $DIR1/d14/ls
380         $DIR2/d14/ls && error || true
381         exec 100<&-
382 }
383 run_test 14 "execution of file open for write returns -ETXTBSY ="
384
385 test_14a() {
386         mkdir -p $DIR1/d14
387         cp -p `which multiop` $DIR1/d14/multiop || error "cp failed"
388         $DIR1/d14/multiop $TMP/test14.junk O_c &
389         MULTIPID=$!
390         sleep 1
391         multiop $DIR2/d14/multiop Oc && error "expected error, got success"
392         kill -USR1 $MULTIPID || return 2
393         wait $MULTIPID || return 3
394         rm $TMP/test14.junk
395 }
396 run_test 14a "open(RDWR) of executing file returns -ETXTBSY ===="
397
398 test_14b() { # bug 3192
399         mkdir -p $DIR1/d14
400         cp -p `which multiop` $DIR1/d14/multiop || error "cp failed"
401         $DIR1/d14/multiop $TMP/test14.junk O_c &
402         MULTIPID=$!
403         sleep 1
404         truncate $DIR2/d14/multiop 0 && error "expected error, got success"
405         kill -USR1 $MULTIPID || return 2
406         wait $MULTIPID || return 3
407         rm $TMP/test14.junk
408 }
409 run_test 14b "truncate of executing file returns -ETXTBSY ======"
410
411 test_14c() { # bug 3430
412         mkdir -p $DIR1/d14
413         cp -p `which multiop` $DIR1/d14/multiop || error "cp failed"
414         $DIR1/d14/multiop $TMP/test14.junk O_c &
415         MULTIPID=$!
416         sleep 1
417         cp /etc/hosts $DIR2/d14/multiop && error "expected error, got success"
418         kill -USR1 $MULTIPID || return 2
419         wait $MULTIPID || return 3
420         #cmp `which multiop` $DIR1/d14/multiop || error "binary changed"
421         rm $TMP/test14.junk
422 }
423 run_test 14c "open(O_TRUNC) of executing file return -ETXTBSY =="
424
425 test_15() {     # bug 974 - ENOSPC
426         echo "PATH=$PATH"
427         sh oos2.sh $MOUNT1 $MOUNT2
428 }
429 run_test 15 "test out-of-space with multiple writers ==========="
430
431 test_16() {
432         fsx -c 50 -p 100 -N 2500 -S 0 $MOUNT1/fsxfile $MOUNT2/fsxfile
433 }
434 run_test 16 "2500 iterations of dual-mount fsx ================="
435
436 cancel_lru_locks() {
437         for d in /proc/fs/lustre/ldlm/namespaces/*-$1-*; do
438                 echo clear > $d/lru_size
439         done
440         grep "[0-9]" /proc/fs/lustre/ldlm/namespaces/*-$1-*/lock_unused_count /dev/null
441 }
442
443 test_17() { # bug 3513, 3667
444         [ ! -d /proc/fs/lustre/ost ] && echo "skipping OST-only test" && return
445
446         cp /etc/termcap $DIR1/f17
447         cancel_lru_locks osc > /dev/null
448         #define OBD_FAIL_ONCE|OBD_FAIL_LDLM_CREATE_RESOURCE    0x30a
449         echo 0x8000030a > /proc/sys/lustre/fail_loc
450         ls -ls $DIR1/f17 | awk '{ print $1,$6 }' > $DIR1/f17-1 & \
451         ls -ls $DIR2/f17 | awk '{ print $1,$6 }' > $DIR2/f17-2
452         wait
453         diff -u $DIR1/f17-1 $DIR2/f17-2 || error "files are different"
454 }
455 run_test 17 "resource creation/LVB creation race ==============="
456
457 test_18() {
458         ./mmap_sanity -d $MOUNT1 -m $MOUNT2
459         sync; sleep 1; sync
460 }
461 run_test 18 "mmap sanity check ================================="
462
463 test_19() { # bug3811
464         [ -d /proc/fs/lustre/obdfilter ] || return 0
465
466         MAX=`cat /proc/fs/lustre/obdfilter/*/readcache_max_filesize | head -n 1`
467         for O in /proc/fs/lustre/obdfilter/*OST*; do
468                 echo 4096 > $O/readcache_max_filesize
469         done
470         dd if=/dev/urandom of=$TMP/f19b bs=512k count=32
471         SUM=`cksum $TMP/f19b | cut -d" " -f 1,2`
472         cp $TMP/f19b $DIR1/f19b
473         for i in `seq 1 20`; do
474                 [ $((i % 5)) -eq 0 ] && log "test_18 loop $i"
475                 cancel_lru_locks osc > /dev/null
476                 cksum $DIR1/f19b | cut -d" " -f 1,2 > $TMP/sum1 & \
477                 cksum $DIR2/f19b | cut -d" " -f 1,2 > $TMP/sum2
478                 wait
479                 [ "`cat $TMP/sum1`" = "$SUM" ] || \
480                         error "$DIR1/f19b `cat $TMP/sum1` != $SUM"
481                 [ "`cat $TMP/sum2`" = "$SUM" ] || \
482                         error "$DIR2/f19b `cat $TMP/sum2` != $SUM"
483         done
484         for O in /proc/fs/lustre/obdfilter/*OST*; do
485                 echo $MAX > $O/readcache_max_filesize
486         done
487         rm $DIR1/f19b
488 }
489 #run_test 19 "test concurrent uncached read races ==============="
490
491 test_20() {
492         mkdir $DIR1/d20
493         cancel_lru_locks osc
494         CNT=$((`cat /proc/fs/lustre/llite/*/dump_page_cache | wc -l`))
495         multiop $DIR1/f20 Ow8190c
496         multiop $DIR2/f20 Oz8194w8190c
497         multiop $DIR1/f20 Oz0r8190c
498         cancel_lru_locks osc
499         CNTD=$((`cat /proc/fs/lustre/llite/*/dump_page_cache | wc -l` - $CNT))
500         [ $CNTD -gt 0 ] && \
501             error $CNTD" page left in cache after lock cancel" || true
502 }
503 run_test 20 "test extra readahead page left in cache ===="
504
505 cleanup_21() {
506         trap 0
507         umount $DIR1/d21
508 }
509
510 test_21() { # Bug 5907
511         mkdir $DIR1/d21
512         mount /etc $DIR1/d21 --bind || error "mount failed" # Poor man's mount.
513         trap cleanup_21 EXIT
514         rmdir -v $DIR1/d21 && error "Removed mounted directory"
515         rmdir -v $DIR2/d21 && echo "Removed mounted directory from another mountpoint, needs to be fixed"
516         test -d $DIR1/d21 || error "Mounted directory disappeared"
517         cleanup_21
518         test -d $DIR2/d21 || test -d $DIR1/d21 && error "Removed dir still visible after umount"
519         true
520 }
521 run_test 21 " Try to remove mountpoint on another dir ===="
522
523 JOIN=${JOIN:-"lfs join"}
524
525 test_22() { # Bug 9926
526         mkdir $DIR1/d21
527         dd if=/dev/urandom of=$DIR1/d21/128k bs=1024 count=128
528         cp -p $DIR1/d21/128k $DIR1/d21/f_head
529         for ((i=0;i<10;i++)); do
530                 cp -p $DIR1/d21/128k $DIR1/d21/f_tail
531                 $JOIN $DIR1/d21/f_head $DIR1/d21/f_tail || error "join error"
532                 $CHECKSTAT -a $DIR1/d21/f_tail || error "tail file exist after join"
533         done
534         echo aaaaaaaaaaa >> $DIR1/d21/no_joined
535
536         mv $DIR2/d21/f_head $DIR2/
537         munlink $DIR2/f_head || error "unlink joined file error"
538         cat $DIR2/d21/no_joined || error "cat error"
539         rm -rf $DIR2/d21/no_joined || error "unlink normal file error"
540 }
541 run_test 22 " After joining in one dir,  open/close unlink file in anther dir" 
542
543 test_23() { # Bug 5972
544         echo "others should see updated atime while another read" > $DIR1/f23
545         
546         # clear the lock(mode: LCK_PW) gotten from creating operation
547         cancel_lru_locks osc
548         
549         time1=`date +%s`        
550         sleep 2
551         
552         multiop $DIR1/f23 or20_c &
553         MULTIPID=$!
554
555         sleep 2
556         time2=`stat -c "%X" $DIR2/f23`
557
558         if (( $time2 <= $time1 )); then
559                 kill -USR1 $MULTIPID
560                 error "atime doesn't update among nodes"
561         fi
562
563         kill -USR1 $MULTIPID || return 1
564         rm -f $DIR1/f23 || error "rm -f $DIR1/f23 failed"
565         true
566 }
567 run_test 23 " others should see updated atime while another read===="
568
569 test_24() {
570         touch $DIR1/$tfile
571         lfs df || error "lfs df failed"
572         lfs df -ih || error "lfs df -ih failed"
573         lfs df -h $DIR1 || error "lfs df -h $DIR1 failed"
574         lfs df -i $DIR2 || error "lfs df -i $DIR2 failed"
575         lfs df $DIR1/$tfile || error "lfs df $DIR1/$tfile failed"
576         lfs df -ih $DIR2/$tfile || error "lfs df -ih $DIR2/$tfile failed"
577         
578         OSC=`lctl dl | awk '/-osc-/ {print $4}' | head -n 1`
579         lctl --device %$OSC deactivate
580         lfs df -i || error "lfs df -i with deactivated OSC failed"
581         lctl --device %$OSC recover
582         lfs df || error "lfs df with reactivated OSC failed"
583 }
584 run_test 24 "lfs df [-ih] [path] test ========================="
585
586 test_25() {
587         [ `cat $LPROC/mdc/*-mdc-*/connect_flags | grep -c acl` -lt 2 ] && echo "skipping $TESTNAME (must have acl)" && return
588
589         mkdir $DIR1/d25 || error
590         touch $DIR1/d25/f1 || error
591         chmod 0755 $DIR1/d25/f1 || error
592
593         $RUNAS checkstat $DIR2/d25/f1 || error
594         setfacl -m u:$RUNAS_ID:--- $DIR1/d25 || error
595         $RUNAS checkstat $DIR2/d25/f1 && error
596         setfacl -m u:$RUNAS_ID:r-x $DIR1/d25 || error
597         $RUNAS checkstat $DIR2/d25/f1 || error
598         setfacl -m u:$RUNAS_ID:--- $DIR1/d25 || error
599         $RUNAS checkstat $DIR2/d25/f1 && error
600         setfacl -x u:$RUNAS_ID: $DIR1/d25 || error
601         $RUNAS checkstat $DIR2/d25/f1 || error
602
603         rm -rf $DIR1/d25
604 }
605 run_test 25 "change ACL on one mountpoint be seen on another ==="
606
607 test_26a() {
608         utime $DIR1/f26a -s $DIR2/f26a || error
609 }
610 run_test 26a "allow mtime to get older"
611
612 test_26b() {
613         touch $DIR1/$tfile
614         sleep 1
615         echo "aaa" >> $DIR1/$tfile
616         sleep 1
617         chmod a+x $DIR2/$tfile
618         mt1=`stat -c %Y $DIR1/$tfile`
619         mt2=`stat -c %Y $DIR2/$tfile`
620         
621         if [ x"$mt1" != x"$mt2" ]; then 
622                 error "not equal mtime, client1: "$mt1", client2: "$mt2"."
623         fi
624 }
625 run_test 26b "sync mtime between ost and mds"
626
627 log "cleanup: ======================================================"
628 rm -rf $DIR1/[df][0-9]* $DIR1/lnk || true
629 if [ "$I_MOUNTED" = "yes" ]; then
630     cleanup
631 fi
632
633 echo '=========================== finished ==============================='
634 [ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true
635