Revert to Fedora kernel-2.6.17-1.2187_FC5 patched with vs2.0.2.1; there are too many...
[linux-2.6.git] / fs / nfs / idmap.c
index f96dfac..3fab5b0 100644 (file)
@@ -47,6 +47,7 @@
 #include <linux/workqueue.h>
 #include <linux/sunrpc/rpc_pipe_fs.h>
 
+#include <linux/nfs_fs_sb.h>
 #include <linux/nfs_fs.h>
 
 #include <linux/nfs_idmap.h>
 /* 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;