aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2018-08-21 10:25:33 -0400
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2018-08-21 13:39:05 -0400
commit1c1aeaf1432f51b57341741dcb76a3825d63a168 (patch)
tree66a3efccd02839a15a60f3b975fe739f321295ce
parentea51f94b45a0fd657c61206c1b648cc72f95befa (diff)
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>
-rw-r--r--fs/nfs/flexfilelayout/flexfilelayout.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index 280b6b060d53..cae43333ef16 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -812,7 +812,6 @@ ff_layout_pg_get_read(struct nfs_pageio_descriptor *pgio,
812 struct nfs_page *req, 812 struct nfs_page *req,
813 bool strict_iomode) 813 bool strict_iomode)
814{ 814{
815retry_strict:
816 pnfs_put_lseg(pgio->pg_lseg); 815 pnfs_put_lseg(pgio->pg_lseg);
817 pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode, 816 pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
818 req->wb_context, 817 req->wb_context,
@@ -825,16 +824,6 @@ retry_strict:
825 pgio->pg_error = PTR_ERR(pgio->pg_lseg); 824 pgio->pg_error = PTR_ERR(pgio->pg_lseg);
826 pgio->pg_lseg = NULL; 825 pgio->pg_lseg = NULL;
827 } 826 }
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 }
838} 827}
839 828
840static void 829static void
@@ -849,14 +838,16 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
849retry: 838retry:
850 pnfs_generic_pg_check_layout(pgio); 839 pnfs_generic_pg_check_layout(pgio);
851 /* Use full layout for now */ 840 /* Use full layout for now */
852 if (!pgio->pg_lseg) 841 if (!pgio->pg_lseg) {
853 ff_layout_pg_get_read(pgio, req, false); 842 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)) {
855 ff_layout_pg_get_read(pgio, req, true); 847 ff_layout_pg_get_read(pgio, req, true);
856 848 if (!pgio->pg_lseg)
857 /* If no lseg, fall back to read through mds */ 849 goto out_nolseg;
858 if (pgio->pg_lseg == NULL) 850 }
859 goto out_mds;
860 851
861 ds = ff_layout_choose_best_ds_for_read(pgio->pg_lseg, 0, &ds_idx); 852 ds = ff_layout_choose_best_ds_for_read(pgio->pg_lseg, 0, &ds_idx);
862 if (!ds) { 853 if (!ds) {
@@ -878,6 +869,9 @@ retry:
878 pgm->pg_bsize = mirror->mirror_ds->ds_versions[0].rsize; 869 pgm->pg_bsize = mirror->mirror_ds->ds_versions[0].rsize;
879 870
880 return; 871 return;
872out_nolseg:
873 if (pgio->pg_error < 0)
874 return;
881out_mds: 875out_mds:
882 pnfs_put_lseg(pgio->pg_lseg); 876 pnfs_put_lseg(pgio->pg_lseg);
883 pgio->pg_lseg = NULL; 877 pgio->pg_lseg = NULL;