Commit 0a156dd5 authored by Trond Myklebust's avatar Trond Myklebust

NFS/flexfiles: Avoid unnecessary layout invalidations

In ff_layout_mirror_valid() we may not want to invalidate the layout
segment despite the call to GETDEVICEINFO failing. The reason is that
a read may still be able to make progress on another mirror.

So instead we let the caller (in this case nfs4_ff_layout_prepare_ds())
decide whether or not it needs to invalidate.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 2444ff27
...@@ -196,7 +196,7 @@ static bool ff_layout_mirror_valid(struct pnfs_layout_segment *lseg, ...@@ -196,7 +196,7 @@ static bool ff_layout_mirror_valid(struct pnfs_layout_segment *lseg,
struct nfs4_ff_layout_mirror *mirror, struct nfs4_ff_layout_mirror *mirror,
bool create) bool create)
{ {
if (mirror == NULL || IS_ERR(mirror->mirror_ds)) if (mirror == NULL)
goto outerr; goto outerr;
if (mirror->mirror_ds == NULL) { if (mirror->mirror_ds == NULL) {
if (create) { if (create) {
...@@ -229,7 +229,6 @@ static bool ff_layout_mirror_valid(struct pnfs_layout_segment *lseg, ...@@ -229,7 +229,6 @@ static bool ff_layout_mirror_valid(struct pnfs_layout_segment *lseg,
} }
return true; return true;
outerr: outerr:
pnfs_error_mark_layout_for_return(lseg->pls_layout->plh_inode, lseg);
return false; return false;
} }
...@@ -417,7 +416,7 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg, ...@@ -417,7 +416,7 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg,
int status; int status;
if (!ff_layout_mirror_valid(lseg, mirror, true)) if (!ff_layout_mirror_valid(lseg, mirror, true))
goto out; goto noconnect;
ds = mirror->mirror_ds->ds; ds = mirror->mirror_ds->ds;
/* matching smp_wmb() in _nfs4_pnfs_v3/4_ds_connect */ /* matching smp_wmb() in _nfs4_pnfs_v3/4_ds_connect */
...@@ -444,6 +443,7 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg, ...@@ -444,6 +443,7 @@ nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg,
mirror->mirror_ds->ds_versions[0].wsize = max_payload; mirror->mirror_ds->ds_versions[0].wsize = max_payload;
goto out; goto out;
} }
noconnect:
ff_layout_track_ds_error(FF_LAYOUT_FROM_HDR(lseg->pls_layout), ff_layout_track_ds_error(FF_LAYOUT_FROM_HDR(lseg->pls_layout),
mirror, lseg->pls_range.offset, mirror, lseg->pls_range.offset,
lseg->pls_range.length, NFS4ERR_NXIO, lseg->pls_range.length, NFS4ERR_NXIO,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment