Whamcloud - gitweb
LU-793 ptlrpc: fix ptlrpc_request_change_export() 82/8582/2
authorMikhail Pershin <mike.pershin@intel.com>
Mon, 16 Dec 2013 06:57:39 +0000 (10:57 +0400)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 28 Dec 2013 02:15:11 +0000 (02:15 +0000)
The ptlrpc_request_change_export() is incompatible with recent
changes related to LU-793. It moves requests having rq_exp_list
to the new export exp_hp_req list assuming only hp requests have
rq_exp_list used, but now all requests use it. That may cause
normal requests to be moved to the hp queue.

Patch checks rq_ops instead and move request into proper list.
Second change fixes CFS_FAIL_TIMEOUT define, it uses sec * 1000
but 'sec' can be expression so it must be (sec) * 1000

Signed-off-by: Mikhail Pershin <mike.pershin@intel.com>
Change-Id: I2c385a824453a7cfaeede80180b3a83f72fc0f5b
Reviewed-on: http://review.whamcloud.com/8582
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
libcfs/include/libcfs/libcfs_fail.h
lustre/ptlrpc/service.c
lustre/target/tgt_handler.c
lustre/tests/recovery-small.sh

index 89d0b97..f8490cc 100644 (file)
@@ -130,7 +130,7 @@ static inline int cfs_fail_timeout_set(__u32 id, __u32 value, int ms, int set)
 
 /* If id hit cfs_fail_loc, sleep for seconds or milliseconds */
 #define CFS_FAIL_TIMEOUT(id, secs) \
-        cfs_fail_timeout_set(id, 0, secs * 1000, CFS_FAIL_LOC_NOSET)
+        cfs_fail_timeout_set(id, 0, (secs) * 1000, CFS_FAIL_LOC_NOSET)
 
 #define CFS_FAIL_TIMEOUT_MS(id, ms) \
         cfs_fail_timeout_set(id, 0, ms, CFS_FAIL_LOC_NOSET)
@@ -138,7 +138,7 @@ static inline int cfs_fail_timeout_set(__u32 id, __u32 value, int ms, int set)
 /* If id hit cfs_fail_loc, cfs_fail_loc |= value and
  * sleep seconds or milliseconds */
 #define CFS_FAIL_TIMEOUT_ORSET(id, value, secs) \
-        cfs_fail_timeout_set(id, value, secs * 1000, CFS_FAIL_LOC_ORSET)
+        cfs_fail_timeout_set(id, value, (secs) * 1000, CFS_FAIL_LOC_ORSET)
 
 #define CFS_FAIL_TIMEOUT_MS_ORSET(id, value, ms) \
         cfs_fail_timeout_set(id, value, ms, CFS_FAIL_LOC_ORSET)
index 40b65bf..ca2aa01 100644 (file)
@@ -989,19 +989,21 @@ void ptlrpc_request_change_export(struct ptlrpc_request *req,
                                  struct obd_export *export)
 {
        if (req->rq_export != NULL) {
-               if (!cfs_list_empty(&req->rq_exp_list)) {
-                       /* remove rq_exp_list from last export */
-                       spin_lock_bh(&req->rq_export->exp_rpc_lock);
-                       cfs_list_del_init(&req->rq_exp_list);
-                       spin_unlock_bh(&req->rq_export->exp_rpc_lock);
+               LASSERT(!list_empty(&req->rq_exp_list));
+               /* remove rq_exp_list from last export */
+               spin_lock_bh(&req->rq_export->exp_rpc_lock);
+               list_del_init(&req->rq_exp_list);
+               spin_unlock_bh(&req->rq_export->exp_rpc_lock);
+               /* export has one reference already, so it`s safe to
+                * add req to export queue here and get another
+                * reference for request later */
+               spin_lock_bh(&export->exp_rpc_lock);
+               if (req->rq_ops != NULL) /* hp request */
+                       list_add(&req->rq_exp_list, &export->exp_hp_rpcs);
+               else
+                       list_add(&req->rq_exp_list, &export->exp_reg_rpcs);
+               spin_unlock_bh(&export->exp_rpc_lock);
 
-                       /* export has one reference already, so it`s safe to
-                        * add req to export queue here and get another
-                        * reference for request later */
-                       spin_lock_bh(&export->exp_rpc_lock);
-                       cfs_list_add(&req->rq_exp_list, &export->exp_hp_rpcs);
-                       spin_unlock_bh(&export->exp_rpc_lock);
-               }
                class_export_rpc_dec(req->rq_export);
                class_export_put(req->rq_export);
        }
index 08b40a6..b0c26e0 100644 (file)
@@ -1738,7 +1738,8 @@ int tgt_brw_write(struct tgt_session_info *tsi)
                RETURN(err_serious(-EFAULT));
 
        /* pause before transaction has been started */
-       OBD_FAIL_TIMEOUT(OBD_FAIL_OST_BRW_PAUSE_BULK, (obd_timeout + 1) / 4);
+       CFS_FAIL_TIMEOUT(OBD_FAIL_OST_BRW_PAUSE_BULK, cfs_fail_val > 0 ?
+                        cfs_fail_val : (obd_timeout + 1) / 4);
 
        /* There must be big cache in current thread to process this request
         * if it is NULL then something went wrong and it wasn't allocated,
index 420a8f9..0cdc7f7 100755 (executable)
@@ -1792,9 +1792,6 @@ run_test 111 "mdd setup fail should not cause umount oops"
 test_112a() {
        remote_ost_nodsh && skip "remote OST with nodsh" && return 0
 
-       [[ $(lustre_version_code ost1) -ge $(version_code 2.5.92) ]] ||
-               { skip "Need OST version at least 2.5.92"; return 0; }
-
        do_facet_random_file client $TMP/$tfile 100K ||
                error_noexit "Create random file $TMP/$tfile"