Whamcloud - gitweb
Use a new ptlrpc_client->cli_lock to protect the cli lists.
authorpschwan <pschwan>
Thu, 18 Apr 2002 04:11:27 +0000 (04:11 +0000)
committerpschwan <pschwan>
Thu, 18 Apr 2002 04:11:27 +0000 (04:11 +0000)
lustre/include/linux/lustre_net.h
lustre/ptlrpc/client.c
lustre/ptlrpc/events.c
lustre/ptlrpc/niobuf.c

index 9a249bd..3dea905 100644 (file)
@@ -89,7 +89,8 @@ struct ptlrpc_client {
 
         struct semaphore cli_rpc_sem; /* limits outstanding requests */
 
-        struct list_head cli_sending_head; /* lists protected by ha_mgr lock */
+        spinlock_t cli_lock; /* protects lists */
+        struct list_head cli_sending_head;
         struct list_head cli_sent_head;
         struct list_head cli_ha_item; 
 
index 2daebfa..33020fe 100644 (file)
@@ -38,6 +38,7 @@ void ptlrpc_init_client(struct connmgr_obd *mgr, int req_portal,
         cl->cli_reply_portal = rep_portal;
         INIT_LIST_HEAD(&cl->cli_sending_head);
         INIT_LIST_HEAD(&cl->cli_sent_head);
+        spin_lock_init(&cl->cli_lock);
         sema_init(&cl->cli_rpc_sem, 32);
 }
 
@@ -132,9 +133,11 @@ void ptlrpc_free_req(struct ptlrpc_request *request)
         if (request->rq_repmsg != NULL)
                 OBD_FREE(request->rq_repmsg, request->rq_replen);
 
-        spin_lock(&request->rq_client->cli_ha_mgr->mgr_lock);
-        list_del(&request->rq_list);
-        spin_unlock(&request->rq_client->cli_ha_mgr->mgr_lock);
+        if (request->rq_client) {
+                spin_lock(&request->rq_client->cli_lock);
+                list_del(&request->rq_list);
+                spin_unlock(&request->rq_client->cli_lock);
+        }
 
         ptlrpc_put_connection(request->rq_connection);
 
index 16ddff1..4bfec2c 100644 (file)
@@ -46,10 +46,10 @@ static int request_out_callback(ptl_event_t *ev, void *data)
         ENTRY;
 
         if (ev->type == PTL_EVENT_SENT) {
-                spin_lock(&req->rq_client->cli_ha_mgr->mgr_lock);
+                spin_lock(&req->rq_client->cli_lock);
                 list_del(&req->rq_list);
                 list_add(&req->rq_list, &cl->cli_sent_head);
-                spin_unlock(&req->rq_client->cli_ha_mgr->mgr_lock);
+                spin_unlock(&req->rq_client->cli_lock);
         } else { 
                 // XXX make sure we understand all events, including ACK's
                 CERROR("Unknown event %d\n", ev->type); 
index fde43a2..af8465b 100644 (file)
@@ -295,9 +295,9 @@ int ptl_send_rpc(struct ptlrpc_request *request)
                request->rq_replen, request->rq_reqmsg->xid,
                request->rq_client->cli_request_portal);
 
-        spin_lock(&request->rq_client->cli_ha_mgr->mgr_lock);
+        spin_lock(&request->rq_client->cli_lock);
         list_add(&request->rq_list, &request->rq_client->cli_sending_head);
-        spin_unlock(&request->rq_client->cli_ha_mgr->mgr_lock);
+        spin_unlock(&request->rq_client->cli_lock);
 
         rc = ptl_send_buf(request, request->rq_connection,
                           request->rq_client->cli_request_portal);