From 50a5347dcacaea85aca2a0596fa11c97adb74f2d Mon Sep 17 00:00:00 2001 From: pschwan Date: Thu, 18 Apr 2002 04:11:27 +0000 Subject: [PATCH] Use a new ptlrpc_client->cli_lock to protect the cli lists. --- lustre/include/linux/lustre_net.h | 3 ++- lustre/ptlrpc/client.c | 9 ++++++--- lustre/ptlrpc/events.c | 4 ++-- lustre/ptlrpc/niobuf.c | 4 ++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lustre/include/linux/lustre_net.h b/lustre/include/linux/lustre_net.h index 9a249bd..3dea905 100644 --- a/lustre/include/linux/lustre_net.h +++ b/lustre/include/linux/lustre_net.h @@ -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; diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 2daebfa..33020fe 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -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); diff --git a/lustre/ptlrpc/events.c b/lustre/ptlrpc/events.c index 16ddff1..4bfec2c 100644 --- a/lustre/ptlrpc/events.c +++ b/lustre/ptlrpc/events.c @@ -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); diff --git a/lustre/ptlrpc/niobuf.c b/lustre/ptlrpc/niobuf.c index fde43a2..af8465b 100644 --- a/lustre/ptlrpc/niobuf.c +++ b/lustre/ptlrpc/niobuf.c @@ -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); -- 1.8.3.1