Skip to content

Commit

Permalink
pNFS/flexfiles: When initing reads or writes, we might have to retry …
Browse files Browse the repository at this point in the history
…connecting to DSes

If we are initializing reads or writes and can not connect to a DS, then
check whether or not IO is allowed through the MDS. If it is allowed,
reset to the MDS. Else, fail the layout segment and force a retry
of a new layout segment.

Signed-off-by: Tom Haynes <[email protected]>
Signed-off-by: Anna Schumaker <[email protected]>
  • Loading branch information
Tom Haynes authored and amschuma-ntap committed May 17, 2016
1 parent 3b13b4b commit 446ca21
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions fs/nfs/flexfilelayout/flexfilelayout.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,8 +848,13 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
goto out_mds;

ds = ff_layout_choose_best_ds_for_read(pgio->pg_lseg, 0, &ds_idx);
if (!ds)
goto out_mds;
if (!ds) {
if (ff_layout_no_fallback_to_mds(pgio->pg_lseg))
goto out_pnfs;
else
goto out_mds;
}

mirror = FF_LAYOUT_COMP(pgio->pg_lseg, ds_idx);

pgio->pg_mirror_idx = ds_idx;
Expand All @@ -863,6 +868,12 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
pnfs_put_lseg(pgio->pg_lseg);
pgio->pg_lseg = NULL;
nfs_pageio_reset_read_mds(pgio);
return;

out_pnfs:
pnfs_set_lo_fail(pgio->pg_lseg);
pnfs_put_lseg(pgio->pg_lseg);
pgio->pg_lseg = NULL;
}

static void
Expand Down Expand Up @@ -905,8 +916,12 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio,

for (i = 0; i < pgio->pg_mirror_count; i++) {
ds = nfs4_ff_layout_prepare_ds(pgio->pg_lseg, i, true);
if (!ds)
goto out_mds;
if (!ds) {
if (ff_layout_no_fallback_to_mds(pgio->pg_lseg))
goto out_pnfs;
else
goto out_mds;
}
pgm = &pgio->pg_mirrors[i];
mirror = FF_LAYOUT_COMP(pgio->pg_lseg, i);
pgm->pg_bsize = mirror->mirror_ds->ds_versions[0].wsize;
Expand All @@ -918,6 +933,12 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio,
pnfs_put_lseg(pgio->pg_lseg);
pgio->pg_lseg = NULL;
nfs_pageio_reset_write_mds(pgio);
return;

out_pnfs:
pnfs_set_lo_fail(pgio->pg_lseg);
pnfs_put_lseg(pgio->pg_lseg);
pgio->pg_lseg = NULL;
}

static unsigned int
Expand Down

0 comments on commit 446ca21

Please sign in to comment.