Whamcloud - gitweb
b=22818 exp_queued_rpc under a separate lock
authorVitaly Fertman <Vitaly.Fertman@sun.com>
Wed, 4 Aug 2010 22:17:50 +0000 (02:17 +0400)
committerMikhail Pershin <tappro@sun.com>
Fri, 6 Aug 2010 17:28:14 +0000 (21:28 +0400)
i=green
i=liang

another bh lock is added just to protect exp_queued_rpc in the export

lustre/include/lustre_export.h
lustre/ldlm/ldlm_lockd.c
lustre/obdclass/genops.c
lustre/ptlrpc/service.c

index 629a635..f8ad0c3 100644 (file)
@@ -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;
index 579d33f..2b1af6f 100644 (file)
@@ -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;
 }
 
index 28d96a6..d61104e 100644 (file)
@@ -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);
 
index 5f67efa..afd1da4 100644 (file)
@@ -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;
 }