Skip to content

Commit

Permalink
NFSD: Fix bad update of layout in nfsd4_return_file_layout
Browse files Browse the repository at this point in the history
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: 9cf514c ("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>
  • Loading branch information
kinglongmee authored and J. Bruce Fields committed Mar 26, 2015
1 parent 376675d commit 7890203
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions fs/nfsd/nfs4layouts.c
Expand Up @@ -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);
Expand Down

0 comments on commit 7890203

Please sign in to comment.