summaryrefslogtreecommitdiff
path: root/fs/dax.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2016-02-08 14:40:51 +1100
committerDave Chinner <david@fromorbit.com>2016-02-08 14:40:51 +1100
commit187372a3b9faff68ed61c291d0135e6739e0dbdf (patch)
tree7eeed8ee2944dbdcc60ec49cf08f1b1604400b3e /fs/dax.c
parent36f90b0a2ddd60823fe193a85e60ff1906c2a9b3 (diff)
downloadlwn-187372a3b9faff68ed61c291d0135e6739e0dbdf.tar.gz
lwn-187372a3b9faff68ed61c291d0135e6739e0dbdf.zip
direct-io: always call ->end_io if non-NULL
This way we can pass back errors to the file system, and allow for cleanup required for all direct I/O invocations. Also allow the ->end_io handlers to return errors on their own, so that I/O completion errors can be passed on to the callers. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/dax.c')
-rw-r--r--fs/dax.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/dax.c b/fs/dax.c
index 4fd6b0c5c6b5..e38b2c589b54 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -267,8 +267,13 @@ ssize_t dax_do_io(struct kiocb *iocb, struct inode *inode,
if ((flags & DIO_LOCKING) && iov_iter_rw(iter) == READ)
inode_unlock(inode);
- if ((retval > 0) && end_io)
- end_io(iocb, pos, retval, bh.b_private);
+ if (end_io) {
+ int err;
+
+ err = end_io(iocb, pos, retval, bh.b_private);
+ if (err)
+ retval = err;
+ }
if (!(flags & DIO_SKIP_DIO_COUNT))
inode_dio_end(inode);