Whamcloud - gitweb
LU-13368 lnet: discard the callback
[fs/lustre-release.git] / lustre / ptlrpc / client.c
index 4ec69b3..7ee5324 100644 (file)
@@ -1880,7 +1880,7 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set)
                         * not corrupt any data.
                         */
                        if (req->rq_phase == RQ_PHASE_UNREG_RPC &&
-                           ptlrpc_client_recv_or_unlink(req))
+                           ptlrpc_cli_wait_unlink(req))
                                continue;
                        if (req->rq_phase == RQ_PHASE_UNREG_BULK &&
                            ptlrpc_client_bulk_active(req))
@@ -1918,7 +1918,7 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set)
                        /*
                         * Check if we still need to wait for unlink.
                         */
-                       if (ptlrpc_client_recv_or_unlink(req) ||
+                       if (ptlrpc_cli_wait_unlink(req) ||
                            ptlrpc_client_bulk_active(req))
                                continue;
                        /* If there is no need to resend, fail it now. */
@@ -2758,6 +2758,7 @@ EXPORT_SYMBOL(ptlrpc_req_xid);
  */
 static int ptlrpc_unregister_reply(struct ptlrpc_request *request, int async)
 {
+       bool discard = false;
        /*
         * Might sleep.
         */
@@ -2772,15 +2773,18 @@ static int ptlrpc_unregister_reply(struct ptlrpc_request *request, int async)
        /*
         * Nothing left to do.
         */
-       if (!ptlrpc_client_recv_or_unlink(request))
+       if (!__ptlrpc_cli_wait_unlink(request, &discard))
                RETURN(1);
 
        LNetMDUnlink(request->rq_reply_md_h);
 
+       if (discard) /* Discard the request-out callback */
+               __LNetMDUnlink(request->rq_req_md_h, discard);
+
        /*
         * Let's check it once again.
         */
-       if (!ptlrpc_client_recv_or_unlink(request))
+       if (!ptlrpc_cli_wait_unlink(request))
                RETURN(1);
 
        /* Move to "Unregistering" phase as reply was not unlinked yet. */
@@ -2809,7 +2813,7 @@ static int ptlrpc_unregister_reply(struct ptlrpc_request *request, int async)
                while (seconds > 0 &&
                       wait_event_idle_timeout(
                               *wq,
-                              !ptlrpc_client_recv_or_unlink(request),
+                              !ptlrpc_cli_wait_unlink(request),
                               cfs_time_seconds(1)) == 0)
                        seconds -= 1;
                if (seconds > 0) {