Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7890203d authored by Kinglong Mee's avatar Kinglong Mee Committed by J. Bruce Fields
Browse files

NFSD: Fix bad update of layout in nfsd4_return_file_layout



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: 9cf514cc ("nfsd: implement pNFS operations")
Signed-off-by: default avatarKinglong Mee <kinglongmee@gmail.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 376675da
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
@@ -440,15 +440,14 @@ nfsd4_return_file_layout(struct nfs4_layout *lp, struct nfsd4_layout_seg *seg,
			list_move_tail(&lp->lo_perstate, reaplist);
			list_move_tail(&lp->lo_perstate, reaplist);
			return;
			return;
		}
		}
		end = seg->offset;
		lo->offset = layout_end(seg);
	} else {
	} else {
		/* retain the whole layout segment on a split. */
		/* retain the whole layout segment on a split. */
		if (layout_end(seg) < end) {
		if (layout_end(seg) < end) {
			dprintk("%s: split not supported\n", __func__);
			dprintk("%s: split not supported\n", __func__);
			return;
			return;
		}
		}

		end = seg->offset;
		lo->offset = layout_end(seg);
	}
	}


	layout_update_len(lo, end);
	layout_update_len(lo, end);