NFSv4/pNFS: Fix a layoutget livelock loop
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 26 Jul 2021 11:58:49 +0000 (07:58 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Sep 2021 11:40:13 +0000 (13:40 +0200)
commit4b96edea5cd1b77bef855a51ecabfb3579f8b7bc
tree79c0091b9ac94b768955e01cc938bd71fd863a37
parentfa55e76641d80b36994904c7dff7ec9b3d91b8a3
NFSv4/pNFS: Fix a layoutget livelock loop

[ Upstream commit e20772cbdf463c12088837e5a08bde1b876bfd25 ]

If NFS_LAYOUT_RETURN_REQUESTED is set, but there is no value set for
the layout plh_return_seq, we can end up in a livelock loop in which
every layout segment retrieved by a new call to layoutget is immediately
invalidated by pnfs_layout_need_return().
To get around this, we should just set plh_return_seq to the current
value of the layout stateid's seqid.

Fixes: d474f96104bd ("NFS: Don't return layout segments that are in use")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/pnfs.c