diff options
author | Trond Myklebust <trondmy@gmail.com> | 2018-10-01 10:41:49 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2018-10-29 16:58:04 -0400 |
commit | 9d5afd9491c80779730686159aeec7fa06ead085 (patch) | |
tree | 1362211f878bcf48d548c6ada586842e5d672395 | |
parent | 6d1616b26cd91f2502111d098cd9c288dbafe5c8 (diff) |
knfsd: Lockless lookup of NFSv4 identities.
Enable RCU protected lookups of the NFSv4 idmap.
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r-- | fs/nfsd/nfs4idmap.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c index a5bb76593ce7..bf137fec33ff 100644 --- a/fs/nfsd/nfs4idmap.c +++ b/fs/nfsd/nfs4idmap.c | |||
@@ -65,6 +65,7 @@ struct ent { | |||
65 | u32 id; | 65 | u32 id; |
66 | char name[IDMAP_NAMESZ]; | 66 | char name[IDMAP_NAMESZ]; |
67 | char authname[IDMAP_NAMESZ]; | 67 | char authname[IDMAP_NAMESZ]; |
68 | struct rcu_head rcu_head; | ||
68 | }; | 69 | }; |
69 | 70 | ||
70 | /* Common entry handling */ | 71 | /* Common entry handling */ |
@@ -89,7 +90,7 @@ static void | |||
89 | ent_put(struct kref *ref) | 90 | ent_put(struct kref *ref) |
90 | { | 91 | { |
91 | struct ent *map = container_of(ref, struct ent, h.ref); | 92 | struct ent *map = container_of(ref, struct ent, h.ref); |
92 | kfree(map); | 93 | kfree_rcu(map, rcu_head); |
93 | } | 94 | } |
94 | 95 | ||
95 | static struct cache_head * | 96 | static struct cache_head * |
@@ -264,8 +265,8 @@ out: | |||
264 | static struct ent * | 265 | static struct ent * |
265 | idtoname_lookup(struct cache_detail *cd, struct ent *item) | 266 | idtoname_lookup(struct cache_detail *cd, struct ent *item) |
266 | { | 267 | { |
267 | struct cache_head *ch = sunrpc_cache_lookup(cd, &item->h, | 268 | struct cache_head *ch = sunrpc_cache_lookup_rcu(cd, &item->h, |
268 | idtoname_hash(item)); | 269 | idtoname_hash(item)); |
269 | if (ch) | 270 | if (ch) |
270 | return container_of(ch, struct ent, h); | 271 | return container_of(ch, struct ent, h); |
271 | else | 272 | else |
@@ -422,8 +423,8 @@ out: | |||
422 | static struct ent * | 423 | static struct ent * |
423 | nametoid_lookup(struct cache_detail *cd, struct ent *item) | 424 | nametoid_lookup(struct cache_detail *cd, struct ent *item) |
424 | { | 425 | { |
425 | struct cache_head *ch = sunrpc_cache_lookup(cd, &item->h, | 426 | struct cache_head *ch = sunrpc_cache_lookup_rcu(cd, &item->h, |
426 | nametoid_hash(item)); | 427 | nametoid_hash(item)); |
427 | if (ch) | 428 | if (ch) |
428 | return container_of(ch, struct ent, h); | 429 | return container_of(ch, struct ent, h); |
429 | else | 430 | else |