1 From bf0291dd2267a2b9a4cd74d65249553d11bb45d6 Mon Sep 17 00:00:00 2001
2 From: Trond Myklebust <trond.myklebust@primarydata.com>
3 Date: Sat, 3 Sep 2016 10:39:51 -0400
4 Subject: pNFS: Ensure LAYOUTGET and LAYOUTRETURN are properly serialised
6 From: Trond Myklebust <trond.myklebust@primarydata.com>
8 commit bf0291dd2267a2b9a4cd74d65249553d11bb45d6 upstream.
10 According to RFC5661, the client is responsible for serialising
11 LAYOUTGET and LAYOUTRETURN to avoid ambiguity. Consider the case
12 where we send both in parallel.
18 LAYOUTGET return seqid=X+1
19 LAYOUTRETURN return seqid=X+2
25 The client processes the layoutget/layoutreturn in the wrong order,
26 and since the result of the layoutreturn was to clear the only
27 existing layout segment, the client forgets the layout stateid.
29 When the LAYOUTGET comes in, it is treated as having a completely
30 new stateid, and so the client sets the wrong sequence id...
32 Fix is to check if there are outstanding LAYOUTGET requests
33 before we send the LAYOUTRETURN (note that LAYOUGET will already
34 wait if it sees an outstanding LAYOUTRETURN).
36 Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
37 Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
38 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
42 1 file changed, 3 insertions(+)
46 @@ -365,6 +365,9 @@ pnfs_layout_need_return(struct pnfs_layo
48 pnfs_prepare_layoutreturn(struct pnfs_layout_hdr *lo)
50 + /* Serialise LAYOUTGET/LAYOUTRETURN */
51 + if (atomic_read(&lo->plh_outstanding) != 0)
53 if (test_and_set_bit(NFS_LAYOUT_RETURN, &lo->plh_flags))
55 lo->plh_return_iomode = 0;