Commit 75bf47eb authored by Trond Myklebust's avatar Trond Myklebust Committed by Anna Schumaker

pNFS/flexfile: Fix erroneous fall back to read/write through the MDS

This patch fixes a problem whereby the pNFS client falls back to doing
reads and writes through the metadata server even when the layout flag
FF_FLAGS_NO_IO_THRU_MDS is set.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent cca588d6
...@@ -1295,7 +1295,7 @@ ff_layout_set_layoutcommit(struct nfs_pgio_header *hdr) ...@@ -1295,7 +1295,7 @@ ff_layout_set_layoutcommit(struct nfs_pgio_header *hdr)
} }
static bool static bool
ff_layout_reset_to_mds(struct pnfs_layout_segment *lseg, int idx) ff_layout_device_unavailable(struct pnfs_layout_segment *lseg, int idx)
{ {
/* No mirroring for now */ /* No mirroring for now */
struct nfs4_deviceid_node *node = FF_LAYOUT_DEVID_NODE(lseg, idx); struct nfs4_deviceid_node *node = FF_LAYOUT_DEVID_NODE(lseg, idx);
...@@ -1332,16 +1332,10 @@ static int ff_layout_read_prepare_common(struct rpc_task *task, ...@@ -1332,16 +1332,10 @@ static int ff_layout_read_prepare_common(struct rpc_task *task,
rpc_exit(task, -EIO); rpc_exit(task, -EIO);
return -EIO; return -EIO;
} }
if (ff_layout_reset_to_mds(hdr->lseg, hdr->pgio_mirror_idx)) { if (ff_layout_device_unavailable(hdr->lseg, hdr->pgio_mirror_idx)) {
dprintk("%s task %u reset io to MDS\n", __func__, task->tk_pid); rpc_exit(task, -EHOSTDOWN);
if (ff_layout_has_available_ds(hdr->lseg))
pnfs_read_resend_pnfs(hdr);
else
ff_layout_reset_read(hdr);
rpc_exit(task, 0);
return -EAGAIN; return -EAGAIN;
} }
hdr->pgio_done_cb = ff_layout_read_done_cb;
ff_layout_read_record_layoutstats_start(task, hdr); ff_layout_read_record_layoutstats_start(task, hdr);
return 0; return 0;
...@@ -1531,14 +1525,8 @@ static int ff_layout_write_prepare_common(struct rpc_task *task, ...@@ -1531,14 +1525,8 @@ static int ff_layout_write_prepare_common(struct rpc_task *task,
return -EIO; return -EIO;
} }
if (ff_layout_reset_to_mds(hdr->lseg, hdr->pgio_mirror_idx)) { if (ff_layout_device_unavailable(hdr->lseg, hdr->pgio_mirror_idx)) {
bool retry_pnfs; rpc_exit(task, -EHOSTDOWN);
retry_pnfs = ff_layout_has_available_ds(hdr->lseg);
dprintk("%s task %u reset io to %s\n", __func__,
task->tk_pid, retry_pnfs ? "pNFS" : "MDS");
ff_layout_reset_write(hdr, retry_pnfs);
rpc_exit(task, 0);
return -EAGAIN; return -EAGAIN;
} }
...@@ -1755,6 +1743,7 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr) ...@@ -1755,6 +1743,7 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr)
dprintk("%s USE DS: %s cl_count %d vers %d\n", __func__, dprintk("%s USE DS: %s cl_count %d vers %d\n", __func__,
ds->ds_remotestr, atomic_read(&ds->ds_clp->cl_count), vers); ds->ds_remotestr, atomic_read(&ds->ds_clp->cl_count), vers);
hdr->pgio_done_cb = ff_layout_read_done_cb;
atomic_inc(&ds->ds_clp->cl_count); atomic_inc(&ds->ds_clp->cl_count);
hdr->ds_clp = ds->ds_clp; hdr->ds_clp = ds->ds_clp;
fh = nfs4_ff_layout_select_ds_fh(lseg, idx); fh = nfs4_ff_layout_select_ds_fh(lseg, idx);
......
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