aboutsummaryrefslogtreecommitdiffstats
path: root/fs/direct-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/direct-io.c')
-rw-r--r--fs/direct-io.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 160a5489a939..a701752dd750 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -1194,13 +1194,19 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
1194 } 1194 }
1195 1195
1196 /* 1196 /*
1197 * For file extending writes updating i_size before data 1197 * For file extending writes updating i_size before data writeouts
1198 * writeouts complete can expose uninitialized blocks. So 1198 * complete can expose uninitialized blocks in dumb filesystems.
1199 * even for AIO, we need to wait for i/o to complete before 1199 * In that case we need to wait for I/O completion even if asked
1200 * returning in this case. 1200 * for an asynchronous write.
1201 */ 1201 */
1202 dio->is_async = !is_sync_kiocb(iocb) && !((rw & WRITE) && 1202 if (is_sync_kiocb(iocb))
1203 (end > i_size_read(inode))); 1203 dio->is_async = false;
1204 else if (!(dio->flags & DIO_ASYNC_EXTEND) &&
1205 (rw & WRITE) && end > i_size_read(inode))
1206 dio->is_async = false;
1207 else
1208 dio->is_async = true;
1209
1204 dio->inode = inode; 1210 dio->inode = inode;
1205 dio->rw = rw; 1211 dio->rw = rw;
1206 1212