diff mbox series

[5/5] NFSv4: Don't hold the layoutget locks across multiple RPC calls

Message ID 20220514140814.3655-5-trondmy@kernel.org (mailing list archive)
State New
Headers show
Series [1/5] NFS: Memory allocation failures are not server fatal errors | expand

Commit Message

trondmy@kernel.org May 14, 2022, 2:08 p.m. UTC
From: Trond Myklebust <trond.myklebust@hammerspace.com>

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>
 fs/nfs/nfs4proc.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series


diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index a79f66432bd3..bf3ba541b9fb 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3098,6 +3098,10 @@  static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
+	if (opendata->lgp) {
+		nfs4_lgopen_release(opendata->lgp);
+		opendata->lgp = NULL;
+	}
 	if (!opendata->cancelled)
 	return ret;