Skip to content

Commit ee15c7b

Browse files
author
Trond Myklebust
committed
pNFS/flexfiles: Ensure we initialise the mirror bsizes correctly on read
While it is true that reading from an unmirrored source always uses index 0, that is no longer true for mirrored sources when we fail over. Fixes: 563c53e ("NFS: Fix flexfiles read failover") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
1 parent 16abd2a commit ee15c7b

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎fs/nfs/flexfilelayout/flexfilelayout.c‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,7 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
838838
struct nfs4_ff_layout_mirror *mirror;
839839
struct nfs4_pnfs_ds *ds;
840840
int ds_idx;
841+
u32 i;
841842

842843
retry:
843844
ff_layout_pg_check_layout(pgio, req);
@@ -863,14 +864,14 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
863864
goto retry;
864865
}
865866

866-
mirror = FF_LAYOUT_COMP(pgio->pg_lseg, ds_idx);
867+
for (i = 0; i < pgio->pg_mirror_count; i++) {
868+
mirror = FF_LAYOUT_COMP(pgio->pg_lseg, i);
869+
pgm = &pgio->pg_mirrors[i];
870+
pgm->pg_bsize = mirror->mirror_ds->ds_versions[0].rsize;
871+
}
867872

868873
pgio->pg_mirror_idx = ds_idx;
869874

870-
/* read always uses only one mirror - idx 0 for pgio layer */
871-
pgm = &pgio->pg_mirrors[0];
872-
pgm->pg_bsize = mirror->mirror_ds->ds_versions[0].rsize;
873-
874875
if (NFS_SERVER(pgio->pg_inode)->flags &
875876
(NFS_MOUNT_SOFT|NFS_MOUNT_SOFTERR))
876877
pgio->pg_maxretrans = io_maxretrans;

0 commit comments

Comments
 (0)