Skip to content

Commit 6a404f4

Browse files
neilbrownchucklever
authored andcommitted
nfsd: make use of warning provided by refcount_t
refcount_t, by design, checks for unwanted situations and provides warnings. It is rarely useful to have explicit warnings with refcount usage. In this case we have an explicit warning if a refcount_t reaches zero when decremented. Simply using refcount_dec() will provide a similar warning and also mark the refcount_t as saturated to avoid any possible use-after-free. This patch drops the warning and uses refcount_dec() instead of refcount_dec_and_test(). Signed-off-by: NeilBrown <neilb@suse.de> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent a2c0412 commit 6a404f4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/nfsd/filecache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ nfsd_file_do_acquire(struct svc_rqst *rqstp, struct net *net,
10501050
* the last one however, since we should hold another.
10511051
*/
10521052
if (nfsd_file_lru_remove(nf))
1053-
WARN_ON_ONCE(refcount_dec_and_test(&nf->nf_ref));
1053+
refcount_dec(&nf->nf_ref);
10541054
goto wait_for_construction;
10551055
}
10561056

0 commit comments

Comments
 (0)