瀏覽代碼

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>
Trond Myklebust 6 年之前
父節點
當前提交
9d5afd9491
共有 1 個文件被更改,包括 6 次插入5 次删除
  1. 6 5
      fs/nfsd/nfs4idmap.c

+ 6 - 5
fs/nfsd/nfs4idmap.c

@@ -65,6 +65,7 @@ struct ent {
 	u32               id;
 	u32               id;
 	char              name[IDMAP_NAMESZ];
 	char              name[IDMAP_NAMESZ];
 	char              authname[IDMAP_NAMESZ];
 	char              authname[IDMAP_NAMESZ];
+	struct rcu_head	  rcu_head;
 };
 };
 
 
 /* Common entry handling */
 /* Common entry handling */
@@ -89,7 +90,7 @@ static void
 ent_put(struct kref *ref)
 ent_put(struct kref *ref)
 {
 {
 	struct ent *map = container_of(ref, struct ent, h.ref);
 	struct ent *map = container_of(ref, struct ent, h.ref);
-	kfree(map);
+	kfree_rcu(map, rcu_head);
 }
 }
 
 
 static struct cache_head *
 static struct cache_head *
@@ -264,8 +265,8 @@ out:
 static struct ent *
 static struct ent *
 idtoname_lookup(struct cache_detail *cd, struct ent *item)
 idtoname_lookup(struct cache_detail *cd, struct ent *item)
 {
 {
-	struct cache_head *ch = sunrpc_cache_lookup(cd, &item->h,
-						    idtoname_hash(item));
+	struct cache_head *ch = sunrpc_cache_lookup_rcu(cd, &item->h,
+							idtoname_hash(item));
 	if (ch)
 	if (ch)
 		return container_of(ch, struct ent, h);
 		return container_of(ch, struct ent, h);
 	else
 	else
@@ -422,8 +423,8 @@ out:
 static struct ent *
 static struct ent *
 nametoid_lookup(struct cache_detail *cd, struct ent *item)
 nametoid_lookup(struct cache_detail *cd, struct ent *item)
 {
 {
-	struct cache_head *ch = sunrpc_cache_lookup(cd, &item->h,
-						    nametoid_hash(item));
+	struct cache_head *ch = sunrpc_cache_lookup_rcu(cd, &item->h,
+							nametoid_hash(item));
 	if (ch)
 	if (ch)
 		return container_of(ch, struct ent, h);
 		return container_of(ch, struct ent, h);
 	else
 	else