From: Andreas Dilger Date: Sat, 30 Oct 2021 00:40:40 +0000 (-0600) Subject: LU-12678 ptlrpc: remove bogus LASSERT X-Git-Tag: 2.14.56~79 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=49769c1eea52e067d6c2d35b2976f44aada1ccee LU-12678 ptlrpc: remove bogus LASSERT In the error case, it isn't possible for rc to be both -ENOMEM and 0 at the same time, so remove the incorrect LASSERT(rc == 0) to avoid crashing the system on an allocation failure. Improve error messages to conform to code style. Fixes: ceeeae4271fd ("LU-12678 lnet: me: discard struct lnet_handle_me") Signed-off-by: Andreas Dilger Change-Id: I61ac5d735d7b2658dae76213a2d40cbfd2bb8bb9 Reviewed-on: https://review.whamcloud.com/45421 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Chris Horn Reviewed-by: Oleg Drokin --- diff --git a/lustre/ptlrpc/niobuf.c b/lustre/ptlrpc/niobuf.c index bd8f0d4..604475a 100644 --- a/lustre/ptlrpc/niobuf.c +++ b/lustre/ptlrpc/niobuf.c @@ -986,11 +986,11 @@ int ptlrpc_register_rqbd(struct ptlrpc_request_buffer_desc *rqbd) struct lnet_md md; struct lnet_me *me; - CDEBUG(D_NET, "LNetMEAttach: portal %d\n", - service->srv_req_portal); + CDEBUG(D_NET, "%s: registering portal %d\n", service->srv_name, + service->srv_req_portal); - if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_RQBD)) - return (-ENOMEM); + if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_RQBD)) + return -ENOMEM; /* NB: CPT affinity service should use new LNet flag LNET_INS_LOCAL, * which means buffer can only be attached on local CPT, and LND @@ -1000,8 +1000,9 @@ int ptlrpc_register_rqbd(struct ptlrpc_request_buffer_desc *rqbd) rqbd->rqbd_svcpt->scp_cpt >= 0 ? LNET_INS_LOCAL : LNET_INS_AFTER); if (IS_ERR(me)) { - CERROR("LNetMEAttach failed: %ld\n", PTR_ERR(me)); - return -ENOMEM; + CERROR("%s: LNetMEAttach failed: rc = %ld\n", + service->srv_name, PTR_ERR(me)); + return PTR_ERR(me); } LASSERT(rqbd->rqbd_refcount == 0); @@ -1021,10 +1022,9 @@ int ptlrpc_register_rqbd(struct ptlrpc_request_buffer_desc *rqbd) return 0; } - CERROR("ptlrpc: LNetMDAttach failed: rc = %d\n", rc); + CERROR("%s: LNetMDAttach failed: rc = %d\n", service->srv_name, rc); LASSERT(rc == -ENOMEM); - LASSERT(rc == 0); rqbd->rqbd_refcount = 0; - return -ENOMEM; + return rc; }