diff options
author | J. Bruce Fields <bfields@redhat.com> | 2011-01-04 17:53:52 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2011-01-04 18:22:11 -0500 |
commit | 3c726023402a2f3b28f49b9d90ebf9e71151157d (patch) | |
tree | 434ee06a662815327c8bd34aaf7b5258994dc033 /fs/nfsd | |
parent | 775a1905e1e042e830eae31e70efec9387eb3e1d (diff) |
nfsd4: return nfs errno from name_to_id functions
This avoids the need for the confusing ESRCH mapping.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/idmap.h | 4 | ||||
-rw-r--r-- | fs/nfsd/nfs4idmap.c | 13 | ||||
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 10 | ||||
-rw-r--r-- | fs/nfsd/nfsproc.c | 1 |
4 files changed, 14 insertions, 14 deletions
diff --git a/fs/nfsd/idmap.h b/fs/nfsd/idmap.h index 514758994763..2f3be1321534 100644 --- a/fs/nfsd/idmap.h +++ b/fs/nfsd/idmap.h | |||
@@ -54,8 +54,8 @@ static inline void nfsd_idmap_shutdown(void) | |||
54 | } | 54 | } |
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | int nfsd_map_name_to_uid(struct svc_rqst *, const char *, size_t, __u32 *); | 57 | __be32 nfsd_map_name_to_uid(struct svc_rqst *, const char *, size_t, __u32 *); |
58 | int nfsd_map_name_to_gid(struct svc_rqst *, const char *, size_t, __u32 *); | 58 | __be32 nfsd_map_name_to_gid(struct svc_rqst *, const char *, size_t, __u32 *); |
59 | int nfsd_map_uid_to_name(struct svc_rqst *, __u32, char *); | 59 | int nfsd_map_uid_to_name(struct svc_rqst *, __u32, char *); |
60 | int nfsd_map_gid_to_name(struct svc_rqst *, __u32, char *); | 60 | int nfsd_map_gid_to_name(struct svc_rqst *, __u32, char *); |
61 | 61 | ||
diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c index cbd599732765..6d2c397d458b 100644 --- a/fs/nfsd/nfs4idmap.c +++ b/fs/nfsd/nfs4idmap.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/sched.h> | 37 | #include <linux/sched.h> |
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include "idmap.h" | 39 | #include "idmap.h" |
40 | #include "nfsd.h" | ||
40 | 41 | ||
41 | /* | 42 | /* |
42 | * Cache entry | 43 | * Cache entry |
@@ -514,7 +515,7 @@ rqst_authname(struct svc_rqst *rqstp) | |||
514 | return clp->name; | 515 | return clp->name; |
515 | } | 516 | } |
516 | 517 | ||
517 | static int | 518 | static __be32 |
518 | idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen, | 519 | idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen, |
519 | uid_t *id) | 520 | uid_t *id) |
520 | { | 521 | { |
@@ -524,15 +525,15 @@ idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen | |||
524 | int ret; | 525 | int ret; |
525 | 526 | ||
526 | if (namelen + 1 > sizeof(key.name)) | 527 | if (namelen + 1 > sizeof(key.name)) |
527 | return -ESRCH; /* nfserr_badowner */ | 528 | return nfserr_badowner; |
528 | memcpy(key.name, name, namelen); | 529 | memcpy(key.name, name, namelen); |
529 | key.name[namelen] = '\0'; | 530 | key.name[namelen] = '\0'; |
530 | strlcpy(key.authname, rqst_authname(rqstp), sizeof(key.authname)); | 531 | strlcpy(key.authname, rqst_authname(rqstp), sizeof(key.authname)); |
531 | ret = idmap_lookup(rqstp, nametoid_lookup, &key, &nametoid_cache, &item); | 532 | ret = idmap_lookup(rqstp, nametoid_lookup, &key, &nametoid_cache, &item); |
532 | if (ret == -ENOENT) | 533 | if (ret == -ENOENT) |
533 | ret = -ESRCH; /* nfserr_badowner */ | 534 | return nfserr_badowner; |
534 | if (ret) | 535 | if (ret) |
535 | return ret; | 536 | return nfserrno(ret); |
536 | *id = item->id; | 537 | *id = item->id; |
537 | cache_put(&item->h, &nametoid_cache); | 538 | cache_put(&item->h, &nametoid_cache); |
538 | return 0; | 539 | return 0; |
@@ -560,14 +561,14 @@ idmap_id_to_name(struct svc_rqst *rqstp, int type, uid_t id, char *name) | |||
560 | return ret; | 561 | return ret; |
561 | } | 562 | } |
562 | 563 | ||
563 | int | 564 | __be32 |
564 | nfsd_map_name_to_uid(struct svc_rqst *rqstp, const char *name, size_t namelen, | 565 | nfsd_map_name_to_uid(struct svc_rqst *rqstp, const char *name, size_t namelen, |
565 | __u32 *id) | 566 | __u32 *id) |
566 | { | 567 | { |
567 | return idmap_name_to_id(rqstp, IDMAP_TYPE_USER, name, namelen, id); | 568 | return idmap_name_to_id(rqstp, IDMAP_TYPE_USER, name, namelen, id); |
568 | } | 569 | } |
569 | 570 | ||
570 | int | 571 | __be32 |
571 | nfsd_map_name_to_gid(struct svc_rqst *rqstp, const char *name, size_t namelen, | 572 | nfsd_map_name_to_gid(struct svc_rqst *rqstp, const char *name, size_t namelen, |
572 | __u32 *id) | 573 | __u32 *id) |
573 | { | 574 | { |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 2a0814d0ab1a..ca3786905dec 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -289,17 +289,17 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, | |||
289 | len += XDR_QUADLEN(dummy32) << 2; | 289 | len += XDR_QUADLEN(dummy32) << 2; |
290 | READMEM(buf, dummy32); | 290 | READMEM(buf, dummy32); |
291 | ace->whotype = nfs4_acl_get_whotype(buf, dummy32); | 291 | ace->whotype = nfs4_acl_get_whotype(buf, dummy32); |
292 | host_err = 0; | 292 | status = nfs_ok; |
293 | if (ace->whotype != NFS4_ACL_WHO_NAMED) | 293 | if (ace->whotype != NFS4_ACL_WHO_NAMED) |
294 | ace->who = 0; | 294 | ace->who = 0; |
295 | else if (ace->flag & NFS4_ACE_IDENTIFIER_GROUP) | 295 | else if (ace->flag & NFS4_ACE_IDENTIFIER_GROUP) |
296 | host_err = nfsd_map_name_to_gid(argp->rqstp, | 296 | status = nfsd_map_name_to_gid(argp->rqstp, |
297 | buf, dummy32, &ace->who); | 297 | buf, dummy32, &ace->who); |
298 | else | 298 | else |
299 | host_err = nfsd_map_name_to_uid(argp->rqstp, | 299 | status = nfsd_map_name_to_uid(argp->rqstp, |
300 | buf, dummy32, &ace->who); | 300 | buf, dummy32, &ace->who); |
301 | if (host_err) | 301 | if (status) |
302 | goto out_nfserr; | 302 | return status; |
303 | } | 303 | } |
304 | } else | 304 | } else |
305 | *acl = NULL; | 305 | *acl = NULL; |
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c index 8f05dcd0bf85..e15dc45fc5ec 100644 --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c | |||
@@ -738,7 +738,6 @@ nfserrno (int errno) | |||
738 | { nfserr_jukebox, -EAGAIN }, | 738 | { nfserr_jukebox, -EAGAIN }, |
739 | { nfserr_jukebox, -EWOULDBLOCK }, | 739 | { nfserr_jukebox, -EWOULDBLOCK }, |
740 | { nfserr_jukebox, -ENOMEM }, | 740 | { nfserr_jukebox, -ENOMEM }, |
741 | { nfserr_badowner, -ESRCH }, | ||
742 | { nfserr_io, -ETXTBSY }, | 741 | { nfserr_io, -ETXTBSY }, |
743 | { nfserr_notsupp, -EOPNOTSUPP }, | 742 | { nfserr_notsupp, -EOPNOTSUPP }, |
744 | { nfserr_toosmall, -ETOOSMALL }, | 743 | { nfserr_toosmall, -ETOOSMALL }, |