linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Myklebust, Trond" <Trond.Myklebust@netapp.com>
To: Jeff Layton <jlayton@redhat.com>
Cc: Nix <nix@esperi.org.uk>,
	"Toralf Förster" <toralf.foerster@gmx.de>,
	"Oleg Nesterov" <oleg@redhat.com>,
	"NFS list" <linux-nfs@vger.kernel.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"dhowells@redhat.com" <dhowells@redhat.com>
Subject: Re: [3.10.4] NFS locking panic, plus persisting NFS shutdown panic from 3.9.*
Date: Mon, 5 Aug 2013 18:18:03 +0000	[thread overview]
Message-ID: <1375726682.7337.29.camel@leira.trondhjem.org> (raw)
In-Reply-To: <20130805133739.21654ecb@tlielax.poochiereds.net>

[-- Attachment #1: Type: text/plain, Size: 3038 bytes --]

On Mon, 2013-08-05 at 13:37 -0400, Jeff Layton wrote:
> On Mon, 5 Aug 2013 16:15:01 +0000
> "Myklebust, Trond" <Trond.Myklebust@netapp.com> wrote:
> 
> > From 3c50ba80105464a28d456d9a1e0f1d81d4af92a8 Mon Sep 17 00:00:00 2001
> > From: Trond Myklebust <Trond.Myklebust@netapp.com>
> > Date: Mon, 5 Aug 2013 12:06:12 -0400
> > Subject: [PATCH] LOCKD: Don't call utsname()->nodename from
> >  nlmclnt_setlockargs
> > MIME-Version: 1.0
> > Content-Type: text/plain; charset=UTF-8
> > Content-Transfer-Encoding: 8bit
> > 
> > Firstly, nlmclnt_setlockargs can be called from a reclaimer thread, in
> > which case we're in entirely the wrong namespace.
> > Secondly, commit 8aac62706adaaf0fab02c4327761561c8bda9448 (move
> > exit_task_namespaces() outside of exit_notify()) now means that
> > exit_task_work() is called after exit_task_namespaces(), which
> > triggers an Oops when we're freeing up the locks.
> > 
> > Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
> > Cc: Toralf Förster <toralf.foerster@gmx.de>
> > Cc: Oleg Nesterov <oleg@redhat.com>
> > Cc: Nix <nix@esperi.org.uk>
> > Cc: Jeff Layton <jlayton@redhat.com>
> > ---
> >  fs/lockd/clntproc.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
> > index 9760ecb..acd3947 100644
> > --- a/fs/lockd/clntproc.c
> > +++ b/fs/lockd/clntproc.c
> > @@ -125,14 +125,15 @@ static void nlmclnt_setlockargs(struct nlm_rqst *req, struct file_lock *fl)
> >  {
> >  	struct nlm_args	*argp = &req->a_args;
> >  	struct nlm_lock	*lock = &argp->lock;
> > +	char *nodename = req->a_host->h_rpcclnt->cl_nodename;
> >  
> >  	nlmclnt_next_cookie(&argp->cookie);
> >  	memcpy(&lock->fh, NFS_FH(file_inode(fl->fl_file)), sizeof(struct nfs_fh));
> > -	lock->caller  = utsname()->nodename;
> > +	lock->caller  = nodename;
> >  	lock->oh.data = req->a_owner;
> >  	lock->oh.len  = snprintf(req->a_owner, sizeof(req->a_owner), "%u@%s",
> >  				(unsigned int)fl->fl_u.nfs_fl.owner->pid,
> > -				utsname()->nodename);
> > +				nodename);
> >  	lock->svid = fl->fl_u.nfs_fl.owner->pid;
> >  	lock->fl.fl_start = fl->fl_start;
> >  	lock->fl.fl_end = fl->fl_end;
> 
> Looks good to me...
> 
> Reviewed-by: Jeff Layton <jlayton@redhat.com>
> 
> Trond, any thoughts on the other oops that Nix posted? The issue there
> seems to be that we're trying to do the pathwalk to the rpcbind unix
> socket from exit_task_work(), but that's happening after we've already
> called exit_fs().
> 
> The trivial answer seems to be to simply call exit_task_work() before
> exit_fs() there, but it seems like we ought to be doing the upcall to
> rpcbind in a mount namespace from which we know we can reach the
> socket...

Isn't it enough to just do the same thing as we did for gss proxy? i.e.
set the RPC_CLNT_CREATE_NO_IDLE_TIMEOUT flag.

See attachment.
-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-SUNRPC-Don-t-auto-disconnect-from-the-local-rpcbind-.patch --]
[-- Type: text/x-patch; name="0001-SUNRPC-Don-t-auto-disconnect-from-the-local-rpcbind-.patch", Size: 1452 bytes --]

From ab56d77893815b1b9f0aaa7a89cee7c832a31cff Mon Sep 17 00:00:00 2001
From: Trond Myklebust <Trond.Myklebust@netapp.com>
Date: Mon, 5 Aug 2013 14:10:43 -0400
Subject: [PATCH] SUNRPC: Don't auto-disconnect from the local rpcbind socket

There is no need for the kernel to time out the AF_LOCAL connection to
the rpcbind socket, and doing so is problematic because when it is
time to reconnect, our process may no longer be using the same mount
namespace.

Reported-by: Nix <nix@esperi.org.uk>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Jeff Layton <jlayton@redhat.com>
Cc: stable@vger.kernel.org # 3.9.x
---
 net/sunrpc/rpcb_clnt.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index 3df764d..4b00555 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -238,6 +238,15 @@ static int rpcb_create_local_unix(struct net *net)
 		.program	= &rpcb_program,
 		.version	= RPCBVERS_2,
 		.authflavor	= RPC_AUTH_NULL,
+		/*
+		 * We turn off the idle timeout to prevent the kernel
+		 * from automatically disconnecting the socket.
+		 * Otherwise, we'd have to cache the mount namespace
+		 * of the caller and somehow pass that to the socket
+		 * reconnect code.
+		 */
+		.flags		= RPC_CLNT_CREATE_NOPING |
+				  RPC_CLNT_CREATE_NO_IDLE_TIMEOUT,
 	};
 	struct rpc_clnt *clnt, *clnt4;
 	int result = 0;
-- 
1.8.3.1


  reply	other threads:[~2013-08-05 18:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-04 15:40 [3.10.4] NFS locking panic, plus persisting NFS shutdown panic from 3.9.* Nix
2013-08-05 12:44 ` Jeff Layton
2013-08-05 14:48   ` Nix
2013-08-05 15:04     ` Jeff Layton
2013-08-05 15:11       ` Jeff Layton
2013-08-05 15:50         ` Nix
2013-08-05 16:15           ` Myklebust, Trond
2013-08-05 17:37             ` Jeff Layton
2013-08-05 18:18               ` Myklebust, Trond [this message]
2013-08-05 18:33                 ` Jeff Layton
2013-08-06  2:21                   ` Myklebust, Trond
2013-08-06  9:24                     ` Jeff Layton
2013-08-07 10:18                     ` Nix
2013-08-07 15:27                       ` Myklebust, Trond
2013-08-07 21:01                         ` Nix
2013-08-07 21:09                           ` Myklebust, Trond
2013-08-05 18:33             ` Nix
2013-08-05 19:12               ` Myklebust, Trond
2013-08-06 20:46                 ` Nix
2013-08-05 16:21           ` Jeff Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1375726682.7337.29.camel@leira.trondhjem.org \
    --to=trond.myklebust@netapp.com \
    --cc=dhowells@redhat.com \
    --cc=jlayton@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=nix@esperi.org.uk \
    --cc=oleg@redhat.com \
    --cc=toralf.foerster@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).