diff mbox series

[12/19] lustre: ptlrpc: remove bogus LASSERT

Message ID 1638142074-5945-13-git-send-email-jsimmons@infradead.org (mailing list archive)
State New, archived
Headers show
Series lustre: update to OpenSFS tree Nov 28, 2021 | expand

Commit Message

James Simmons Nov. 28, 2021, 11:27 p.m. UTC
From: Andreas Dilger <adilger@whamcloud.com>

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: c8c95f49fd73 ("lnet: me: discard struct lnet_handle_me")
WC-bug-id: https://jira.whamcloud.com/browse/LU-12678
Lustre-commit: 49769c1eea52e067d ("LU-12678 ptlrpc: remove bogus LASSERT")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/45421
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/ptlrpc/niobuf.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/fs/lustre/ptlrpc/niobuf.c b/fs/lustre/ptlrpc/niobuf.c
index c5bbf5a..da04d4e 100644
--- a/fs/lustre/ptlrpc/niobuf.c
+++ b/fs/lustre/ptlrpc/niobuf.c
@@ -774,7 +774,7 @@  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",
+	CDEBUG(D_NET, "%s: registering portal %d\n", service->srv_name,
 	       service->srv_req_portal);
 
 	if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_RQBD))
@@ -789,8 +789,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);
@@ -810,9 +811,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);
 	rqbd->rqbd_refcount = 0;
 
-	return -ENOMEM;
+	return rc;
 }