nfs/flexfiles: Use the layout segment for reading unless it a IOMODE_RW and reading...
authorTom Haynes <thomas.haynes@primarydata.com>
Wed, 25 May 2016 14:31:13 +0000 (07:31 -0700)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Thu, 26 May 2016 12:40:51 +0000 (08:40 -0400)
Signed-off-by: Tom Haynes <loghyr@primarydata.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/flexfilelayout/flexfilelayout.c

index 40bccb2c06d16f8a614b6b8d35662a33d9eedc83..a7aeb7407252ee126525b296783ff81da29e8e42 100644 (file)
@@ -830,7 +830,8 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
        int ds_idx;
 
        /* Use full layout for now */
-       if (!pgio->pg_lseg) {
+       if (!pgio->pg_lseg || ff_layout_avoid_read_on_rw(pgio->pg_lseg)) {
+               pnfs_put_lseg(pgio->pg_lseg);
                pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
                                                   req->wb_context,
                                                   0,
@@ -840,9 +841,9 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
                if (IS_ERR(pgio->pg_lseg)) {
                        pgio->pg_error = PTR_ERR(pgio->pg_lseg);
                        pgio->pg_lseg = NULL;
-                       return;
                }
        }
+
        /* If no lseg, fall back to read through mds */
        if (pgio->pg_lseg == NULL)
                goto out_mds;