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
91 [ "$SANITYLOG" ] && rm -f $SANITYLOG || true
95 if [ "$SANITYLOG" ]; then
96 echo "FAIL: $TESTNAME $@" >> $SANITYLOG
106 export MOUNT1=`mount| awk '/ lustre/ { print $3 }'| head -1`
107 export MOUNT2=`mount| awk '/ lustre/ { print $3 }'| tail -1`
108 [ -z "$MOUNT1" ] && error "NAME=$NAME not mounted once"
109 [ "$MOUNT1" = "$MOUNT2" ] && error "NAME=$NAME not mounted twice"
110 [ `mount| awk '/ lustre/ { print $3 }'| wc -l` -ne 2 ] && \
111 error "NAME=$NAME mounted more than twice"
113 export DIR1=${DIR1:-$MOUNT1}
114 export DIR2=${DIR2:-$MOUNT2}
115 [ -z "`echo $DIR1 | grep $MOUNT1`" ] && echo "$DIR1 not in $MOUNT1" && exit 96
116 [ -z "`echo $DIR2 | grep $MOUNT2`" ] && echo "$DIR2 not in $MOUNT2" && exit 95
118 rm -rf $DIR1/[df][0-9]* $DIR1/lnk
122 [ -f $DIR2/f1 ] || error
124 run_test 1a "check create on 2 mtpt's =========================="
128 $CHECKSTAT -t file -p 0777 $DIR1/f1 || error
131 run_test 1b "check attribute updates on 2 mtpt's ==============="
134 $CHECKSTAT -t file -p 0666 $DIR1/f1 || error
136 run_test 1c "check after remount attribute updates on 2 mtpt's ="
140 $CHECKSTAT -a $DIR1/f1 || error
142 run_test 1d "unlink on one mountpoint removes file on other ===="
148 $CHECKSTAT -t file -p 0777 $DIR1/f2a || error
150 run_test 2a "check cached attribute updates on 2 mtpt's ========"
156 $CHECKSTAT -t file -p 0777 $DIR2/f2b || error
158 run_test 2b "check cached attribute updates on 2 mtpt's ========"
160 # NEED TO SAVE ROOT DIR MODE
163 $CHECKSTAT -t dir -p 0777 $DIR2 || error
165 run_test 2c "check cached attribute updates on 2 mtpt's root ==="
169 $CHECKSTAT -t dir -p 0755 $DIR2 || error
171 run_test 2c "check cached attribute updates on 2 mtpt's root ==="
174 ( cd $DIR1 ; ln -s this/is/good lnk )
175 [ "this/is/good" = "`perl -e 'print readlink("'$DIR2/lnk'");'`" ] || \
178 run_test 3 "symlink on one mtpt, readlink on another ==========="
181 ./multifstat $DIR1/f4 $DIR2/f4
183 run_test 4 "fstat validation on multiple mount points =========="
187 truncate $DIR2/f5 100
188 $CHECKSTAT -t file -s 100 $DIR1/f5 || error
191 run_test 5 "create a file on one mount, truncate it on the other"
194 ./openunlink $DIR1/f6 $DIR2/f6 || error
196 run_test 6 "remove of open file on other node =================="
199 ./opendirunlink $DIR1/d7 $DIR2/d7 || error
201 run_test 7 "remove of open directory on other node ============="
204 ./opendevunlink $DIR1/dev8 $DIR2/dev8 || error
206 run_test 8 "remove of open special file on other node =========="
211 for C in a b c d e f g h i j k l; do
212 DIR=`eval echo \\$DIR$MTPT`
213 echo -n $C >> $DIR/f9
214 [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1
216 [ "`cat $DIR1/f9`" = "abcdefghijkl" ] || \
217 error "`od -a $DIR1/f10` != abcdefghijkl"
219 run_test 9 "append of file with sub-page size on multiple mounts"
225 for C in a b c d e f g h i j k l; do
226 DIR=`eval echo \\$DIR$MTPT`
227 echo -n $C | dd of=$DIR/f10 bs=1 seek=$OFFSET count=1
228 [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1
229 OFFSET=`expr $OFFSET + 1`
231 [ "`cat $DIR1/f10`" = "abcdefghijkl" ] || \
232 error "`od -a $DIR1/f10` != abcdefghijkl"
234 run_test 10 "write of file with sub-page size on multiple mounts "
238 multiop $DIR1/d11/f O_c &
240 cp -p /bin/ls $DIR1/d11/f
244 wait $MULTIPID || error
245 [ $RC -eq 0 ] && error || true
247 run_test 11 "execution of file opened for write should return error ===="
252 run_test 12 "test lock ordering (link, stat, unlink) ==========="
254 test_13() { # bug 2451 - directory coherency
256 mkdir $DIR1/d13 || error
257 cd $DIR1/d13 || error
259 ( touch $DIR1/d13/f13 ) # needs to be a separate shell
261 rm -f $DIR2/d13/f13 || error
262 ls 2>&1 | grep f13 && error "f13 shouldn't return an error (1)" || true
263 # need to run it twice
264 ( touch $DIR1/d13/f13 ) # needs to be a separate shell
266 rm -f $DIR2/d13/f13 || error
267 ls 2>&1 | grep f13 && error "f13 shouldn't return an error (2)" || true
269 run_test 13 "test directory page revocation ===================="
271 log "cleanup: ======================================================"
272 rm -rf $DIR1/[df][0-9]* $DIR1/lnk || true
273 echo '=========================== finished ==============================='
274 [ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true