diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2016-05-17 12:28:36 -0400 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2016-05-17 15:48:07 -0400 |
commit | 75bf47ebf6b5349d875fdffe7d64b0fc4e936170 (patch) | |
tree | 00e2a205bc7ee8c85d05b6a3bbdce8b87d8a269a | |
parent | cca588d6c835e21fd7a3e02a964ce5fe09fdad26 (diff) |
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: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
-rw-r--r-- | fs/nfs/flexfilelayout/flexfilelayout.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c index 53b6391e0eba..b6e0e32b6053 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.c +++ b/fs/nfs/flexfilelayout/flexfilelayout.c | |||
@@ -1295,7 +1295,7 @@ ff_layout_set_layoutcommit(struct nfs_pgio_header *hdr) | |||
1295 | } | 1295 | } |
1296 | 1296 | ||
1297 | static bool | 1297 | static bool |
1298 | ff_layout_reset_to_mds(struct pnfs_layout_segment *lseg, int idx) | 1298 | ff_layout_device_unavailable(struct pnfs_layout_segment *lseg, int idx) |
1299 | { | 1299 | { |
1300 | /* No mirroring for now */ | 1300 | /* No mirroring for now */ |
1301 | struct nfs4_deviceid_node *node = FF_LAYOUT_DEVID_NODE(lseg, idx); | 1301 | 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 | rpc_exit(task, -EIO); | 1332 | rpc_exit(task, -EIO); |
1333 | return -EIO; | 1333 | return -EIO; |
1334 | } | 1334 | } |
1335 | if (ff_layout_reset_to_mds(hdr->lseg, hdr->pgio_mirror_idx)) { | 1335 | if (ff_layout_device_unavailable(hdr->lseg, hdr->pgio_mirror_idx)) { |
1336 | dprintk("%s task %u reset io to MDS\n", __func__, task->tk_pid); | 1336 | rpc_exit(task, -EHOSTDOWN); |
1337 | if (ff_layout_has_available_ds(hdr->lseg)) | ||
1338 | pnfs_read_resend_pnfs(hdr); | ||
1339 | else | ||
1340 | ff_layout_reset_read(hdr); | ||
1341 | rpc_exit(task, 0); | ||
1342 | return -EAGAIN; | 1337 | return -EAGAIN; |
1343 | } | 1338 | } |
1344 | hdr->pgio_done_cb = ff_layout_read_done_cb; | ||
1345 | 1339 | ||
1346 | ff_layout_read_record_layoutstats_start(task, hdr); | 1340 | ff_layout_read_record_layoutstats_start(task, hdr); |
1347 | return 0; | 1341 | return 0; |
@@ -1531,14 +1525,8 @@ static int ff_layout_write_prepare_common(struct rpc_task *task, | |||
1531 | return -EIO; | 1525 | return -EIO; |
1532 | } | 1526 | } |
1533 | 1527 | ||
1534 | if (ff_layout_reset_to_mds(hdr->lseg, hdr->pgio_mirror_idx)) { | 1528 | if (ff_layout_device_unavailable(hdr->lseg, hdr->pgio_mirror_idx)) { |
1535 | bool retry_pnfs; | 1529 | rpc_exit(task, -EHOSTDOWN); |
1536 | |||
1537 | retry_pnfs = ff_layout_has_available_ds(hdr->lseg); | ||
1538 | dprintk("%s task %u reset io to %s\n", __func__, | ||
1539 | task->tk_pid, retry_pnfs ? "pNFS" : "MDS"); | ||
1540 | ff_layout_reset_write(hdr, retry_pnfs); | ||
1541 | rpc_exit(task, 0); | ||
1542 | return -EAGAIN; | 1530 | return -EAGAIN; |
1543 | } | 1531 | } |
1544 | 1532 | ||
@@ -1755,6 +1743,7 @@ ff_layout_read_pagelist(struct nfs_pgio_header *hdr) | |||
1755 | dprintk("%s USE DS: %s cl_count %d vers %d\n", __func__, | 1743 | dprintk("%s USE DS: %s cl_count %d vers %d\n", __func__, |
1756 | ds->ds_remotestr, atomic_read(&ds->ds_clp->cl_count), vers); | 1744 | ds->ds_remotestr, atomic_read(&ds->ds_clp->cl_count), vers); |
1757 | 1745 | ||
1746 | hdr->pgio_done_cb = ff_layout_read_done_cb; | ||
1758 | atomic_inc(&ds->ds_clp->cl_count); | 1747 | atomic_inc(&ds->ds_clp->cl_count); |
1759 | hdr->ds_clp = ds->ds_clp; | 1748 | hdr->ds_clp = ds->ds_clp; |
1760 | fh = nfs4_ff_layout_select_ds_fh(lseg, idx); | 1749 | fh = nfs4_ff_layout_select_ds_fh(lseg, idx); |