Whamcloud - gitweb
LU-17379 ptlrpc: fix check for callback discard 37/53937/2
authorMikhail Pershin <mpershin@whamcloud.com>
Tue, 6 Feb 2024 09:36:40 +0000 (12:36 +0300)
committerOleg Drokin <green@whamcloud.com>
Fri, 23 Feb 2024 07:16:46 +0000 (07:16 +0000)
In ptlrpc_unregister_reply() decision about need to
discard request-out callback is done too early, before
LNetMDUnlink() invokes reply callback. Therefore at the
monent of discard check rq_reply_unlinked is not set yet
and discard is skipped always.

Patch removes discard check from __ptlrpc_cli_wait_unlink()
and does that after LNetMDUnlink() call right inside
ptlrpc_unregister_reply().
That makes __ptlrpc_cli_wait_unlink() unused, so it was
removed and only ptlrpc_cli_wait_unlink() remains

Fixes: babf0232273 ("LU-13368 lnet: discard the callback")
Signed-off-by: Mikhail Pershin <mpershin@whamcloud.com>
Change-Id: I6448cafa8a0b81d7ba0172ad1709e75e592d4924
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53937
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lustre_net.h
lustre/ptlrpc/client.c

index 279a41b..1a72add 100644 (file)
@@ -2476,10 +2476,8 @@ ptlrpc_client_recv(struct ptlrpc_request *req)
        return req->rq_receiving_reply;
 }
 
-#define ptlrpc_cli_wait_unlink(req) __ptlrpc_cli_wait_unlink(req, NULL)
-
 static inline int
-__ptlrpc_cli_wait_unlink(struct ptlrpc_request *req, bool *discard)
+ptlrpc_cli_wait_unlink(struct ptlrpc_request *req)
 {
        int rc;
 
@@ -2493,15 +2491,6 @@ __ptlrpc_cli_wait_unlink(struct ptlrpc_request *req, bool *discard)
                return 1;
        }
 
-       if (discard) {
-               *discard = false;
-               if (req->rq_reply_unlinked && req->rq_req_unlinked == 0) {
-                       *discard = true;
-                       spin_unlock(&req->rq_lock);
-                       return 1; /* Should call again after LNetMDUnlink */
-               }
-       }
-
        rc = !req->rq_req_unlinked || !req->rq_reply_unlinked ||
             req->rq_receiving_reply;
        spin_unlock(&req->rq_lock);
index a157a50..4c63dfd 100644 (file)
@@ -2800,7 +2800,7 @@ EXPORT_SYMBOL(ptlrpc_req_xid);
  */
 static int ptlrpc_unregister_reply(struct ptlrpc_request *request, int async)
 {
-       bool discard = false;
+       bool discard;
        /*
         * Might sleep.
         */
@@ -2815,11 +2815,15 @@ static int ptlrpc_unregister_reply(struct ptlrpc_request *request, int async)
        /*
         * Nothing left to do.
         */
-       if (!__ptlrpc_cli_wait_unlink(request, &discard))
+       if (!ptlrpc_cli_wait_unlink(request))
                RETURN(1);
 
        LNetMDUnlink(request->rq_reply_md_h);
 
+       spin_lock(&request->rq_lock);
+       discard = request->rq_reply_unlinked && !request->rq_req_unlinked;
+       spin_unlock(&request->rq_lock);
+
        if (discard) /* Discard the request-out callback */
                __LNetMDUnlink(request->rq_req_md_h, discard);