NeilBrown cfe972295c NFS: avoid infinite loop in pnfs_update_layout.
[ Upstream commit 2fdbc20036acda9e5694db74a032d3c605323005 ]

If pnfsd_update_layout() is called on a file for which recovery has
failed it will enter a tight infinite loop.

NFS_LAYOUT_INVALID_STID will be set, nfs4_select_rw_stateid() will
return -EIO, and nfs4_schedule_stateid_recovery() will do nothing, so
nfs4_client_recover_expired_lease() will not wait.  So the code will
loop indefinitely.

Break the loop by testing the validity of the open stateid at the top of
the loop.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 4980d45cca2b1135a1ab3dea101425cf44da72cd)
[Vegard: fix conflict in context due to missing commit
 d03360aaf5ccac49581960bd736258c62972b88b ("pNFS: Ensure we return the
 error if someone kills a waiting layoutget").]
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
2024-10-24 10:07:38 +00:00
..
2019-09-21 07:15:37 +02:00