Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294478
b: refs/heads/master
c: d073e9b
h: refs/heads/master
v: v3
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Feb 15, 2012
1 parent c8833e2 commit e5efdaa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7ced286e0ade171af89d32c22b1590e1ca480542
refs/heads/master: d073e9b541e1ac3f52d72c3a153855d9a9ee3278
16 changes: 13 additions & 3 deletions trunk/fs/nfs/idmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ struct idmap_hashent {
unsigned long ih_expires;
__u32 ih_id;
size_t ih_namelen;
char ih_name[IDMAP_NAMESZ];
const char *ih_name;
};

struct idmap_hashtable {
Expand Down Expand Up @@ -482,12 +482,17 @@ void
nfs_idmap_delete(struct nfs_client *clp)
{
struct idmap *idmap = clp->cl_idmap;
int i;

if (!idmap)
return;
nfs_idmap_unregister(clp, idmap->idmap_pipe);
rpc_destroy_pipe_data(idmap->idmap_pipe);
clp->cl_idmap = NULL;
for (i = 0; i < ARRAY_SIZE(idmap->idmap_user_hash.h_entries); i++)
kfree(idmap->idmap_user_hash.h_entries[i].ih_name);
for (i = 0; i < ARRAY_SIZE(idmap->idmap_group_hash.h_entries); i++)
kfree(idmap->idmap_group_hash.h_entries[i].ih_name);
kfree(idmap);
}

Expand Down Expand Up @@ -634,9 +639,14 @@ static void
idmap_update_entry(struct idmap_hashent *he, const char *name,
size_t namelen, __u32 id)
{
char *str = kmalloc(namelen + 1, GFP_KERNEL);
if (str == NULL)
return;
kfree(he->ih_name);
he->ih_id = id;
memcpy(he->ih_name, name, namelen);
he->ih_name[namelen] = '\0';
memcpy(str, name, namelen);
str[namelen] = '\0';
he->ih_name = str;
he->ih_namelen = namelen;
he->ih_expires = jiffies + nfs_idmap_cache_timeout;
}
Expand Down

0 comments on commit e5efdaa

Please sign in to comment.