aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_aops.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_aops.c')
-rw-r--r--fs/xfs/xfs_aops.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 46bba3e0af47..22aadf667862 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -88,8 +88,10 @@ xfs_destroy_ioend(
88 } 88 }
89 89
90 if (ioend->io_iocb) { 90 if (ioend->io_iocb) {
91 if (ioend->io_isasync) 91 if (ioend->io_isasync) {
92 aio_complete(ioend->io_iocb, ioend->io_result, 0); 92 aio_complete(ioend->io_iocb, ioend->io_error ?
93 ioend->io_error : ioend->io_result, 0);
94 }
93 inode_dio_done(ioend->io_inode); 95 inode_dio_done(ioend->io_inode);
94 } 96 }
95 97
@@ -141,9 +143,6 @@ xfs_setfilesize(
141 xfs_inode_t *ip = XFS_I(ioend->io_inode); 143 xfs_inode_t *ip = XFS_I(ioend->io_inode);
142 xfs_fsize_t isize; 144 xfs_fsize_t isize;
143 145
144 if (unlikely(ioend->io_error))
145 return 0;
146
147 if (!xfs_ilock_nowait(ip, XFS_ILOCK_EXCL)) 146 if (!xfs_ilock_nowait(ip, XFS_ILOCK_EXCL))
148 return EAGAIN; 147 return EAGAIN;
149 148
@@ -189,17 +188,24 @@ xfs_end_io(
189 struct xfs_inode *ip = XFS_I(ioend->io_inode); 188 struct xfs_inode *ip = XFS_I(ioend->io_inode);
190 int error = 0; 189 int error = 0;
191 190
191 if (XFS_FORCED_SHUTDOWN(ip->i_mount)) {
192 error = -EIO;
193 goto done;
194 }
195 if (ioend->io_error)
196 goto done;
197
192 /* 198 /*
193 * For unwritten extents we need to issue transactions to convert a 199 * For unwritten extents we need to issue transactions to convert a
194 * range to normal written extens after the data I/O has finished. 200 * range to normal written extens after the data I/O has finished.
195 */ 201 */
196 if (ioend->io_type == IO_UNWRITTEN && 202 if (ioend->io_type == IO_UNWRITTEN) {
197 likely(!ioend->io_error && !XFS_FORCED_SHUTDOWN(ip->i_mount))) {
198
199 error = xfs_iomap_write_unwritten(ip, ioend->io_offset, 203 error = xfs_iomap_write_unwritten(ip, ioend->io_offset,
200 ioend->io_size); 204 ioend->io_size);
201 if (error) 205 if (error) {
202 ioend->io_error = error; 206 ioend->io_error = -error;
207 goto done;
208 }
203 } 209 }
204 210
205 /* 211 /*
@@ -209,6 +215,7 @@ xfs_end_io(
209 error = xfs_setfilesize(ioend); 215 error = xfs_setfilesize(ioend);
210 ASSERT(!error || error == EAGAIN); 216 ASSERT(!error || error == EAGAIN);
211 217
218done:
212 /* 219 /*
213 * If we didn't complete processing of the ioend, requeue it to the 220 * If we didn't complete processing of the ioend, requeue it to the
214 * tail of the workqueue for another attempt later. Otherwise destroy 221 * tail of the workqueue for another attempt later. Otherwise destroy