Skip to content

Commit 55fcc7d

Browse files
committed
SUNRPC: Ignore return value of ->xpo_sendto
Clean up: All callers of svc_process() ignore its return value, so svc_process() can safely be converted to return void. Ditto for svc_send(). The return value of ->xpo_sendto() is now used only as part of a trace event. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent ae0d777 commit 55fcc7d

4 files changed

Lines changed: 18 additions & 20 deletions

File tree

include/linux/sunrpc/svc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int,
430430
int (*threadfn)(void *data));
431431
int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int);
432432
int svc_pool_stats_open(struct svc_serv *serv, struct file *file);
433-
int svc_process(struct svc_rqst *);
433+
void svc_process(struct svc_rqst *rqstp);
434434
int bc_svc_process(struct svc_serv *, struct rpc_rqst *,
435435
struct svc_rqst *);
436436
int svc_register(const struct svc_serv *, struct net *, const int,

include/linux/sunrpc/svcsock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static inline u32 svc_sock_final_rec(struct svc_sock *svsk)
5656
*/
5757
void svc_close_net(struct svc_serv *, struct net *);
5858
int svc_recv(struct svc_rqst *, long);
59-
int svc_send(struct svc_rqst *);
59+
void svc_send(struct svc_rqst *rqstp);
6060
void svc_drop(struct svc_rqst *);
6161
void svc_sock_update_bufs(struct svc_serv *serv);
6262
bool svc_alien_sock(struct net *net, int fd);

net/sunrpc/svc.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,11 +1444,12 @@ svc_process_common(struct svc_rqst *rqstp)
14441444
goto sendit;
14451445
}
14461446

1447-
/*
1448-
* Process the RPC request.
1447+
/**
1448+
* svc_process - Execute one RPC transaction
1449+
* @rqstp: RPC transaction context
1450+
*
14491451
*/
1450-
int
1451-
svc_process(struct svc_rqst *rqstp)
1452+
void svc_process(struct svc_rqst *rqstp)
14521453
{
14531454
struct kvec *resv = &rqstp->rq_res.head[0];
14541455
__be32 *p;
@@ -1484,15 +1485,15 @@ svc_process(struct svc_rqst *rqstp)
14841485

14851486
if (!svc_process_common(rqstp))
14861487
goto out_drop;
1487-
return svc_send(rqstp);
1488+
svc_send(rqstp);
1489+
return;
14881490

14891491
out_baddir:
14901492
svc_printk(rqstp, "bad direction 0x%08x, dropping request\n",
14911493
be32_to_cpu(*p));
14921494
rqstp->rq_server->sv_stats->rpcbadfmt++;
14931495
out_drop:
14941496
svc_drop(rqstp);
1495-
return 0;
14961497
}
14971498
EXPORT_SYMBOL_GPL(svc_process);
14981499

net/sunrpc/svc_xprt.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -909,18 +909,20 @@ void svc_drop(struct svc_rqst *rqstp)
909909
}
910910
EXPORT_SYMBOL_GPL(svc_drop);
911911

912-
/*
913-
* Return reply to client.
912+
/**
913+
* svc_send - Return reply to client
914+
* @rqstp: RPC transaction context
915+
*
914916
*/
915-
int svc_send(struct svc_rqst *rqstp)
917+
void svc_send(struct svc_rqst *rqstp)
916918
{
917919
struct svc_xprt *xprt;
918-
int len = -EFAULT;
919920
struct xdr_buf *xb;
921+
int status;
920922

921923
xprt = rqstp->rq_xprt;
922924
if (!xprt)
923-
goto out;
925+
return;
924926

925927
/* calculate over-all length */
926928
xb = &rqstp->rq_res;
@@ -930,15 +932,10 @@ int svc_send(struct svc_rqst *rqstp)
930932
trace_svc_xdr_sendto(rqstp->rq_xid, xb);
931933
trace_svc_stats_latency(rqstp);
932934

933-
len = xprt->xpt_ops->xpo_sendto(rqstp);
935+
status = xprt->xpt_ops->xpo_sendto(rqstp);
934936

935-
trace_svc_send(rqstp, len);
937+
trace_svc_send(rqstp, status);
936938
svc_xprt_release(rqstp);
937-
938-
if (len == -ECONNREFUSED || len == -ENOTCONN || len == -EAGAIN)
939-
len = 0;
940-
out:
941-
return len;
942939
}
943940

944941
/*

0 commit comments

Comments
 (0)