6 # bug number for skipped test: 1557 2366
7 ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"8 10 "}
8 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
10 [ "$ALWAYS_EXCEPT$EXCEPT" ] && echo "Skipping tests: $ALWAYS_EXCEPT $EXCEPT"
13 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
15 CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
16 CREATETEST=${CREATETEST:-createtest}
18 LSTRIPE=${LSTRIPE:-lstripe}
20 MCREATE=${MCREATE:-mcreate}
21 OPENFILE=${OPENFILE:-openfile}
22 OPENUNLINK=${OPENUNLINK:-openunlink}
23 TOEXCL=${TOEXCL:-toexcl}
24 TRUNCATE=${TRUNCATE:-truncate}
26 if [ $UID -ne 0 ]; then
30 RUNAS_ID=${RUNAS_ID:-500}
31 RUNAS=${RUNAS:-"runas -u $RUNAS_ID"}
34 export NAME=${NAME:-mount2}
40 sh llmountcleanup.sh > /dev/null || exit 20
46 sh llrmount.sh > /dev/null || exit 10
53 lctl mark "$*" 2> /dev/null || true
57 if ! mount | grep -q $DIR1; then
61 export TESTNAME=test_$1
62 test_$1 || error "test_$1: exit with rc=$?"
71 if [ "`echo $1 | grep '\<'$O'[a-z]*\>'`" ]; then
79 for X in $EXCEPT $ALWAYS_EXCEPT; do
80 if [ "`echo $1 | grep '\<'$X'[a-z]*\>'`" ]; then
81 echo "skipping excluded test $1"
85 if [ -z "$ONLY" ]; then
92 log "FAIL: $TESTNAME $@"
100 export MOUNT1=`mount| awk '/ lustre/ { print $3 }'| head -1`
101 export MOUNT2=`mount| awk '/ lustre/ { print $3 }'| tail -1`
102 [ -z "$MOUNT1" ] && error "NAME=$NAME not mounted once"
103 [ "$MOUNT1" = "$MOUNT2" ] && error "NAME=$NAME not mounted twice"
104 [ `mount| awk '/ lustre/ { print $3 }'| wc -l` -ne 2 ] && \
105 error "NAME=$NAME mounted more than twice"
107 export DIR1=${DIR1:-$MOUNT1}
108 export DIR2=${DIR2:-$MOUNT2}
109 [ -z "`echo $DIR1 | grep $MOUNT1`" ] && echo "$DIR1 not in $MOUNT1" && exit 96
110 [ -z "`echo $DIR2 | grep $MOUNT2`" ] && echo "$DIR2 not in $MOUNT2" && exit 95
112 rm -rf $DIR1/[df][0-9]* $DIR1/lnk
116 [ -f $DIR2/f1 ] || error
118 run_test 1a "check create on 2 mtpt's =========================="
122 $CHECKSTAT -t file -p 0777 $DIR1/f1 || error
125 run_test 1b "check attribute updates on 2 mtpt's ==============="
128 $CHECKSTAT -t file -p 0666 $DIR1/f1 || error
130 run_test 1c "check after remount attribute updates on 2 mtpt's ="
134 $CHECKSTAT -a $DIR1/f1 || error
136 run_test 1d "unlink on one mountpoint removes file on other ===="
142 $CHECKSTAT -t file -p 0777 $DIR1/f2a || error
144 run_test 2a "check cached attribute updates on 2 mtpt's ========"
150 $CHECKSTAT -t file -p 0777 $DIR2/f2b || error
152 run_test 2b "check cached attribute updates on 2 mtpt's ========"
154 # NEED TO SAVE ROOT DIR MODE
157 $CHECKSTAT -t dir -p 0777 $DIR2 || error
159 run_test 2c "check cached attribute updates on 2 mtpt's root ==="
163 $CHECKSTAT -t dir -p 0755 $DIR2 || error
165 run_test 2c "check cached attribute updates on 2 mtpt's root ==="
168 ( cd $DIR1 ; ln -s this/is/good lnk )
169 [ "this/is/good" = "`perl -e 'print readlink("'$DIR2/lnk'");'`" ] || \
172 run_test 3 "symlink on one mtpt, readlink on another ==========="
175 ./multifstat $DIR1/f4 $DIR2/f4
177 run_test 4 "fstat validation on multiple mount points =========="
181 truncate $DIR2/f5 100
182 $CHECKSTAT -t file -s 100 $DIR1/f5 || error
185 run_test 5 "create a file on one mount, truncate it on the other"
188 ./openunlink $DIR1/f6 $DIR2/f6 || error
190 run_test 6 "remove of open file on other node =================="
193 ./opendirunlink $DIR1/d7 $DIR2/d7 || error
195 run_test 7 "remove of open directory on other node ============="
198 ./opendevunlink $DIR1/dev8 $DIR2/dev8 || error
200 run_test 8 "remove of open special file on other node =========="
205 for C in a b c d e f g h i j k l; do
206 DIR=`eval echo \\$DIR$MTPT`
207 echo -n $C >> $DIR/f9
208 [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1
210 [ "`cat $DIR1/f9`" = "abcdefghijkl" ] || \
211 error "`od -a $DIR1/f10` != abcdefghijkl"
213 run_test 9 "append of file with sub-page size on multiple mounts"
219 for C in a b c d e f g h i j k l; do
220 DIR=`eval echo \\$DIR$MTPT`
221 echo -n $C | dd of=$DIR/f10 bs=1 seek=$OFFSET count=1
222 [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1
223 OFFSET=`expr $OFFSET + 1`
225 [ "`cat $DIR1/f10`" = "abcdefghijkl" ] || \
226 error "`od -a $DIR1/f10` != abcdefghijkl"
228 run_test 10 "write of file with sub-page size on multiple mounts "
232 multiop $DIR1/d11/f O_c &
234 cp -p /bin/ls $DIR1/d11/f
238 wait $MULTIPID || error
239 [ $RC -eq 0 ] && error || true
241 run_test 11 "execution of file opened for write should return error ===="
246 run_test 12 "test lock ordering (link, stat, unlink) ==========="
248 test_13() { # bug 2451 - directory coherency
250 mkdir $DIR1/d13 || error
251 cd $DIR1/d13 || error
253 ( touch $DIR1/d13/f13 ) # needs to be a separate shell
255 rm -f $DIR2/d13/f13 || error
256 ls 2>&1 | grep f13 && error "f13 shouldn't return an error (1)" || true
257 # need to run it twice
258 ( touch $DIR1/d13/f13 ) # needs to be a separate shell
260 rm -f $DIR2/d13/f13 || error
261 ls 2>&1 | grep f13 && error "f13 shouldn't return an error (2)" || true
263 run_test 13 "test directory page revocation ===================="
265 log "cleanup: ======================================================"
266 rm -rf $DIR1/[df][0-9]* $DIR1/lnk || true
267 echo '=========================== finished ==============================='