]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
pNFS: Fix a hang in nfs4_evict_inode()
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Sun, 8 Oct 2023 18:20:19 +0000 (14:20 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Oct 2023 09:59:02 +0000 (11:59 +0200)
commit5762e72ef1b083704912e3412e88e4fd5997815f
treed3de200995950506a4a167be1fe6042fe88d6ed4
parent5a3abee2eee9344d1a67f5a112e4891d6355402c
pNFS: Fix a hang in nfs4_evict_inode()

commit f63955721a8020e979b99cc417dcb6da3106aa24 upstream.

We are not allowed to call pnfs_mark_matching_lsegs_return() without
also holding a reference to the layout header, since doing so could lead
to the reference count going to zero when we call
pnfs_layout_remove_lseg(). This again can lead to a hang when we get to
nfs4_evict_inode() and are unable to clear the layout pointer.

pnfs_layout_return_unused_byserver() is guilty of this behaviour, and
has been seen to trigger the refcount warning prior to a hang.

Fixes: b6d49ecd1081 ("NFSv4: Fix a pNFS layout related use-after-free race when freeing the inode")
Cc: stable@vger.kernel.org
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfs/pnfs.c