X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fnfs%2Fidmap.c;h=3fab5b0cfc5ad8987829da40034b698aac435b77;hb=9464c7cf61b9433057924c36e6e02f303a00e768;hp=f96dfac7dc9a6ade7807a5f1820ebce75d21e1c6;hpb=41689045f6a3cbe0550e1d34e9cc20d2e8c432ba;p=linux-2.6.git diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c index f96dfac7d..3fab5b0cf 100644 --- a/fs/nfs/idmap.c +++ b/fs/nfs/idmap.c @@ -47,6 +47,7 @@ #include #include +#include #include #include @@ -57,20 +58,6 @@ /* Default cache timeout is 10 minutes */ unsigned int nfs_idmap_cache_timeout = 600 * HZ; -static int param_set_idmap_timeout(const char *val, struct kernel_param *kp) -{ - char *endp; - int num = simple_strtol(val, &endp, 0); - int jif = num * HZ; - if (endp == val || *endp || num < 0 || jif < num) - return -EINVAL; - *((int *)kp->arg) = jif; - return 0; -} - -module_param_call(idmap_cache_timeout, param_set_idmap_timeout, param_get_int, - &nfs_idmap_cache_timeout, 0644); - struct idmap_hashent { unsigned long ih_expires; __u32 ih_id; @@ -108,16 +95,15 @@ static struct rpc_pipe_ops idmap_upcall_ops = { .destroy_msg = idmap_pipe_destroy_msg, }; -int -nfs_idmap_new(struct nfs_client *clp) +void +nfs_idmap_new(struct nfs4_client *clp) { struct idmap *idmap; - int error; - - BUG_ON(clp->cl_idmap != NULL); + if (clp->cl_idmap != NULL) + return; if ((idmap = kzalloc(sizeof(*idmap), GFP_KERNEL)) == NULL) - return -ENOMEM; + return; snprintf(idmap->idmap_path, sizeof(idmap->idmap_path), "%s/idmap", clp->cl_rpcclient->cl_pathname); @@ -125,9 +111,8 @@ nfs_idmap_new(struct nfs_client *clp) idmap->idmap_dentry = rpc_mkpipe(idmap->idmap_path, idmap, &idmap_upcall_ops, 0); if (IS_ERR(idmap->idmap_dentry)) { - error = PTR_ERR(idmap->idmap_dentry); kfree(idmap); - return error; + return; } mutex_init(&idmap->idmap_lock); @@ -137,17 +122,18 @@ nfs_idmap_new(struct nfs_client *clp) idmap->idmap_group_hash.h_type = IDMAP_TYPE_GROUP; clp->cl_idmap = idmap; - return 0; } void -nfs_idmap_delete(struct nfs_client *clp) +nfs_idmap_delete(struct nfs4_client *clp) { struct idmap *idmap = clp->cl_idmap; if (!idmap) return; - rpc_unlink(idmap->idmap_dentry); + dput(idmap->idmap_dentry); + idmap->idmap_dentry = NULL; + rpc_unlink(idmap->idmap_path); clp->cl_idmap = NULL; kfree(idmap); } @@ -494,27 +480,27 @@ static unsigned int fnvhash32(const void *buf, size_t buflen) return (hash); } -int nfs_map_name_to_uid(struct nfs_client *clp, const char *name, size_t namelen, __u32 *uid) +int nfs_map_name_to_uid(struct nfs4_client *clp, const char *name, size_t namelen, __u32 *uid) { struct idmap *idmap = clp->cl_idmap; return nfs_idmap_id(idmap, &idmap->idmap_user_hash, name, namelen, uid); } -int nfs_map_group_to_gid(struct nfs_client *clp, const char *name, size_t namelen, __u32 *uid) +int nfs_map_group_to_gid(struct nfs4_client *clp, const char *name, size_t namelen, __u32 *uid) { struct idmap *idmap = clp->cl_idmap; return nfs_idmap_id(idmap, &idmap->idmap_group_hash, name, namelen, uid); } -int nfs_map_uid_to_name(struct nfs_client *clp, __u32 uid, char *buf) +int nfs_map_uid_to_name(struct nfs4_client *clp, __u32 uid, char *buf) { struct idmap *idmap = clp->cl_idmap; return nfs_idmap_name(idmap, &idmap->idmap_user_hash, uid, buf); } -int nfs_map_gid_to_group(struct nfs_client *clp, __u32 uid, char *buf) +int nfs_map_gid_to_group(struct nfs4_client *clp, __u32 uid, char *buf) { struct idmap *idmap = clp->cl_idmap;