]> git.baikalelectronics.ru Git - kernel.git/commit
nfsd: fix nfsd_file_unhash_and_dispose
authorJeff Layton <jlayton@kernel.org>
Fri, 30 Sep 2022 20:56:02 +0000 (16:56 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Wed, 5 Oct 2022 14:57:48 +0000 (10:57 -0400)
commitf472b9c080e6abcb3337309258202f29ca13b1df
tree35d483aaacf4c9c76ed45291cc65f77fe6092cf5
parented1206a15e52881085e24a1dbe6462d26c28cb7e
nfsd: fix nfsd_file_unhash_and_dispose

nfsd_file_unhash_and_dispose() is called for two reasons:

We're either shutting down and purging the filecache, or we've gotten a
notification about a file delete, so we want to go ahead and unhash it
so that it'll get cleaned up when we close.

We're either walking the hashtable or doing a lookup in it and we
don't take a reference in either case. What we want to do in both cases
is to try and unhash the object and put it on the dispose list if that
was successful. If it's no longer hashed, then we don't want to touch
it, with the assumption being that something else is already cleaning
up the sentinel reference.

Instead of trying to selectively decrement the refcount in this
function, just unhash it, and if that was successful, move it to the
dispose list. Then, the disposal routine will just clean that up as
usual.

Also, just make this a void function, drop the WARN_ON_ONCE, and the
comments about deadlocking since the nature of the purported deadlock
is no longer clear.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/filecache.c