From acea923a4b1e109731b8ee1749be75b445b733e9 Mon Sep 17 00:00:00 2001 From: johann <johann> Date: Mon, 6 Oct 2008 12:11:18 +0000 Subject: [PATCH] Branch b1_6 b=17261 i=shadow i=umka prevent ptlrpc_queue_wait() from looping indefinitely because of ENOMEM. --- lustre/ptlrpc/client.c | 6 +++--- lustre/ptlrpc/niobuf.c | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 8ea20368de..059891119a 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -1878,8 +1878,8 @@ restart: if ((brc == -ETIMEDOUT) && !ptlrpc_expire_one_request(req)) { /* Wait forever for reconnect / replay or failure */ lwi = LWI_INTR(interrupted_request, req); - rc = l_wait_event(req->rq_reply_waitq, ptlrpc_check_reply(req), - &lwi); + brc = l_wait_event(req->rq_reply_waitq, ptlrpc_check_reply(req), + &lwi); } CDEBUG(D_RPCTRACE, "Completed RPC pname:cluuid:pid:xid:nid:opc " @@ -1902,7 +1902,7 @@ restart: if (req->rq_err) { DEBUG_REQ(D_RPCTRACE, req, "err rc=%d status=%d", rc, req->rq_status); - GOTO(out, rc = -EIO); + GOTO(out, rc = rc ? rc : -EIO); } if (req->rq_intr) { diff --git a/lustre/ptlrpc/niobuf.c b/lustre/ptlrpc/niobuf.c index 2551d9079c..920786102c 100644 --- a/lustre/ptlrpc/niobuf.c +++ b/lustre/ptlrpc/niobuf.c @@ -482,6 +482,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) request->rq_import->imp_obd->obd_name); /* this prevents us from waiting in ptlrpc_queue_wait */ request->rq_err = 1; + request->rq_status = -ENODEV; RETURN(-ENODEV); } @@ -505,8 +506,12 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) LASSERT (request->rq_replen != 0); if (request->rq_repbuf == NULL) OBD_ALLOC(request->rq_repbuf, request->rq_replen); - if (request->rq_repbuf == NULL) + if (request->rq_repbuf == NULL) { + /* this prevents us from looping in ptlrpc_queue_wait */ + request->rq_err = 1; + request->rq_status = -ENOMEM; GOTO(cleanup_bulk, rc = -ENOMEM); + } request->rq_repmsg = NULL; rc = LNetMEAttach(request->rq_reply_portal,/*XXX FIXME bug 249*/ -- GitLab