public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] repair nfsd/sunrpc in 2.6.14-rc2-mm1 (and other -mm versions)
@ 2005-09-22 13:04 Max Kellermann
  2005-09-22 19:27 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Max Kellermann @ 2005-09-22 13:04 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Avuton Olrich

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

Hi Andrew,

nfsd is still broken in 2.6.14-rc2-mm1; the following procedure is
reproducable:

 rabbit:~# echo 2 >/proc/fs/nfsd/threads 

... /var/log/daemon.log says:

 Sep 22 13:52:55 rabbit kernel: NFSD: Using /var/lib/nfs/v4recovery as
 the NFSv4 state recovery directory
 Sep 22 13:52:55 rabbit kernel: NFSD: starting 90-second grace period
 Sep 22 13:52:55 rabbit portmap[3191]: connect from 127.0.0.1 to
 set(nfs): request from unprivileged port

Your -mm patches make the sunrpc client connect to the portmapper with
a non-privileged source port.  This is due to a change in
net/sunrpc/pmap_clnt.c, which manually resets the xprt->resvport
field.  My tiny patch removes this line.  I have no idea why the line
was added in the first place, does somebody know better?

Max


[-- Attachment #2: nfsd-pmap-fix-privileged-port.patch --]
[-- Type: text/plain, Size: 397 bytes --]

--- linux-2.6.14-rc2-mm1/net/sunrpc/pmap_clnt.c.orig	2005-09-22 14:58:14.000000000 +0200
+++ linux-2.6.14-rc2-mm1/net/sunrpc/pmap_clnt.c	2005-09-22 14:58:16.000000000 +0200
@@ -208,7 +208,6 @@
 	if (IS_ERR(xprt))
 		return (struct rpc_clnt *)xprt;
 	xprt->addr.sin_port = htons(RPC_PMAP_PORT);
-	xprt->resvport = 0;
 
 	/* printk("pmap: create clnt\n"); */
 	clnt = rpc_new_client(xprt, hostname,

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

* Re: [PATCH] repair nfsd/sunrpc in 2.6.14-rc2-mm1 (and other -mm versions)
       [not found] <mailman.1127394541.15384.linux-kernel2news@redhat.com>
@ 2005-09-22 14:02 ` Steve Dickson
  0 siblings, 0 replies; 3+ messages in thread
From: Steve Dickson @ 2005-09-22 14:02 UTC (permalink / raw)
  To: linux-kernel; +Cc: NFS

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

Max Kellermann wrote:
> Your -mm patches make the sunrpc client connect to the portmapper with
> a non-privileged source port.  This is due to a change in
> net/sunrpc/pmap_clnt.c, which manually resets the xprt->resvport
> field.  My tiny patch removes this line.  I have no idea why the line
> was added in the first place, does somebody know better?
Yes this is a bug, since most Linux portmapper will not
allow ports to be set or unset using non-privilege ports.
But non-privilege ports can be used to get ports information.
So I would suggest the following patch that stops the
use of privileges ports on only get port requests.

steved.

[-- Attachment #2: 2.6.14-rc2-mm1-sunrpc-getports.patch --]
[-- Type: text/x-patch, Size: 996 bytes --]

Privilege ports are need for services to set and unset ports, but
are not needed to get ports. This patch eliminates the use of
privilege ports for PMAP_GETPORT rpcs and restores the use
of privilege ports for PMAP_SET  and  PMAP_UNSET rpcs.

Signed-off-by: Steve Dickson <steved@redhat.com>

-------------------------
--- 2.6.14-rc2-mm1/net/sunrpc/pmap_clnt.c.orig	2005-09-22 09:42:28.394681000 -0400
+++ 2.6.14-rc2-mm1/net/sunrpc/pmap_clnt.c	2005-09-22 09:52:51.777617000 -0400
@@ -70,6 +70,8 @@ rpc_getport(struct rpc_task *task, struc
 		task->tk_status = PTR_ERR(pmap_clnt);
 		goto bailout;
 	}
+	/* Don't need reserved ports to get ports from portmappers */
+	pmap_clnt->cl_xprt->resvport = 0;
 	task->tk_status = 0;
 
 	/*
@@ -208,7 +210,6 @@ pmap_create(char *hostname, struct socka
 	if (IS_ERR(xprt))
 		return (struct rpc_clnt *)xprt;
 	xprt->addr.sin_port = htons(RPC_PMAP_PORT);
-	xprt->resvport = 0;
 
 	/* printk("pmap: create clnt\n"); */
 	clnt = rpc_new_client(xprt, hostname,

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

* Re: [PATCH] repair nfsd/sunrpc in 2.6.14-rc2-mm1 (and other -mm versions)
  2005-09-22 13:04 Max Kellermann
@ 2005-09-22 19:27 ` Andrew Morton
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2005-09-22 19:27 UTC (permalink / raw)
  To: Max Kellermann; +Cc: linux-kernel, avuton, Trond Myklebust

Max Kellermann <max@duempel.org> wrote:
>
> nfsd is still broken in 2.6.14-rc2-mm1; the following procedure is
>  reproducable:
> 
>   rabbit:~# echo 2 >/proc/fs/nfsd/threads 
> 
>  ... /var/log/daemon.log says:
> 
>   Sep 22 13:52:55 rabbit kernel: NFSD: Using /var/lib/nfs/v4recovery as
>   the NFSv4 state recovery directory
>   Sep 22 13:52:55 rabbit kernel: NFSD: starting 90-second grace period
>   Sep 22 13:52:55 rabbit portmap[3191]: connect from 127.0.0.1 to
>   set(nfs): request from unprivileged port
> 
>  Your -mm patches make the sunrpc client connect to the portmapper with
>  a non-privileged source port.  This is due to a change in
>  net/sunrpc/pmap_clnt.c, which manually resets the xprt->resvport
>  field.  My tiny patch removes this line.  I have no idea why the line
>  was added in the first place, does somebody know better?
> 

That change comes from Trond's git tree.  I don't know why the change was
made.

Trond, rsync://client.linux-nfs.org/pub/linux/nfs-2.6.git hasn't been
updated in quite some time, I think.  I still need to revert the oopsy
rpc_mkdir() change.  Am I using the right tree?

> 
> [nfsd-pmap-fix-privileged-port.patch  text/plain (522 bytes)]
>  --- linux-2.6.14-rc2-mm1/net/sunrpc/pmap_clnt.c.orig	2005-09-22 14:58:14.000000000 +0200
>  +++ linux-2.6.14-rc2-mm1/net/sunrpc/pmap_clnt.c	2005-09-22 14:58:16.000000000 +0200
>  @@ -208,7 +208,6 @@
>   	if (IS_ERR(xprt))
>   		return (struct rpc_clnt *)xprt;
>   	xprt->addr.sin_port = htons(RPC_PMAP_PORT);
>  -	xprt->resvport = 0;
>   
>   	/* printk("pmap: create clnt\n"); */
>   	clnt = rpc_new_client(xprt, hostname,


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

end of thread, other threads:[~2005-09-22 19:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1127394541.15384.linux-kernel2news@redhat.com>
2005-09-22 14:02 ` [PATCH] repair nfsd/sunrpc in 2.6.14-rc2-mm1 (and other -mm versions) Steve Dickson
2005-09-22 13:04 Max Kellermann
2005-09-22 19:27 ` Andrew Morton

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