X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=fs%2Fnfs%2Fidmap.c;h=821edd30333b8aff740fc1e66a013527f967fcfc;hb=5342fba5412cead88b61ead07168615dbeba1ee3;hp=87f4f9aeac86b2c4a5f07c4d856fb5690b967cb2;hpb=f2cbb4f01936a3e4225692e03b084b78c56d386d;p=linux-2.6-omap-h63xx.git diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c index 87f4f9aeac8..821edd30333 100644 --- a/fs/nfs/idmap.c +++ b/fs/nfs/idmap.c @@ -50,10 +50,15 @@ #include #include +#include "nfs4_fs.h" #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]; @@ -148,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; } @@ -163,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; } @@ -191,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; } /*