Trond Myklebust 9df654268a 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>
2023-10-25 11:54:24 +02:00
..
2023-06-21 15:45:40 +02:00
2021-09-18 13:40:15 +02:00
2023-10-25 11:54:13 +02:00
2023-05-17 11:47:35 +02:00
2023-09-19 12:20:23 +02:00
2023-02-22 12:55:54 +01:00
2023-09-23 11:01:09 +02:00
2022-06-09 10:21:16 +02:00
2023-01-04 11:39:23 +01:00
2023-01-14 10:16:27 +01:00