Skip to contentSkip to conversation

NFSD: Fix bad update of layout in nfsd4_return_file_layout

PATCH In review Kinglong Mee 3 participants 3 messages Mar 22, 2015 – Mar 26, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 fs/nfsd/nfs4layouts.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
fs/nfsd/nfs4layouts.c +2 -3
index 6964613..80e236b 100644
@@ -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);
Signature · 1 line
2.3.3
#2 lore raw
Quoted 6 lines · Christoph Hellwig

Looks good,

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.