* reference, put it on the LRU. */
ldlm_lock_add_to_lru(lock);
unlock_res_and_lock(lock);
+
+ if (lock->l_flags & LDLM_FL_FAIL_LOC)
+ OBD_RACE(OBD_FAIL_LDLM_CP_BL_RACE);
+
/* Call ldlm_cancel_lru() only if EARLY_CANCEL and LRU RESIZE
* are not supported by the server, otherwise, it is done on
* enqueue. */
}
run_test 33 "no lock timeout under IO"
-test_34() { # bug 17645
+test_35() { # bug 17645
local generation=[]
local count=0
- for imp in /proc/fs/lustre/osc/$FSNAME-OST*-osc-*; do
+ for imp in /proc/fs/lustre/mdc/$FSNAME-MDT*-mdc-*; do
g=$(awk '/generation/{print $2}' $imp/import)
generation[count]=$g
let count=count+1
done
- dd if=/dev/zero of=$MOUNT1/$tfile bs=1M count=10
- cp $MOUNT1/$tfile $MOUNT1/${tfile}-1
- sync
- cancel_lru_locks osc
+ mkdir -p $MOUNT1/$tfile
+ cancel_lru_locks mdc
# Let's initiate -EINTR situation by setting fail_loc and take
# write lock on same file from same client. This will not cause
# bl_ast yet as lock is already in local cache.
#define OBD_FAIL_LDLM_INTR_CP_AST 0x317
do_facet client "lctl set_param fail_loc=0x80000317"
- dd if=$MOUNT1/${tfile}-1 of=$MOUNT1/$tfile bs=512 count=10000 &
- pid1=$!
- sleep 1
-
- # Let's take write lock on same file from another mount. This
- # should cause conflict and bl_ast
- dd if=$MOUNT2/${tfile}-1 of=$MOUNT2/$tfile bs=512 count=10000 &
- pid2=$!
local timeout=`do_facet mds lctl get_param -n timeout`
let timeout=timeout*3
- log "Wait for $pid1 $pid2 for $timeout sec..."
- sleep $timeout
- kill -9 $pid1 $pid2 > /dev/null 2>&1
- wait
-
+ local nr=0
+ while test $nr -lt 10; do
+ log "Race attempt $nr"
+ local blk1=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'`
+ test "x$blk1" = "x" && blk1=0
+ createmany -o $MOUNT2/$tfile/a 4000 &
+ pid1=$!
+ sleep 1
+
+ # Let's make conflict and bl_ast
+ ls -la $MOUNT1/$tfile > /dev/null &
+ pid2=$!
+
+ log "Wait for $pid1 $pid2 for $timeout sec..."
+ sleep $timeout
+ kill -9 $pid1 $pid2 > /dev/null 2>&1
+ wait
+ local blk2=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'`
+ test "x$blk2" = "x" && blk2=0
+ test $blk2 -gt $blk1 && break
+ rm -fr $MOUNT1/$tfile/*
+ cancel_lru_locks mdc
+ let nr=nr+1
+ done
do_facet client "lctl set_param fail_loc=0x0"
df -h $MOUNT1 $MOUNT2
count=0
- for imp in /proc/fs/lustre/osc/$FSNAME-OST*-osc-*; do
+ for imp in /proc/fs/lustre/mdc/$FSNAME-MDT*-mdc-*; do
g=$(awk '/generation/{print $2}' $imp/import)
if ! test "$g" -eq "${generation[count]}"; then
error "Eviction happened on import $(basename $imp)"
let count=count+1
done
}
-run_test 34 "-EINTR cp_ast vs. bl_ast race does not evict client"
+run_test 35 "-EINTR cp_ast vs. bl_ast race does not evict client"
log "cleanup: ======================================================"