From 32c3775bab8902e533fd153a357b46da12076933 Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Mon, 10 Apr 2017 09:17:20 -0500 Subject: [PATCH] LU-9296 ptlrpc: set rq_sent when send fails due to -ENOMEM In ptl_send_rpc() set rq_sent when we fail to send the RPC due to insufficient memory, since this is what the upper layers expect. Signed-off-by: John L. Hammond Change-Id: Ia19c5d44e2999a9b347ec1088a7d448e1b548136 Reviewed-on: https://review.whamcloud.com/26470 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Jinshan Xiong Reviewed-by: Mike Pershin Reviewed-by: Oleg Drokin --- lustre/ptlrpc/niobuf.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lustre/ptlrpc/niobuf.c b/lustre/ptlrpc/niobuf.c index e80d5b0..889216c 100644 --- a/lustre/ptlrpc/niobuf.c +++ b/lustre/ptlrpc/niobuf.c @@ -781,10 +781,6 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) mpflag = cfs_memory_pressure_get_and_set(); rc = sptlrpc_cli_wrap_request(request); - if (rc == -ENOMEM) - /* set rq_sent so that this request is treated - * as a delayed send in the upper layers */ - request->rq_sent = cfs_time_current_sec(); if (rc) GOTO(out, rc); @@ -926,9 +922,16 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) * the chance to have long unlink to sluggish net is smaller here. */ ptlrpc_unregister_bulk(request, 0); out: - if (request->rq_memalloc) - cfs_memory_pressure_restore(mpflag); - return rc; + if (rc == -ENOMEM) { + /* set rq_sent so that this request is treated + * as a delayed send in the upper layers */ + request->rq_sent = cfs_time_current_sec(); + } + + if (request->rq_memalloc) + cfs_memory_pressure_restore(mpflag); + + return rc; } EXPORT_SYMBOL(ptl_send_rpc); -- 1.8.3.1