From 9db3b77445d8b96f1f4a20ab03a6b8df3aec01e4 Mon Sep 17 00:00:00 2001 From: Mikhail Pershin Date: Mon, 16 Dec 2013 10:57:39 +0400 Subject: [PATCH] LU-793 ptlrpc: fix ptlrpc_request_change_export() 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 Change-Id: I2c385a824453a7cfaeede80180b3a83f72fc0f5b Reviewed-on: http://review.whamcloud.com/8582 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Johann Lombardi Reviewed-by: Andreas Dilger Reviewed-by: Nathaniel Clark --- libcfs/include/libcfs/libcfs_fail.h | 4 ++-- lustre/ptlrpc/service.c | 26 ++++++++++++++------------ lustre/target/tgt_handler.c | 3 ++- lustre/tests/recovery-small.sh | 3 --- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/libcfs/include/libcfs/libcfs_fail.h b/libcfs/include/libcfs/libcfs_fail.h index 89d0b97..f8490cc 100644 --- a/libcfs/include/libcfs/libcfs_fail.h +++ b/libcfs/include/libcfs/libcfs_fail.h @@ -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) diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 40b65bf..ca2aa01 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -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); } diff --git a/lustre/target/tgt_handler.c b/lustre/target/tgt_handler.c index 08b40a6..b0c26e0 100644 --- a/lustre/target/tgt_handler.c +++ b/lustre/target/tgt_handler.c @@ -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, diff --git a/lustre/tests/recovery-small.sh b/lustre/tests/recovery-small.sh index 420a8f9..0cdc7f7 100755 --- a/lustre/tests/recovery-small.sh +++ b/lustre/tests/recovery-small.sh @@ -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" -- 1.8.3.1