6 ALWAYS_EXCEPT=${ALWAYS_EXCEPT:-"8"} # bug 1557
9 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
11 CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
12 CREATETEST=${CREATETEST:-createtest}
14 LSTRIPE=${LSTRIPE:-lstripe}
16 MCREATE=${MCREATE:-mcreate}
17 OPENFILE=${OPENFILE:-openfile}
18 OPENUNLINK=${OPENUNLINK:-openunlink}
19 TOEXCL=${TOEXCL:-toexcl}
20 TRUNCATE=${TRUNCATE:-truncate}
22 if [ $UID -ne 0 ]; then
26 RUNAS_ID=${RUNAS_ID:-500}
27 RUNAS=${RUNAS:-"runas -u $RUNAS_ID"}
30 export NAME=${NAME:-mount2}
36 sh llmountcleanup.sh > /dev/null || exit 20
42 sh llrmount.sh > /dev/null || exit 10
49 lctl mark "$*" 2> /dev/null || true
53 if ! mount | grep -q $DIR1; then
57 test_$1 || error "test_$1: $?"
65 if [ "`echo $1 | grep '\<'$O'[a-z]*\>'`" ]; then
73 for X in $EXCEPT $ALWAYS_EXCEPT; do
74 if [ "`echo $1 | grep '\<'$X'[a-z]*\>'`" ]; then
75 echo "skipping excluded test $1"
79 if [ -z "$ONLY" ]; then
94 MOUNT1=`mount| awk '/ lustre/ { print $3 }'| head -1`
95 MOUNT2=`mount| awk '/ lustre/ { print $3 }'| tail -1`
96 [ -z "$MOUNT1" ] && error "NAME=$NAME not mounted once"
97 [ "$MOUNT1" = "$MOUNT2" ] && error "NAME=$NAME not mounted twice"
98 [ `mount| awk '/ lustre/ { print $3 }'| wc -l` -ne 2 ] && \
99 error "NAME=$NAME mounted more than twice"
101 DIR1=${DIR1:-$MOUNT1}
102 DIR2=${DIR2:-$MOUNT2}
103 [ -z "`echo $DIR1 | grep $MOUNT1`" ] && echo "$DIR1 not in $MOUNT1" && exit 96
104 [ -z "`echo $DIR2 | grep $MOUNT2`" ] && echo "$DIR2 not in $MOUNT2" && exit 95
106 rm -rf $DIR1/[df][0-9]* $DIR1/lnk
110 [ -f $DIR2/f1 ] || error
112 run_test 1a "check create on 2 mtpt's =========================="
116 $CHECKSTAT -t file -p 0777 $DIR1/f1 || error
119 run_test 1b "check attribute updates on 2 mtpt's ==============="
122 $CHECKSTAT -t file -p 0666 $DIR1/f1 || error
124 run_test 1c "check after remount attribute updates on 2 mtpt's ="
128 $CHECKSTAT -a $DIR1/f1 || error
130 run_test 1d "unlink on one mountpoint removes file on other ===="
136 $CHECKSTAT -t file -p 0777 $DIR1/f2a || error
138 run_test 2a "check cached attribute updates on 2 mtpt's ========"
144 $CHECKSTAT -t file -p 0777 $DIR2/f2b || error
146 run_test 2b "check cached attribute updates on 2 mtpt's ========"
148 # NEED TO SAVE ROOT DIR MODE
151 $CHECKSTAT -t dir -p 0777 $DIR2 || error
153 run_test 2c "check cached attribute updates on 2 mtpt's root ==="
157 $CHECKSTAT -t dir -p 0755 $DIR2 || error
159 run_test 2c "check cached attribute updates on 2 mtpt's root ==="
162 ( cd $DIR1 ; ln -s this/is/good lnk )
163 [ "this/is/good" = "`perl -e 'print readlink("'$DIR2/lnk'");'`" ] || \
166 run_test 3 "symlink on one mtpt, readlink on another ==========="
169 ./multifstat $DIR1/f4 $DIR2/f4
171 run_test 4 "fstat validation on multiple mount points =========="
175 truncate $DIR2/f5 100
176 $CHECKSTAT -t file -s 100 $DIR1/f5 || error
179 run_test 5 "create a file on one mount, truncate it on the other"
182 ./openunlink $DIR1/f6 $DIR2/f6 || error
184 run_test 6 "remove of open file on other node =================="
187 ./opendirunlink $DIR1/d7 $DIR2/d7 || error
189 run_test 7 "remove of open directory on other node ============="
192 ./opendevunlink $DIR1/dev8 $DIR2/dev8 || error
194 run_test 8 "remove of open special file on other node =========="
199 for C in a b c d e f g h i j k l; do
200 DIR=`eval echo \\$DIR$MTPT`
201 echo -n $C >> $DIR/f9
202 [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1
204 [ "`cat $DIR1/f9`" = "abcdefghijkl" ] || \
205 error "`od -a $DIR1/f10` != abcdefghijkl"
207 run_test 9 "append of file with sub-page size on multiple mounts"
213 for C in a b c d e f g h i j k l; do
214 DIR=`eval echo \\$DIR$MTPT`
215 echo -n $C | dd of=$DIR/f10 bs=1 seek=$OFFSET count=1
216 [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1
217 OFFSET=`expr $OFFSET + 1`
219 [ "`cat $DIR1/f10`" = "abcdefghijkl" ] || \
220 error "`od -a $DIR1/f10` != abcdefghijkl"
222 run_test 10 "write of file with sub-page size on multiple mounts "
226 multiop $DIR1/d11/f O_c &
228 cp -p /bin/ls $DIR1/d11/f
232 wait $MULTIPID || error
233 [ $RC -eq 0 ] && error || true
235 run_test 11 "execution of file opened for write should return error ===="
240 run_test 12 "test lock ordering (link, stat, unlink) ==========="
242 log "cleanup: ======================================================"
243 rm -rf $DIR1/[df][0-9]* $DIR1/lnk || true
244 echo '=========================== finished ==============================='