Skip to content

Commit 605c61b

Browse files
committed
svcrdma: Eliminate return value for svc_rdma_send_error_msg()
Like svc_rdma_send_error(), have svc_rdma_send_error_msg() handle any error conditions internally, rather than duplicating that recovery logic at every call site. Signed-off-by: Chuck Lever <[email protected]>
1 parent 4f200bd commit 605c61b

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

net/sunrpc/xprtrdma/svc_rdma_sendto.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -810,10 +810,10 @@ static int svc_rdma_send_reply_msg(struct svcxprt_rdma *rdma,
810810
*
811811
* Remote Invalidation is skipped for simplicity.
812812
*/
813-
static int svc_rdma_send_error_msg(struct svcxprt_rdma *rdma,
814-
struct svc_rdma_send_ctxt *sctxt,
815-
struct svc_rdma_recv_ctxt *rctxt,
816-
int status)
813+
static void svc_rdma_send_error_msg(struct svcxprt_rdma *rdma,
814+
struct svc_rdma_send_ctxt *sctxt,
815+
struct svc_rdma_recv_ctxt *rctxt,
816+
int status)
817817
{
818818
__be32 *rdma_argp = rctxt->rc_recv_buf;
819819
__be32 *p;
@@ -825,7 +825,7 @@ static int svc_rdma_send_error_msg(struct svcxprt_rdma *rdma,
825825
p = xdr_reserve_space(&sctxt->sc_stream,
826826
rpcrdma_fixed_maxsz * sizeof(*p));
827827
if (!p)
828-
return -ENOMSG;
828+
goto put_ctxt;
829829

830830
*p++ = *rdma_argp;
831831
*p++ = *(rdma_argp + 1);
@@ -836,7 +836,7 @@ static int svc_rdma_send_error_msg(struct svcxprt_rdma *rdma,
836836
case -EPROTONOSUPPORT:
837837
p = xdr_reserve_space(&sctxt->sc_stream, 3 * sizeof(*p));
838838
if (!p)
839-
return -ENOMSG;
839+
goto put_ctxt;
840840

841841
*p++ = err_vers;
842842
*p++ = rpcrdma_version;
@@ -846,7 +846,7 @@ static int svc_rdma_send_error_msg(struct svcxprt_rdma *rdma,
846846
default:
847847
p = xdr_reserve_space(&sctxt->sc_stream, sizeof(*p));
848848
if (!p)
849-
return -ENOMSG;
849+
goto put_ctxt;
850850

851851
*p = err_chunk;
852852
trace_svcrdma_err_chunk(*rdma_argp);
@@ -855,7 +855,12 @@ static int svc_rdma_send_error_msg(struct svcxprt_rdma *rdma,
855855
sctxt->sc_send_wr.num_sge = 1;
856856
sctxt->sc_send_wr.opcode = IB_WR_SEND;
857857
sctxt->sc_sges[0].length = sctxt->sc_hdrbuf.len;
858-
return svc_rdma_send(rdma, &sctxt->sc_send_wr);
858+
if (svc_rdma_send(rdma, &sctxt->sc_send_wr))
859+
goto put_ctxt;
860+
return;
861+
862+
put_ctxt:
863+
svc_rdma_send_ctxt_put(rdma, sctxt);
859864
}
860865

861866
/**
@@ -950,9 +955,7 @@ int svc_rdma_sendto(struct svc_rqst *rqstp)
950955
* of previously posted RDMA Writes.
951956
*/
952957
svc_rdma_save_io_pages(rqstp, sctxt);
953-
ret = svc_rdma_send_error_msg(rdma, sctxt, rctxt, ret);
954-
if (ret < 0)
955-
goto err1;
958+
svc_rdma_send_error_msg(rdma, sctxt, rctxt, ret);
956959
return 0;
957960

958961
err1:

0 commit comments

Comments
 (0)