nfsd: no need get cache ref when protected by rcu

rcu_read_lock/rcu_read_unlock has already provide protection for the
pointer we will reference when we call e_show. Therefore, there is no
need to obtain a cache reference to help protect cache_head.
Additionally, the .put such as expkey_put/svc_export_put will invoke
dput, which can sleep and break rcu. Stop get cache reference to fix
them all.

Fixes: ae74136b4b ("SUNRPC: Allow cache lookups to use RCU protection rather than the r/w spinlock")
Suggested-by: NeilBrown <[email protected]>
Signed-off-by: Yang Erkun <[email protected]>
Reviewed-by: Jeff Layton <[email protected]>
Signed-off-by: Chuck Lever <[email protected]>
This commit is contained in:
Yang Erkun authored and Chuck Lever committed 2025-01-06 09:37:41 -05:00
1 parent 2f55dbe4e2
commit c224edca7a
1 file changed
+1 -5
+1 -5
View File
@@ -1425,13 +1425,9 @@ static int e_show(struct seq_file *m, void *p)
return 0;
}
if (!cache_get_rcu(&exp->h))
if (cache_check_rcu(cd, &exp->h, NULL))
return 0;
if (cache_check(cd, &exp->h, NULL))
return 0;
exp_put(exp);
return svc_export_show(m, cd, cp);
}