From 6a404f475f65c3b74799f4652dc15753834b3be0 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mon, 28 Oct 2024 09:04:43 +1100 Subject: [PATCH] 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 --- fs/nfsd/filecache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 2.47.2