Skip to content

Commit c224edc

Browse files
Yang Erkunchucklever
authored andcommitted
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: ae74136 ("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]>
1 parent 2f55dbe commit c224edc

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

fs/nfsd/export.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,13 +1425,9 @@ static int e_show(struct seq_file *m, void *p)
14251425
return 0;
14261426
}
14271427

1428-
if (!cache_get_rcu(&exp->h))
1428+
if (cache_check_rcu(cd, &exp->h, NULL))
14291429
return 0;
14301430

1431-
if (cache_check(cd, &exp->h, NULL))
1432-
return 0;
1433-
1434-
exp_put(exp);
14351431
return svc_export_show(m, cd, cp);
14361432
}
14371433

0 commit comments

Comments
 (0)