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>
This commit is contained in:

committed by
Dave Chinner

parent
36f90b0a2d
commit
187372a3b9
@@ -620,7 +620,7 @@ bail:
|
||||
* particularly interested in the aio/dio case. We use the rw_lock DLM lock
|
||||
* to protect io on one node from truncation on another.
|
||||
*/
|
||||
static void ocfs2_dio_end_io(struct kiocb *iocb,
|
||||
static int ocfs2_dio_end_io(struct kiocb *iocb,
|
||||
loff_t offset,
|
||||
ssize_t bytes,
|
||||
void *private)
|
||||
@@ -628,6 +628,9 @@ static void ocfs2_dio_end_io(struct kiocb *iocb,
|
||||
struct inode *inode = file_inode(iocb->ki_filp);
|
||||
int level;
|
||||
|
||||
if (bytes <= 0)
|
||||
return 0;
|
||||
|
||||
/* this io's submitter should not have unlocked this before we could */
|
||||
BUG_ON(!ocfs2_iocb_is_rw_locked(iocb));
|
||||
|
||||
@@ -644,6 +647,8 @@ static void ocfs2_dio_end_io(struct kiocb *iocb,
|
||||
level = ocfs2_iocb_rw_locked_level(iocb);
|
||||
ocfs2_rw_unlock(inode, level);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ocfs2_releasepage(struct page *page, gfp_t wait)
|
||||
|
Reference in New Issue
Block a user