From 5579cbd6894d83f81517c6b790c4f511f94e7976 Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Thu, 21 Aug 2003 04:42:05 -0700 Subject: [PATCH] A request cannot be used as part of the RTO estimation if it gets resent since you don't know whether the server is replying to the first or the second transmission. However we're currently setting the cutoff point to be the timeout of the first transmission. This patch moves the cutoff point to the actual start of the retransmission. --- include/linux/sunrpc/xprt.h | 2 +- net/sunrpc/xprt.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index 2687ba7b9f139..e29381edeaeaf 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h @@ -115,7 +115,7 @@ struct rpc_rqst { unsigned long rq_xtime; /* when transmitted */ int rq_ntimeo; - int rq_nresend; + int rq_ntrans; }; #define rq_svec rq_snd_buf.head #define rq_slen rq_snd_buf.len diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 7c8678157d09b..858337425e847 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -143,15 +143,17 @@ __xprt_lock_write(struct rpc_xprt *xprt, struct rpc_task *task) if (!xprt->snd_task) { if (xprt->nocong || __xprt_get_cong(xprt, task)) { xprt->snd_task = task; - if (req) + if (req) { req->rq_bytes_sent = 0; + req->rq_ntrans++; + } } } if (xprt->snd_task != task) { dprintk("RPC: %4d TCP write queue full\n", task->tk_pid); task->tk_timeout = 0; task->tk_status = -EAGAIN; - if (req && req->rq_nresend) + if (req && req->rq_ntrans) rpc_sleep_on(&xprt->resend, task, NULL, NULL); else rpc_sleep_on(&xprt->sending, task, NULL, NULL); @@ -189,8 +191,10 @@ __xprt_lock_write_next(struct rpc_xprt *xprt) if (xprt->nocong || __xprt_get_cong(xprt, task)) { struct rpc_rqst *req = task->tk_rqstp; xprt->snd_task = task; - if (req) + if (req) { req->rq_bytes_sent = 0; + req->rq_ntrans++; + } } } @@ -578,7 +582,7 @@ xprt_complete_rqst(struct rpc_xprt *xprt, struct rpc_rqst *req, int copied) if (!xprt->nocong) { xprt_adjust_cwnd(xprt, copied); __xprt_put_cong(xprt, req); - if (!req->rq_nresend) { + if (req->rq_ntrans == 1) { unsigned timer = task->tk_msg.rpc_proc->p_timer; if (timer) @@ -1064,7 +1068,7 @@ xprt_timer(struct rpc_task *task) goto out; xprt_adjust_cwnd(req->rq_xprt, -ETIMEDOUT); - req->rq_nresend++; + __xprt_put_cong(xprt, req); dprintk("RPC: %4d xprt_timer (%s request)\n", task->tk_pid, req ? "pending" : "backlogged"); -- 2.53.0