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)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Tue, 17 May 2022 16:53:33 +0000 (12:53 -0400)
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>
fs/nfs/nfs4proc.c

index a79f66432bd3985cdfc486560ac5461ed6dd306f..bf3ba541b9fb65214acf08c207a7068c6dbee0c0 100644 (file)
@@ -3098,6 +3098,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;