Whamcloud - gitweb
LU-9296 ptlrpc: set rq_sent when send fails due to -ENOMEM 70/26470/3
authorJohn L. Hammond <john.hammond@intel.com>
Mon, 10 Apr 2017 14:17:20 +0000 (09:17 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 1 May 2017 17:49:32 +0000 (17:49 +0000)
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 <john.hammond@intel.com>
Change-Id: Ia19c5d44e2999a9b347ec1088a7d448e1b548136
Reviewed-on: https://review.whamcloud.com/26470
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/ptlrpc/niobuf.c

index e80d5b0..889216c 100644 (file)
@@ -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);
                 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);
 
        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:
          * 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);
 
 }
 EXPORT_SYMBOL(ptl_send_rpc);