run_test 19 "test concurrent uncached read races ==============="
test_20() {
- test_mkdir $DIR1/d20
+ test_mkdir $DIR1/$tdir
cancel_lru_locks
- CNT=$((`lctl get_param -n llite.*.dump_page_cache | wc -l`))
- $MULTIOP $DIR1/f20 Ow8190c
- $MULTIOP $DIR2/f20 Oz8194w8190c
- $MULTIOP $DIR1/f20 Oz0r8190c
+ CNT=$($LCTL get_param -n llite.*.dump_page_cache | wc -l)
+ $MULTIOP $DIR1/$tdir/$tfile Ow8190c
+ $MULTIOP $DIR2/$tdir/$tfile Oz8194w8190c
+ $MULTIOP $DIR1/$tdir/$tfile Oz0r8190c
cancel_lru_locks
- CNTD=$((`lctl get_param -n llite.*.dump_page_cache | wc -l` - $CNT))
- [ $CNTD -gt 0 ] && \
- error $CNTD" page left in cache after lock cancel" || true
+ CNT2=$($LCTL get_param -n llite.*.dump_page_cache | wc -l)
+ [[ $CNT2 == $CNT ]] ||
+ error $((CNT2 - CNT))" page left in cache after lock cancel"
}
run_test 20 "test extra readahead page left in cache ===="
lctl clear
dd if=/dev/zero of=$DIR2/$tfile bs=$((4096+4))k conv=notrunc count=4 seek=3 &
DD2_PID=$!
- usleep 50
+ sleep 0.5
log "dd 1 started"
dd if=/dev/zero of=$DIR1/$tfile bs=$((16384-1024))k conv=notrunc count=1 seek=4 &
log "checking cached lockless truncate"
$TRUNCATE $DIR1/$tfile 8000000
- $CHECKSTAT -s 8000000 $DIR2/$tfile || error "wrong file size"
+ $CHECKSTAT -s 8000000 $DIR2/$tfile ||
+ error "cached truncate - wrong file size"
[ $(calc_stats $OSC.*.${OSC}_stats lockless_truncate) -ne 0 ] ||
error "cached truncate isn't lockless"
log "checking not cached lockless truncate"
$TRUNCATE $DIR2/$tfile 5000000
- $CHECKSTAT -s 5000000 $DIR1/$tfile || error "wrong file size"
+ $CHECKSTAT -s 5000000 $DIR1/$tfile ||
+ error "not cached truncate - wrong file size"
[ $(calc_stats $OSC.*.${OSC}_stats lockless_truncate) -ne 0 ] ||
error "not cached truncate isn't lockless"
enable_lockless_truncate 0
clear_stats $OSC.*.${OSC}_stats
$TRUNCATE $DIR2/$tfile 3000000
- $CHECKSTAT -s 3000000 $DIR1/$tfile || error "wrong file size"
+ $CHECKSTAT -s 3000000 $DIR1/$tfile ||
+ error "lockless truncate disabled - wrong file size"
[ $(calc_stats $OSC.*.${OSC}_stats lockless_truncate) -eq 0 ] ||
error "lockless truncate disabling failed"
rm -f $DIR1/$tfile
# delay glimpse so that layout has changed when glimpse finish
#define OBD_FAIL_GLIMPSE_DELAY 0x1404
- $LCTL set_param fail_loc=0x1404
+ $LCTL set_param fail_loc=0x1404 fail_val=4
stat -c %s $DIR2/$tfile |tee $tmpfile &
local pid=$!
- sleep 1
+ sleep 0.2
# extend layout of testing file
dd if=/dev/zero of=$DIR1/$tfile bs=1M count=1 seek=2 conv=notrunc ||
local mdt_xtimes=($(get_mdt_xtimes $mdtdev))
echo "STAT a|m|ctime ${xtimes[*]}"
- echo "MDT a|m|ctime ${xtimes[*]}"
+ echo "MDT a|m|ctime ${mdt_xtimes[*]}"
[[ ${xtimes[0]} == ${mdt_xtimes[0]} ]] ||
error "$DIR/$tfile atime (${xtimes[0]}:${mdt_xtimes[0]}) diff"
[[ ${xtimes[1]} == ${mdt_xtimes[1]} ]] ||
}
run_test 106c "Verify statx attributes mask"
+test_107a() { # LU-1031
+ dd if=/dev/zero of=$DIR1/$tfile bs=1M count=10
+ local gid1=14091995
+ local gid2=16022000
+
+ $LFS getstripe $DIR1/$tfile
+
+ multiop_bg_pause $DIR1/$tfile OG${gid1}_g${gid1}c || return 1
+ local MULTIPID1=$!
+ multiop_bg_pause $DIR2/$tfile O_G${gid2}r10g${gid2}c || return 2
+ local MULTIPID2=$!
+ kill -USR1 $MULTIPID2
+ sleep 2
+ if [[ $(ps h -o comm -p $MULTIPID2) == "" ]]; then
+ error "First grouplock does not block second one"
+ else
+ echo "First grouplock blocks second one"
+ fi
+ kill -USR1 $MULTIPID1
+ wait $MULTIPID1
+ wait $MULTIPID2
+}
+run_test 107a "Basic grouplock conflict"
+
+test_107b() {
+ dd if=/dev/zero of=$DIR1/$tfile bs=1M count=10
+ local gid1=14091995
+ local gid2=16022000
+
+ $LFS getstripe $DIR1/$tfile
+
+ multiop_bg_pause $DIR1/$tfile OG${gid1}_g${gid1}c || return 1
+ local MULTIPID1=$!
+ multiop $DIR2/$tfile Or10c &
+ local MULTIPID2=$!
+ sleep 2
+
+ if [[ $(ps h -o comm -p $MULTIPID2) == "" ]]; then
+ error "Grouplock does not block IO"
+ else
+ echo "Grouplock blocks IO"
+ fi
+
+ multiop $DIR2/$tfile OG${gid2}_g${gid2}c &
+ local MULTIPID3=$!
+ sleep 2
+ if [[ $(ps h -o comm -p $MULTIPID3) == "" ]]; then
+ error "First grouplock does not block second one"
+ else
+ echo "First grouplock blocks second one"
+ fi
+
+ kill -USR1 $MULTIPID1
+ sleep 2
+
+ if [[ $(ps h -o comm -p $MULTIPID3) == "" ]]; then
+ error "Second grouplock thread disappeared"
+ fi
+
+ if [[ $(ps h -o comm -p $MULTIPID2) == "" ]]; then
+ error "Second grouplock does not block IO"
+ else
+ echo "Second grouplock blocks IO"
+ fi
+
+ kill -USR1 $MULTIPID3
+ wait $MULTIPID1
+ wait $MULTIPID2
+ wait $MULTIPID3
+}
+run_test 107b "Grouplock is added to the head of waiting list"
+
+test_108a() {
+ local offset
+
+ $LFS setstripe -E 1M -c 1 -E -1 $DIR1/$tfile ||
+ error "Create $DIR1/$tfile failed"
+
+ dd if=/dev/zero of=$DIR1/$tfile bs=10000 count=1 ||
+ error "dd $DIR1/$tfile failed"
+ offset=$(lseek_test -d 5000 $DIR2/$tfile)
+ [[ $offset == 5000 ]] || error "offset $offset != 5000"
+
+ $TRUNCATE $DIR1/$tfile 2000
+ offset=$(lseek_test -l 1000 $DIR2/$tfile)
+ [[ $offset == 2000 ]] || error "offset $offset != 2000"
+
+ #define OBD_FAIL_OSC_DELAY_IO 0x414
+ $LCTL set_param fail_val=4 fail_loc=0x80000414
+ dd if=/dev/zero of=$DIR1/$tfile count=1 bs=8M conv=notrunc oflag=dsync &
+ local pid=$!
+ sleep 2
+
+ offset=$(lseek_test -l 8000 $DIR2/$tfile)
+ wait $pid
+ [[ $offset == 8388608 ]] || error "offset $offset != 8388608"
+}
+run_test 108a "lseek: parallel updates"
+
log "cleanup: ======================================================"
# kill and wait in each test only guarentee script finish, but command in script