Whamcloud - gitweb
b=18080
authoryury <yury>
Mon, 5 Jan 2009 20:04:28 +0000 (20:04 +0000)
committeryury <yury>
Mon, 5 Jan 2009 20:04:28 +0000 (20:04 +0000)
- synchronize test with HEAD version and rename it to test_35 (just like in HEAD);

- 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/ldlm/ldlm_request.c
lustre/tests/sanityN.sh

index 48bb4d2..a03bf0f 100644 (file)
@@ -653,6 +653,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 e318e88..ce4c556 100644 (file)
@@ -189,7 +189,6 @@ noreproc:
         }
 
         if (ns_is_client(lock->l_resource->lr_namespace) && 
-            lock->l_resource->lr_type == LDLM_EXTENT &&
             OBD_FAIL_CHECK(OBD_FAIL_LDLM_INTR_CP_AST | OBD_FAIL_ONCE)) {
                 obd_fail_loc = OBD_FAIL_LDLM_CP_BL_RACE | OBD_FAIL_ONCE;
                 lock->l_flags |= LDLM_FL_FAIL_LOC;
index eafe38e..ed31f66 100644 (file)
@@ -738,44 +738,53 @@ test_33() { #16129
 }
 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)"
@@ -783,7 +792,7 @@ test_34() { # bug 17645
             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: ======================================================"