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