]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
NFSv4: Don't hold the layoutget locks across multiple RPC calls
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Sat, 14 May 2022 14:08:14 +0000 (10:08 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jun 2022 14:59:34 +0000 (16:59 +0200)
[ Upstream commit 6949493884fe88500de4af182588e071cf1544ee ]

When doing layoutget as part of the open() compound, we have to be
careful to release the layout locks before we can call any further RPC
calls, such as setattr(). The reason is that those calls could trigger
a recall, which could deadlock.

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/nfs4proc.c

index 759c834b60fd6f013ee13b3fb2a1d7244009c030..f48a11fa78bb9b1658e974d3e94c705290a0ee8e 100644 (file)
@@ -2920,6 +2920,10 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
        }
 
 out:
+       if (opendata->lgp) {
+               nfs4_lgopen_release(opendata->lgp);
+               opendata->lgp = NULL;
+       }
        if (!opendata->cancelled)
                nfs4_sequence_free_slot(&opendata->o_res.seq_res);
        return ret;