A Handful of 2.6.21.5 bugs

J. Bruce Fields bfields at fieldses.org
Wed Jun 20 19:19:49 EDT 2007


OK, slowly taking one report at a time....

On Thu, Jun 14, 2007 at 07:53:05AM -0700, John McCorquodale wrote:
> The keys of form 'DOMAIN user N' for nfs4.idtoname should render N as an
> unsigned, not as a signed.
> 
> If you have a file in the server's exported (ext3) fs with a big owner UID, say
> 4294967294, when it's accessed from the client, a query comes out of
> nfs4.idtoname that looks like:
> 
>   domain user -2
> 
> And when you respond with that key, you get Invalid Argument presumably due to
> the minus sign.  Thus, you can't repond to the query and the client hangs on
> the access until the client-side idmap timeout expires.

Thanks.  I suspect all that's needed is the below.  If you got the
chance to apply the patch and confirm the fix, that'd be helpful.

--b.

diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c
index 45aa21c..251b2f9 100644
--- a/fs/nfsd/nfs4idmap.c
+++ b/fs/nfsd/nfs4idmap.c
@@ -138,7 +138,7 @@ idtoname_request(struct cache_detail *cd, struct cache_head *ch, char **bpp,
 	char idstr[11];
 
 	qword_add(bpp, blen, ent->authname);
-	snprintf(idstr, sizeof(idstr), "%d", ent->id);
+	snprintf(idstr, sizeof(idstr), "%u", ent->id);
 	qword_add(bpp, blen, ent->type == IDMAP_TYPE_GROUP ? "group" : "user");
 	qword_add(bpp, blen, idstr);
 
@@ -165,7 +165,7 @@ idtoname_show(struct seq_file *m, struct cache_detail *cd, struct cache_head *h)
 		return 0;
 	}
 	ent = container_of(h, struct ent, h);
-	seq_printf(m, "%s %s %d", ent->authname,
+	seq_printf(m, "%s %s %u", ent->authname,
 			ent->type == IDMAP_TYPE_GROUP ? "group" : "user",
 			ent->id);
 	if (test_bit(CACHE_VALID, &h->flags))
@@ -349,7 +349,7 @@ nametoid_show(struct seq_file *m, struct cache_detail *cd, struct cache_head *h)
 			ent->type == IDMAP_TYPE_GROUP ? "group" : "user",
 			ent->name);
 	if (test_bit(CACHE_VALID, &h->flags))
-		seq_printf(m, " %d", ent->id);
+		seq_printf(m, " %u", ent->id);
 	seq_printf(m, "\n");
 	return 0;
 }


More information about the NFSv4 mailing list