提交 04f658ee 编写于 作者: C Christoph Hellwig 提交者: Alex Elder

xfs: improve ioend error handling

Return unwritten extent conversion errors to aio_complete.

Skip both unwritten extent conversion and size updates if we had an
I/O error or the filesystem has been shut down.

Return -EIO to the aio/buffer completion handlers in case of a
forced shutdown.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NDave Chinner <dchinner@redhat.com>
Signed-off-by: NAlex Elder <aelder@sgi.com>
上级 c58cb165
...@@ -88,8 +88,10 @@ xfs_destroy_ioend( ...@@ -88,8 +88,10 @@ xfs_destroy_ioend(
} }
if (ioend->io_iocb) { if (ioend->io_iocb) {
if (ioend->io_isasync) if (ioend->io_isasync) {
aio_complete(ioend->io_iocb, ioend->io_result, 0); aio_complete(ioend->io_iocb, ioend->io_error ?
ioend->io_error : ioend->io_result, 0);
}
inode_dio_done(ioend->io_inode); inode_dio_done(ioend->io_inode);
} }
...@@ -141,9 +143,6 @@ xfs_setfilesize( ...@@ -141,9 +143,6 @@ xfs_setfilesize(
xfs_inode_t *ip = XFS_I(ioend->io_inode); xfs_inode_t *ip = XFS_I(ioend->io_inode);
xfs_fsize_t isize; xfs_fsize_t isize;
if (unlikely(ioend->io_error))
return 0;
if (!xfs_ilock_nowait(ip, XFS_ILOCK_EXCL)) if (!xfs_ilock_nowait(ip, XFS_ILOCK_EXCL))
return EAGAIN; return EAGAIN;
...@@ -189,17 +188,24 @@ xfs_end_io( ...@@ -189,17 +188,24 @@ xfs_end_io(
struct xfs_inode *ip = XFS_I(ioend->io_inode); struct xfs_inode *ip = XFS_I(ioend->io_inode);
int error = 0; int error = 0;
if (XFS_FORCED_SHUTDOWN(ip->i_mount)) {
error = -EIO;
goto done;
}
if (ioend->io_error)
goto done;
/* /*
* For unwritten extents we need to issue transactions to convert a * For unwritten extents we need to issue transactions to convert a
* range to normal written extens after the data I/O has finished. * range to normal written extens after the data I/O has finished.
*/ */
if (ioend->io_type == IO_UNWRITTEN && if (ioend->io_type == IO_UNWRITTEN) {
likely(!ioend->io_error && !XFS_FORCED_SHUTDOWN(ip->i_mount))) {
error = xfs_iomap_write_unwritten(ip, ioend->io_offset, error = xfs_iomap_write_unwritten(ip, ioend->io_offset,
ioend->io_size); ioend->io_size);
if (error) if (error) {
ioend->io_error = error; ioend->io_error = -error;
goto done;
}
} }
/* /*
...@@ -209,6 +215,7 @@ xfs_end_io( ...@@ -209,6 +215,7 @@ xfs_end_io(
error = xfs_setfilesize(ioend); error = xfs_setfilesize(ioend);
ASSERT(!error || error == EAGAIN); ASSERT(!error || error == EAGAIN);
done:
/* /*
* If we didn't complete processing of the ioend, requeue it to the * If we didn't complete processing of the ioend, requeue it to the
* tail of the workqueue for another attempt later. Otherwise destroy * tail of the workqueue for another attempt later. Otherwise destroy
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册