DVB (2445): Added demodulator driver for Nova-S-Plus and Nova-SE2 DVB-S support.
[powerpc.git] / fs / nfs / idmap.c
index 1d0a5bf..821edd3 100644 (file)
 
 #define IDMAP_HASH_SZ          128
 
+/* Default cache timeout is 10 minutes */
+unsigned int nfs_idmap_cache_timeout = 600 * HZ;
+
 struct idmap_hashent {
+       unsigned long ih_expires;
        __u32 ih_id;
        int ih_namelen;
        char ih_name[IDMAP_NAMESZ];
@@ -66,6 +70,7 @@ struct idmap_hashtable {
 };
 
 struct idmap {
+       char                  idmap_path[48];
        struct dentry        *idmap_dentry;
        wait_queue_head_t     idmap_wq;
        struct idmap_msg      idmap_im;
@@ -101,8 +106,11 @@ nfs_idmap_new(struct nfs4_client *clp)
 
        memset(idmap, 0, sizeof(*idmap));
 
-       idmap->idmap_dentry = rpc_mkpipe(clp->cl_rpcclient->cl_dentry,
-                       "idmap", idmap, &idmap_upcall_ops, 0);
+       snprintf(idmap->idmap_path, sizeof(idmap->idmap_path),
+           "%s/idmap", clp->cl_rpcclient->cl_pathname);
+
+        idmap->idmap_dentry = rpc_mkpipe(idmap->idmap_path,
+           idmap, &idmap_upcall_ops, 0);
         if (IS_ERR(idmap->idmap_dentry)) {
                kfree(idmap);
                return;
@@ -124,7 +132,7 @@ nfs_idmap_delete(struct nfs4_client *clp)
 
        if (!idmap)
                return;
-       rpc_unlink(idmap->idmap_dentry);
+       rpc_unlink(idmap->idmap_path);
        clp->cl_idmap = NULL;
        kfree(idmap);
 }
@@ -145,6 +153,8 @@ idmap_lookup_name(struct idmap_hashtable *h, const char *name, size_t len)
 
        if (he->ih_namelen != len || memcmp(he->ih_name, name, len) != 0)
                return NULL;
+       if (time_after(jiffies, he->ih_expires))
+               return NULL;
        return he;
 }
 
@@ -160,6 +170,8 @@ idmap_lookup_id(struct idmap_hashtable *h, __u32 id)
        struct idmap_hashent *he = idmap_id_hash(h, id);
        if (he->ih_id != id || he->ih_namelen == 0)
                return NULL;
+       if (time_after(jiffies, he->ih_expires))
+               return NULL;
        return he;
 }
 
@@ -188,6 +200,7 @@ idmap_update_entry(struct idmap_hashent *he, const char *name,
        memcpy(he->ih_name, name, namelen);
        he->ih_name[namelen] = '\0';
        he->ih_namelen = namelen;
+       he->ih_expires = jiffies + nfs_idmap_cache_timeout;
 }
 
 /*