NFS: Ensure O_DIRECT reports an error if the bytes read/written is 0

If the attempt to resend the I/O results in no bytes being read/written,
we must ensure that we report the error.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Fixes: 0a00b77b33 ("nfs: mirroring support for direct io")
Cc: stable@vger.kernel.org # v3.20+
This commit is contained in:
Trond Myklebust
2019-08-12 18:04:36 -04:00
parent f4340e9314
commit eb2c50da9e
2 changed files with 19 additions and 9 deletions

View File

@@ -1266,6 +1266,7 @@ int nfs_pageio_resend(struct nfs_pageio_descriptor *desc,
if (!list_empty(&pages)) {
int err = desc->pg_error < 0 ? desc->pg_error : -EIO;
hdr->completion_ops->error_cleanup(&pages, err);
nfs_set_pgio_error(hdr, err, hdr->io_start);
return err;
}
return 0;