Skip to content

Commit e6f533b

Browse files
bcodding-rhamschuma-ntap
authored andcommitted
SUNRPC: Fixup v4.1 backchannel request timeouts
After commit 59464b2 ("SUNRPC: SOFTCONN tasks should time out when on the sending list"), any 4.1 backchannel tasks placed on the sending queue would immediately return with -ETIMEDOUT since their req timers are zero. Initialize the backchannel's rpc_rqst timeout parameters from the xprt's default timeout settings. Fixes: 59464b2 ("SUNRPC: SOFTCONN tasks should time out when on the sending list") Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Tested-by: Chuck Lever <chuck.lever@oracle.com> Tested-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent 597a421 commit e6f533b

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

net/sunrpc/xprt.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -651,9 +651,9 @@ static unsigned long xprt_abs_ktime_to_jiffies(ktime_t abstime)
651651
jiffies + nsecs_to_jiffies(-delta);
652652
}
653653

654-
static unsigned long xprt_calc_majortimeo(struct rpc_rqst *req)
654+
static unsigned long xprt_calc_majortimeo(struct rpc_rqst *req,
655+
const struct rpc_timeout *to)
655656
{
656-
const struct rpc_timeout *to = req->rq_task->tk_client->cl_timeout;
657657
unsigned long majortimeo = req->rq_timeout;
658658

659659
if (to->to_exponential)
@@ -665,17 +665,19 @@ static unsigned long xprt_calc_majortimeo(struct rpc_rqst *req)
665665
return majortimeo;
666666
}
667667

668-
static void xprt_reset_majortimeo(struct rpc_rqst *req)
668+
static void xprt_reset_majortimeo(struct rpc_rqst *req,
669+
const struct rpc_timeout *to)
669670
{
670-
req->rq_majortimeo += xprt_calc_majortimeo(req);
671+
req->rq_majortimeo += xprt_calc_majortimeo(req, to);
671672
}
672673

673674
static void xprt_reset_minortimeo(struct rpc_rqst *req)
674675
{
675676
req->rq_minortimeo += req->rq_timeout;
676677
}
677678

678-
static void xprt_init_majortimeo(struct rpc_task *task, struct rpc_rqst *req)
679+
static void xprt_init_majortimeo(struct rpc_task *task, struct rpc_rqst *req,
680+
const struct rpc_timeout *to)
679681
{
680682
unsigned long time_init;
681683
struct rpc_xprt *xprt = req->rq_xprt;
@@ -684,8 +686,9 @@ static void xprt_init_majortimeo(struct rpc_task *task, struct rpc_rqst *req)
684686
time_init = jiffies;
685687
else
686688
time_init = xprt_abs_ktime_to_jiffies(task->tk_start);
687-
req->rq_timeout = task->tk_client->cl_timeout->to_initval;
688-
req->rq_majortimeo = time_init + xprt_calc_majortimeo(req);
689+
690+
req->rq_timeout = to->to_initval;
691+
req->rq_majortimeo = time_init + xprt_calc_majortimeo(req, to);
689692
req->rq_minortimeo = time_init + req->rq_timeout;
690693
}
691694

@@ -713,7 +716,7 @@ int xprt_adjust_timeout(struct rpc_rqst *req)
713716
} else {
714717
req->rq_timeout = to->to_initval;
715718
req->rq_retries = 0;
716-
xprt_reset_majortimeo(req);
719+
xprt_reset_majortimeo(req, to);
717720
/* Reset the RTT counters == "slow start" */
718721
spin_lock(&xprt->transport_lock);
719722
rpc_init_rtt(req->rq_task->tk_client->cl_rtt, to->to_initval);
@@ -1886,7 +1889,7 @@ xprt_request_init(struct rpc_task *task)
18861889
req->rq_snd_buf.bvec = NULL;
18871890
req->rq_rcv_buf.bvec = NULL;
18881891
req->rq_release_snd_buf = NULL;
1889-
xprt_init_majortimeo(task, req);
1892+
xprt_init_majortimeo(task, req, task->tk_client->cl_timeout);
18901893

18911894
trace_xprt_reserve(req);
18921895
}
@@ -1996,6 +1999,8 @@ xprt_init_bc_request(struct rpc_rqst *req, struct rpc_task *task)
19961999
*/
19972000
xbufp->len = xbufp->head[0].iov_len + xbufp->page_len +
19982001
xbufp->tail[0].iov_len;
2002+
2003+
xprt_init_majortimeo(task, req, req->rq_xprt->timeout);
19992004
}
20002005
#endif
20012006

0 commit comments

Comments
 (0)