diff options
| author | Steve French <sfrench@us.ibm.com> | 2006-01-12 17:47:08 -0500 |
|---|---|---|
| committer | Steve French <sfrench@us.ibm.com> | 2006-01-12 17:47:08 -0500 |
| commit | 94bc2be31a01a3055ec94176e595dfe208e92d3b (patch) | |
| tree | ebfbe81c6718a6390bfa1b99c6d228237d818576 /fs/nfs/idmap.c | |
| parent | c32a0b689cb9cc160cfcd19735bbf50bb70c6ef4 (diff) | |
| parent | 58cba4650a7a414eabd2b40cc9d8e45fcdf192d9 (diff) | |
Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/nfs/idmap.c')
| -rw-r--r-- | fs/nfs/idmap.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c index ffb8df91dc34..821edd30333b 100644 --- a/fs/nfs/idmap.c +++ b/fs/nfs/idmap.c | |||
| @@ -54,7 +54,11 @@ | |||
| 54 | 54 | ||
| 55 | #define IDMAP_HASH_SZ 128 | 55 | #define IDMAP_HASH_SZ 128 |
| 56 | 56 | ||
| 57 | /* Default cache timeout is 10 minutes */ | ||
| 58 | unsigned int nfs_idmap_cache_timeout = 600 * HZ; | ||
| 59 | |||
| 57 | struct idmap_hashent { | 60 | struct idmap_hashent { |
| 61 | unsigned long ih_expires; | ||
| 58 | __u32 ih_id; | 62 | __u32 ih_id; |
| 59 | int ih_namelen; | 63 | int ih_namelen; |
| 60 | char ih_name[IDMAP_NAMESZ]; | 64 | char ih_name[IDMAP_NAMESZ]; |
| @@ -149,6 +153,8 @@ idmap_lookup_name(struct idmap_hashtable *h, const char *name, size_t len) | |||
| 149 | 153 | ||
| 150 | if (he->ih_namelen != len || memcmp(he->ih_name, name, len) != 0) | 154 | if (he->ih_namelen != len || memcmp(he->ih_name, name, len) != 0) |
| 151 | return NULL; | 155 | return NULL; |
| 156 | if (time_after(jiffies, he->ih_expires)) | ||
| 157 | return NULL; | ||
| 152 | return he; | 158 | return he; |
| 153 | } | 159 | } |
| 154 | 160 | ||
| @@ -164,6 +170,8 @@ idmap_lookup_id(struct idmap_hashtable *h, __u32 id) | |||
| 164 | struct idmap_hashent *he = idmap_id_hash(h, id); | 170 | struct idmap_hashent *he = idmap_id_hash(h, id); |
| 165 | if (he->ih_id != id || he->ih_namelen == 0) | 171 | if (he->ih_id != id || he->ih_namelen == 0) |
| 166 | return NULL; | 172 | return NULL; |
| 173 | if (time_after(jiffies, he->ih_expires)) | ||
| 174 | return NULL; | ||
| 167 | return he; | 175 | return he; |
| 168 | } | 176 | } |
| 169 | 177 | ||
| @@ -192,6 +200,7 @@ idmap_update_entry(struct idmap_hashent *he, const char *name, | |||
| 192 | memcpy(he->ih_name, name, namelen); | 200 | memcpy(he->ih_name, name, namelen); |
| 193 | he->ih_name[namelen] = '\0'; | 201 | he->ih_name[namelen] = '\0'; |
| 194 | he->ih_namelen = namelen; | 202 | he->ih_namelen = namelen; |
| 203 | he->ih_expires = jiffies + nfs_idmap_cache_timeout; | ||
| 195 | } | 204 | } |
| 196 | 205 | ||
| 197 | /* | 206 | /* |
