public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] SUNRPC: Fix possible autodisconnect during connect due to stale last_used
@ 2019-06-26 19:50 Dave Wysochanski
  2019-06-26 20:11 ` Trond Myklebust
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Wysochanski @ 2019-06-26 19:50 UTC (permalink / raw)
  To: trondmy; +Cc: linux-nfs

When a connection is successful ensure last_used is updated before calling
xprt_schedule_autodisconnect inside xprt_unlock_connect.  This avoids a
possible xprt_autoclose firing immediately after connect sequence due to
an old value of last_used given to mod_timer in xprt_schedule_autodisconnect.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 net/sunrpc/xprt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index f6c82b1..fceaede 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -800,6 +800,7 @@ void xprt_unlock_connect(struct rpc_xprt *xprt, void *cookie)
 		goto out;
 	xprt->snd_task =NULL;
 	xprt->ops->release_xprt(xprt, NULL);
+	xprt->last_used = jiffies;
 	xprt_schedule_autodisconnect(xprt);
 out:
 	spin_unlock_bh(&xprt->transport_lock);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] SUNRPC: Fix possible autodisconnect during connect due to stale last_used
  2019-06-26 19:50 [PATCH] SUNRPC: Fix possible autodisconnect during connect due to stale last_used Dave Wysochanski
@ 2019-06-26 20:11 ` Trond Myklebust
  2019-06-26 20:14   ` Dave Wysochanski
  2019-06-26 20:30   ` [PATCH] SUNRPC: Fix possible autodisconnect during connect due to old last_used Dave Wysochanski
  0 siblings, 2 replies; 4+ messages in thread
From: Trond Myklebust @ 2019-06-26 20:11 UTC (permalink / raw)
  To: dwysocha@redhat.com; +Cc: linux-nfs@vger.kernel.org

On Wed, 2019-06-26 at 15:50 -0400, Dave Wysochanski wrote:
> When a connection is successful ensure last_used is updated before
> calling
> xprt_schedule_autodisconnect inside xprt_unlock_connect.  This avoids
> a
> possible xprt_autoclose firing immediately after connect sequence due
> to
> an old value of last_used given to mod_timer in
> xprt_schedule_autodisconnect.
> 
> Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
> ---
>  net/sunrpc/xprt.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
> index f6c82b1..fceaede 100644
> --- a/net/sunrpc/xprt.c
> +++ b/net/sunrpc/xprt.c
> @@ -800,6 +800,7 @@ void xprt_unlock_connect(struct rpc_xprt *xprt,
> void *cookie)
>  		goto out;
>  	xprt->snd_task =NULL;
>  	xprt->ops->release_xprt(xprt, NULL);
> +	xprt->last_used = jiffies;
>  	xprt_schedule_autodisconnect(xprt);
>  out:
>  	spin_unlock_bh(&xprt->transport_lock);

Let's just move that line into xprt_schedule_autodisconnect(), since in
practice this means all callers are doing the same thing.

-- 
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] SUNRPC: Fix possible autodisconnect during connect due to stale last_used
  2019-06-26 20:11 ` Trond Myklebust
@ 2019-06-26 20:14   ` Dave Wysochanski
  2019-06-26 20:30   ` [PATCH] SUNRPC: Fix possible autodisconnect during connect due to old last_used Dave Wysochanski
  1 sibling, 0 replies; 4+ messages in thread
From: Dave Wysochanski @ 2019-06-26 20:14 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-nfs@vger.kernel.org

On Wed, 2019-06-26 at 20:11 +0000, Trond Myklebust wrote:
> On Wed, 2019-06-26 at 15:50 -0400, Dave Wysochanski wrote:
> > When a connection is successful ensure last_used is updated before
> > calling
> > xprt_schedule_autodisconnect inside xprt_unlock_connect.  This
> > avoids
> > a
> > possible xprt_autoclose firing immediately after connect sequence
> > due
> > to
> > an old value of last_used given to mod_timer in
> > xprt_schedule_autodisconnect.
> > 
> > Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
> > ---
> >  net/sunrpc/xprt.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
> > index f6c82b1..fceaede 100644
> > --- a/net/sunrpc/xprt.c
> > +++ b/net/sunrpc/xprt.c
> > @@ -800,6 +800,7 @@ void xprt_unlock_connect(struct rpc_xprt *xprt,
> > void *cookie)
> >  		goto out;
> >  	xprt->snd_task =NULL;
> >  	xprt->ops->release_xprt(xprt, NULL);
> > +	xprt->last_used = jiffies;
> >  	xprt_schedule_autodisconnect(xprt);
> >  out:
> >  	spin_unlock_bh(&xprt->transport_lock);
> 
> Let's just move that line into xprt_schedule_autodisconnect(), since
> in
> practice this means all callers are doing the same thing.
> 
> 

Will do and resubmit - thanks!


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] SUNRPC: Fix possible autodisconnect during connect due to old last_used
  2019-06-26 20:11 ` Trond Myklebust
  2019-06-26 20:14   ` Dave Wysochanski
@ 2019-06-26 20:30   ` Dave Wysochanski
  1 sibling, 0 replies; 4+ messages in thread
From: Dave Wysochanski @ 2019-06-26 20:30 UTC (permalink / raw)
  To: trondmy; +Cc: linux-nfs

Ensure last_used is updated before calling mod_timer inside
xprt_schedule_autodisconnect.  This avoids a possible xprt_autoclose
firing immediately after a successful connect when xprt_unlock_connect
calls xprt_schedule_autodisconnect with an old value of last_used.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
 net/sunrpc/xprt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index f6c82b1..871b904 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -750,6 +750,7 @@ void xprt_conditional_disconnect(struct rpc_xprt *xprt, unsigned int cookie)
 xprt_schedule_autodisconnect(struct rpc_xprt *xprt)
 	__must_hold(&xprt->transport_lock)
 {
+	xprt->last_used = jiffies;
 	if (RB_EMPTY_ROOT(&xprt->recv_queue) && xprt_has_timer(xprt))
 		mod_timer(&xprt->timer, xprt->last_used + xprt->idle_timeout);
 }
@@ -1774,7 +1775,6 @@ void xprt_release(struct rpc_task *task)
 	xprt->ops->release_xprt(xprt, task);
 	if (xprt->ops->release_request)
 		xprt->ops->release_request(task);
-	xprt->last_used = jiffies;
 	xprt_schedule_autodisconnect(xprt);
 	spin_unlock_bh(&xprt->transport_lock);
 	if (req->rq_buffer)
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-26 20:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-26 19:50 [PATCH] SUNRPC: Fix possible autodisconnect during connect due to stale last_used Dave Wysochanski
2019-06-26 20:11 ` Trond Myklebust
2019-06-26 20:14   ` Dave Wysochanski
2019-06-26 20:30   ` [PATCH] SUNRPC: Fix possible autodisconnect during connect due to old last_used Dave Wysochanski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox