@@ -852,7 +852,8 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
int ds_idx;
/* Use full layout for now */
- if (!pgio->pg_lseg) {
+ if (!pgio->pg_lseg || ff_layout_avoid_read_on_rw(pgio->pg_lseg)) {
+ pnfs_put_lseg(pgio->pg_lseg);
pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
req->wb_context,
0,
@@ -862,9 +863,9 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
if (IS_ERR(pgio->pg_lseg)) {
pgio->pg_error = PTR_ERR(pgio->pg_lseg);
pgio->pg_lseg = NULL;
- return;
}
}
+
/* If no lseg, fall back to read through mds */
if (pgio->pg_lseg == NULL)
goto out_mds;
Signed-off-by: Tom Haynes <loghyr@primarydata.com> --- fs/nfs/flexfilelayout/flexfilelayout.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)