]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
pnfs: Don't release the sequence slot until we've processed layoutget on open
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Tue, 22 May 2018 15:17:16 +0000 (11:17 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Aug 2018 05:47:38 +0000 (07:47 +0200)
[ Upstream commit ae55e59da0e401893b3c52b575fc18a00623d0a1 ]

If the server recalls the layout that was just handed out, we risk hitting
a race as described in RFC5661 Section 2.10.6.3 unless we ensure that we
release the sequence slot after processing the LAYOUTGET operation that
was sent as part of the OPEN compound.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfs/nfs4proc.c

index 6d2b44d4384074f0a1ed7827749e96a79af70c66..2d94eb9cd38682e4d2e321860a0bcf44a172ef35 100644 (file)
@@ -2807,7 +2807,7 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
        if (ret != 0)
                goto out;
 
-       state = nfs4_opendata_to_nfs4_state(opendata);
+       state = _nfs4_opendata_to_nfs4_state(opendata);
        ret = PTR_ERR(state);
        if (IS_ERR(state))
                goto out;
@@ -2843,6 +2843,7 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
                        nfs4_schedule_stateid_recovery(server, state);
        }
 out:
+       nfs4_sequence_free_slot(&opendata->o_res.seq_res);
        return ret;
 }