Commit 1c1aeaf1 authored by Trond Myklebust's avatar Trond Myklebust Committed by Anna Schumaker

pNFS/flexfiles: ff_layout_pg_init_read should exit on error

If we get an error while retrieving the layout, then we should
report it rather than falling back to I/O through the MDS.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent ea51f94b
...@@ -812,7 +812,6 @@ ff_layout_pg_get_read(struct nfs_pageio_descriptor *pgio, ...@@ -812,7 +812,6 @@ ff_layout_pg_get_read(struct nfs_pageio_descriptor *pgio,
struct nfs_page *req, struct nfs_page *req,
bool strict_iomode) bool strict_iomode)
{ {
retry_strict:
pnfs_put_lseg(pgio->pg_lseg); pnfs_put_lseg(pgio->pg_lseg);
pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode, pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
req->wb_context, req->wb_context,
...@@ -825,16 +824,6 @@ ff_layout_pg_get_read(struct nfs_pageio_descriptor *pgio, ...@@ -825,16 +824,6 @@ ff_layout_pg_get_read(struct nfs_pageio_descriptor *pgio,
pgio->pg_error = PTR_ERR(pgio->pg_lseg); pgio->pg_error = PTR_ERR(pgio->pg_lseg);
pgio->pg_lseg = NULL; pgio->pg_lseg = NULL;
} }
/* If we don't have checking, do get a IOMODE_RW
* segment, and the server wants to avoid READs
* there, then retry!
*/
if (pgio->pg_lseg && !strict_iomode &&
ff_layout_avoid_read_on_rw(pgio->pg_lseg)) {
strict_iomode = true;
goto retry_strict;
}
} }
static void static void
...@@ -849,14 +838,16 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio, ...@@ -849,14 +838,16 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
retry: retry:
pnfs_generic_pg_check_layout(pgio); pnfs_generic_pg_check_layout(pgio);
/* Use full layout for now */ /* Use full layout for now */
if (!pgio->pg_lseg) if (!pgio->pg_lseg) {
ff_layout_pg_get_read(pgio, req, false); ff_layout_pg_get_read(pgio, req, false);
else if (ff_layout_avoid_read_on_rw(pgio->pg_lseg)) if (!pgio->pg_lseg)
goto out_nolseg;
}
if (ff_layout_avoid_read_on_rw(pgio->pg_lseg)) {
ff_layout_pg_get_read(pgio, req, true); ff_layout_pg_get_read(pgio, req, true);
if (!pgio->pg_lseg)
/* If no lseg, fall back to read through mds */ goto out_nolseg;
if (pgio->pg_lseg == NULL) }
goto out_mds;
ds = ff_layout_choose_best_ds_for_read(pgio->pg_lseg, 0, &ds_idx); ds = ff_layout_choose_best_ds_for_read(pgio->pg_lseg, 0, &ds_idx);
if (!ds) { if (!ds) {
...@@ -878,6 +869,9 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio, ...@@ -878,6 +869,9 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
pgm->pg_bsize = mirror->mirror_ds->ds_versions[0].rsize; pgm->pg_bsize = mirror->mirror_ds->ds_versions[0].rsize;
return; return;
out_nolseg:
if (pgio->pg_error < 0)
return;
out_mds: out_mds:
pnfs_put_lseg(pgio->pg_lseg); pnfs_put_lseg(pgio->pg_lseg);
pgio->pg_lseg = NULL; pgio->pg_lseg = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment