]> git.baikalelectronics.ru Git - kernel.git/commitdiff
pNFS/flexfiles: Check the layout segment range before doing I/O
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 23 Mar 2020 18:48:23 +0000 (14:48 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Fri, 27 Mar 2020 20:34:35 +0000 (16:34 -0400)
When starting to read or write with a layout segment, check that the
range matches our request.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/flexfilelayout/flexfilelayout.c
fs/nfs/pnfs.c
fs/nfs/pnfs.h

index 3221001f2ea1622d447ad3751a10de68a4548f68..2b45807a52214b61db71e70d2b0eb7ff9aa40fbe 100644 (file)
@@ -830,6 +830,14 @@ ff_layout_pg_get_read(struct nfs_pageio_descriptor *pgio,
        }
 }
 
+static void
+ff_layout_pg_check_layout(struct nfs_pageio_descriptor *pgio,
+                         struct nfs_page *req)
+{
+       pnfs_generic_pg_check_layout(pgio);
+       pnfs_generic_pg_check_range(pgio, req);
+}
+
 static void
 ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
                        struct nfs_page *req)
@@ -840,7 +848,7 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
        int ds_idx;
 
 retry:
-       pnfs_generic_pg_check_layout(pgio);
+       ff_layout_pg_check_layout(pgio, req);
        /* Use full layout for now */
        if (!pgio->pg_lseg) {
                ff_layout_pg_get_read(pgio, req, false);
@@ -900,7 +908,7 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio,
        int i;
 
 retry:
-       pnfs_generic_pg_check_layout(pgio);
+       ff_layout_pg_check_layout(pgio, req);
        if (!pgio->pg_lseg) {
                pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
                                                   nfs_req_openctx(req),
index eba18f137fb04fe96dd2d0e8bdbdea3c92513e61..6fcf26b168163304367f1478c3b30b661e029646 100644 (file)
@@ -2611,7 +2611,7 @@ EXPORT_SYMBOL_GPL(pnfs_generic_pg_check_layout);
  * Check for any intersection between the request and the pgio->pg_lseg,
  * and if none, put this pgio->pg_lseg away.
  */
-static void
+void
 pnfs_generic_pg_check_range(struct nfs_pageio_descriptor *pgio, struct nfs_page *req)
 {
        if (pgio->pg_lseg && !pnfs_lseg_request_intersecting(pgio->pg_lseg, req)) {
@@ -2619,6 +2619,7 @@ pnfs_generic_pg_check_range(struct nfs_pageio_descriptor *pgio, struct nfs_page
                pgio->pg_lseg = NULL;
        }
 }
+EXPORT_SYMBOL_GPL(pnfs_generic_pg_check_range);
 
 void
 pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *req)
index b32025553f262de0c66b311ec913ff05de69416e..8e0ada581b92e3ef3f8e84d3c7165a4c177d7b1c 100644 (file)
@@ -252,6 +252,7 @@ void pnfs_put_lseg(struct pnfs_layout_segment *lseg);
 void set_pnfs_layoutdriver(struct nfs_server *, const struct nfs_fh *, struct nfs_fsinfo *);
 void unset_pnfs_layoutdriver(struct nfs_server *);
 void pnfs_generic_pg_check_layout(struct nfs_pageio_descriptor *pgio);
+void pnfs_generic_pg_check_range(struct nfs_pageio_descriptor *pgio, struct nfs_page *req);
 void pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *, struct nfs_page *);
 int pnfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc);
 void pnfs_generic_pg_init_write(struct nfs_pageio_descriptor *pgio,