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>
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;
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);
*/
static int ptlrpc_unregister_reply(struct ptlrpc_request *request, int async)
{
- bool discard = false;
+ bool discard;
/*
* Might sleep.
*/
/*
* 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);