diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 6c794b8a97b6940115367180fa5b430a89eceaab..704f66f74a3d1b6c9acfe8689a4d0b774496db3b 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -1095,8 +1095,6 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req) req->rq_status = rc; RETURN(1); } else { - /* here begins timeout counting */ - req->rq_sent = cfs_time_current_sec(); req->rq_wait_ctx = 1; RETURN(0); } @@ -1197,12 +1195,6 @@ int ptlrpc_check_set(struct ptlrpc_request_set *set) req->rq_waiting || req->rq_wait_ctx) { int status; - /* rq_wait_ctx is only touched in ptlrpcd, - * no lock needed here. - */ - if (req->rq_wait_ctx) - goto check_ctx; - ptlrpc_unregister_reply(req); spin_lock(&imp->imp_lock); @@ -1247,21 +1239,21 @@ int ptlrpc_check_set(struct ptlrpc_request_set *set) old_xid, req->rq_xid); } } -check_ctx: + /* + * rq_wait_ctx is only touched by ptlrpcd, + * so no lock is needed here. + */ status = sptlrpc_req_refresh_ctx(req, -1); if (status) { if (req->rq_err) { req->rq_status = status; force_timer_recalc = 1; - } - if (!req->rq_wait_ctx) { - /* begins timeout counting */ - req->rq_sent = cfs_time_current_sec(); + } else { req->rq_wait_ctx = 1; } + continue; } else { - req->rq_sent = 0; req->rq_wait_ctx = 0; } @@ -1402,7 +1394,6 @@ int ptlrpc_expire_one_request(struct ptlrpc_request *req) spin_lock(&req->rq_lock); req->rq_timedout = 1; - req->rq_wait_ctx = 0; spin_unlock(&req->rq_lock); ptlrpc_unregister_reply (req); @@ -1534,6 +1525,9 @@ int ptlrpc_set_next_timeout(struct ptlrpc_request_set *set) if (req->rq_timedout) /* already timed out */ continue; + if (req->rq_wait_ctx) /* waiting for ctx */ + continue; + if (req->rq_phase == RQ_PHASE_NEW) deadline = req->rq_sent; else diff --git a/lustre/ptlrpc/niobuf.c b/lustre/ptlrpc/niobuf.c index 3ca88b7e81f25a5f8bfb53d8c19f808b133e9d15..6d4226ddf007712868a2009d70a962743dffb13c 100644 --- a/lustre/ptlrpc/niobuf.c +++ b/lustre/ptlrpc/niobuf.c @@ -477,7 +477,8 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_DROP_RPC)) RETURN(0); - LASSERT (request->rq_type == PTL_RPC_MSG_REQUEST); + LASSERT(request->rq_type == PTL_RPC_MSG_REQUEST); + LASSERT(request->rq_wait_ctx == 0); /* If this is a re-transmit, we're required to have disengaged * cleanly from the previous attempt */