Commit 1b1bc66b authored by Weston Andros Adamson's avatar Weston Andros Adamson Committed by Anna Schumaker

pnfs: set NFS_IOHDR_REDO in pnfs_read_resend_pnfs

Like other resend paths, mark the (old) hdr as NFS_IOHDR_REDO. This
ensures the hdr completion function will not count the (old) hdr
as good bytes.

Also, vector the error back through the hdr->task.tk_status like other
retry calls.

This fixes a bug with the FlexFiles layout where libaio was reporting more
bytes read than requested.
Signed-off-by: default avatarWeston Andros Adamson <dros@primarydata.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 44549e8f
...@@ -2143,12 +2143,15 @@ pnfs_try_to_read_data(struct nfs_pgio_header *hdr, ...@@ -2143,12 +2143,15 @@ pnfs_try_to_read_data(struct nfs_pgio_header *hdr,
} }
/* Resend all requests through pnfs. */ /* Resend all requests through pnfs. */
int pnfs_read_resend_pnfs(struct nfs_pgio_header *hdr) void pnfs_read_resend_pnfs(struct nfs_pgio_header *hdr)
{ {
struct nfs_pageio_descriptor pgio; struct nfs_pageio_descriptor pgio;
nfs_pageio_init_read(&pgio, hdr->inode, false, hdr->completion_ops); if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) {
return nfs_pageio_resend(&pgio, hdr); nfs_pageio_init_read(&pgio, hdr->inode, false,
hdr->completion_ops);
hdr->task.tk_status = nfs_pageio_resend(&pgio, hdr);
}
} }
EXPORT_SYMBOL_GPL(pnfs_read_resend_pnfs); EXPORT_SYMBOL_GPL(pnfs_read_resend_pnfs);
...@@ -2158,12 +2161,11 @@ pnfs_do_read(struct nfs_pageio_descriptor *desc, struct nfs_pgio_header *hdr) ...@@ -2158,12 +2161,11 @@ pnfs_do_read(struct nfs_pageio_descriptor *desc, struct nfs_pgio_header *hdr)
const struct rpc_call_ops *call_ops = desc->pg_rpc_callops; const struct rpc_call_ops *call_ops = desc->pg_rpc_callops;
struct pnfs_layout_segment *lseg = desc->pg_lseg; struct pnfs_layout_segment *lseg = desc->pg_lseg;
enum pnfs_try_status trypnfs; enum pnfs_try_status trypnfs;
int err = 0;
trypnfs = pnfs_try_to_read_data(hdr, call_ops, lseg); trypnfs = pnfs_try_to_read_data(hdr, call_ops, lseg);
if (trypnfs == PNFS_TRY_AGAIN) if (trypnfs == PNFS_TRY_AGAIN)
err = pnfs_read_resend_pnfs(hdr); pnfs_read_resend_pnfs(hdr);
if (trypnfs == PNFS_NOT_ATTEMPTED || err) if (trypnfs == PNFS_NOT_ATTEMPTED || hdr->task.tk_status)
pnfs_read_through_mds(desc, hdr); pnfs_read_through_mds(desc, hdr);
} }
......
...@@ -282,7 +282,7 @@ int _pnfs_return_layout(struct inode *); ...@@ -282,7 +282,7 @@ int _pnfs_return_layout(struct inode *);
int pnfs_commit_and_return_layout(struct inode *); int pnfs_commit_and_return_layout(struct inode *);
void pnfs_ld_write_done(struct nfs_pgio_header *); void pnfs_ld_write_done(struct nfs_pgio_header *);
void pnfs_ld_read_done(struct nfs_pgio_header *); void pnfs_ld_read_done(struct nfs_pgio_header *);
int pnfs_read_resend_pnfs(struct nfs_pgio_header *); void pnfs_read_resend_pnfs(struct nfs_pgio_header *);
struct pnfs_layout_segment *pnfs_update_layout(struct inode *ino, struct pnfs_layout_segment *pnfs_update_layout(struct inode *ino,
struct nfs_open_context *ctx, struct nfs_open_context *ctx,
loff_t pos, loff_t pos,
......
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