2015-03-22 14:17:28

by Kinglong Mee

[permalink] [raw]
Subject: [PATCH] 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: 9cf514ccfa ("nfsd: implement pNFS operations")
Signed-off-by: Kinglong Mee <[email protected]>
---
fs/nfsd/nfs4layouts.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c
index 6964613..80e236b 100644
--- a/fs/nfsd/nfs4layouts.c
+++ b/fs/nfsd/nfs4layouts.c
@@ -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);
--
2.3.3



2015-03-25 08:34:47

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH] NFSD: Fix bad update of layout in nfsd4_return_file_layout

Looks good,

Reviewed-by: Christoph Hellwig <[email protected]>

Guess we need some good testcase for these artifical partial segment
returns that don't happen with the real client..

2015-03-26 01:15:20

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH] NFSD: Fix bad update of layout in nfsd4_return_file_layout

On Wed, Mar 25, 2015 at 09:34:45AM +0100, Christoph Hellwig wrote:
> Looks good,
>
> Reviewed-by: Christoph Hellwig <[email protected]>
>
> Guess we need some good testcase for these artifical partial segment
> returns that don't happen with the real client..

pynfs might do it? But I'm not volunteering.

Anyway, applying these three for 4.0. (NFSD: Printk blocklayout length
a.., NFSD: Take care the return value.., NFSD: Fix bad update of layout
in...).

--b.