NFSD: Fix bad update of layout in nfsd4_return_file_layout
authorKinglong Mee <kinglongmee@gmail.com>
Sun, 22 Mar 2015 14:17:20 +0000 (22:17 +0800)
committerJ. Bruce Fields <bfields@redhat.com>
Thu, 26 Mar 2015 01:13:03 +0000 (21:13 -0400)
With return layout as, (seg is return layout, lo is record layout)
seg->offset <= lo->offset and layout_end(seg) < layout_end(lo),
nfsd should update lo's offset to seg's end,
and,
seg->offset > lo->offset and layout_end(seg) >= layout_end(lo),
nfsd should update lo's end to seg's offset.

Fixes: 9cf514ccfa ("nfsd: implement pNFS operations")
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4layouts.c

index 6964613bad9091cf0d8a49371668c7fbf977f53e..80e236bf79fc647a18a325e9bceefa8af1f86f6b 100644 (file)
@@ -440,15 +440,14 @@ nfsd4_return_file_layout(struct nfs4_layout *lp, struct nfsd4_layout_seg *seg,
                        list_move_tail(&lp->lo_perstate, reaplist);
                        return;
                }
-               end = seg->offset;
+               lo->offset = layout_end(seg);
        } else {
                /* retain the whole layout segment on a split. */
                if (layout_end(seg) < end) {
                        dprintk("%s: split not supported\n", __func__);
                        return;
                }
-
-               lo->offset = layout_end(seg);
+               end = seg->offset;
        }
 
        layout_update_len(lo, end);
This page took 0.028508 seconds and 5 git commands to generate.