From: Tom Haynes Date: Wed, 25 May 2016 14:31:13 +0000 (-0700) Subject: nfs/flexfiles: Use the layout segment for reading unless it a IOMODE_RW and reading... X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=602c4cd452d93355166daf8a662c84a5f85d2856;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git nfs/flexfiles: Use the layout segment for reading unless it a IOMODE_RW and reading is disabled Signed-off-by: Tom Haynes Signed-off-by: Anna Schumaker --- diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c index 40bccb2c06d1..a7aeb7407252 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.c +++ b/fs/nfs/flexfilelayout/flexfilelayout.c @@ -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;