From: Vitaly Fertman Date: Tue, 7 Dec 2010 22:00:13 +0000 (+0300) Subject: b=21804 protect rpc by refcount in ptlrpc_server_handle_req_in() X-Git-Tag: 2.0.59.0~39 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=9afee0366ab03c9feba88cc8eb0027aa0fb9bf6b;ds=sidebyside b=21804 protect rpc by refcount in ptlrpc_server_handle_req_in() i=johann i=adilger ptlrpc_hpreq_init() inserts rpc to the export list and by the time of ptlrpc_server_request_add() it could be already handled and released. To not lose request in between, take an extra reference on the request. --- diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 3b9faab..cfb798f 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -1477,6 +1477,11 @@ ptlrpc_server_handle_req_in(struct ptlrpc_service *svc) svc->srv_n_queued_reqs--; /* Consider this still a "queued" request as far as stats are concerned */ + /* ptlrpc_hpreq_init() inserts it to the export list and by the time + * of ptlrpc_server_request_add() it could be already handled and + * released. To not lose request in between, take an extra reference + * on the request. */ + ptlrpc_request_addref(req); cfs_spin_unlock(&svc->srv_lock); /* go through security check/transform */ @@ -1586,9 +1591,11 @@ ptlrpc_server_handle_req_in(struct ptlrpc_service *svc) if (rc) GOTO(err_req, rc); cfs_waitq_signal(&svc->srv_waitq); + ptlrpc_server_drop_request(req); RETURN(1); err_req: + ptlrpc_server_drop_request(req); cfs_spin_lock(&svc->srv_rq_lock); svc->srv_n_active_reqs++; cfs_spin_unlock(&svc->srv_rq_lock);