Whamcloud - gitweb
b=18080
authoryury <yury>
Mon, 5 Jan 2009 20:45:10 +0000 (20:45 +0000)
committeryury <yury>
Mon, 5 Jan 2009 20:45:10 +0000 (20:45 +0000)
- fixes in test 35;

- OBD_RACE in all execution branches in ldlm_lock_decref_internal() to balance OBD_RACE in bl_ast
and prevent hanging.

lustre/ldlm/ldlm_lock.c
lustre/tests/sanityN.sh

index 50dcf54..c0c566a 100644 (file)
@@ -708,6 +708,10 @@ void ldlm_lock_decref_internal(struct ldlm_lock *lock, __u32 mode)
                  * 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. */
index 78bba9a..983dc80 100644 (file)
@@ -838,8 +838,6 @@ test_35() { # bug 17645
         done
 
         mkdir -p $MOUNT1/$tfile
-        createmany -o $MOUNT1/$tfile/a 2000
-        sync
         cancel_lru_locks mdc
 
         # Let's initiate -EINTR situation by setting fail_loc and take
@@ -847,20 +845,32 @@ test_35() { # bug 17645
         # 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"
-        ls -la $MOUNT1/$tfile > /dev/null &
-        pid1=$!
-        sleep 1
-        
-        # Let's take write lock on same file from another mount. This
-        # should cause conflict and bl_ast
-        createmany -o $MOUNT2/$tfile/a 2000 &
-        pid2=$!
         local timeout=`do_facet $SINGLEMDS 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