Skip to content

Commit e1e54ab

Browse files
author
Trond Myklebust
committed
pNFS/flexfiles: Check the layout segment range before doing I/O
When starting to read or write with a layout segment, check that the range matches our request. Signed-off-by: Trond Myklebust <[email protected]>
1 parent 660d1eb commit e1e54ab

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

fs/nfs/flexfilelayout/flexfilelayout.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,14 @@ ff_layout_pg_get_read(struct nfs_pageio_descriptor *pgio,
830830
}
831831
}
832832

833+
static void
834+
ff_layout_pg_check_layout(struct nfs_pageio_descriptor *pgio,
835+
struct nfs_page *req)
836+
{
837+
pnfs_generic_pg_check_layout(pgio);
838+
pnfs_generic_pg_check_range(pgio, req);
839+
}
840+
833841
static void
834842
ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
835843
struct nfs_page *req)
@@ -840,7 +848,7 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
840848
int ds_idx;
841849

842850
retry:
843-
pnfs_generic_pg_check_layout(pgio);
851+
ff_layout_pg_check_layout(pgio, req);
844852
/* Use full layout for now */
845853
if (!pgio->pg_lseg) {
846854
ff_layout_pg_get_read(pgio, req, false);
@@ -900,7 +908,7 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio,
900908
int i;
901909

902910
retry:
903-
pnfs_generic_pg_check_layout(pgio);
911+
ff_layout_pg_check_layout(pgio, req);
904912
if (!pgio->pg_lseg) {
905913
pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
906914
nfs_req_openctx(req),

fs/nfs/pnfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2611,14 +2611,15 @@ EXPORT_SYMBOL_GPL(pnfs_generic_pg_check_layout);
26112611
* Check for any intersection between the request and the pgio->pg_lseg,
26122612
* and if none, put this pgio->pg_lseg away.
26132613
*/
2614-
static void
2614+
void
26152615
pnfs_generic_pg_check_range(struct nfs_pageio_descriptor *pgio, struct nfs_page *req)
26162616
{
26172617
if (pgio->pg_lseg && !pnfs_lseg_request_intersecting(pgio->pg_lseg, req)) {
26182618
pnfs_put_lseg(pgio->pg_lseg);
26192619
pgio->pg_lseg = NULL;
26202620
}
26212621
}
2622+
EXPORT_SYMBOL_GPL(pnfs_generic_pg_check_range);
26222623

26232624
void
26242625
pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *req)

fs/nfs/pnfs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ void pnfs_put_lseg(struct pnfs_layout_segment *lseg);
252252
void set_pnfs_layoutdriver(struct nfs_server *, const struct nfs_fh *, struct nfs_fsinfo *);
253253
void unset_pnfs_layoutdriver(struct nfs_server *);
254254
void pnfs_generic_pg_check_layout(struct nfs_pageio_descriptor *pgio);
255+
void pnfs_generic_pg_check_range(struct nfs_pageio_descriptor *pgio, struct nfs_page *req);
255256
void pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *, struct nfs_page *);
256257
int pnfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc);
257258
void pnfs_generic_pg_init_write(struct nfs_pageio_descriptor *pgio,

0 commit comments

Comments
 (0)