Skip to content

Commit 1c1aeaf

Browse files
trondmypdamschuma-ntap
authored andcommitted
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: Trond Myklebust <trond.myklebust@primarydata.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent ea51f94 commit 1c1aeaf

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

fs/nfs/flexfilelayout/flexfilelayout.c

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,6 @@ ff_layout_pg_get_read(struct nfs_pageio_descriptor *pgio,
812812
struct nfs_page *req,
813813
bool strict_iomode)
814814
{
815-
retry_strict:
816815
pnfs_put_lseg(pgio->pg_lseg);
817816
pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
818817
req->wb_context,
@@ -825,16 +824,6 @@ ff_layout_pg_get_read(struct nfs_pageio_descriptor *pgio,
825824
pgio->pg_error = PTR_ERR(pgio->pg_lseg);
826825
pgio->pg_lseg = NULL;
827826
}
828-
829-
/* If we don't have checking, do get a IOMODE_RW
830-
* segment, and the server wants to avoid READs
831-
* there, then retry!
832-
*/
833-
if (pgio->pg_lseg && !strict_iomode &&
834-
ff_layout_avoid_read_on_rw(pgio->pg_lseg)) {
835-
strict_iomode = true;
836-
goto retry_strict;
837-
}
838827
}
839828

840829
static void
@@ -849,14 +838,16 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
849838
retry:
850839
pnfs_generic_pg_check_layout(pgio);
851840
/* Use full layout for now */
852-
if (!pgio->pg_lseg)
841+
if (!pgio->pg_lseg) {
853842
ff_layout_pg_get_read(pgio, req, false);
854-
else if (ff_layout_avoid_read_on_rw(pgio->pg_lseg))
843+
if (!pgio->pg_lseg)
844+
goto out_nolseg;
845+
}
846+
if (ff_layout_avoid_read_on_rw(pgio->pg_lseg)) {
855847
ff_layout_pg_get_read(pgio, req, true);
856-
857-
/* If no lseg, fall back to read through mds */
858-
if (pgio->pg_lseg == NULL)
859-
goto out_mds;
848+
if (!pgio->pg_lseg)
849+
goto out_nolseg;
850+
}
860851

861852
ds = ff_layout_choose_best_ds_for_read(pgio->pg_lseg, 0, &ds_idx);
862853
if (!ds) {
@@ -878,6 +869,9 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
878869
pgm->pg_bsize = mirror->mirror_ds->ds_versions[0].rsize;
879870

880871
return;
872+
out_nolseg:
873+
if (pgio->pg_error < 0)
874+
return;
881875
out_mds:
882876
pnfs_put_lseg(pgio->pg_lseg);
883877
pgio->pg_lseg = NULL;

0 commit comments

Comments
 (0)