From 36e8719a5d9684f1e1883656d28e56612d10f757 Mon Sep 17 00:00:00 2001 From: Vitaly Fertman Date: Thu, 5 Aug 2010 02:17:50 +0400 Subject: [PATCH] b=22818 exp_queued_rpc under a separate lock i=green i=liang another bh lock is added just to protect exp_queued_rpc in the export --- lustre/include/lustre_export.h | 2 ++ lustre/ldlm/ldlm_lockd.c | 8 ++++---- lustre/obdclass/genops.c | 1 + lustre/ptlrpc/service.c | 8 ++++---- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lustre/include/lustre_export.h b/lustre/include/lustre_export.h index 629a635..f8ad0c3 100644 --- a/lustre/include/lustre_export.h +++ b/lustre/include/lustre_export.h @@ -219,6 +219,8 @@ struct obd_export { cfs_list_t exp_req_replay_queue; /** protects exp_flags and exp_outstanding_replies */ cfs_spinlock_t exp_lock; + /** protects exp_queued_rpc */ + cfs_spinlock_t exp_rpc_lock; /** Compatibility flags for this export */ __u64 exp_connect_flags; enum obd_option exp_flags; diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 579d33f..2b1af6f 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -255,7 +255,7 @@ static int ldlm_lock_busy(struct ldlm_lock *lock) if (lock->l_export == NULL) return 0; - cfs_spin_lock(&lock->l_export->exp_lock); + cfs_spin_lock_bh(&lock->l_export->exp_rpc_lock); cfs_list_for_each_entry(req, &lock->l_export->exp_queued_rpc, rq_exp_list) { if (req->rq_ops->hpreq_lock_match) { @@ -264,7 +264,7 @@ static int ldlm_lock_busy(struct ldlm_lock *lock) break; } } - cfs_spin_unlock(&lock->l_export->exp_lock); + cfs_spin_unlock_bh(&lock->l_export->exp_rpc_lock); RETURN(match); } @@ -696,14 +696,14 @@ static void ldlm_lock_reorder_req(struct ldlm_lock *lock) RETURN_EXIT; } - cfs_spin_lock(&lock->l_export->exp_lock); + cfs_spin_lock_bh(&lock->l_export->exp_rpc_lock); cfs_list_for_each_entry(req, &lock->l_export->exp_queued_rpc, rq_exp_list) { if (!req->rq_hp && req->rq_ops->hpreq_lock_match && req->rq_ops->hpreq_lock_match(req, lock)) ptlrpc_hpreq_reorder(req); } - cfs_spin_unlock(&lock->l_export->exp_lock); + cfs_spin_unlock_bh(&lock->l_export->exp_rpc_lock); EXIT; } diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 28d96a6..d61104e 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -801,6 +801,7 @@ struct obd_export *class_new_export(struct obd_device *obd, class_handle_hash(&export->exp_handle, export_handle_addref); export->exp_last_request_time = cfs_time_current_sec(); cfs_spin_lock_init(&export->exp_lock); + cfs_spin_lock_init(&export->exp_rpc_lock); CFS_INIT_HLIST_NODE(&export->exp_uuid_hash); CFS_INIT_HLIST_NODE(&export->exp_nid_hash); diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 5f67efa..afd1da4 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -1237,10 +1237,10 @@ static int ptlrpc_hpreq_init(struct ptlrpc_service *svc, RETURN(rc); } if (req->rq_export && req->rq_ops) { - cfs_spin_lock(&req->rq_export->exp_lock); + cfs_spin_lock_bh(&req->rq_export->exp_rpc_lock); cfs_list_add(&req->rq_exp_list, &req->rq_export->exp_queued_rpc); - cfs_spin_unlock(&req->rq_export->exp_lock); + cfs_spin_unlock_bh(&req->rq_export->exp_rpc_lock); } RETURN(0); @@ -1251,9 +1251,9 @@ static void ptlrpc_hpreq_fini(struct ptlrpc_request *req) { ENTRY; if (req->rq_export && req->rq_ops) { - cfs_spin_lock(&req->rq_export->exp_lock); + cfs_spin_lock_bh(&req->rq_export->exp_rpc_lock); cfs_list_del_init(&req->rq_exp_list); - cfs_spin_unlock(&req->rq_export->exp_lock); + cfs_spin_unlock_bh(&req->rq_export->exp_rpc_lock); } EXIT; } -- 1.8.3.1