Skip to contentSkip to conversation

nfs server patches for 2.6.25

PATCH In review J. Bruce Fields 10 participants 158 messages Jan 25, 2008 – Feb 11, 2008 5 messages not in the archive Page 2 of 2

Subsystems (5)
Networking VFS Kbuild NFS client +1 more subsystems
lore
Share & tools
lore
#117 lore raw

Re: [PATCH 038/100] nfsd: Allow AIX client to read dir containing mountpoints

In reply to J. Bruce Fields
Quoted 48 lines · J. Bruce Fields
Quoted 16 lines · Peter Staubach
Quoted 14 lines · J. Bruce Fields
Quoted 12 lines · Peter Staubach

Can we go through this explanation one more time, a little more slowly, please? I am not following it.

It is my understanding that FATTR4_RDATTR_ERROR simply says to return a magic value to indicate that the requested attributes could not be retrieved during a READDIR operation. It is also my understanding that the FATTR4_MOUNTED_ON_FILEID returns either the fileid of the entry in the directory or the fileid of the directory which is the root of the mount point which is mounted on top of the entry in the directory.

Quoted 9 lines
Quoted 6 lines

No, it's the fileid of the directory underneath (the mounted-on directory), not of the directory that's mounted on top of it--that would be just the regular fileid. Does that clear up the confusion?

Yes, that helps. I was misinterpreting the arguments in the call to vfs_getattr() to be the wrong direction.

Any ideas for cleanup (especially patches) are welcomed. I'd rather the code be easier to read there.

Quoted 16 lines
Quoted 16 lines
Quoted 11 lines

Review

Quoted 5 lines
(quoted diff) +3 -0
+	if (d_mountpoint(dentry) &&
+	    (cd->rd_bmval[0] & ~FATTR4_WORD0_RDATTR_ERROR) == 0 &&
+	    (cd->rd_bmval[1] & ~FATTR4_WORD1_MOUNTED_ON_FILEID) == 0)

These are some odd looking tests. What is the real intention for these tests? They don't test just for requests with just RDATTR_ERROR and MOUNTED_ON_FILEID set. They will trigger whether or not either or neither is set as well.

Right. The test is meant to fail iff someone requests an attribute other than those two. (Note the different rd_bmval[] array indices.)

Quoted 8 lines
Quoted 2 lines

So, it doesn't matter whether those options are even set then?

Right.

Would something like this clarify?:

Yes, that is better. The whole area is somewhat complex, but every little bit helps.

Thanx...

ps

Quoted 34 lines

--b.

fs/nfsd/nfs4xdr.c +10 -3
index b0592e7..ac47f45 100644
@@ -1867,6 +1867,15 @@ out_serverfault:
 	goto out;
 }
 
+static inline int attributes_need_mount(u32 *bmval)
+{
+	if (bmval[0] & ~(FATTR4_WORD0_RDATTR_ERROR | FATTR4_WORD0_LEASE_TIME))
+		return 1;
+	if (bmval[1] & ~FATTR4_WORD1_MOUNTED_ON_FILEID)
+		return 1;
+	return 0;
+}
+
 static __be32
 nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd,
 		const char *name, int namlen, __be32 *p, int *buflen)
@@ -1888,9 +1897,7 @@ nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd,
 	 * we will not follow the cross mount and will fill the attribtutes
 	 * directly from the mountpoint dentry.
 	 */
-	if (d_mountpoint(dentry) &&
-	    (cd->rd_bmval[0] & ~FATTR4_WORD0_RDATTR_ERROR) == 0 &&
-	    (cd->rd_bmval[1] & ~FATTR4_WORD1_MOUNTED_ON_FILEID) == 0)
+	if (d_mountpoint(dentry) && !attributes_need_mount(cd->rd_bmval))
 		ignore_crossmnt = 1;
 	else if (d_mountpoint(dentry)) {
 		int err;
#118 lore raw

Re: [PATCH 036/100] lockd: fix reference count leaks in async locking case

In reply to J. Bruce Fields
Quoted 8 lines · J. Bruce Fields

From: Oleg Drokin <green-SOTZviwpzew/[email protected]>

In a number of places where we wish only to translate nlm_drop_reply to rpc_drop_reply errors we instead return early with rpc_drop_reply, skipping some important end-of-function cleanup.

This results in reference count leaks when lockd is doing posix locking on GFS2.

Is Oleg's Signed-off-by: missing?

Quoted 5 lines
---
 fs/lockd/svc4proc.c |   20 ++++++++++++--------
 fs/lockd/svcproc.c  |   22 +++++++++++++---------
 2 files changed, 25 insertions(+), 17 deletions(-)

More below.

Quoted 24 lines
fs/lockd/svc4proc.c +1 -0
index bf27b6c..225304d 100644
@@ -84,6 +84,7 @@ nlm4svc_proc_test(struct svc_rqst *rqstp, struct  
 nlm_args *argp,
 {
 	struct nlm_host	*host;
 	struct nlm_file	*file;
+	int rc = rpc_success;
 
 	dprintk("lockd: TEST4        called\n");
fs/lockd/svc4proc.c +1 -1
 	resp->cookie = argp->cookie;
@@ -91,7 +92,7 @@ nlm4svc_proc_test(struct svc_rqst *rqstp, struct  
 nlm_args *argp,
 	/* Don't accept test requests during grace period */
 	if (nlmsvc_grace_period) {
 		resp->status = nlm_lck_denied_grace_period;
-		return rpc_success;
+		return rc;
 	}
 
fs/lockd/svc4proc.c +0 -0
 	/* Obtain client and file */

fs/lockd/svc4proc.c nlm4svc_proc_test(struct svc_rqst *rqstp, · line 110

Quoted 10 lines
fs/lockd/svc4proc.c +3 -1
@@ -101,12 +102,13 @@ nlm4svc_proc_test(struct svc_rqst *rqstp,  
 struct nlm_args *argp,
 	/* Now check for conflicting locks */
 	resp->status = nlmsvc_testlock(rqstp, file, &argp->lock, &resp- 
 >lock, &resp->cookie);
 	if (resp->status == nlm_drop_reply)
-		return rpc_drop_reply;
+		rc = rpc_drop_reply;
+        else
+                dprintk("lockd: TEST4        status %d\n", ntohl 
 (resp->status));

This appears to introduce some white space damage.

Quoted 70 lines
fs/lockd/svc4proc.c +1 -2
-	dprintk("lockd: TEST4          status %d\n", ntohl(resp->status));
 	nlm_release_host(host);
 	nlm_release_file(file);
-	return rpc_success;
+	return rc;
 }

static __be32

fs/lockd/svc4proc.c +2 -1
@@ -115,6 +117,7 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp,  
 struct nlm_args *argp,
 {
 	struct nlm_host	*host;
 	struct nlm_file	*file;
+	int rc = rpc_success;
 
 	dprintk("lockd: LOCK          called\n");
@@ -123,7 +126,7 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp,  
 struct nlm_args *argp,
 	/* Don't accept new lock requests during grace period */
 	if (nlmsvc_grace_period && !argp->reclaim) {
 		resp->status = nlm_lck_denied_grace_period;
-		return rpc_success;
+		return rc;
 	}
 
fs/lockd/svc4proc.c +4 -3
 	/* Obtain client and file */
@@ -146,12 +149,13 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp,  
 struct nlm_args *argp,
 	resp->status = nlmsvc_lock(rqstp, file, &argp->lock,
 					argp->block, &argp->cookie);
 	if (resp->status == nlm_drop_reply)
-		return rpc_drop_reply;
+		rc = rpc_drop_reply;
+        else
+                dprintk("lockd: LOCK         status %d\n", ntohl 
 (resp->status));
 
-	dprintk("lockd: LOCK          status %d\n", ntohl(resp->status));
 	nlm_release_host(host);
 	nlm_release_file(file);
-	return rpc_success;
+	return rc;
 }

static __be32

fs/lockd/svcproc.c +1 -0
index 9cd5c8b..1a2b10c 100644
@@ -113,6 +113,7 @@ nlmsvc_proc_test(struct svc_rqst *rqstp, struct  
 nlm_args *argp,
 {
 	struct nlm_host	*host;
 	struct nlm_file	*file;
+	int rc = rpc_success;
 
 	dprintk("lockd: TEST          called\n");
fs/lockd/svcproc.c +1 -1
 	resp->cookie = argp->cookie;
@@ -120,7 +121,7 @@ nlmsvc_proc_test(struct svc_rqst *rqstp, struct  
 nlm_args *argp,
 	/* Don't accept test requests during grace period */
 	if (nlmsvc_grace_period) {
 		resp->status = nlm_lck_denied_grace_period;
-		return rpc_success;
+		return rc;
 	}
 
fs/lockd/svcproc.c +0 -0
 	/* Obtain client and file */

fs/lockd/svcproc.c nlmsvc_proc_test(struct svc_rqst *rqstp, · line 139

Quoted 10 lines
fs/lockd/svcproc.c +4 -1
@@ -130,13 +131,14 @@ nlmsvc_proc_test(struct svc_rqst *rqstp,  
 struct nlm_args *argp,
 	/* Now check for conflicting locks */
 	resp->status = cast_status(nlmsvc_testlock(rqstp, file, &argp- 
 >lock, &resp->lock, &resp->cookie));
 	if (resp->status == nlm_drop_reply)
-		return rpc_drop_reply;
+		rc = rpc_drop_reply;
+        else
+                dprintk("lockd: TEST          status %d vers %d\n",
+                        ntohl(resp->status), rqstp->rq_vers);

More white space damage here.

Quoted 29 lines
fs/lockd/svcproc.c +1 -3
-	dprintk("lockd: TEST          status %d vers %d\n",
-		ntohl(resp->status), rqstp->rq_vers);
 	nlm_release_host(host);
 	nlm_release_file(file);
-	return rpc_success;
+	return rc;
 }
 

static __be32

fs/lockd/svcproc.c +2 -1
@@ -145,6 +147,7 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp, struct  
 nlm_args *argp,
 {
 	struct nlm_host	*host;
 	struct nlm_file	*file;
+	int rc = rpc_success;
 
 	dprintk("lockd: LOCK          called\n");
@@ -153,7 +156,7 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp, struct  
 nlm_args *argp,
 	/* Don't accept new lock requests during grace period */
 	if (nlmsvc_grace_period && !argp->reclaim) {
 		resp->status = nlm_lck_denied_grace_period;
-		return rpc_success;
+		return rc;
 	}
 
fs/lockd/svcproc.c +0 -0
 	/* Obtain client and file */

fs/lockd/svcproc.c nlmsvc_proc_lock(struct svc_rqst *rqstp, · line 186

Quoted 9 lines
fs/lockd/svcproc.c +3 -1
@@ -176,12 +179,13 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp,  
 struct nlm_args *argp,
 	resp->status = cast_status(nlmsvc_lock(rqstp, file, &argp->lock,
 					       argp->block, &argp->cookie));
 	if (resp->status == nlm_drop_reply)
-		return rpc_drop_reply;
+		rc = rpc_drop_reply;
+        else
+                dprintk("lockd: LOCK         status %d\n", ntohl 
 (resp->status));

And here.

Quoted 8 lines
fs/lockd/svcproc.c +1 -2
-	dprintk("lockd: LOCK          status %d\n", ntohl(resp->status));
 	nlm_release_host(host);
 	nlm_release_file(file);
-	return rpc_success;
+	return rc;
 }
 

static __be32

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#119 lore raw

Re: [PATCH 036/100] lockd: fix reference count leaks in async locking case

Quoted 7 lines · Chuck Lever
Quoted 6 lines · J. Bruce Fields

From: Oleg Drokin <green-SOTZviwpzew/[email protected]>

In a number of places where we wish only to translate nlm_drop_reply to rpc_drop_reply errors we instead return early with rpc_drop_reply, skipping some important end-of-function cleanup.

Quoted 5 lines
Quoted 3 lines

This results in reference count leaks when lockd is doing posix locking
on GFS2.

Is Oleg's Signed-off-by: missing?

Oleg?

Quoted 8 lines
Quoted 6 lines
---
 fs/lockd/svc4proc.c |   20 ++++++++++++--------
 fs/lockd/svcproc.c  |   22 +++++++++++++---------
 2 files changed, 25 insertions(+), 17 deletions(-)

More below.

White space damaged fixed, thanks.

--b.

#120 lore raw

Re: [PATCH 036/100] lockd: fix reference count leaks in async locking case

Hello!

Quoted 2 lines · J. Bruce Fields
Quoted 1 line

Is Oleg's Signed-off-by: missing?

Oleg?

How do I fix it if you have the patch already? ;)

Bye,
Oleg

A message that is not in the archive (sent off-list or not yet received): B0E92DA2-92DD-4637-B265-57B0D6D0D761-SOTZviwpzew/[email protected]

#122 lore raw

Re: [PATCH 036/100] lockd: fix reference count leaks in async locking case

Quoted 7 lines · Oleg Drokin

Hello!

Quoted 2 lines · J. Bruce Fields
Quoted 1 line

Is Oleg's Signed-off-by: missing?

Oleg?

How do I fix it if you have the patch already? ;)

You just tell me to add it. I'll take that as a yes! Done.

(I just assume it's something that the person in question should explicitly add or ask to have added, if it's meant to be an explicit agreement to the stuff in Documentation/SubmittingPatches. So rather than add it myself for someone in cases where I'm sure they'd be OK with it, I'd just as soon add my own and let that be my statement that I think the situation's OK. But, whatever....)

--b.

#123 lore raw

Re: [PATCH 034/100] nfsd4: miscellaneous nfs4state.c style fixes

In reply to J. Bruce Fields
Quoted 20 lines · J. Bruce Fields

Fix various minor style violations.

---
 fs/nfsd/nfs4state.c |   55 +++++++++++++++++++++++ 
+--------------------------
 1 files changed, 26 insertions(+), 29 deletions(-)
fs/nfsd/nfs4state.c +0 -0
index 6efce99..1c72b23 100644
@@ -339,21 +339,20 @@ STALE_CLIENTID(clientid_t *clid)
  * This type of memory management is somewhat inefficient, but we  

use it
* anyway since SETCLIENTID is not a common operation. */

fs/nfsd/nfs4state.c +1 -2
-static inline struct nfs4_client *
-alloc_client(struct xdr_netobj name)
+static inline struct nfs4_client * alloc_client(struct xdr_netobj  
Quoted 1 line

name)

Since you are addressing style issues, CodingStyle likes "struct nfs4_client *alloc_client" (no blank after the asterisk). Also, "inline" is probably not necessary here; the compiler will do it automatically (likewise below).

Quoted 94 lines

{

fs/nfsd/nfs4state.c +0 -1
 	struct nfs4_client *clp;
 
-	if ((clp = kzalloc(sizeof(struct nfs4_client), GFP_KERNEL))!=  

NULL) {

fs/nfsd/nfs4state.c +14 -12
-		if ((clp->cl_name.data = kmalloc(name.len, GFP_KERNEL)) != NULL) {
-			memcpy(clp->cl_name.data, name.data, name.len);
-			clp->cl_name.len = name.len;
-		}
-		else {
-			kfree(clp);
-			clp = NULL;
-		}
+	clp = kzalloc(sizeof(struct nfs4_client), GFP_KERNEL);
+	if (clp == NULL)
+		return NULL;
+	clp->cl_name.data = kmalloc(name.len, GFP_KERNEL);
+	if (clp->cl_name.data == NULL) {
+		kfree(clp);
+		return NULL;
 	}
+	memcpy(clp->cl_name.data, name.data, name.len);
+	clp->cl_name.len = name.len;
 	return clp;
 }
@@ -421,12 +420,13 @@ expire_client(struct nfs4_client *clp)
 	put_nfs4_client(clp);
 }
 
-static struct nfs4_client *
-create_client(struct xdr_netobj name, char *recdir) {
+static struct nfs4_client * create_client(struct xdr_netobj name,  
 char *recdir)
+{
 	struct nfs4_client *clp;
 
-	if (!(clp = alloc_client(name)))
-		goto out;
+	clp = alloc_client(name);
+	if (clp == NULL)
+		return NULL;
 	memcpy(clp->cl_recdir, recdir, HEXDIR_LEN);
 	atomic_set(&clp->cl_count, 1);
fs/nfsd/nfs4state.c +9 -11
 	atomic_set(&clp->cl_callback.cb_set, 0);
@@ -435,32 +435,30 @@ create_client(struct xdr_netobj name, char  
 *recdir) {
 	INIT_LIST_HEAD(&clp->cl_openowners);
 	INIT_LIST_HEAD(&clp->cl_delegations);
 	INIT_LIST_HEAD(&clp->cl_lru);
-out:
 	return clp;
 }
 
-static void
-copy_verf(struct nfs4_client *target, nfs4_verifier *source) {
-	memcpy(target->cl_verifier.data, source->data, sizeof(target- 
 >cl_verifier.data));
+static void copy_verf(struct nfs4_client *target, nfs4_verifier  
 *source)
+{
+	memcpy(target->cl_verifier.data, source->data,
+			sizeof(target->cl_verifier.data));
 }
 
-static void
-copy_clid(struct nfs4_client *target, struct nfs4_client *source) {
+static void copy_clid(struct nfs4_client *target, struct  
 nfs4_client *source)
+{
 	target->cl_clientid.cl_boot = source->cl_clientid.cl_boot;
 	target->cl_clientid.cl_id = source->cl_clientid.cl_id;
 }
 
-static void
-copy_cred(struct svc_cred *target, struct svc_cred *source) {
-
+static void copy_cred(struct svc_cred *target, struct svc_cred  
 *source)
+{
 	target->cr_uid = source->cr_uid;
 	target->cr_gid = source->cr_gid;
 	target->cr_group_info = source->cr_group_info;
 	get_group_info(target->cr_group_info);
 }
 
-static inline int
-same_name(const char *n1, const char *n2)
+static inline int same_name(const char *n1, const char *n2)
 {
 	return 0 == memcmp(n1, n2, HEXDIR_LEN);
 }
@@ -502,9 +500,8 @@ static void gen_confirm(struct nfs4_client *clp)
 	*p++ = i++;

fs/nfsd/nfs4state.c static void gen_confirm(struct nfs4_client *clp) · line 507

Quoted 10 lines
fs/nfsd/nfs4state.c +2 -3
 }
 
-static int
-check_name(struct xdr_netobj name) {
-
+static int check_name(struct xdr_netobj name)
+{
 	if (name.len == 0)
 		return 0;
 	if (name.len > NFS4_OPAQUE_LIMIT) {

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#124 lore raw

Re: [PATCH 034/100] nfsd4: miscellaneous nfs4state.c style fixes

Quoted 19 lines · Chuck Lever
Quoted 18 lines · J. Bruce Fields

Fix various minor style violations.

---
 fs/nfsd/nfs4state.c |   55 +++++++++++++++++++++++ 
+--------------------------
 1 files changed, 26 insertions(+), 29 deletions(-)
fs/nfsd/nfs4state.c +0 -0
index 6efce99..1c72b23 100644
@@ -339,21 +339,20 @@ STALE_CLIENTID(clientid_t *clid)
  * This type of memory management is somewhat inefficient, but we use 

it
* anyway since SETCLIENTID is not a common operation. */
-static inline struct nfs4_client *

Quoted 8 lines
Quoted 3 lines
fs/nfsd/nfs4state.c +1 -1
-alloc_client(struct xdr_netobj name)
+static inline struct nfs4_client * alloc_client(struct xdr_netobj  

name)

Since you are addressing style issues, CodingStyle likes "struct nfs4_client *alloc_client" (no blank after the asterisk). Also, "inline" is probably not necessary here; the compiler will do it automatically (likewise below).

OK, done.--b.

Quoted 108 lines
Quoted 94 lines

{

fs/nfsd/nfs4state.c +14 -13
 	struct nfs4_client *clp;
 
-	if ((clp = kzalloc(sizeof(struct nfs4_client), GFP_KERNEL))!= NULL) {
-		if ((clp->cl_name.data = kmalloc(name.len, GFP_KERNEL)) != NULL) {
-			memcpy(clp->cl_name.data, name.data, name.len);
-			clp->cl_name.len = name.len;
-		}
-		else {
-			kfree(clp);
-			clp = NULL;
-		}
+	clp = kzalloc(sizeof(struct nfs4_client), GFP_KERNEL);
+	if (clp == NULL)
+		return NULL;
+	clp->cl_name.data = kmalloc(name.len, GFP_KERNEL);
+	if (clp->cl_name.data == NULL) {
+		kfree(clp);
+		return NULL;
 	}
+	memcpy(clp->cl_name.data, name.data, name.len);
+	clp->cl_name.len = name.len;
 	return clp;
 }
@@ -421,12 +420,13 @@ expire_client(struct nfs4_client *clp)
 	put_nfs4_client(clp);
 }
 
-static struct nfs4_client *
-create_client(struct xdr_netobj name, char *recdir) {
+static struct nfs4_client * create_client(struct xdr_netobj name,  
 char *recdir)
+{
 	struct nfs4_client *clp;
 
-	if (!(clp = alloc_client(name)))
-		goto out;
+	clp = alloc_client(name);
+	if (clp == NULL)
+		return NULL;
 	memcpy(clp->cl_recdir, recdir, HEXDIR_LEN);
 	atomic_set(&clp->cl_count, 1);
fs/nfsd/nfs4state.c +9 -11
 	atomic_set(&clp->cl_callback.cb_set, 0);
@@ -435,32 +435,30 @@ create_client(struct xdr_netobj name, char  
 *recdir) {
 	INIT_LIST_HEAD(&clp->cl_openowners);
 	INIT_LIST_HEAD(&clp->cl_delegations);
 	INIT_LIST_HEAD(&clp->cl_lru);
-out:
 	return clp;
 }
 
-static void
-copy_verf(struct nfs4_client *target, nfs4_verifier *source) {
-	memcpy(target->cl_verifier.data, source->data, sizeof(target- 
 >cl_verifier.data));
+static void copy_verf(struct nfs4_client *target, nfs4_verifier  
 *source)
+{
+	memcpy(target->cl_verifier.data, source->data,
+			sizeof(target->cl_verifier.data));
 }
 
-static void
-copy_clid(struct nfs4_client *target, struct nfs4_client *source) {
+static void copy_clid(struct nfs4_client *target, struct nfs4_client 
 *source)
+{
 	target->cl_clientid.cl_boot = source->cl_clientid.cl_boot;
 	target->cl_clientid.cl_id = source->cl_clientid.cl_id;
 }
 
-static void
-copy_cred(struct svc_cred *target, struct svc_cred *source) {
-
+static void copy_cred(struct svc_cred *target, struct svc_cred  
 *source)
+{
 	target->cr_uid = source->cr_uid;
 	target->cr_gid = source->cr_gid;
 	target->cr_group_info = source->cr_group_info;
 	get_group_info(target->cr_group_info);
 }
 
-static inline int
-same_name(const char *n1, const char *n2)
+static inline int same_name(const char *n1, const char *n2)
 {
 	return 0 == memcmp(n1, n2, HEXDIR_LEN);
 }
@@ -502,9 +500,8 @@ static void gen_confirm(struct nfs4_client *clp)
 	*p++ = i++;

fs/nfsd/nfs4state.c static void gen_confirm(struct nfs4_client *clp) · line 507

Quoted 10 lines
fs/nfsd/nfs4state.c +2 -3
 }
 
-static int
-check_name(struct xdr_netobj name) {
-
+static int check_name(struct xdr_netobj name)
+{
 	if (name.len == 0)
 		return 0;
 	if (name.len > NFS4_OPAQUE_LIMIT) {

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#125 lore raw

Re: [PATCH 024/100] nfsd: move nfsd/auth.h into fs/nfsd

In reply to J. Bruce Fields
Quoted 26 lines · J. Bruce Fields

This header is used only in a few places in fs/nfsd, so there seems to be little point to having it in include/. (Thanks to Robert Day for pointing this out.)

Cc Robert P. J. Day <rpjday-L09J2beyid0N/[email protected]>
---
 fs/nfsd/auth.h               |   27 +++++++++++++++++++++++++++
 fs/nfsd/nfs3xdr.c            |    1 +
 fs/nfsd/nfsfh.c              |    1 +
 fs/nfsd/nfsxdr.c             |    1 +
 include/linux/nfsd/Kbuild    |    1 -
 include/linux/nfsd/auth.h    |   27 ---------------------------
 include/linux/nfsd/nfsd.h    |    1 -
 include/linux/nfsd/syscall.h |    1 -
 8 files changed, 30 insertions(+), 30 deletions(-)
 create mode 100644 fs/nfsd/auth.h
 delete mode 100644 include/linux/nfsd/auth.h
fs/nfsd/auth.h new file +0 -0
new file mode 100644
index 0000000..0fb9f72

fs/nfsd/auth.h line 2

Quoted 2 lines
fs/nfsd/auth.h new file +2 -0
@@ -0,0 +1,27 @@
+/*
+ * include/linux/nfsd/auth.h

Now that you've moved this header into fs/nfsd, the pathname in this comment is no longer correct. Usually hch complains about this; his recommended solution is to remove the filename from the block comment completely.

Quoted 134 lines
fs/nfsd/auth.h new file +25 -0
+ *
+ * nfsd-specific authentication stuff.
+ * uid/gid mapping not yet implemented.
+ *
+ * Copyright (C) 1995, 1996 Olaf Kirch <[email protected]>
+ */
+
+#ifndef LINUX_NFSD_AUTH_H
+#define LINUX_NFSD_AUTH_H
+
+#ifdef __KERNEL__
+
+#define nfsd_luid(rq, uid)	((u32)(uid))
+#define nfsd_lgid(rq, gid)	((u32)(gid))
+#define nfsd_ruid(rq, uid)	((u32)(uid))
+#define nfsd_rgid(rq, gid)	((u32)(gid))
+
+/*
+ * Set the current process's fsuid/fsgid etc to those of the NFS
+ * client user
+ */
+int nfsd_setuser(struct svc_rqst *, struct svc_export *);
+
+#endif /* __KERNEL__ */
+#endif /* LINUX_NFSD_AUTH_H */
fs/nfsd/nfs3xdr.c +1 -0
index be515c5..4b1ffe3 100644
@@ -21,6 +21,7 @@
 #include <linux/sunrpc/svc.h>
 #include <linux/nfsd/nfsd.h>
 #include <linux/nfsd/xdr3.h>
+#include "auth.h"
 
 #define NFSDDBG_FACILITY		NFSDDBG_XDR
 
fs/nfsd/nfsfh.c +1 -0
index 468f17a..8fbd2dc 100644
@@ -22,6 +22,7 @@
 #include <linux/sunrpc/svc.h>
 #include <linux/sunrpc/svcauth_gss.h>
 #include <linux/nfsd/nfsd.h>
+#include "auth.h"
 
 #define NFSDDBG_FACILITY		NFSDDBG_FH
 
fs/nfsd/nfsxdr.c +1 -0
index 7003c31..61ad617 100644
@@ -15,6 +15,7 @@
 #include <linux/nfsd/nfsd.h>
 #include <linux/nfsd/xdr.h>
 #include <linux/mm.h>
+#include "auth.h"
 
 #define NFSDDBG_FACILITY		NFSDDBG_XDR
 
include/linux/nfsd/Kbuild +0 -1
index d9c5455..e726fc3 100644
@@ -4,4 +4,3 @@ unifdef-y += stats.h
 unifdef-y += syscall.h
 unifdef-y += nfsfh.h
 unifdef-y += debug.h
-unifdef-y += auth.h
include/linux/nfsd/auth.h deleted +0 -27
deleted file mode 100644
index 0fb9f72..0000000
@@ -1,27 +0,0 @@
-/*
- * include/linux/nfsd/auth.h
- *
- * nfsd-specific authentication stuff.
- * uid/gid mapping not yet implemented.
- *
- * Copyright (C) 1995, 1996 Olaf Kirch <[email protected]>
- */
-
-#ifndef LINUX_NFSD_AUTH_H
-#define LINUX_NFSD_AUTH_H
-
-#ifdef __KERNEL__
-
-#define nfsd_luid(rq, uid)	((u32)(uid))
-#define nfsd_lgid(rq, gid)	((u32)(gid))
-#define nfsd_ruid(rq, uid)	((u32)(uid))
-#define nfsd_rgid(rq, gid)	((u32)(gid))
-
-/*
- * Set the current process's fsuid/fsgid etc to those of the NFS
- * client user
- */
-int nfsd_setuser(struct svc_rqst *, struct svc_export *);
-
-#endif /* __KERNEL__ */
-#endif /* LINUX_NFSD_AUTH_H */
include/linux/nfsd/nfsd.h +0 -1
index a51a30f..8caf4c4 100644
@@ -20,7 +20,6 @@
 #include <linux/nfsd/debug.h>
 #include <linux/nfsd/nfsfh.h>
 #include <linux/nfsd/export.h>
-#include <linux/nfsd/auth.h>
 #include <linux/nfsd/stats.h>
 /*
  * nfsd version
include/linux/nfsd/syscall.h +0 -1
index 8bcddcc..4e43976 100644
@@ -18,7 +18,6 @@
 #include <linux/nfsd/const.h>
 #include <linux/nfsd/export.h>
 #include <linux/nfsd/nfsfh.h>
-#include <linux/nfsd/auth.h>
 
 /*
  * Version of the syscall interface
Signature · 6 lines
1.5.4.rc2.60.gb2e62

-
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#126 lore raw

Re: [PATCH 024/100] nfsd: move nfsd/auth.h into fs/nfsd

Quoted 21 lines · Chuck Lever
Quoted 20 lines · J. Bruce Fields

This header is used only in a few places in fs/nfsd, so there seems to be little point to having it in include/. (Thanks to Robert Day for pointing this out.)

Cc Robert P. J. Day <rpjday-L09J2beyid0N/[email protected]>
---
 fs/nfsd/auth.h               |   27 +++++++++++++++++++++++++++
 fs/nfsd/nfs3xdr.c            |    1 +
 fs/nfsd/nfsfh.c              |    1 +
 fs/nfsd/nfsxdr.c             |    1 +
 include/linux/nfsd/Kbuild    |    1 -
 include/linux/nfsd/auth.h    |   27 ---------------------------
 include/linux/nfsd/nfsd.h    |    1 -
 include/linux/nfsd/syscall.h |    1 -
 8 files changed, 30 insertions(+), 30 deletions(-)
 create mode 100644 fs/nfsd/auth.h
 delete mode 100644 include/linux/nfsd/auth.h
Quoted 13 lines

fs/nfsd/auth.h line 2

Quoted 8 lines
fs/nfsd/auth.h new file +2 -0
new file mode 100644
index 0000000..0fb9f72
@@ -0,0 +1,27 @@
+/*
+ * include/linux/nfsd/auth.h

Now that you've moved this header into fs/nfsd, the pathname in this comment is no longer correct. Usually hch complains about this; his recommended solution is to remove the filename from the block comment completely.

Right. Done in the following patch along with some other cleanup. It seemed cleaner to do make the rename completely trivial to identify, then fix the file conntents afterwards.

--b.

#127 lore raw

Re: [PATCH 022/100] nfsd: move cache proc (un)registration to separate function

In reply to J. Bruce Fields
Quoted 17 lines · J. Bruce Fields

Just some minor cleanup.

Also I don't see much point in trying to register further proc entries if initial entries fail; so just stop trying in that case.

---
 net/sunrpc/cache.c |   99 +++++++++++++++++++++++++++ 
+-----------------------
 1 files changed, 54 insertions(+), 45 deletions(-)
net/sunrpc/cache.c +0 -0
index d05ea16..504b4e8 100644

net/sunrpc/cache.c static const struct file_operations · line 294

Quoted 6 lines
net/sunrpc/cache.c +1 -1
@@ -290,44 +290,63 @@ static const struct file_operations  
 cache_flush_operations;
 static void do_cache_clean(struct work_struct *work);
 static DECLARE_DELAYED_WORK(cache_cleaner, do_cache_clean);
 
-void cache_register(struct cache_detail *cd)
+void remove_cache_proc_entries(struct cache_detail *cd)

Since you don't provide an EXPORT_SYMBOL for this new function, perhaps it should be declared static?

Quoted 17 lines
net/sunrpc/cache.c +11 -5
 {
-	cd->proc_ent = proc_mkdir(cd->name, proc_net_rpc);
-	if (cd->proc_ent) {
-		struct proc_dir_entry *p;
-		cd->proc_ent->owner = cd->owner;
-		cd->channel_ent = cd->content_ent = NULL;
+	if (cd->proc_ent == NULL)
+		return;
+	if (cd->flush_ent)
+		remove_proc_entry("flush", cd->proc_ent);
+	if (cd->channel_ent)
+		remove_proc_entry("channel", cd->proc_ent);
+	if (cd->content_ent)
+		remove_proc_entry("content", cd->proc_ent);
+	cd->proc_ent = NULL;
+	remove_proc_entry(cd->name, proc_net_rpc);
+}

net/sunrpc/cache.c static const struct file_operations cache_flush_operations; · line 307

Quoted 10 lines
net/sunrpc/cache.c +1 -8
 
-		p = create_proc_entry("flush", S_IFREG|S_IRUSR|S_IWUSR,
-				      cd->proc_ent);
-		cd->flush_ent =  p;
-		if (p) {
-			p->proc_fops = &cache_flush_operations;
-			p->owner = cd->owner;
-			p->data = cd;
-		}
+void create_cache_proc_entries(struct cache_detail *cd)

Likewise.

Quoted 92 lines
net/sunrpc/cache.c +40 -20
+{
+	struct proc_dir_entry *p;
 
-		if (cd->cache_request || cd->cache_parse) {
-			p = create_proc_entry("channel", S_IFREG|S_IRUSR|S_IWUSR,
-					      cd->proc_ent);
-			cd->channel_ent = p;
-			if (p) {
-				p->proc_fops = &cache_file_operations;
-				p->owner = cd->owner;
-				p->data = cd;
-			}
-		}
-		if (cd->cache_show) {
-			p = create_proc_entry("content", S_IFREG|S_IRUSR|S_IWUSR,
-					      cd->proc_ent);
-			cd->content_ent = p;
-			if (p) {
-				p->proc_fops = &content_file_operations;
-				p->owner = cd->owner;
-				p->data = cd;
-			}
-		}
+	cd->proc_ent = proc_mkdir(cd->name, proc_net_rpc);
+	if (cd->proc_ent == NULL)
+		return;
+	cd->proc_ent->owner = cd->owner;
+	cd->channel_ent = cd->content_ent = NULL;
+
+	p = create_proc_entry("flush", S_IFREG|S_IRUSR|S_IWUSR, cd- 
 >proc_ent);
+	cd->flush_ent = p;
+	if (p == NULL)
+		return;
+	p->proc_fops = &cache_flush_operations;
+	p->owner = cd->owner;
+	p->data = cd;
+
+	if (cd->cache_request || cd->cache_parse) {
+		p = create_proc_entry("channel", S_IFREG|S_IRUSR|S_IWUSR,
+				      cd->proc_ent);
+		cd->channel_ent = p;
+		if (p == NULL)
+			return;
+		p->proc_fops = &cache_file_operations;
+		p->owner = cd->owner;
+		p->data = cd;
+	}
+	if (cd->cache_show) {
+		p = create_proc_entry("content", S_IFREG|S_IRUSR|S_IWUSR,
+				      cd->proc_ent);
+		cd->content_ent = p;
+		if (p == NULL)
+			return;
+		p->proc_fops = &content_file_operations;
+		p->owner = cd->owner;
+		p->data = cd;
 	}
+}
+
+void cache_register(struct cache_detail *cd)
+{
+	create_cache_proc_entries(cd);
 	rwlock_init(&cd->hash_lock);
net/sunrpc/cache.c +1 -11
 	INIT_LIST_HEAD(&cd->queue);
 	spin_lock(&cache_list_lock);
@@ -358,17 +377,7 @@ void cache_unregister(struct cache_detail *cd)
 	list_del_init(&cd->others);
 	write_unlock(&cd->hash_lock);
 	spin_unlock(&cache_list_lock);
-	if (cd->proc_ent) {
-		if (cd->flush_ent)
-			remove_proc_entry("flush", cd->proc_ent);
-		if (cd->channel_ent)
-			remove_proc_entry("channel", cd->proc_ent);
-		if (cd->content_ent)
-			remove_proc_entry("content", cd->proc_ent);
-
-		cd->proc_ent = NULL;
-		remove_proc_entry(cd->name, proc_net_rpc);
-	}
+	remove_cache_proc_entries(cd);
 	if (list_empty(&cache_list)) {
 		/* module must be being unloaded so its safe to kill the worker */
 		cancel_delayed_work_sync(&cache_cleaner);
Signature · 6 lines
1.5.4.rc2.60.gb2e62

-
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#128 lore raw

Re: [PATCH 022/100] nfsd: move cache proc (un)registration to separate function

Quoted 46 lines · Chuck Lever
Quoted 17 lines · J. Bruce Fields

Just some minor cleanup.

Also I don't see much point in trying to register further proc entries if initial entries fail; so just stop trying in that case.

---
 net/sunrpc/cache.c |   99 +++++++++++++++++++++++++++ 
+-----------------------
 1 files changed, 54 insertions(+), 45 deletions(-)
net/sunrpc/cache.c +0 -0
index d05ea16..504b4e8 100644

net/sunrpc/cache.c static const struct file_operations · line 294

Quoted 6 lines
net/sunrpc/cache.c +1 -1
@@ -290,44 +290,63 @@ static const struct file_operations  
 cache_flush_operations;
 static void do_cache_clean(struct work_struct *work);
 static DECLARE_DELAYED_WORK(cache_cleaner, do_cache_clean);
 
-void cache_register(struct cache_detail *cd)
+void remove_cache_proc_entries(struct cache_detail *cd)

Since you don't provide an EXPORT_SYMBOL for this new function, perhaps it should be declared static?

Quoted 18 lines
net/sunrpc/cache.c +11 -5
 {
-	cd->proc_ent = proc_mkdir(cd->name, proc_net_rpc);
-	if (cd->proc_ent) {
-		struct proc_dir_entry *p;
-		cd->proc_ent->owner = cd->owner;
-		cd->channel_ent = cd->content_ent = NULL;
+	if (cd->proc_ent == NULL)
+		return;
+	if (cd->flush_ent)
+		remove_proc_entry("flush", cd->proc_ent);
+	if (cd->channel_ent)
+		remove_proc_entry("channel", cd->proc_ent);
+	if (cd->content_ent)
+		remove_proc_entry("content", cd->proc_ent);
+	cd->proc_ent = NULL;
+	remove_proc_entry(cd->name, proc_net_rpc);
+}
 
Quoted 11 lines

net/sunrpc/cache.c static const struct file_operations cache_flush_operations; · line 307

Quoted 9 lines
net/sunrpc/cache.c +1 -8
-		p = create_proc_entry("flush", S_IFREG|S_IRUSR|S_IWUSR,
-				      cd->proc_ent);
-		cd->flush_ent =  p;
-		if (p) {
-			p->proc_fops = &cache_flush_operations;
-			p->owner = cd->owner;
-			p->data = cd;
-		}
+void create_cache_proc_entries(struct cache_detail *cd)

Likewise.

Whoops, yes, fixed.

--b.

#129 lore raw

Re: [PATCH 021/100] nfsd: fail init on /proc/fs/nfs/exports creation failure

In reply to J. Bruce Fields
Quoted 17 lines · J. Bruce Fields

I assume the reason failure of creation was ignored here was just to continue support embedded systems that want nfsd but not proc.

However, in cases where proc is supported it would be clearer to fail entirely than to come up with some features disabled.

---
 fs/nfsd/nfsctl.c |   37 ++++++++++++++++++++++++++++---------
 1 files changed, 28 insertions(+), 9 deletions(-)
fs/nfsd/nfsctl.c +0 -0
index 2bfda9b..63d8075 100644

fs/nfsd/nfsctl.c static struct file_system_type nfsd_fs_type = { · line 678

Quoted 5 lines
fs/nfsd/nfsctl.c +2 -0
@@ -674,6 +674,27 @@ static struct file_system_type nfsd_fs_type = {
 	.kill_sb	= kill_litter_super,
 };
 
+#ifdef CONFIG_PROC_FS
+static inline int create_proc_exports_entry(void)

Nit: "inline" is probably not needed here.

Quoted 43 lines
fs/nfsd/nfsctl.c +22 -9
+{
+	struct proc_dir_entry *entry;
+
+	entry = proc_mkdir("fs/nfs", NULL);
+	if (!entry)
+		return -ENOMEM;
+	entry = create_proc_entry("fs/nfs/exports", 0, NULL);
+	if (!entry)
+		return -ENOMEM;
+	entry->proc_fops =  &exports_operations;
+	return 0;
+}
+#else /* CONFIG_PROC_FS */
+static inline int create_proc_exports_entry(void)
+{
+	return 0;
+}
+#endif
+
 static int __init init_nfsd(void)
 {
 	int retval;
@@ -689,23 +710,21 @@ static int __init init_nfsd(void)
 	nfsd_export_init();	/* Exports table */
 	nfsd_lockd_init();	/* lockd->nfsd callbacks */
 	nfsd_idmap_init();      /* Name to ID mapping */
-	if (proc_mkdir("fs/nfs", NULL)) {
-		struct proc_dir_entry *entry;
-		entry = create_proc_entry("fs/nfs/exports", 0, NULL);
-		if (entry)
-			entry->proc_fops =  &exports_operations;
-	}
+	retval = create_proc_exports_entry();
+	if (retval)
+		goto out_free_idmap;
 	retval = register_filesystem(&nfsd_fs_type);
 	if (retval)
 		goto out_free_all;
 	return 0;
 out_free_all:
-	nfsd_idmap_shutdown();
-	nfsd_export_shutdown();
-	nfsd_reply_cache_shutdown();

fs/nfsd/nfsctl.c static int __init init_nfsd(void) · line 730

Quoted 10 lines
fs/nfsd/nfsctl.c +4 -0
 	remove_proc_entry("fs/nfs/exports", NULL);
 	remove_proc_entry("fs/nfs", NULL);
+	nfsd_idmap_shutdown();
+out_free_idmap:
 	nfsd_lockd_shutdown();
+	nfsd_export_shutdown();
+	nfsd_reply_cache_shutdown();
 out_free_stat:
 	nfsd_stat_shutdown();
 	nfsd4_free_slabs();

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#130 lore raw

Re: [PATCH 021/100] nfsd: fail init on /proc/fs/nfs/exports creation failure

Quoted 21 lines · Chuck Lever
Quoted 20 lines · J. Bruce Fields

I assume the reason failure of creation was ignored here was just to continue support embedded systems that want nfsd but not proc.

However, in cases where proc is supported it would be clearer to fail entirely than to come up with some features disabled.

---
 fs/nfsd/nfsctl.c |   37 ++++++++++++++++++++++++++++---------
 1 files changed, 28 insertions(+), 9 deletions(-)
fs/nfsd/nfsctl.c +0 -0
index 2bfda9b..63d8075 100644
@@ -674,6 +674,27 @@ static struct file_system_type nfsd_fs_type = {
 	.kill_sb	= kill_litter_super,
 };
 
Quoted 4 lines

fs/nfsd/nfsctl.c static struct file_system_type nfsd_fs_type = { · line 678

Quoted 2 lines
fs/nfsd/nfsctl.c +2 -0
+#ifdef CONFIG_PROC_FS
+static inline int create_proc_exports_entry(void)

Nit: "inline" is probably not needed here.

OK, fixed.--b.

#131 lore raw

Re: [PATCH 020/100] nfsd: select CONFIG_PROC_FS in nfsv4 and gss server cases

In reply to J. Bruce Fields
Quoted 20 lines · J. Bruce Fields

The server depends on upcalls under /proc to support nfsv4 and gss.

---
 fs/Kconfig |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
fs/Kconfig +2 -0
index 487236c..e81fcd6 100644
@@ -1679,6 +1679,8 @@ config NFSD
 	select CRYPTO_MD5 if NFSD_V4
 	select CRYPTO if NFSD_V4
 	select FS_POSIX_ACL if NFSD_V4
+	select PROC_FS if NFSD_V4
+	select PROC_FS if SUNRPC_GSS
 	help
 	  If you want your Linux box to act as an NFS *server*, so that  
Quoted 3 lines

other
computers on your local network which support NFS can access
certain

I'm no Kconfig guru... but wouldn't this be better expressed as a "depends" clause?

i.e. CONFIG_NFSD_V4 and SUNRPC_GSS should depend on PROC_FS -- otherwise, someone might deselect PROC_FS, then select NFSV4 or GSS, and get a surprise.

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#132 lore raw

Re: [PATCH 020/100] nfsd: select CONFIG_PROC_FS in nfsv4 and gss server cases

Quoted 19 lines · Chuck Lever
Quoted 18 lines · J. Bruce Fields

The server depends on upcalls under /proc to support nfsv4 and gss.

---
 fs/Kconfig |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
fs/Kconfig +2 -0
index 487236c..e81fcd6 100644
@@ -1679,6 +1679,8 @@ config NFSD
 	select CRYPTO_MD5 if NFSD_V4
 	select CRYPTO if NFSD_V4
 	select FS_POSIX_ACL if NFSD_V4
+	select PROC_FS if NFSD_V4
+	select PROC_FS if SUNRPC_GSS
Quoted 8 lines
Quoted 5 lines
fs/Kconfig +0 -0
 	help
 	  If you want your Linux box to act as an NFS *server*, so that  

other
computers on your local network which support NFS can access
certain

I'm no Kconfig guru... but wouldn't this be better expressed as a "depends" clause?

No idea. "Not a Kconfig guru" would be a vast understatement in my case.

Quoted 3 lines

i.e. CONFIG_NFSD_V4 and SUNRPC_GSS should depend on PROC_FS -- otherwise, someone might deselect PROC_FS, then select NFSV4 or GSS, and get a surprise.

The drawback being that no amount of searching through the menus will then help you figure out where the NFSv4 and GSS options have gone to, right?

I don't care either way, but I'm inclined to leave this as is until someone comes along with really clear and convincing criteria for when to choose select and when to choose depends.

--b.

#133 lore raw

Re: [PATCH 020/100] nfsd: select CONFIG_PROC_FS in nfsv4 and gss server cases

Quoted 32 lines · J. Bruce Fields
Quoted 19 lines · Chuck Lever
Quoted 18 lines · J. Bruce Fields

The server depends on upcalls under /proc to support nfsv4 and gss.

---
 fs/Kconfig |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
fs/Kconfig +2 -0
index 487236c..e81fcd6 100644
@@ -1679,6 +1679,8 @@ config NFSD
 	select CRYPTO_MD5 if NFSD_V4
 	select CRYPTO if NFSD_V4
 	select FS_POSIX_ACL if NFSD_V4
+	select PROC_FS if NFSD_V4
+	select PROC_FS if SUNRPC_GSS
Quoted 8 lines
Quoted 5 lines
fs/Kconfig +0 -0
 	help
 	  If you want your Linux box to act as an NFS *server*, so that

other
computers on your local network which support NFS can access
certain

I'm no Kconfig guru... but wouldn't this be better expressed as a "depends" clause?

No idea. "Not a Kconfig guru" would be a vast understatement in my case.

Quoted 7 lines
Quoted 3 lines

i.e. CONFIG_NFSD_V4 and SUNRPC_GSS should depend on PROC_FS -- otherwise, someone might deselect PROC_FS, then select NFSV4 or GSS, and get a surprise.

The drawback being that no amount of searching through the menus will then help you figure out where the NFSv4 and GSS options have gone to, right?

Just looking in fs/Kconfig will give you some idea. But what would be more helpful would be a statement in the help for CONFIG_NFS that procfs is required to support NFSv4 or GSS.

Quoted 3 lines

I don't care either way, but I'm inclined to leave this as is until someone comes along with really clear and convincing criteria for when to choose select and when to choose depends.

If NFSv4 or GSS *require* procfs to work, then "depends" is the right choice.

As the patch stands, selecting NFSv4 will also select PROC_FS, but you can go back and deselect PROC_FS later; and you're back in the same boat you were in before this patch.

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#134 lore raw

Re: [PATCH 020/100] nfsd: select CONFIG_PROC_FS in nfsv4 and gss server cases

Quoted 7 lines · Chuck Lever
Quoted 3 lines · J. Bruce Fields

I don't care either way, but I'm inclined to leave this as is until someone comes along with really clear and convincing criteria for when to choose select and when to choose depends.

If NFSv4 or GSS *require* procfs to work, then "depends" is the right choice.

Neither CONFIG_NFS_FS nor CONFIG_NFSD_FS seem to be following this rule?

Could you submit a patch that fixes all of those?

Quoted 4 lines

As the patch stands, selecting NFSv4 will also select PROC_FS, but you can go back and deselect PROC_FS later; and you're back in the same boat you were in before this patch.

I just checked, and "make menuconfig", at least, isn't letting me go back and deselect PROC_FS.

--b.

#135 lore raw

Re: [PATCH 020/100] nfsd: select CONFIG_PROC_FS in nfsv4 and gss server cases

Quoted 6 lines · J. Bruce Fields
Quoted 5 lines · Chuck Lever
Quoted 3 lines · J. Bruce Fields

I don't care either way, but I'm inclined to leave this as is until someone comes along with really clear and convincing criteria for when to choose select and when to choose depends.

Quoted 6 lines
Quoted 2 lines

If NFSv4 or GSS *require* procfs to work, then "depends" is the right choice.

Neither CONFIG_NFS_FS nor CONFIG_NFSD_FS seem to be following this rule?

Could you submit a patch that fixes all of those?

According to Documentation/kbuild/kconfig-language.txt, "select" is OK to use on non-visible options like NFS_ACL_SUPPORT, LOCKD, and SUNRPC, but generally "depends on" is preferred for setting visible options. Apparently "select" doesn't do proper dependency checking, it just forces the value of the named option.

NFS_FS looks correct in this regard.

However, NFSD is probably not correct... for example, instead of "select NFSD_TCP if NFSD_V4" we should probably instead add a "depends on NFSD_TCP" under NFSD_V4.

(Alternately, NFSD_TCP could just go away... hint hint).

I'll propose some patches to rectify some of this and fix up the out-of-date help texts.

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#136 lore raw

Re: [PATCH 020/100] nfsd: select CONFIG_PROC_FS in nfsv4 and gss server cases

Quoted 11 lines · Chuck Lever

According to Documentation/kbuild/kconfig-language.txt, "select" is OK to use on non-visible options like NFS_ACL_SUPPORT, LOCKD, and SUNRPC, but generally "depends on" is preferred for setting visible options. Apparently "select" doesn't do proper dependency checking, it just forces the value of the named option.

NFS_FS looks correct in this regard.

However, NFSD is probably not correct... for example, instead of "select NFSD_TCP if NFSD_V4" we should probably instead add a "depends on NFSD_TCP" under NFSD_V4.

OK.

Quoted 1 line

(Alternately, NFSD_TCP could just go away... hint hint).

I guess that would be OK by me, but I'm not volunteering.

Quoted 2 lines

I'll propose some patches to rectify some of this and fix up the out- of-date help texts.

That'd be great, thanks!

--b.

#137 lore raw

Re: [PATCH 020/100] nfsd: select CONFIG_PROC_FS in nfsv4 and gss server cases

In reply to J. Bruce Fields
Quoted 10 lines · J. Bruce Fields
Quoted 7 lines · Chuck Lever
Quoted 3 lines · J. Bruce Fields

I don't care either way, but I'm inclined to leave this as is until someone comes along with really clear and convincing criteria for when to choose select and when to choose depends.

If NFSv4 or GSS *require* procfs to work, then "depends" is the right choice.

Neither CONFIG_NFS_FS nor CONFIG_NFSD_FS seem to be following this rule?

After looking into this, I've found that there are a couple of reasons for this.

First, as I posted last week, "select" is usually OK for non-visible CONFIG options, like LOCKD or SUNRPC.

But, second, we have a mix of boolean and tristate variables here -- and a boolean that selects another tristate variable can only choose Y or N (not M). So the "select ... if ..." clauses are placed up in CONFIG_NFSD on purpose in order to allow the selected variables to be set to M if CONFIG_NFSD is set to M. See commit f05e15b5.

I'm not inclined to adjust any of this for the moment.

And, a quick grep around other Kconfig files reveals that no-one else uses "select PROC_FS" -- every case uses "depends on". Thus CONFIG_NFSD_V4 should use "depends on PROC_FS" as well. Also, this patch doesn't touch the client side -- should CONFIG_NFSV4 depend on PROC_FS too?

Since SUNRPC_GSS is already a non-visible config option and is set via "select", it's more difficult to say with certainty how a "depends on PROC_FS" clause should be constructed for that. However, MAINTAINERS suggests that linux-kbuild@vger might be an appropriate place to ask about these things.

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#138 lore raw

Re: [PATCH 020/100] nfsd: select CONFIG_PROC_FS in nfsv4 and gss server cases

Quoted 17 lines · Chuck Lever
Quoted 7 lines · J. Bruce Fields
Quoted 6 lines · Chuck Lever
Quoted 4 lines · J. Bruce Fields

I don't care either way, but I'm inclined to leave this as is until someone comes along with really clear and convincing criteria for when
to choose select and when to choose depends.

Quoted 5 lines
Quoted 2 lines

If NFSv4 or GSS *require* procfs to work, then "depends" is the right choice.

Neither CONFIG_NFS_FS nor CONFIG_NFSD_FS seem to be following this rule?

After looking into this, I've found that there are a couple of reasons for this.

Quoted 8 lines

First, as I posted last week, "select" is usually OK for non-visible CONFIG options, like LOCKD or SUNRPC.

But, second, we have a mix of boolean and tristate variables here -- and a boolean that selects another tristate variable can only choose Y or N (not M). So the "select ... if ..." clauses are placed up in CONFIG_NFSD on purpose in order to allow the selected variables to be set to M if CONFIG_NFSD is set to M. See commit f05e15b5.

OK, so we only really need "select ... if ..." clauses in CONFIG_NFSD when the thing we're selecting is a tristate. But PROC_FS is a boolean.

Quoted 6 lines

I'm not inclined to adjust any of this for the moment.

And, a quick grep around other Kconfig files reveals that no-one else uses "select PROC_FS" -- every case uses "depends on". Thus CONFIG_NFSD_V4 should use "depends on PROC_FS" as well.

OK. Is there a chance you make a patch with a changelog summarizing this?

Quoted 2 lines

Also, this patch doesn't touch the client side -- should CONFIG_NFSV4 depend on PROC_FS too?

No, the server case is unique since it uses files under /proc for certain upcalls necessary to support nfsv4 and rpcsec_gss.

Quoted 5 lines

Since SUNRPC_GSS is already a non-visible config option and is set via "select", it's more difficult to say with certainty how a "depends on PROC_FS" clause should be constructed for that. However, MAINTAINERS suggests that linux-kbuild@vger might be an appropriate place to ask about these things.

OK, so the question is: how can we ensure that PROC_FS is turned on when SUNRPC_GSS *and* NFSD are (where both SUNRPC_GSS and NFSD may be independently set on or off), while still leaving SUNRPC_GSS a tristate whose value is at least that of RPCSEC_GSS_KRB5 and RPCSEC_GSS_SPKM3.

--b.

#139 lore raw

Re: [PATCH 020/100] nfsd: select CONFIG_PROC_FS in nfsv4 and gss server cases

Quoted 31 lines · J. Bruce Fields
Quoted 20 lines · Chuck Lever
Quoted 7 lines · J. Bruce Fields
Quoted 6 lines · Chuck Lever
Quoted 4 lines · J. Bruce Fields

I don't care either way, but I'm inclined to leave this as is until someone comes along with really clear and convincing criteria for when
to choose select and when to choose depends.

Quoted 5 lines
Quoted 2 lines

If NFSv4 or GSS *require* procfs to work, then "depends" is the right choice.

Neither CONFIG_NFS_FS nor CONFIG_NFSD_FS seem to be following this rule?

After looking into this, I've found that there are a couple of reasons for this.

First, as I posted last week, "select" is usually OK for non-visible CONFIG options, like LOCKD or SUNRPC.

Quoted 6 lines

But, second, we have a mix of boolean and tristate variables here -- and
a boolean that selects another tristate variable can only choose Y or N (not M). So the "select ... if ..." clauses are placed up in CONFIG_NFSD on purpose in order to allow the selected variables to be set to M if CONFIG_NFSD is set to M. See commit f05e15b5.

OK, so we only really need "select ... if ..." clauses in CONFIG_NFSD when the thing we're selecting is a tristate. But PROC_FS is a boolean.

Quoted 8 lines
Quoted 5 lines

I'm not inclined to adjust any of this for the moment.

And, a quick grep around other Kconfig files reveals that no-one else uses "select PROC_FS" -- every case uses "depends on". Thus CONFIG_NFSD_V4 should use "depends on PROC_FS" as well.

OK. Is there a chance you make a patch with a changelog summarizing this?

OK, will post after I've synced up with 2.6.25-rc1 + your server patches.

Quoted 10 lines
Quoted 5 lines

Since SUNRPC_GSS is already a non-visible config option and is set via "select", it's more difficult to say with certainty how a "depends on PROC_FS" clause should be constructed for that. However, MAINTAINERS suggests that linux-kbuild@vger might be an appropriate place to ask about these things.

OK, so the question is: how can we ensure that PROC_FS is turned on when SUNRPC_GSS *and* NFSD are (where both SUNRPC_GSS and NFSD may be independently set on or off), while still leaving SUNRPC_GSS a tristate whose value is at least that of RPCSEC_GSS_KRB5 and RPCSEC_GSS_SPKM3.

How about adding "depends on ... && PROC_FS" in the RPCSEC_GSS_FOO sections?

I also thought about adding "depends on PROC_FS" under the SUNRPC_GSS section.

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#140 lore raw

Re: [PATCH 020/100] nfsd: select CONFIG_PROC_FS in nfsv4 and gss server cases

Quoted 11 lines · Chuck Lever
Quoted 7 lines · J. Bruce Fields
Quoted 3 lines · Chuck Lever

And, a quick grep around other Kconfig files reveals that no-one else uses "select PROC_FS" -- every case uses "depends on". Thus CONFIG_NFSD_V4 should use "depends on PROC_FS" as well.

OK. Is there a chance you make a patch with a changelog summarizing this?

OK, will post after I've synced up with 2.6.25-rc1 + your server patches.

Thanks!

Quoted 15 lines
Quoted 7 lines
Quoted 6 lines

Since SUNRPC_GSS is already a non-visible config option and is set via
"select", it's more difficult to say with certainty how a "depends on PROC_FS" clause should be constructed for that. However, MAINTAINERS suggests that linux-kbuild@vger might be an appropriate place to ask about these things.

Quoted 6 lines

OK, so the question is: how can we ensure that PROC_FS is turned on when
SUNRPC_GSS *and* NFSD are (where both SUNRPC_GSS and NFSD may be independently set on or off), while still leaving SUNRPC_GSS a tristate
whose value is at least that of RPCSEC_GSS_KRB5 and RPCSEC_GSS_SPKM3.

Quoted 5 lines

How about adding "depends on ... && PROC_FS" in the RPCSEC_GSS_FOO sections?

I also thought about adding "depends on PROC_FS" under the SUNRPC_GSS section.

Well, in theory I think it's currently possible to build a kernel with NFS and SUNRPC_GSS but no PROC_FS (or NFSD). Such a change would make that no longer possible. (Whether anyone cares, I don't know.)

--b.

#141 lore raw

Re: [PATCH 018/100] nfsd: fail module init on reply cache init failure

In reply to J. Bruce Fields
Quoted 26 lines · J. Bruce Fields

If the reply cache initialization fails due to a kmalloc failure, currently we try to soldier on with a reduced (or nonexistant) reply cache.

Better to just fail immediately: the failure is then much easier to understand and debug, and it could save us complexity in some later code. (But actually, it doesn't help currently because the cache is also turned off in some odd failure cases; we should probably find a better way to handle those failure cases some day.)

Fix some minor style problems while we're at it, and rename nfsd_cache_init() to remove the need for a comment describing it.

---
 fs/nfsd/nfscache.c         |   28 +++++++++++++---------------
 fs/nfsd/nfsctl.c           |   11 +++++++----
 include/linux/nfsd/cache.h |    4 ++--
 3 files changed, 22 insertions(+), 21 deletions(-)
fs/nfsd/nfscache.c +0 -0
index 578f2c9..92cb5ae 100644

fs/nfsd/nfscache.c static int nfsd_cache_append(struct svc_rqst · line 49

Quoted 8 lines
fs/nfsd/nfscache.c +2 -2
@@ -44,17 +44,18 @@ static int	nfsd_cache_append(struct svc_rqst  
 *rqstp, struct kvec *vec);
  */
 static DEFINE_SPINLOCK(cache_lock);
 
-void
-nfsd_cache_init(void)
+int
+nfsd_reply_cache_init(void)

I'm surprised this got by the style police.

Quoted 36 lines
fs/nfsd/nfscache.c +3 -2
 {
 	struct svc_cacherep	*rp;
 	int			i;
 
 	INIT_LIST_HEAD(&lru_head);
 	i = CACHESIZE;
-	while(i) {
+	while (i) {
 		rp = kmalloc(sizeof(*rp), GFP_KERNEL);
-		if (!rp) break;
+		if (!rp)
+			goto out_nomem;
 		list_add(&rp->c_lru, &lru_head);
 		rp->c_state = RC_UNUSED;
fs/nfsd/nfscache.c +2 -10
 		rp->c_type = RC_NOCACHE;
@@ -62,23 +63,20 @@ nfsd_cache_init(void)
 		i--;
 	}
 
-	if (i)
-		printk (KERN_ERR "nfsd: cannot allocate all %d cache entries,  
 only got %d\n",
-			CACHESIZE, CACHESIZE-i);
-
 	hash_list = kcalloc (HASHSIZE, sizeof(struct hlist_head),  
 GFP_KERNEL);
-	if (!hash_list) {
-		nfsd_cache_shutdown();
-		printk (KERN_ERR "nfsd: cannot allocate %Zd bytes for hash list\n",
-			HASHSIZE * sizeof(struct hlist_head));
-		return;
-	}
+	if (!hash_list)
+		goto out_nomem;
 
 	cache_disabled = 0;

fs/nfsd/nfscache.c nfsd_cache_init(void) · line 81

Quoted 10 lines
fs/nfsd/nfscache.c +6 -1
+	return 0;
+out_nomem:
+	printk(KERN_ERR "nfsd: failed to allocate reply cache\n");
+	nfsd_reply_cache_shutdown();
+	return -ENOMEM;
 }
 
 void
-nfsd_cache_shutdown(void)
+nfsd_reply_cache_shutdown(void)

Likewise.

Quoted 64 lines
fs/nfsd/nfscache.c +0 -0
 {
fs/nfsd/nfscache.c +0 -0
 	struct svc_cacherep	*rp;
fs/nfsd/nfsctl.c +7 -4
index ecf3779..2bfda9b 100644
@@ -683,7 +683,9 @@ static int __init init_nfsd(void)
 	if (retval)
 		return retval;
 	nfsd_stat_init();	/* Statistics */
-	nfsd_cache_init();	/* RPC reply cache */
+	retval = nfsd_reply_cache_init();
+	if (retval)
+		goto out_free_stat;
 	nfsd_export_init();	/* Exports table */
 	nfsd_lockd_init();	/* lockd->nfsd callbacks */
 	nfsd_idmap_init();      /* Name to ID mapping */
@@ -700,11 +702,12 @@ static int __init init_nfsd(void)
 out_free_all:
 	nfsd_idmap_shutdown();
 	nfsd_export_shutdown();
-	nfsd_cache_shutdown();
+	nfsd_reply_cache_shutdown();
 	remove_proc_entry("fs/nfs/exports", NULL);
 	remove_proc_entry("fs/nfs", NULL);
-	nfsd_stat_shutdown();
 	nfsd_lockd_shutdown();
+out_free_stat:
+	nfsd_stat_shutdown();
 	nfsd4_free_slabs();
 	return retval;
 }
@@ -712,7 +715,7 @@ out_free_all:
 static void __exit exit_nfsd(void)
 {
 	nfsd_export_shutdown();
-	nfsd_cache_shutdown();
+	nfsd_reply_cache_shutdown();
 	remove_proc_entry("fs/nfs/exports", NULL);
 	remove_proc_entry("fs/nfs", NULL);
 	nfsd_stat_shutdown();
include/linux/nfsd/cache.h +2 -2
index 007480c..7b5d784 100644
@@ -72,8 +72,8 @@ enum {
  */
 #define RC_DELAY		(HZ/5)
 
-void	nfsd_cache_init(void);
-void	nfsd_cache_shutdown(void);
+int	nfsd_reply_cache_init(void);
+void	nfsd_reply_cache_shutdown(void);
 int	nfsd_cache_lookup(struct svc_rqst *, int);
 void	nfsd_cache_update(struct svc_rqst *, int, __be32 *);
 
Signature · 6 lines
1.5.4.rc2.60.gb2e62

-
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#142 lore raw

Re: [PATCH 018/100] nfsd: fail module init on reply cache init failure

Quoted 31 lines · Chuck Lever
Quoted 30 lines · J. Bruce Fields

If the reply cache initialization fails due to a kmalloc failure, currently we try to soldier on with a reduced (or nonexistant) reply cache.

Better to just fail immediately: the failure is then much easier to understand and debug, and it could save us complexity in some later code. (But actually, it doesn't help currently because the cache is also turned off in some odd failure cases; we should probably find a better way to handle those failure cases some day.)

Fix some minor style problems while we're at it, and rename nfsd_cache_init() to remove the need for a comment describing it.

---
 fs/nfsd/nfscache.c         |   28 +++++++++++++---------------
 fs/nfsd/nfsctl.c           |   11 +++++++----
 include/linux/nfsd/cache.h |    4 ++--
 3 files changed, 22 insertions(+), 21 deletions(-)
fs/nfsd/nfscache.c +0 -0
index 578f2c9..92cb5ae 100644
@@ -44,17 +44,18 @@ static int	nfsd_cache_append(struct svc_rqst  
 *rqstp, struct kvec *vec);
  */
 static DEFINE_SPINLOCK(cache_lock);
 
Quoted 6 lines

fs/nfsd/nfscache.c static int nfsd_cache_append(struct svc_rqst *rqstp, struct kvec *vec); · line 48

Quoted 4 lines
fs/nfsd/nfscache.c +2 -2
-void
-nfsd_cache_init(void)
+int
+nfsd_reply_cache_init(void)

I'm surprised this got by the style police.

Hmm. checkpatch.pl doesn't seem to catch that.

Anyway, fair enough, fixed, and...

Quoted 5 lines

fs/nfsd/nfscache.c nfsd_cache_init(void) · line 79

Quoted 3 lines
fs/nfsd/nfscache.c +1 -1
 void
-nfsd_cache_shutdown(void)
+nfsd_reply_cache_shutdown(void)

Likewise.

... also fixed. Thanks.

--b.

#143 lore raw

Re: [PATCH 015/100] nfsd: Fix handling of negative lengths in read_buf()

In reply to J. Bruce Fields
Quoted 18 lines · J. Bruce Fields

The length "nbytes" passed into read_buf should never be negative, but we check only for too-large values of "nbytes", not for too-small values. Make nbytes unsigned, so it's clear that the former tests are sufficient. (Despite this read_buf() currently correctly returns an xdr error in the case of a negative length, thanks to an unsigned comparison with size_of() and bounds-checking in kmalloc(). This seems very fragile, though.)

---
 fs/nfsd/nfs4xdr.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
fs/nfsd/nfs4xdr.c +0 -0
index 5733394..25c7ae2 100644

fs/nfsd/nfs4xdr.c xdr_error: \ · line 154

Quoted 8 lines
fs/nfsd/nfs4xdr.c +1 -1
@@ -148,7 +148,7 @@ xdr_error:					\
 	}					\
 } while (0)
 
-static __be32 *read_buf(struct nfsd4_compoundargs *argp, int nbytes)
+static __be32 *read_buf(struct nfsd4_compoundargs *argp, u32 nbytes)
 {
 	/* We want more bytes than seem to be available.
 	 * Maybe we need a new page, maybe we have just run out

Changing nbytes to an unsigned introduces a mixed-sign comparison:

        int avail = (char*)argp->end - (char*)argp->p;
        __be32 *p;
        if (avail + argp->pagelen < nbytes)  <<<<<<

"avail" and "argp->pagelen" are signed ints.

                return NULL;
        if (avail + PAGE_SIZE < nbytes) /* need more than a page !! */
                return NULL;

PAGE_SIZE is unsigned long (defined as "1UL << PAGE_SHIFT"), so changing nbytes may have additional unintended consequences.

We need careful review of everywhere argp->pagelen is used throughout this file. But I think just this simple fix is inadequate.

Quoted 12 lines
fs/nfsd/nfs4xdr.c +5 -0
@@ -169,6 +169,11 @@ static __be32 *read_buf(struct  
 nfsd4_compoundargs *argp, int nbytes)
 			return NULL;
 
 	}
+	/*
+	 * The following memcpy is safe because read_buf is always
+	 * called with nbytes > avail, and the two cases above both
+	 * guarantee p points to at least nbytes bytes.
+	 */
 	memcpy(p, argp->p, avail);
 	/* step to next page */
Quoted 8 lines

argp->p = page_address(argp->pagelist[0]);

Signature · 6 lines
1.5.4.rc2.60.gb2e62

-
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#144 lore raw

Re: [PATCH 015/100] nfsd: Fix handling of negative lengths in read_buf()

Quoted 32 lines · Chuck Lever
Quoted 20 lines · J. Bruce Fields

The length "nbytes" passed into read_buf should never be negative, but we check only for too-large values of "nbytes", not for too-small values. Make nbytes unsigned, so it's clear that the former tests are sufficient. (Despite this read_buf() currently correctly returns an xdr
error in the case of a negative length, thanks to an unsigned comparison with size_of() and bounds-checking in kmalloc(). This seems
very fragile, though.)

---
 fs/nfsd/nfs4xdr.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
fs/nfsd/nfs4xdr.c +0 -0
index 5733394..25c7ae2 100644

fs/nfsd/nfs4xdr.c xdr_error: \ · line 154

Quoted 8 lines
fs/nfsd/nfs4xdr.c +1 -1
@@ -148,7 +148,7 @@ xdr_error:					\
 	}					\
 } while (0)
 
-static __be32 *read_buf(struct nfsd4_compoundargs *argp, int nbytes)
+static __be32 *read_buf(struct nfsd4_compoundargs *argp, u32 nbytes)
 {
 	/* We want more bytes than seem to be available.
 	 * Maybe we need a new page, maybe we have just run out

Changing nbytes to an unsigned introduces a mixed-sign comparison:

Quoted 5 lines
        int avail = (char*)argp->end - (char*)argp->p;
        __be32 *p;
        if (avail + argp->pagelen < nbytes)  <<<<<<

"avail" and "argp->pagelen" are signed ints.

OK. Is the result incorrect?

(Any objections to just making "avail" unsigned?)

Quoted 10 lines
                return NULL;
        if (avail + PAGE_SIZE < nbytes) /* need more than a page !! */
                return NULL;

PAGE_SIZE is unsigned long (defined as "1UL << PAGE_SHIFT"), so changing nbytes may have additional unintended consequences.

We need careful review of everywhere argp->pagelen is used throughout this file. But I think just this simple fix is inadequate.

Sure, such a review would be welcomed.

The patch still seems an obvious improvement to me (and you don't seem to be arguing the contrary?) so I'm inclined to apply it pending that further work.

--b.

#145 lore raw

Re: [PATCH 015/100] nfsd: Fix handling of negative lengths in read_buf()

Hi Bruce-

Quoted 35 lines · J. Bruce Fields
Quoted 34 lines · Chuck Lever
Quoted 28 lines · J. Bruce Fields

The length "nbytes" passed into read_buf should never be negative, but we check only for too-large values of "nbytes", not for too-small values. Make nbytes unsigned, so it's clear that the former tests are sufficient. (Despite this read_buf() currently correctly returns an xdr
error in the case of a negative length, thanks to an unsigned comparison with size_of() and bounds-checking in kmalloc(). This seems
very fragile, though.)

---
 fs/nfsd/nfs4xdr.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
fs/nfsd/nfs4xdr.c +1 -1
index 5733394..25c7ae2 100644
@@ -148,7 +148,7 @@ xdr_error:					\
 	}					\
 } while (0)
 
-static __be32 *read_buf(struct nfsd4_compoundargs *argp, int  
 nbytes)
+static __be32 *read_buf(struct nfsd4_compoundargs *argp, u32  
 nbytes)
 {

fs/nfsd/nfs4xdr.c xdr_error: \ · line 154

Quoted 2 lines
fs/nfsd/nfs4xdr.c +0 -0
 	/* We want more bytes than seem to be available.
 	 * Maybe we need a new page, maybe we have just run out

Changing nbytes to an unsigned introduces a mixed-sign comparison:

Quoted 7 lines
Quoted 5 lines
        int avail = (char*)argp->end - (char*)argp->p;
        __be32 *p;
        if (avail + argp->pagelen < nbytes)  <<<<<<

"avail" and "argp->pagelen" are signed ints.

OK. Is the result incorrect?

Whether it is or it isn't, I'm not comfortable with introducing a mixed-sign comparison for no reason. It's not a correctness issue, it's a maintainability issue.

Quoted 1 line

(Any objections to just making "avail" unsigned?)

If we can guarantee that argp->end is always larger than argp->p... then there's no need for "avail" to be a signed int. However:

Quoted 7 lines
Quoted 7 lines

return NULL;
if (avail + PAGE_SIZE < nbytes) /* need more than a
page !! */

                return NULL;

PAGE_SIZE is unsigned long (defined as "1UL << PAGE_SHIFT"), so changing nbytes may have additional unintended consequences.

...and since that wasn't noticed or addressed by this patch, it suggests that there may be other issues that the patch author didn't address and that reviewers didn't catch.

Quoted 8 lines
Quoted 2 lines

We need careful review of everywhere argp->pagelen is used throughout this file. But I think just this simple fix is inadequate.

Sure, such a review would be welcomed.

The patch still seems an obvious improvement to me (and you don't seem to be arguing the contrary?) so I'm inclined to apply it pending that further work.

I agree that nbytes should be unsigned, but I'm arguing that you will need more than just changing nbytes to a u32 to produce a truly clean fix; therefore, I'm suggesting you should hold off on this until we have a complete fix that is a result of a thorough review of that code.

My experience with the NFSv4 XDR routines is that there are scores of these little nuisances waiting to bite us (and a brief review of how argp->pagelen is used in nfs4xdr.c vindicates this experience).

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#146 lore raw

Re: [PATCH 015/100] nfsd: Fix handling of negative lengths in read_buf()

Quoted 10 lines · Chuck Lever

Hi Bruce-

Quoted 7 lines · J. Bruce Fields
Quoted 6 lines · Chuck Lever

Changing nbytes to an unsigned introduces a mixed-sign comparison:

        int avail = (char*)argp->end - (char*)argp->p;
        __be32 *p;
        if (avail + argp->pagelen < nbytes)  <<<<<<
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

"avail" and "argp->pagelen" are signed ints.

OK. Is the result incorrect?

Whether it is or it isn't, I'm not comfortable with introducing a mixed-sign comparison for no reason. It's not a correctness issue, it's a maintainability issue.

I understand, I just wanted to make sure.

(As a general rule, it would be helpful to me if, both in comments like this and on any patches, you'd clearly state whether or not you've found a run-time bug.)

Quoted 5 lines
Quoted 2 lines

(Any objections to just making "avail" unsigned?)

If we can guarantee that argp->end is always larger than argp->p... then there's no need for "avail" to be a signed int. However:

OK.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

return NULL;
if (avail + PAGE_SIZE < nbytes) /* need more than a page !!
*/

                return NULL;
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

PAGE_SIZE is unsigned long (defined as "1UL << PAGE_SHIFT"), so changing
nbytes may have additional unintended consequences.

...and since that wasn't noticed or addressed by this patch, it suggests that there may be other issues that the patch author didn't address and that reviewers didn't catch.

The change in behavior of these comparisons was exactly the point of the patch:

"The length "nbytes" passed into read_buf should never be negative, but we check only for too-large values of "nbytes", not for too-small values. Make nbytes unsigned, so it's clear that the former tests are sufficient."

Was my comment there unclear, or am I missing some other problem?

--b.

#147 lore raw

Re: [PATCH 015/100] nfsd: Fix handling of negative lengths in read_buf()

Hi Bruce-

Quoted 19 lines · J. Bruce Fields
Quoted 10 lines · Chuck Lever

Hi Bruce-

Quoted 7 lines · J. Bruce Fields
Quoted 6 lines · Chuck Lever

Changing nbytes to an unsigned introduces a mixed-sign comparison:

        int avail = (char*)argp->end - (char*)argp->p;
        __be32 *p;
        if (avail + argp->pagelen < nbytes)  <<<<<<
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

"avail" and "argp->pagelen" are signed ints.

OK. Is the result incorrect?

Whether it is or it isn't, I'm not comfortable with introducing a mixed-sign comparison for no reason. It's not a correctness issue, it's a maintainability issue.

Quoted 5 lines

I understand, I just wanted to make sure.

(As a general rule, it would be helpful to me if, both in comments like this and on any patches, you'd clearly state whether or not you've found a run-time bug.)

I haven't checked it carefully enough to say whether there is a run-time problem with the old or the patched version of read_buf(). At this point it's not likely, but there is enough implicit type casting in the comparisons and when passing arguments that the original intention of the authors of this code is not exactly clear.

I do now make it a practice in patch descriptions to state "Clean up:" if the patch does not address a run-time bug.

Quoted 9 lines

The change in behavior of these comparisons was exactly the point of the patch:

"The length "nbytes" passed into read_buf should never be negative, but we check only for too-large values of "nbytes", not for too-small values. Make nbytes unsigned, so it's clear that the former tests are sufficient."

Was my comment there unclear, or am I missing some other problem?

In my opinion, introducing a mixed sign comparison makes the tests less clear. I would fix at least "avail" and perhaps "argp->pagelen", and assert that argp->end > argp->p, to make the tests in read_buf() entirely precise.

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#148 lore raw

Re: [PATCH 015/100] nfsd: Fix handling of negative lengths in read_buf()

Quoted 8 lines · Chuck Lever

I haven't checked it carefully enough to say whether there is a run-time problem with the old or the patched version of read_buf(). At this point it's not likely, but there is enough implicit type casting in the comparisons and when passing arguments that the original intention of the authors of this code is not exactly clear.

I do now make it a practice in patch descriptions to state "Clean up:" if the patch does not address a run-time bug.

If it's obvious from the comment that's fine too (just keep in mind I'm often tired and/or stupid, so our definitions of "obvious" may differ!) I'm not looking for excuses to ignore them, I just want to understand whether a patch is supposed to make no change in run-time behavior at all, or fixes a critical runtime bug, or something in between.

Quoted 9 lines
Quoted 9 lines

The change in behavior of these comparisons was exactly the point of the patch:

"The length "nbytes" passed into read_buf should never be negative, but we check only for too-large values of "nbytes", not for too-small values. Make nbytes unsigned, so it's clear that the former tests are sufficient."

Quoted 7 lines
Quoted 1 line

Was my comment there unclear, or am I missing some other problem?

In my opinion, introducing a mixed sign comparison makes the tests less clear. I would fix at least "avail" and perhaps "argp->pagelen", and assert that argp->end > argp->p, to make the tests in read_buf() entirely precise.

OK. For now I'd like to fix the one obvious thing (fixing "avail") and leave the rest as is.

--b.

commit c93b00d7b51e2fa6fd00aaa41f49c4abc264c151

Author: J. Bruce Fields <[email protected]>
Date:   Sun Nov 11 15:43:12 2007 -0500

nfsd: Fix handling of negative lengths in read_buf()

The length "nbytes" passed into read_buf should never be negative, but we check only for too-large values of "nbytes", not for too-small values. Make nbytes unsigned, so it's clear that the former tests are sufficient. (Despite this read_buf() currently correctly returns an xdr error in the case of a negative length, thanks to an unsigned comparison with size_of() and bounds-checking in kmalloc(). This seems very fragile, though.)

fs/nfsd/nfs4xdr.c +7 -2
index 5733394..20a0961 100644
@@ -148,12 +148,12 @@ xdr_error:					\
 	}					\
 } while (0)
 
-static __be32 *read_buf(struct nfsd4_compoundargs *argp, int nbytes)
+static __be32 *read_buf(struct nfsd4_compoundargs *argp, u32 nbytes)
 {
 	/* We want more bytes than seem to be available.
 	 * Maybe we need a new page, maybe we have just run out
 	 */
-	int avail = (char*)argp->end - (char*)argp->p;
+	unsigned int avail = (char*)argp->end - (char*)argp->p;
 	__be32 *p;
 	if (avail + argp->pagelen < nbytes)
 		return NULL;
@@ -169,6 +169,11 @@ static __be32 *read_buf(struct nfsd4_compoundargs *argp, int nbytes)
 			return NULL;
 		
 	}
+	/*
+	 * The following memcpy is safe because read_buf is always
+	 * called with nbytes > avail, and the two cases above both
+	 * guarantee p points to at least nbytes bytes.
+	 */
 	memcpy(p, argp->p, avail);
 	/* step to next page */
 	argp->p = page_address(argp->pagelist[0]);
#149 lore raw

Re: [PATCH 003/100] Fix incorrect assignment

In reply to J. Bruce Fields
Quoted 9 lines · J. Bruce Fields

From: Prasad P <[email protected]>

Dereferenced pointer "dentry" without checking and assigned to inode in the declaration.

(We could just delete the NULL checks that follow instead, as we never get to the encode function in this particular case. But it takes a little detective work to verify that fact, so it's probably safer to leave the checks in place.)

I think adding a comment to this effect before the "dentry == NULL" check would be beneficial.

Quoted 20 lines
---
 fs/nfsd/nfs2acl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/nfsd/nfs2acl.c +1 -1
index 0e5fa11..d5fca59 100644
@@ -221,7 +221,7 @@ static int nfsaclsvc_encode_getaclres(struct  
 svc_rqst *rqstp, __be32 *p,
 		struct nfsd3_getaclres *resp)
 {
 	struct dentry *dentry = resp->fh.fh_dentry;
-	struct inode *inode = dentry->d_inode;
+	struct inode *inode;
 	struct kvec *head = rqstp->rq_res.head;
 	unsigned int base;
Quoted 8 lines

int n;

Signature · 6 lines
1.5.4.rc2.60.gb2e62

-
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#150 lore raw

Re: [PATCH 003/100] Fix incorrect assignment

Quoted 6 lines · Chuck Lever
Quoted 5 lines · J. Bruce Fields

From: Prasad P <[email protected]>

Dereferenced pointer "dentry" without checking and assigned to inode in the declaration.

Quoted 7 lines
Quoted 4 lines

(We could just delete the NULL checks that follow instead, as we never get to the encode function in this particular case. But it takes a little detective work to verify that fact, so it's probably safer to leave the checks in place.)

I think adding a comment to this effect before the "dentry == NULL" check would be beneficial.

OK. How about this?

--b.

commit edd084f0dc22316bff9f4a25fc1fd8cccfbe82bd

Author: Prasad P <[email protected]>
Date:   Wed Oct 24 15:14:32 2007 -0500

nfsd: Fix inconsistent assignment

Dereferenced pointer "dentry" without checking and assigned to inode in the declaration.

(We could just delete the NULL checks that follow instead, as we never get to the encode function in this particular case. But it takes a little detective work to verify that fact, so it's probably safer to leave the checks in place.)

fs/nfsd/nfs2acl.c +6 -1
index 0e5fa11..1c3b765 100644
@@ -221,12 +221,17 @@ static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p,
 		struct nfsd3_getaclres *resp)
 {
 	struct dentry *dentry = resp->fh.fh_dentry;
-	struct inode *inode = dentry->d_inode;
+	struct inode *inode;
 	struct kvec *head = rqstp->rq_res.head;
 	unsigned int base;
 	int n;
 	int w;
 
+	/*
+	 * Since this is version 2, the check for nfserr in
+	 * nfsd_dispatch actually ensures the following cannot happen.
+	 * However, it seems fragile to depend on that.
+	 */
 	if (dentry == NULL || dentry->d_inode == NULL)
 		return 0;
 	inode = dentry->d_inode;
#151 lore raw

Re: [PATCH 003/100] Fix incorrect assignment

Quoted 64 lines · J. Bruce Fields
Quoted 6 lines · Chuck Lever
Quoted 5 lines · J. Bruce Fields

From: Prasad P <[email protected]>

Dereferenced pointer "dentry" without checking and assigned to inode in the declaration.

Quoted 7 lines
Quoted 4 lines

(We could just delete the NULL checks that follow instead, as we never get to the encode function in this particular case. But it takes a little detective work to verify that fact, so it's probably safer to leave the checks in place.)

I think adding a comment to this effect before the "dentry == NULL" check would be beneficial.

OK. How about this?

--b.

commit edd084f0dc22316bff9f4a25fc1fd8cccfbe82bd

Author: Prasad P <[email protected]>
Date:   Wed Oct 24 15:14:32 2007 -0500

nfsd: Fix inconsistent assignment

Dereferenced pointer "dentry" without checking and assigned to
inode
in the declaration.

(We could just delete the NULL checks that follow instead, as
we never
get to the encode function in this particular case. But it
takes a
little detective work to verify that fact, so it's probably
safer to
leave the checks in place.)

fs/nfsd/nfs2acl.c +6 -1
index 0e5fa11..1c3b765 100644
@@ -221,12 +221,17 @@ static int nfsaclsvc_encode_getaclres(struct  
 svc_rqst *rqstp, __be32 *p,
 		struct nfsd3_getaclres *resp)
 {
 	struct dentry *dentry = resp->fh.fh_dentry;
-	struct inode *inode = dentry->d_inode;
+	struct inode *inode;
 	struct kvec *head = rqstp->rq_res.head;
 	unsigned int base;
 	int n;
 	int w;
 
+	/*
+	 * Since this is version 2, the check for nfserr in
+	 * nfsd_dispatch actually ensures the following cannot happen.
+	 * However, it seems fragile to depend on that.
+	 */
 	if (dentry == NULL || dentry->d_inode == NULL)
 		return 0;
Quoted 1 line

inode = dentry->d_inode;

If that's truly the case, then letting an oops occur is probably more appropriate, if I understand what Trond has been trying to tell me for the past 5 years.

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#152 lore raw

Re: [PATCH 001/100] nfsd4: probe callback channel only once

In reply to J. Bruce Fields
Quoted 6 lines · J. Bruce Fields

Our callback code doesn't actually handle concurrent attempts to probe the callback channel. Some rethinking of the locking may be required. However, we can also just move the callback probing to this case. Since this is the only time a client is "confirmed" (and since that can only happen once in the lifetime of a client), this ensures we only probe once.

Applying 001/100 without applying 002/100 will probably break bisectability. Should you consider combining these two?

Quoted 49 lines
---
 fs/nfsd/nfs4callback.c |    3 +--
 fs/nfsd/nfs4state.c    |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
fs/nfsd/nfs4callback.c +1 -2
index 9d536a8..a9735a6 100644
@@ -395,8 +395,7 @@ nfsd4_probe_callback(struct nfs4_client *clp)
 	};
 	struct task_struct *t;
 
-	if (atomic_read(&cb->cb_set))
-		return;
+	BUG_ON(atomic_read(&clp->cl_callback.cb_set));
 
 	/* Initialize address */
 	memset(&addr, 0, sizeof(addr));
fs/nfsd/nfs4state.c +1 -0
index 31673cd..9d81c71 100644
@@ -948,6 +948,7 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
 			}
 			move_to_confirmed(unconf);
 			conf = unconf;
+			nfsd4_probe_callback(conf);
 			status = nfs_ok;
 		}
 	} else if ((!conf || (conf && !same_verf(&conf->cl_confirm,  

&confirm)))

fs/nfsd/nfs4state.c +0 -2
@@ -965,8 +966,6 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
 		status = nfserr_clid_inuse;
 	}
 out:
-	if (!status)
-		nfsd4_probe_callback(conf);
 	nfs4_unlock_state();
 	return status;
 }
Signature · 6 lines
1.5.4.rc2.60.gb2e62

-
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#153 lore raw

Re: [PATCH 001/100] nfsd4: probe callback channel only once

Quoted 11 lines · Chuck Lever
Quoted 7 lines · J. Bruce Fields

Our callback code doesn't actually handle concurrent attempts to probe the callback channel. Some rethinking of the locking may be required. However, we can also just move the callback probing to this case. Since
this is the only time a client is "confirmed" (and since that can only happen once in the lifetime of a client), this ensures we only probe once.

Applying 001/100 without applying 002/100 will probably break bisectability.

You lost me here. Why? I'm probably just missing something obvious.

--b.

#154 lore raw

Re: [PATCH 001/100] nfsd4: probe callback channel only once

Hi Bruce-

Quoted 10 lines · J. Bruce Fields
Quoted 9 lines · Chuck Lever
Quoted 7 lines · J. Bruce Fields

Our callback code doesn't actually handle concurrent attempts to probe the callback channel. Some rethinking of the locking may be required. However, we can also just move the callback probing to this case. Since
this is the only time a client is "confirmed" (and since that can only happen once in the lifetime of a client), this ensures we only probe once.

Quoted 4 lines
Quoted 2 lines

Applying 001/100 without applying 002/100 will probably break bisectability.

You lost me here. Why? I'm probably just missing something obvious.

Because, even though the kernel compiles with just 001, it doesn't work properly. In fact, it may even Oops, if I read 002 right, since no RPC client is available to do the probe?

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#155 lore raw

Re: [PATCH 001/100] nfsd4: probe callback channel only once

Quoted 16 lines · Chuck Lever

Hi Bruce-

Quoted 13 lines · J. Bruce Fields
Quoted 12 lines · Chuck Lever
Quoted 10 lines · J. Bruce Fields

Our callback code doesn't actually handle concurrent attempts to probe
the callback channel. Some rethinking of the locking may be required.
However, we can also just move the callback probing to this case. Since
this is the only time a client is "confirmed" (and since that can only
happen once in the lifetime of a client), this ensures we only probe once.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Applying 001/100 without applying 002/100 will probably break bisectability.

You lost me here. Why? I'm probably just missing something obvious.

Because, even though the kernel compiles with just 001, it doesn't work properly.

Why not? Treat me like a tired person here ('cause that would be accurate) and break it down really carefully....

Quoted 2 lines

In fact, it may even Oops, if I read 002 right, since no RPC client is available to do the probe?

An rpc client is created in nfsd4_probe_callback():

        /* Create RPC client */
        cb->cb_client = rpc_create(&args);
        if (IS_ERR(cb->cb_client)) {
                dprintk("NFSD: couldn't create callback client\n");
                goto out_err;
        }

        /* the task holds a reference to the nfs4_client struct */
        atomic_inc(&clp->cl_count);

        t = kthread_run(do_probe_callback, clp, "nfs4_cb_probe");

All #2 does is move that rpc_create() into the do_probe_callback() called in the new thread.

--b.

#156 lore raw

Re: [PATCH 001/100] nfsd4: probe callback channel only once

Quoted 46 lines · J. Bruce Fields
Quoted 16 lines · Chuck Lever

Hi Bruce-

Quoted 13 lines · J. Bruce Fields
Quoted 12 lines · Chuck Lever
Quoted 10 lines · J. Bruce Fields

Our callback code doesn't actually handle concurrent attempts to probe
the callback channel. Some rethinking of the locking may be required.
However, we can also just move the callback probing to this case. Since
this is the only time a client is "confirmed" (and since that can only
happen once in the lifetime of a client), this ensures we only probe once.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Applying 001/100 without applying 002/100 will probably break bisectability.

You lost me here. Why? I'm probably just missing something obvious.

Because, even though the kernel compiles with just 001, it doesn't work properly.

Why not? Treat me like a tired person here ('cause that would be accurate) and break it down really carefully....

Quoted 2 lines

In fact, it may even Oops, if I read 002 right, since no RPC client is available to do the probe?

An rpc client is created in nfsd4_probe_callback():

        /* Create RPC client */
        cb->cb_client = rpc_create(&args);
        if (IS_ERR(cb->cb_client)) {
                dprintk("NFSD: couldn't create callback client\n");
                goto out_err;
        }

        /* the task holds a reference to the nfs4_client struct */
        atomic_inc(&clp->cl_count);

        t = kthread_run(do_probe_callback, clp, "nfs4_cb_probe");
Quoted 2 lines

All #2 does is move that rpc_create() into the do_probe_callback() called in the new thread.

Ah. I suppose the situation after 001 but before 002 is applied is no better or worse than it was before 001... so no problem.

There is a slightly more remote argument for combining the two patches -- distributions may take one of these and not the other just because they didn't go looking for additional patches on that code.

But I won't worry about it any more. :-)

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#157 lore raw

nfs server patches not in 2.6.25

In reply to J. Bruce Fields

SnVzdCBzb21lIGlkZWEgd2hhdCB3ZSBtaWdodCBiZSB3b3JraW5nIG9uIGZvciAyLjYuMjYsIGJl c2lkZXMgY29udGludWVkCmJ1Zy1maXhpbmcgYW5kIGNsZWFudXA6CgpXb3JrIHRoYXQgd2UgYWxy ZWFkeSBoYXZlIHBhdGNoZXMgZm9yIGFuZCB0aGF0IEkgZXhwZWN0IHRvIGJlIGluY2x1ZGVkCmlu IHdob2xlIG9yIGluIDIuNi4yNjoKCgktIGlwdjY6IEF1csOpbGllbiBDaGFyYm9uJ3MgcGF0Y2gg dG8gYWRkIGlwdjYgc3VwcG9ydCB0byB0aGUKCSAgc2VydmVyJ3MgZXhwb3J0IGludGVyZmFjZSBp cyByZWFkeS4gIEknbSBub3QgY2xlYXIgd2hhdCBlbHNlCgkgIHJlbWFpbnMgZm9yIGZ1bGwgaXB2 NiBzdXBwb3J0LgoJLSBmYWlsb3ZlciBhbmQgbWlncmF0aW9uOiBXZW5keSBDaGVuZydzIHBhdGNo ZXMgYXBwZWFyIHRvIGJlIGluCgkgIGdvb2Qgc2hhcGUsIHNvIEkgZXhwZWN0IHRoZW0gb3Igc29t ZXRoaW5nIHdpdGggZXF1aXZhbGVudAoJICBmdW5jdGlvbmFsaXR5IHRvIGJlIGluIDIuNi4yNi4K CS0gZ3NzIGNhbGxiYWNrczogV2UgaGF2ZSBwYXRjaGVzIHRvIGFkZCBzdXBwb3J0IGZvciBycGNz ZWNfZ3NzCgkgIG9uIE5GU3Y0J3MgY2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dCBqdXN0 IGhhc24ndAoJICBoYXBwZW5lZC4gIEknbSBob3Bpbmcgd2UgY2FuIGZpbmFsbHkgZ2V0IHRoaXMg cmVhZHkgZm9yCgkgIDIuNi4yNi4KCgktIGV4cG9ydCBzZWN1cml0eTogdGhpcyB3YXMgZmluaXNo ZWQgaW4gMi42LjIzOyB3ZSBub3cgc3VwcG9ydAoJICBleHBvcnQgb3B0aW9ucyBsaWtlIHNlYz1r cmI1OmtyYjVpOmtyYjVwLCB3aGljaCBoYXZlIGEgZmV3CgkgIGFkdmFudGFnZXMgb3ZlciB0aGUg c3BlY2lhbCBnc3Mva3JiNSBjbGllbnQgbmFtZXMuICBUaGlzIGNvdWxkCgkgIGJlIGJldHRlciBk b2N1bWVudGVkLCB0aG91Z2guCgpJJ3ZlIHByb2JhYmx5IGxlZnQgYSBsb3Qgb3V0LiAgTGV0IG1l IGtub3cgb2Ygb25nb2luZyBwcm9qZWN0cyBhbmQKdG9kbydzIHRoYXQgSSd2ZSBmb3Jnb3R0ZW4u Li4uCgotLWIuCl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f Ck5GU3Y0IG1haWxpbmcgbGlzdApORlN2NEBsaW51eC1uZnMub3JnCmh0dHA6Ly9saW51eC1uZnMu b3JnL2NnaS1iaW4vbWFpbG1hbi9saXN0aW5mby9uZnN2NA==

#158 lore raw
In reply to J. Bruce Fields

fre, 25 01 2008 kl. 18:15 -0500, skrev J. Bruce Fields:

Quoted 4 lines

Below is a summary of the nfs server patches which I expect to submit (any day now) for 2.6.25; please let me know if you notice anything wrong or missing. I'll follow up to [email protected] with the full list of patches.

There are at least two patches that don't compile and break bisectability. The errors should be obvious, just checkout and make 6f310df and 23b4e2e (patch no. 29 and 65 from the posting of the patch set on linux-nfs).

[...]

Quoted 2 lines

J. Bruce Fields (34):
nfsd4: kill unnecessary same_name() in setclientid_confirm

fs/nfsd/nfs4state.c +1 -2
index 508b256..d026c24 100644
@@ -858,8 +857,7 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
                }
        } else if ((conf && !unconf) ||
            ((conf && unconf) && 
-            (!same_verf(&conf->cl_verifier, &unconf->cl_verifier) ||
-             !same_name(conf->cl_recdir, unconf->cl_recdir)))) {
+            !same_verf(&conf->cl_verifier, &unconf->cl_verifier)) {

missing ending parenthesis ---------------------------------------^

[...]

Quoted 2 lines

Tom Tucker (47):
svc: Make close transport independent

net/sunrpc/svcsock.c +9 -18
index f86538e..6dffdda 100644
@@ -1912,66 +1911,63 @@ static void svc_sock_free(struct svc_xprt *xprt)
 }
 
 /*
- * Remove a dead socket
+ * Remove a dead transport
  */
-static void
-svc_delete_socket(struct svc_sock *svsk)
+static void svc_delete_xprt(struct svc_xprt *xprt)
 {
-       struct svc_serv *serv;
-       struct sock     *sk;
-
-       dprintk("svc: svc_delete_socket(%p)\n", svsk);
-
-       serv = svsk->sk_xprt.xpt_server;
-       sk = svsk->sk_sk;
+       struct svc_serv *serv = xprt->xpt_server;
 
-       svsk->sk_xprt.xpt_ops->xpo_detach(&svsk->sk_xprt);
+       dprintk("svc: svc_delete_xprt(%p)\n", xprt);
+       xprt->xpt_ops->xpo_detach(xprt);
 
        spin_lock_bh(&serv->sv_lock);
-
-       if (!test_and_set_bit(XPT_DETACHED, &svsk->sk_xprt.xpt_flags))
-               list_del_init(&svsk->sk_list);
+       if (!test_and_set_bit(XPT_DETACHED, &xprt->xpt_flags))
+               list_del_init(&xprt->xpt_list);
        /*
-        * We used to delete the svc_sock from whichever list
-        * it's sk_ready node was on, but we don't actually
+        * We used to delete the transport from whichever list
+        * it's sk_xprt.xpt_ready node was on, but we don't actually
         * need to.  This is because the only time we're called
         * while still attached to a queue, the queue itself
         * is about to be destroyed (in svc_destroy).
         */
-       if (!test_and_set_bit(XPT_DEAD, &svsk->sk_xprt.xpt_flags)) {
-               BUG_ON(atomic_read(&svsk->sk_xprt.xpt_ref.refcount) <

2);
- if (test_bit(XPT_TEMP, &svsk->sk_xprt.xpt_flags))
+ if (!test_and_set_bit(XPT_DEAD, &xprt->xpt_flags)) {
+ BUG_ON(atomic_read(&xprt->xpt_ref.refcount) < 2);
+ if (test_bit(XPT_TEMP, &xprt->xpt_flags))

                        serv->sv_tmpcnt--;
                svc_xprt_put(&svsk->sk_xprt);
should have been
                svc_xprt_put(&xprt);

There might be more errors in the next 15 patches or so; I didn't test them with this error corrected.

Simon Holm Thøgersen

#159 lore raw

T24gU3VuLCBKYW4gMjcsIDIwMDggYXQgMDk6NDI6MjNQTSArMDEwMCwgU2ltb24gSG9sbSBUaMO4 Z2Vyc2VuIHdyb3RlOgo+IAo+IGZyZSwgMjUgMDEgMjAwOCBrbC4gMTg6MTUgLTA1MDAsIHNrcmV2 IEouIEJydWNlIEZpZWxkczogCj4gPiBCZWxvdyBpcyBhIHN1bW1hcnkgb2YgdGhlIG5mcyBzZXJ2 ZXIgcGF0Y2hlcyB3aGljaCBJIGV4cGVjdCB0byBzdWJtaXQKPiA+IChhbnkgZGF5IG5vdykgZm9y IDIuNi4yNTsgcGxlYXNlIGxldCBtZSBrbm93IGlmIHlvdSBub3RpY2UgYW55dGhpbmcKPiA+IHdy b25nIG9yIG1pc3NpbmcuICBJJ2xsIGZvbGxvdyB1cCB0byBsaW51eC1uZnNAdmdlci5rZXJuZWwu b3JnIHdpdGggdGhlCj4gPiBmdWxsIGxpc3Qgb2YgcGF0Y2hlcy4KPiAKPiBUaGVyZSBhcmUgYXQg bGVhc3QgdHdvIHBhdGNoZXMgdGhhdCBkb24ndCBjb21waWxlIGFuZCBicmVhawo+IGJpc2VjdGFi aWxpdHkuIFRoZSBlcnJvcnMgc2hvdWxkIGJlIG9idmlvdXMsIGp1c3QgY2hlY2tvdXQgYW5kIG1h a2UKPiA2ZjMxMGRmIGFuZCAyM2I0ZTJlIChwYXRjaCBuby4gMjkgYW5kIDY1IGZyb20gdGhlIHBv c3Rpbmcgb2YgdGhlIHBhdGNoCj4gc2V0IG9uIGxpbnV4LW5mcykuCgpXaG9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goJZm9yIGMg aW4gJChnaXQgcmV2LWxpc3Qgb3JpZ2luLi5saW51eC1uZnMvbmZzLXNlcnZlci1zdGFibGVeKTsg ZG8KCQlnaXQgY2hlY2tvdXQgJGMKCQltYWtlIC1zIC1qNAoJZG9uZQoKbm93IGp1c3QgdG8gbWFr ZSBzdXJlLi4uLiAgVGhhbmtzIGFnYWluIQoKLS1iLgpfX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fXwpORlN2NCBtYWlsaW5nIGxpc3QKTkZTdjRAbGludXgtbmZz Lm9yZwpodHRwOi8vbGludXgtbmZzLm9yZy9jZ2ktYmluL21haWxtYW4vbGlzdGluZm8vbmZzdjQ=

#160 lore raw
Quoted 8 lines · bfields

OK. I've got a machine running

	for c in $(git rev-list origin..linux-nfs/nfs-server-stable^); do
		git checkout $c
		make -s -j4
	done

now just to make sure.... Thanks again!

Pfft, that should have been:

	for c in $(git rev-list --reverse origin..linux-nfs/nfs-server-stable^); do
		git checkout $c
		make -s -j4
	done

The results are a lot easier to understand if you do the compiles in chronological order!

Anyway, that found one more compile failure, now fixed. Hopefully that's the last. (Probably I did an incomplete job of reordering one of the patches the other week....)

--b.