Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: ae74136b4bb6 ("SUNRPC: Allow cache lookups to use RCU protection rather than the r/w spinlock")
Suggested-by: NeilBrown <neilb@suse.de>
Signed-off-by: Yang Erkun <yangerkun@huawei.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

authored by

Yang Erkun and committed by
Chuck Lever
c224edca 2f55dbe4

+1 -5
+1 -5
fs/nfsd/export.c
··· 1425 1425 return 0; 1426 1426 } 1427 1427 1428 - if (!cache_get_rcu(&exp->h)) 1428 + if (cache_check_rcu(cd, &exp->h, NULL)) 1429 1429 return 0; 1430 1430 1431 - if (cache_check(cd, &exp->h, NULL)) 1432 - return 0; 1433 - 1434 - exp_put(exp); 1435 1431 return svc_export_show(m, cd, cp); 1436 1432 } 1437 1433