NFSv4: Fix a potential state reclaim deadlock
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Sun, 16 Oct 2022 18:44:31 +0000 (14:44 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Nov 2022 17:14:16 +0000 (18:14 +0100)
commit4813dd737dc4fa85e72761c95fc228cafad88c30
tree47a5a06e8e257eca9e2f09b16f2bcc2e59cd92db
parent7c4260f8f188df32414a5ecad63e8b934c2aa3f0
NFSv4: Fix a potential state reclaim deadlock

[ Upstream commit 1ba04394e028ea8b45d92685cc0d6ab582cf7647 ]

If the server reboots while we are engaged in a delegation return, and
there is a pNFS layout with return-on-close set, then the current code
can end up deadlocking in pnfs_roc() when nfs_inode_set_delegation()
tries to return the old delegation.
Now that delegreturn actually uses its own copy of the stateid, it
should be safe to just always update the delegation stateid in place.

Fixes: 078000d02d57 ("pNFS: We want return-on-close to complete when evicting the inode")
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/delegation.c