Commit 9d5afd94 authored by Trond Myklebust's avatar Trond Myklebust Committed by J. Bruce Fields
Browse files

knfsd: Lockless lookup of NFSv4 identities.



Enable RCU protected lookups of the NFSv4 idmap.

Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 6d1616b2
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ struct ent {
	u32               id;
	char              name[IDMAP_NAMESZ];
	char              authname[IDMAP_NAMESZ];
	struct rcu_head	  rcu_head;
};

/* Common entry handling */
@@ -89,7 +90,7 @@ static void
ent_put(struct kref *ref)
{
	struct ent *map = container_of(ref, struct ent, h.ref);
	kfree(map);
	kfree_rcu(map, rcu_head);
}

static struct cache_head *
@@ -264,7 +265,7 @@ out:
static struct ent *
idtoname_lookup(struct cache_detail *cd, struct ent *item)
{
	struct cache_head *ch = sunrpc_cache_lookup(cd, &item->h,
	struct cache_head *ch = sunrpc_cache_lookup_rcu(cd, &item->h,
							idtoname_hash(item));
	if (ch)
		return container_of(ch, struct ent, h);
@@ -422,7 +423,7 @@ out:
static struct ent *
nametoid_lookup(struct cache_detail *cd, struct ent *item)
{
	struct cache_head *ch = sunrpc_cache_lookup(cd, &item->h,
	struct cache_head *ch = sunrpc_cache_lookup_rcu(cd, &item->h,
							nametoid_hash(item));
	if (ch)
		return container_of(ch, struct ent, h);