Skip to contentSkip to conversation

repair nfsd/sunrpc in 2.6.14-rc2-mm1 (and other -mm versions)

PATCH In review Max Kellermann 2 participants 2 messages Sep 22, 2005

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 repair nfsd/sunrpc in 2.6.14-rc2-mm1 (and other -mm versions)

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

net/sunrpc/pmap_clnt.c renamed from net/sunrpc/pmap_clnt.c.orig +0 -1
@@ -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,
#1 lore raw
Quoted 14 lines · Max Kellermann

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
Quoted 6 lines

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?

Quoted 12 lines

[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,