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)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Thu, 31 May 2018 19:03:12 +0000 (15:03 -0400)
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>
fs/nfs/nfs4proc.c

index d18447d11b065b9d2bfbd2e19d9ffe3d0eb96c74..bb1141c48281e27f6147bf33f4b2eb9dc31c55ec 100644 (file)
@@ -2789,7 +2789,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;
@@ -2828,6 +2828,7 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
        }
 
 out:
+       nfs4_sequence_free_slot(&opendata->o_res.seq_res);
        return ret;
 }