diff --git a/lustre/ptlrpc/niobuf.c b/lustre/ptlrpc/niobuf.c index 063dbabb753995f4e176fe10b34a01ee16b8e7b2..33f9faf09cdfaa6d512b9600b2f43e985fa6a486 100644 --- a/lustre/ptlrpc/niobuf.c +++ b/lustre/ptlrpc/niobuf.c @@ -362,7 +362,10 @@ int ptlrpc_send_reply (struct ptlrpc_request *req, int flags) lustre_msg_set_service_time(req->rq_repmsg, service_time); /* Report service time estimate for future client reqs */ lustre_msg_set_timeout(req->rq_repmsg, at_get(&svc->srv_at_estimate)); - + + if (req->rq_export && req->rq_export->exp_obd) + target_pack_pool_reply(req); + if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_AT_SUPPORT) { /* early replies go to offset 0, regular replies go after that*/ if (flags & PTLRPC_REPLY_EARLY) { @@ -383,9 +386,6 @@ int ptlrpc_send_reply (struct ptlrpc_request *req, int flags) lustre_msg_get_magic(req->rq_repmsg), req->rq_replen); } - if (req->rq_export && req->rq_export->exp_obd) - target_pack_pool_reply(req); - if (req->rq_export == NULL || req->rq_export->exp_connection == NULL) conn = ptlrpc_get_connection(req->rq_peer, req->rq_self, NULL); else diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index c951a5d1f3ed57bcb20819042f6d36b58a4caa13..ebc0850b3aed270d19b4b8e9667c97d90f9c697a 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -811,6 +811,9 @@ static int ptlrpc_at_check_timed(struct ptlrpc_service *svc) spin_unlock(&svc->srv_at_lock); + /* we have a new earliest deadline, restart the timer */ + ptlrpc_at_set_timer(svc); + CDEBUG(D_ADAPTTO, "timeout in %+ds, asking for %d secs on %d early " "replies\n", first, at_extra, counter); if (first < 0) @@ -821,7 +824,6 @@ static int ptlrpc_at_check_timed(struct ptlrpc_service *svc) /* ptlrpc_server_free_request may delete an entry out of the work list */ - counter = 0; spin_lock(&svc->srv_at_lock); while (!list_empty(&work_list)) { rq = list_entry(work_list.next, struct ptlrpc_request, @@ -831,20 +833,15 @@ static int ptlrpc_at_check_timed(struct ptlrpc_service *svc) deleted, and is safe to take a ref to keep the req around */ atomic_inc(&rq->rq_refcount); spin_unlock(&svc->srv_at_lock); - if (ptlrpc_at_send_early_reply(rq, at_extra) == 0) { - counter++; + + if (ptlrpc_at_send_early_reply(rq, at_extra) == 0) ptlrpc_at_add_timed(rq); - } + ptlrpc_server_req_decref(rq); spin_lock(&svc->srv_at_lock); } spin_unlock(&svc->srv_at_lock); - if (!counter) - /* Nothing added to timed list, so we have to kick the timer - ourselves. */ - ptlrpc_at_set_timer(svc); - RETURN(0); }