diff -u --recursive --new-file linux-2.4.19-rpc_rtt1/include/linux/sunrpc/timer.h linux-2.4.19-rpc_rtt2/include/linux/sunrpc/timer.h --- linux-2.4.19-rpc_rtt1/include/linux/sunrpc/timer.h Thu Aug 1 12:11:29 2002 +++ linux-2.4.19-rpc_rtt2/include/linux/sunrpc/timer.h Thu Aug 1 12:13:09 2002 @@ -9,10 +9,13 @@ #ifndef _LINUX_SUNRPC_TIMER_H #define _LINUX_SUNRPC_TIMER_H +#include + struct rpc_rtt { long timeo; /* default timeout value */ long srtt[5]; /* smoothed round trip time << 3 */ long sdrtt[5]; /* soothed medium deviation of RTT */ + atomic_t ntimeouts; /* Global count of the number of timeouts */ }; @@ -20,4 +23,19 @@ extern void rpc_update_rtt(struct rpc_rtt *rt, int timer, long m); extern long rpc_calc_rto(struct rpc_rtt *rt, int timer); +static inline void rpc_inc_timeo(struct rpc_rtt *rt) +{ + atomic_inc(&rt->ntimeouts); +} + +static inline void rpc_clear_timeo(struct rpc_rtt *rt) +{ + atomic_set(&rt->ntimeouts, 0); +} + +static inline int rpc_ntimeo(struct rpc_rtt *rt) +{ + return atomic_read(&rt->ntimeouts); +} + #endif /* _LINUX_SUNRPC_TIMER_H */ diff -u --recursive --new-file linux-2.4.19-rpc_rtt1/net/sunrpc/clnt.c linux-2.4.19-rpc_rtt2/net/sunrpc/clnt.c --- linux-2.4.19-rpc_rtt1/net/sunrpc/clnt.c Thu Aug 1 12:11:29 2002 +++ linux-2.4.19-rpc_rtt2/net/sunrpc/clnt.c Thu Aug 1 12:13:09 2002 @@ -675,7 +675,7 @@ rpc_exit(task, -EIO); return; } - if (clnt->cl_chatty && !(task->tk_flags & RPC_CALL_MAJORSEEN)) { + if (clnt->cl_chatty && !(task->tk_flags & RPC_CALL_MAJORSEEN) && rpc_ntimeo(&clnt->cl_rtt) > 7) { task->tk_flags |= RPC_CALL_MAJORSEEN; if (req) printk(KERN_NOTICE "%s: server %s not responding, still trying\n", diff -u --recursive --new-file linux-2.4.19-rpc_rtt1/net/sunrpc/timer.c linux-2.4.19-rpc_rtt2/net/sunrpc/timer.c --- linux-2.4.19-rpc_rtt1/net/sunrpc/timer.c Thu Aug 1 12:11:29 2002 +++ linux-2.4.19-rpc_rtt2/net/sunrpc/timer.c Thu Aug 1 12:13:09 2002 @@ -22,6 +22,7 @@ rt->srtt[i] = t; rt->sdrtt[i] = RPC_RTO_INIT; } + atomic_set(&rt->ntimeouts, 0); } void diff -u --recursive --new-file linux-2.4.19-rpc_rtt1/net/sunrpc/xprt.c linux-2.4.19-rpc_rtt2/net/sunrpc/xprt.c --- linux-2.4.19-rpc_rtt1/net/sunrpc/xprt.c Thu Aug 1 12:11:29 2002 +++ linux-2.4.19-rpc_rtt2/net/sunrpc/xprt.c Thu Aug 1 12:13:09 2002 @@ -498,6 +498,8 @@ int timer = rpcproc_timer(clnt, task->tk_msg.rpc_proc); if (timer) rpc_update_rtt(&clnt->cl_rtt, timer, (long)jiffies - req->rq_xtime); + } + rpc_clear_timeo(&clnt->cl_rtt); } #ifdef RPC_PROFILE @@ -947,6 +949,7 @@ if (req->rq_received) goto out; req->rq_nresend++; + rpc_inc_timeo(&task->tk_client->cl_rtt); xprt_adjust_cwnd(xprt, -ETIMEDOUT); dprintk("RPC: %4d xprt_timer (%s request)\n",