diff options
Diffstat (limited to 'fs/nfs/idmap.c')
-rw-r--r-- | fs/nfs/idmap.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c index e2d579d458f..79664a1025a 100644 --- a/fs/nfs/idmap.c +++ b/fs/nfs/idmap.c | |||
@@ -61,6 +61,9 @@ static int nfs_map_numeric_to_string(__u32 id, char *buf, size_t buflen) | |||
61 | 61 | ||
62 | #include <linux/slab.h> | 62 | #include <linux/slab.h> |
63 | #include <linux/cred.h> | 63 | #include <linux/cred.h> |
64 | #include <linux/sunrpc/sched.h> | ||
65 | #include <linux/nfs4.h> | ||
66 | #include <linux/nfs_fs_sb.h> | ||
64 | #include <linux/nfs_idmap.h> | 67 | #include <linux/nfs_idmap.h> |
65 | #include <linux/keyctl.h> | 68 | #include <linux/keyctl.h> |
66 | #include <linux/key-type.h> | 69 | #include <linux/key-type.h> |
@@ -257,17 +260,20 @@ int nfs_map_group_to_gid(const struct nfs_server *server, const char *name, size | |||
257 | 260 | ||
258 | int nfs_map_uid_to_name(const struct nfs_server *server, __u32 uid, char *buf, size_t buflen) | 261 | int nfs_map_uid_to_name(const struct nfs_server *server, __u32 uid, char *buf, size_t buflen) |
259 | { | 262 | { |
260 | int ret; | 263 | int ret = -EINVAL; |
261 | ret = nfs_idmap_lookup_name(uid, "user", buf, buflen); | 264 | |
265 | if (!(server->caps & NFS_CAP_UIDGID_NOMAP)) | ||
266 | ret = nfs_idmap_lookup_name(uid, "user", buf, buflen); | ||
262 | if (ret < 0) | 267 | if (ret < 0) |
263 | ret = nfs_map_numeric_to_string(uid, buf, buflen); | 268 | ret = nfs_map_numeric_to_string(uid, buf, buflen); |
264 | return ret; | 269 | return ret; |
265 | } | 270 | } |
266 | int nfs_map_gid_to_group(const struct nfs_server *server, __u32 gid, char *buf, size_t buflen) | 271 | int nfs_map_gid_to_group(const struct nfs_server *server, __u32 gid, char *buf, size_t buflen) |
267 | { | 272 | { |
268 | int ret; | 273 | int ret = -EINVAL; |
269 | 274 | ||
270 | ret = nfs_idmap_lookup_name(gid, "group", buf, buflen); | 275 | if (!(server->caps & NFS_CAP_UIDGID_NOMAP)) |
276 | ret = nfs_idmap_lookup_name(gid, "group", buf, buflen); | ||
271 | if (ret < 0) | 277 | if (ret < 0) |
272 | ret = nfs_map_numeric_to_string(gid, buf, buflen); | 278 | ret = nfs_map_numeric_to_string(gid, buf, buflen); |
273 | return ret; | 279 | return ret; |
@@ -750,9 +756,10 @@ int nfs_map_group_to_gid(const struct nfs_server *server, const char *name, size | |||
750 | int nfs_map_uid_to_name(const struct nfs_server *server, __u32 uid, char *buf, size_t buflen) | 756 | int nfs_map_uid_to_name(const struct nfs_server *server, __u32 uid, char *buf, size_t buflen) |
751 | { | 757 | { |
752 | struct idmap *idmap = server->nfs_client->cl_idmap; | 758 | struct idmap *idmap = server->nfs_client->cl_idmap; |
753 | int ret; | 759 | int ret = -EINVAL; |
754 | 760 | ||
755 | ret = nfs_idmap_name(idmap, &idmap->idmap_user_hash, uid, buf); | 761 | if (!(server->caps & NFS_CAP_UIDGID_NOMAP)) |
762 | ret = nfs_idmap_name(idmap, &idmap->idmap_user_hash, uid, buf); | ||
756 | if (ret < 0) | 763 | if (ret < 0) |
757 | ret = nfs_map_numeric_to_string(uid, buf, buflen); | 764 | ret = nfs_map_numeric_to_string(uid, buf, buflen); |
758 | return ret; | 765 | return ret; |
@@ -760,9 +767,10 @@ int nfs_map_uid_to_name(const struct nfs_server *server, __u32 uid, char *buf, s | |||
760 | int nfs_map_gid_to_group(const struct nfs_server *server, __u32 uid, char *buf, size_t buflen) | 767 | int nfs_map_gid_to_group(const struct nfs_server *server, __u32 uid, char *buf, size_t buflen) |
761 | { | 768 | { |
762 | struct idmap *idmap = server->nfs_client->cl_idmap; | 769 | struct idmap *idmap = server->nfs_client->cl_idmap; |
763 | int ret; | 770 | int ret = -EINVAL; |
764 | 771 | ||
765 | ret = nfs_idmap_name(idmap, &idmap->idmap_group_hash, uid, buf); | 772 | if (!(server->caps & NFS_CAP_UIDGID_NOMAP)) |
773 | ret = nfs_idmap_name(idmap, &idmap->idmap_group_hash, uid, buf); | ||
766 | if (ret < 0) | 774 | if (ret < 0) |
767 | ret = nfs_map_numeric_to_string(uid, buf, buflen); | 775 | ret = nfs_map_numeric_to_string(uid, buf, buflen); |
768 | return ret; | 776 | return ret; |