Skip to contentSkip to conversation

nfsd changes for 2.6.34

PATCH New J. Bruce Fields 3 participants 12 messages Mar 6, 2010 – Apr 21, 2010

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

Please pull the following nfsd changes from the 'nfsd' branch at:

git://linux-nfs.org/~bfields/linux.git for-2.6.34 nfsd

This is an unusually quiet cycle for the NFS server--bugfixes, some IPv6 progress, and one new export operation to improve sync performance.

One exception to the 'mostly quiet' statement was a regression in the rpc code which hit a lot of people: enormous thanks to Neil for tracking that down.

--b.

Aime Le Rouzic (1):
NFSD: Support AF_INET6 in svc_addsock() function

Ben Myers (2):
commit_metadata export operation replacing nfsd_sync_dir xfs_export_operations.commit_metadata

Christoph Hellwig (1):
nfsd: use vfs_fsync for non-directories

Chuck Lever (5):
SUNRPC: Use rpc_pton() in ip_map_parse()
SUNRPC: Bury "#ifdef IPV6" in svc_create_xprt()
SUNRPC: NFS kernel APIs shouldn't return ENOENT for "transport not found"
NFSD: Create PF_INET6 listener in write_ports
NFSD: NFSv4 callback client should use RPC_TASK_SOFTCONN

J. Bruce Fields (6):
nfsd: 4.1 has an rfc number
Revert "sunrpc: fix peername failed on closed listener"
Revert "sunrpc: move the close processing after do recvfrom method"
svcrpc: treat uid's as unsigned
nfsd4: fix minor memory leak
Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs into for-2.6.34-incoming

Jeff Layton (2):
lockd: release reference to nsm_handle in nlm_host_rebooted
lockd: don't clear sm_monitored on nsm_reboot_lookup

Neil Brown (2):
sunrpc: remove unnecessary svc_xprt_put
nfsd: ensure sockets are closed on error

Ricardo Labiaga (3):
nfsd41: nfsd4_decode_compound() does not recognize all ops
nfsd4: Use FIRST_NFS4_OP in nfsd4_decode_compound()
nfsd41: Create the recovery entry for the NFSv4.1 client

Trond Myklebust (1):
nfsd: Use vfs_fsync_range() in nfsd_commit

 Documentation/filesystems/nfs/nfs41-server.txt |    5 +-
 fs/lockd/host.c                                |    2 +-
 fs/lockd/mon.c                                 |   12 +--
 fs/lockd/svc.c                                 |    2 -
 fs/nfs/callback.c                              |    2 -
 fs/nfsd/nfs4callback.c                         |    5 +-
 fs/nfsd/nfs4recover.c                          |    4 +-
 fs/nfsd/nfs4state.c                            |    4 +-
 fs/nfsd/nfs4xdr.c                              |    2 +-
 fs/nfsd/nfsctl.c                               |   24 +++-
 fs/nfsd/vfs.c                                  |  153 +++++++++++------------
 fs/xfs/linux-2.6/xfs_export.c                  |   20 +++
 include/linux/exportfs.h                       |    5 +
 net/sunrpc/svc_xprt.c                          |   27 ++--
 net/sunrpc/svcauth_unix.c                      |   49 ++++----
 net/sunrpc/svcsock.c                           |    3 +-
 16 files changed, 174 insertions(+), 145 deletions(-)
#1 lore raw
Quoted 10 lines · bfields

Please pull the following nfsd changes from the 'nfsd' branch at:

git://linux-nfs.org/~bfields/linux.git for-2.6.34 nfsd

This is an unusually quiet cycle for the NFS server--bugfixes, some IPv6 progress, and one new export operation to improve sync performance.

One exception to the 'mostly quiet' statement was a regression in the rpc code which hit a lot of people: enormous thanks to Neil for tracking that down.

However, I forgot to Cc stable on all of those. Stable people, could you also take the following three commits?:

	f5822754ea006563e1bf0a1f43faaad49c0d8bb2 Revert "sunrpc: fix
	peername failed on closed listener"
	1b644b6e6f6160ae35ce4b52c2ca89ed3e356e18 Revert "sunrpc: move
	the close processing after do recvfrom method"
	301e99ce4a2f42a317129230fd42e6cd874c64b0 nfsd: ensure sockets
	are closed on error

Let me know if you need more information.

--b.

#2 lore raw
Quoted 15 lines · J. Bruce Fields
Quoted 10 lines · bfields

Please pull the following nfsd changes from the 'nfsd' branch at:

git://linux-nfs.org/~bfields/linux.git for-2.6.34 nfsd

This is an unusually quiet cycle for the NFS server--bugfixes, some IPv6 progress, and one new export operation to improve sync performance.

One exception to the 'mostly quiet' statement was a regression in the rpc code which hit a lot of people: enormous thanks to Neil for tracking that down.

However, I forgot to Cc stable on all of those. Stable people, could you also take the following three commits?:

Quoted 8 lines
	f5822754ea006563e1bf0a1f43faaad49c0d8bb2 Revert "sunrpc: fix
	peername failed on closed listener"
	1b644b6e6f6160ae35ce4b52c2ca89ed3e356e18 Revert "sunrpc: move
	the close processing after do recvfrom method"
	301e99ce4a2f42a317129230fd42e6cd874c64b0 nfsd: ensure sockets
	are closed on error

Let me know if you need more information.

I've queued all of these up for the .33 -stable tree. If any of them need to go into .32 (maybe that last one?), please let me know.

thanks,

greg k-h

#3 lore raw
Quoted 23 lines · Greg KH
Quoted 22 lines · J. Bruce Fields
Quoted 10 lines · bfields

Please pull the following nfsd changes from the 'nfsd' branch at:

git://linux-nfs.org/~bfields/linux.git for-2.6.34 nfsd

This is an unusually quiet cycle for the NFS server--bugfixes, some IPv6 progress, and one new export operation to improve sync performance.

One exception to the 'mostly quiet' statement was a regression in the rpc code which hit a lot of people: enormous thanks to Neil for tracking that down.

However, I forgot to Cc stable on all of those. Stable people, could you also take the following three commits?:

	f5822754ea006563e1bf0a1f43faaad49c0d8bb2 Revert "sunrpc: fix
	peername failed on closed listener"
	1b644b6e6f6160ae35ce4b52c2ca89ed3e356e18 Revert "sunrpc: move
	the close processing after do recvfrom method"
	301e99ce4a2f42a317129230fd42e6cd874c64b0 nfsd: ensure sockets
	are closed on error
Quoted 4 lines
Quoted 1 line

Let me know if you need more information.

I've queued all of these up for the .33 -stable tree. If any of them need to go into .32 (maybe that last one?), please let me know.

Thanks; .32 needs all three of those.

--b.

#4 lore raw
Quoted 24 lines · J. Bruce Fields
Quoted 23 lines · Greg KH
Quoted 22 lines · J. Bruce Fields
Quoted 10 lines · bfields

Please pull the following nfsd changes from the 'nfsd' branch at:

git://linux-nfs.org/~bfields/linux.git for-2.6.34 nfsd

This is an unusually quiet cycle for the NFS server--bugfixes, some IPv6 progress, and one new export operation to improve sync performance.

One exception to the 'mostly quiet' statement was a regression in the rpc code which hit a lot of people: enormous thanks to Neil for tracking that down.

However, I forgot to Cc stable on all of those. Stable people, could you also take the following three commits?:

	f5822754ea006563e1bf0a1f43faaad49c0d8bb2 Revert "sunrpc: fix
	peername failed on closed listener"
	1b644b6e6f6160ae35ce4b52c2ca89ed3e356e18 Revert "sunrpc: move
	the close processing after do recvfrom method"
	301e99ce4a2f42a317129230fd42e6cd874c64b0 nfsd: ensure sockets
	are closed on error
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Let me know if you need more information.

I've queued all of these up for the .33 -stable tree. If any of them need to go into .32 (maybe that last one?), please let me know.

Thanks; .32 needs all three of those.

Ok, care to backport them and send them to [email protected]? They don't all apply cleanly from what I can see.

thanks,

greg k-h

#5 lore raw
Quoted 27 lines · Greg KH
Quoted 26 lines · J. Bruce Fields
Quoted 25 lines · Greg KH
Quoted 23 lines · J. Bruce Fields
Quoted 10 lines · bfields

Please pull the following nfsd changes from the 'nfsd' branch at:

git://linux-nfs.org/~bfields/linux.git for-2.6.34 nfsd

This is an unusually quiet cycle for the NFS server--bugfixes, some IPv6 progress, and one new export operation to improve sync performance.

One exception to the 'mostly quiet' statement was a regression in the rpc code which hit a lot of people: enormous thanks to Neil for tracking that down.

However, I forgot to Cc stable on all of those. Stable people, could you also take the following three commits?:

	f5822754ea006563e1bf0a1f43faaad49c0d8bb2 Revert "sunrpc: fix
	peername failed on closed listener"
	1b644b6e6f6160ae35ce4b52c2ca89ed3e356e18 Revert "sunrpc: move
	the close processing after do recvfrom method"
	301e99ce4a2f42a317129230fd42e6cd874c64b0 nfsd: ensure sockets
	are closed on error

Let me know if you need more information.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

I've queued all of these up for the .33 -stable tree. If any of them need to go into .32 (maybe that last one?), please let me know.

Thanks; .32 needs all three of those.

Ok, care to backport them and send them to [email protected]? They don't all apply cleanly from what I can see.

Huh. I just checked out 2.6.32.10 and tried applying the patches a couple different ways, and the worst I got was stuff like:

patching file net/sunrpc/svc_xprt.c Hunk #1 succeeded at 711 (offset 5 lines).

Is that enough that you don't consider them clean?

In any case, I'll follow up with patches generated against 2.6.32.10.

--b.

#6 lore raw

PATCH 1/3 Revert "sunrpc: fix peername failed on closed listener"

This reverts commit b292cf9ce70d221c3f04ff62db5ab13d9a249ca8. The commit that it attempted to patch up, b0401d725334a94d57335790b8ac2404144748ee, was fundamentally wrong, and will also be reverted.

---
 net/sunrpc/svc_xprt.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
net/sunrpc/svc_xprt.c +1 -2
index dafd341..929f6db 100644
@@ -711,8 +711,7 @@ int svc_recv(struct svc_rqst *rqstp, long timeout)
 	spin_unlock_bh(&pool->sp_lock);
 
 	len = 0;
-	if (test_bit(XPT_LISTENER, &xprt->xpt_flags) &&
-	    !test_bit(XPT_CLOSE, &xprt->xpt_flags)) {
+	if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) {
 		struct svc_xprt *newxpt;
 		newxpt = xprt->xpt_ops->xpo_accept(xprt);
 		if (newxpt) {
Signature · 1 line
1.6.3.3
#7 lore raw

PATCH 2/3 Revert "sunrpc: move the close processing after do recvfrom method"

This reverts commit b0401d725334a94d57335790b8ac2404144748ee, which moved svc_delete_xprt() outside of XPT_BUSY, and allowed it to be called after svc_xpt_recived(), removing its last reference and destroying it after it had already been queued for future processing.

---
 net/sunrpc/svc_xprt.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)
net/sunrpc/svc_xprt.c +5 -7
index 929f6db..3fbd6ba 100644
@@ -711,7 +711,10 @@ int svc_recv(struct svc_rqst *rqstp, long timeout)
 	spin_unlock_bh(&pool->sp_lock);
 
 	len = 0;
-	if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) {
+	if (test_bit(XPT_CLOSE, &xprt->xpt_flags)) {
+		dprintk("svc_recv: found XPT_CLOSE\n");
+		svc_delete_xprt(xprt);
+	} else if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) {
 		struct svc_xprt *newxpt;
 		newxpt = xprt->xpt_ops->xpo_accept(xprt);
 		if (newxpt) {
@@ -737,7 +740,7 @@ int svc_recv(struct svc_rqst *rqstp, long timeout)
 			svc_xprt_received(newxpt);
 		}
 		svc_xprt_received(xprt);
-	} else if (!test_bit(XPT_CLOSE, &xprt->xpt_flags)) {
+	} else {
 		dprintk("svc: server %p, pool %u, transport %p, inuse=%d\n",
 			rqstp, pool->sp_id, xprt,
 			atomic_read(&xprt->xpt_ref.refcount));
@@ -750,11 +753,6 @@ int svc_recv(struct svc_rqst *rqstp, long timeout)
 		dprintk("svc: got len=%d\n", len);
 	}
 
-	if (test_bit(XPT_CLOSE, &xprt->xpt_flags)) {
-		dprintk("svc_recv: found XPT_CLOSE\n");
-		svc_delete_xprt(xprt);
-	}
-
 	/* No data, incomplete (TCP) read, or accept() */
 	if (len == 0 || len == -EAGAIN) {
 		rqstp->rq_res.len = 0;
Signature · 1 line
1.6.3.3
#8 lore raw

PATCH 3/3 nfsd: ensure sockets are closed on error

From: Neil Brown <[email protected]>

One the changes in commit d7979ae4a "svc: Move close processing to a single place" is:

err_delete:
- svc_delete_socket(svsk);

+       set_bit(SK_CLOSE, &svsk->sk_flags);
        return -EAGAIN;

This is insufficient. The recvfrom methods must always call svc_xprt_received on completion so that the socket gets re-queued if there is any more work to do. This particular path did not make that call because it actually destroyed the svsk, making requeue pointless. When the svc_delete_socket was change to just set a bit, we should have added a call to svc_xprt_received,

This is the problem that b0401d7253 attempted to fix, incorrectly.

---
 net/sunrpc/svcsock.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
net/sunrpc/svcsock.c +1 -0
index 1c246a4..70b0a22 100644
@@ -968,6 +968,7 @@ static int svc_tcp_recv_record(struct svc_sock *svsk, struct svc_rqst *rqstp)
 	return len;
  err_delete:
 	set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags);
+	svc_xprt_received(&svsk->sk_xprt);
  err_again:
 	return -EAGAIN;
 }
Signature · 1 line
1.6.3.3
#9 lore raw

PATCH 1/1 nfsd4: don't try to map gid's in generic rpc code

In reply to J. Bruce Fields

From: J. Bruce Fields <[email protected]>

For nfsd we provide users the option of mapping uid's to server-side supplementary group lists. That makes sense for nfsd, but not necessarily for other rpc users (such as the callback client).

So move that lookup to svcauth_unix_set_client, which is a program-specific method.

---
 net/sunrpc/svcauth_unix.c |   53 +++++++++++++++++++++++++-------------------
 1 files changed, 30 insertions(+), 23 deletions(-)
Quoted 1 line · J. Bruce Fields

In any case, I'll follow up with patches generated against 2.6.32.10.

Also, while testing those patches on 2.6.32, I noticed that 2.6.32.y doesn't include the following (unrelated) patch. Could you apply it as well? Thanks!

net/sunrpc/svcauth_unix.c +30 -23
index 117f68a..97cc3de 100644
@@ -655,23 +655,25 @@ static struct unix_gid *unix_gid_lookup(uid_t uid)
 		return NULL;
 }
 
-static int unix_gid_find(uid_t uid, struct group_info **gip,
-			 struct svc_rqst *rqstp)
+static struct group_info *unix_gid_find(uid_t uid, struct svc_rqst *rqstp)
 {
-	struct unix_gid *ug = unix_gid_lookup(uid);
+	struct unix_gid *ug;
+	struct group_info *gi;
+	int ret;
+
+	ug = unix_gid_lookup(uid);
 	if (!ug)
-		return -EAGAIN;
-	switch (cache_check(&unix_gid_cache, &ug->h, &rqstp->rq_chandle)) {
+		return ERR_PTR(-EAGAIN);
+	ret = cache_check(&unix_gid_cache, &ug->h, &rqstp->rq_chandle);
+	switch (ret) {
 	case -ENOENT:
-		*gip = NULL;
-		return 0;
+		return ERR_PTR(-ENOENT);
 	case 0:
-		*gip = ug->gi;
-		get_group_info(*gip);
+		gi = get_group_info(ug->gi);
 		cache_put(&ug->h, &unix_gid_cache);
-		return 0;
+		return gi;
 	default:
-		return -EAGAIN;
+		return ERR_PTR(-EAGAIN);
 	}
 }
 
@@ -681,6 +683,8 @@ svcauth_unix_set_client(struct svc_rqst *rqstp)
 	struct sockaddr_in *sin;
 	struct sockaddr_in6 *sin6, sin6_storage;
 	struct ip_map *ipm;
+	struct group_info *gi;
+	struct svc_cred *cred = &rqstp->rq_cred;
 
 	switch (rqstp->rq_addr.ss_family) {
 	case AF_INET:
@@ -722,6 +726,17 @@ svcauth_unix_set_client(struct svc_rqst *rqstp)
 			ip_map_cached_put(rqstp, ipm);
 			break;
 	}
+
+	gi = unix_gid_find(cred->cr_uid, rqstp);
+	switch (PTR_ERR(gi)) {
+	case -EAGAIN:
+		return SVC_DROP;
+	case -ENOENT:
+		break;
+	default:
+		put_group_info(cred->cr_group_info);
+		cred->cr_group_info = gi;
+	}
 	return SVC_OK;
 }
 
@@ -818,19 +833,11 @@ svcauth_unix_accept(struct svc_rqst *rqstp, __be32 *authp)
 	slen = svc_getnl(argv);			/* gids length */
 	if (slen > 16 || (len -= (slen + 2)*4) < 0)
 		goto badcred;
-	if (unix_gid_find(cred->cr_uid, &cred->cr_group_info, rqstp)
-	    == -EAGAIN)
+	cred->cr_group_info = groups_alloc(slen);
+	if (cred->cr_group_info == NULL)
 		return SVC_DROP;
-	if (cred->cr_group_info == NULL) {
-		cred->cr_group_info = groups_alloc(slen);
-		if (cred->cr_group_info == NULL)
-			return SVC_DROP;
-		for (i = 0; i < slen; i++)
-			GROUP_AT(cred->cr_group_info, i) = svc_getnl(argv);
-	} else {
-		for (i = 0; i < slen ; i++)
-			svc_getnl(argv);
-	}
+	for (i = 0; i < slen; i++)
+		GROUP_AT(cred->cr_group_info, i) = svc_getnl(argv);
 	if (svc_getu32(argv) != htonl(RPC_AUTH_NULL) || svc_getu32(argv) != 0) {
 		*authp = rpc_autherr_badverf;
 		return SVC_DENIED;
Signature · 1 line
1.6.3.3
#10 lore raw
In reply to J. Bruce Fields
Quoted 39 lines · J. Bruce Fields
Quoted 27 lines · Greg KH
Quoted 26 lines · J. Bruce Fields
Quoted 25 lines · Greg KH
Quoted 23 lines · J. Bruce Fields
Quoted 10 lines · bfields

Please pull the following nfsd changes from the 'nfsd' branch at:

git://linux-nfs.org/~bfields/linux.git for-2.6.34 nfsd

This is an unusually quiet cycle for the NFS server--bugfixes, some IPv6 progress, and one new export operation to improve sync performance.

One exception to the 'mostly quiet' statement was a regression in the rpc code which hit a lot of people: enormous thanks to Neil for tracking that down.

However, I forgot to Cc stable on all of those. Stable people, could you also take the following three commits?:

	f5822754ea006563e1bf0a1f43faaad49c0d8bb2 Revert "sunrpc: fix
	peername failed on closed listener"
	1b644b6e6f6160ae35ce4b52c2ca89ed3e356e18 Revert "sunrpc: move
	the close processing after do recvfrom method"
	301e99ce4a2f42a317129230fd42e6cd874c64b0 nfsd: ensure sockets
	are closed on error

Let me know if you need more information.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

I've queued all of these up for the .33 -stable tree. If any of them need to go into .32 (maybe that last one?), please let me know.

Thanks; .32 needs all three of those.

Ok, care to backport them and send them to [email protected]? They don't all apply cleanly from what I can see.

Huh. I just checked out 2.6.32.10 and tried applying the patches a couple different ways, and the worst I got was stuff like:

Quoted 6 lines

patching file net/sunrpc/svc_xprt.c Hunk #1 succeeded at 711 (offset 5 lines).

Is that enough that you don't consider them clean?

In any case, I'll follow up with patches generated against 2.6.32.10.

You are right, I don't know what I did wrong, sorry. I've now queued all of these up for the next .32 tree, as they are already in .33-stable.

thanks,

greg k-h

#11 lore raw
Quoted 11 lines · Greg KH
Quoted 10 lines · J. Bruce Fields
Quoted 2 lines · Greg KH

Ok, care to backport them and send them to [email protected]? They don't all apply cleanly from what I can see.

Huh. I just checked out 2.6.32.10 and tried applying the patches a couple different ways, and the worst I got was stuff like:

patching file net/sunrpc/svc_xprt.c Hunk #1 succeeded at 711 (offset 5 lines).

Quoted 7 lines
Quoted 3 lines

Is that enough that you don't consider them clean?

In any case, I'll follow up with patches generated against 2.6.32.10.

You are right, I don't know what I did wrong, sorry. I've now queued all of these up for the next .32 tree, as they are already in .33-stable.

OK, thanks.--b.