All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] NFSD: Fix bad update of layout in nfsd4_return_file_layout
@ 2015-03-22 14:17 Kinglong Mee
  2015-03-25  8:34 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Kinglong Mee @ 2015-03-22 14:17 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: Christoph Hellwig, Linux NFS Mailing List

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>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] NFSD: Fix bad update of layout in nfsd4_return_file_layout
  2015-03-22 14:17 [PATCH] NFSD: Fix bad update of layout in nfsd4_return_file_layout Kinglong Mee
@ 2015-03-25  8:34 ` Christoph Hellwig
  2015-03-26  1:15   ` J. Bruce Fields
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2015-03-25  8:34 UTC (permalink / raw)
  To: Kinglong Mee; +Cc: J. Bruce Fields, Christoph Hellwig, Linux NFS Mailing List

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] NFSD: Fix bad update of layout in nfsd4_return_file_layout
  2015-03-25  8:34 ` Christoph Hellwig
@ 2015-03-26  1:15   ` J. Bruce Fields
  0 siblings, 0 replies; 3+ messages in thread
From: J. Bruce Fields @ 2015-03-26  1:15 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Kinglong Mee, Linux NFS Mailing List

On Wed, Mar 25, 2015 at 09:34:45AM +0100, Christoph Hellwig wrote:
> Looks good,
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> 
> 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-26  1:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-22 14:17 [PATCH] NFSD: Fix bad update of layout in nfsd4_return_file_layout Kinglong Mee
2015-03-25  8:34 ` Christoph Hellwig
2015-03-26  1:15   ` J. Bruce Fields

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.