From: NeilBrown Date: Sun, 27 Oct 2024 22:04:43 +0000 (+1100) Subject: nfsd: make use of warning provided by refcount_t X-Git-Tag: v6.13-rc1~76^2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6a404f475f65c3b74799f4652dc15753834b3be0;p=thirdparty%2Fkernel%2Flinux.git 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 Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever --- diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c index 1408166222c5f..c16671135d176 100644 --- a/fs/nfsd/filecache.c +++ b/fs/nfsd/filecache.c @@ -1050,7 +1050,7 @@ retry: * the last one however, since we should hold another. */ if (nfsd_file_lru_remove(nf)) - WARN_ON_ONCE(refcount_dec_and_test(&nf->nf_ref)); + refcount_dec(&nf->nf_ref); goto wait_for_construction; }