All of lore.kernel.org
 help / color / mirror / Atom feed
* Regression: NFS locking hangs when statd not running.
@ 2006-10-20 10:23 Neil Brown
  2006-10-20 12:41 ` Olaf Kirch
  0 siblings, 1 reply; 7+ messages in thread
From: Neil Brown @ 2006-10-20 10:23 UTC (permalink / raw)
  To: nfs; +Cc: Takashi Iwai, Chuck Lever


Hi Chunk et.al.

 There seems to be a regression in 2.6.19-rc which I'm blaming 
 on you  :-)
 I should haste to say that I think you fixed something in the RPC
 layer and this as exposed a new problem.  I'm hoping that you can
 tell me if my analysis can patch make sense.

 In call_bind_status (net/sunrpc/clnt.c) there is code to handle the
 case where portmap has reported that the program/version is
 unavailable (via -EACCES).
 It requests a 3 second delay followed by a retry.  This can be expected
 to recur until a major timeout.

 In 2.6.18, this code is never exercised.  I'm not sure of exactly
 why, but when the portmap sub-task aborts, the whole task aborts.
 In 2.6.19-rc, this case is exercised.  I assume you fixed something
 so that the whole task doesn't get aborted.

 The problem is that there is a case where we don't want the retry.

 In 2.6.18, if statd isn't running, then a lock attempt returns ENOLCK
 immediately, which I think is good.
 In 2.6.19-rc, in the same situation, a lock attempt waits for a major
 timeout (30 seconds for TCP mounts) and is not interruptible for this
 whole time (even with '-o intr' mounts).

 So: what to do?  Should we retry requests when portmap says "no such
 service".

 I think that for requests to a remote service - lockd or nfsd - we do
 want to retry.  The server might be rebooting and so "no such
 service" should be treated much like "no reply".
 
 However for local services - statd - I don't think the timeout is
 desired.   So I would like to propose the following patch.  It
 introduces a new flag 'local' that gets set for statd requests and
 causes the call_bind_status to abort rather than retry after a
 timeout. 
 It also sets RPC_CLNT_CREATE_NOPING as I couldn't see an obvious way
 to pass 'local' through to the ping request.  Maybe this aspect of
 the patch can be improved.

 This also raises another issues.  The 'soft' and 'intr' flags aren't
 really passed around very much.  An 'intr' mount still makes 'nointr'
 requests to statd, and an 'intr,hard' rpc request will make a
 'nointr,soft' request to portmap for binding.  This doesn't seem
 right though I'm not certain if there are bad consequences.
 Have you thought about this issue?  Would you like to convince me
 that the current situation is fine?

Thanks for listening,
Comments on the patch appreciated.
NeilBrown

Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./fs/lockd/mon.c              |    4 +++-
 ./include/linux/sunrpc/clnt.h |    2 ++
 ./net/sunrpc/clnt.c           |    4 ++++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff .prev/fs/lockd/mon.c ./fs/lockd/mon.c
--- .prev/fs/lockd/mon.c	2006-10-20 16:30:56.000000000 +1000
+++ ./fs/lockd/mon.c	2006-10-20 18:45:49.000000000 +1000
@@ -138,7 +138,9 @@ nsm_create(void)
 		.program	= &nsm_program,
 		.version	= SM_VERSION,
 		.authflavor	= RPC_AUTH_NULL,
-		.flags		= (RPC_CLNT_CREATE_ONESHOT),
+		.flags		= (RPC_CLNT_CREATE_ONESHOT|
+				   RPC_CLNT_CREATE_NOPING|
+				   RPC_CLNT_CREATE_LOCAL),
 	};
 
 	return rpc_create(&args);

diff .prev/include/linux/sunrpc/clnt.h ./include/linux/sunrpc/clnt.h
--- .prev/include/linux/sunrpc/clnt.h	2006-10-20 16:24:50.000000000 +1000
+++ ./include/linux/sunrpc/clnt.h	2006-10-20 18:41:24.000000000 +1000
@@ -42,6 +42,7 @@ struct rpc_clnt {
 				cl_intr     : 1,/* interruptible */
 				cl_autobind : 1,/* use getport() */
 				cl_oneshot  : 1,/* dispose after use */
+				cl_local    : 1, /* don't retry if not registered */
 				cl_dead     : 1;/* abandoned */
 
 	struct rpc_rtt *	cl_rtt;		/* RTO estimator data */
@@ -110,6 +111,7 @@ struct rpc_create_args {
 #define RPC_CLNT_CREATE_ONESHOT		(1UL << 3)
 #define RPC_CLNT_CREATE_NONPRIVPORT	(1UL << 4)
 #define RPC_CLNT_CREATE_NOPING		(1UL << 5)
+#define RPC_CLNT_CREATE_LOCAL		(1UL << 6)
 
 struct rpc_clnt *rpc_create(struct rpc_create_args *args);
 struct rpc_clnt	*rpc_bind_new_program(struct rpc_clnt *,

diff .prev/net/sunrpc/clnt.c ./net/sunrpc/clnt.c
--- .prev/net/sunrpc/clnt.c	2006-10-20 15:21:14.000000000 +1000
+++ ./net/sunrpc/clnt.c	2006-10-20 18:42:07.000000000 +1000
@@ -238,6 +238,8 @@ struct rpc_clnt *rpc_create(struct rpc_c
 		clnt->cl_autobind = 1;
 	if (args->flags & RPC_CLNT_CREATE_ONESHOT)
 		clnt->cl_oneshot = 1;
+	if (args->flags & RPC_CLNT_CREATE_LOCAL)
+		clnt->cl_local = 1;
 
 	return clnt;
 }
@@ -860,6 +862,8 @@ call_bind_status(struct rpc_task *task)
 	case -EACCES:
 		dprintk("RPC: %4d remote rpcbind: RPC program/version unavailable\n",
 				task->tk_pid);
+		if (task->tk_client->cl_local)
+			break;
 		rpc_delay(task, 3*HZ);
 		goto retry_timeout;
 	case -ETIMEDOUT:

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

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

end of thread, other threads:[~2006-10-24  2:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-20 10:23 Regression: NFS locking hangs when statd not running Neil Brown
2006-10-20 12:41 ` Olaf Kirch
2006-10-20 13:00   ` Chuck Lever
2006-10-24  1:26     ` Neil Brown
2006-10-24  1:06   ` Neil Brown
2006-10-24  1:53     ` Trond Myklebust
2006-10-24  2:17       ` Neil Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.