aboutsummaryrefslogtreecommitdiffstats
path: root/fs/direct-io.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2014-07-30 07:18:48 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2014-08-01 02:35:51 -0400
commitaf436472772d474acfad724ce789e003d1ca41c3 (patch)
tree282f8b70abda0aa10827d4237cee4c408260748c /fs/direct-io.c
parent6f0928036bcbd8dd2ebee9201580da8bcc0a81af (diff)
direct-io: fix AIO regression
The direct-io.c rewrite to use the iov_iter infrastructure stopped updating the size field in struct dio_submit, and thus rendered the check for allowing asynchronous completions to always return false. Fix this by comparing it to the count of bytes in the iov_iter instead. Signed-off-by: Christoph Hellwig <hch@lst.de> Reported-by: Tim Chen <tim.c.chen@linux.intel.com> Tested-by: Tim Chen <tim.c.chen@linux.intel.com>
Diffstat (limited to 'fs/direct-io.c')
-rw-r--r--fs/direct-io.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 194d0d122cae..17e39b047de5 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -71,7 +71,6 @@ struct dio_submit {
71 been performed at the start of a 71 been performed at the start of a
72 write */ 72 write */
73 int pages_in_io; /* approximate total IO pages */ 73 int pages_in_io; /* approximate total IO pages */
74 size_t size; /* total request size (doesn't change)*/
75 sector_t block_in_file; /* Current offset into the underlying 74 sector_t block_in_file; /* Current offset into the underlying
76 file in dio_block units. */ 75 file in dio_block units. */
77 unsigned blocks_available; /* At block_in_file. changes */ 76 unsigned blocks_available; /* At block_in_file. changes */
@@ -1104,7 +1103,8 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
1104 unsigned blkbits = i_blkbits; 1103 unsigned blkbits = i_blkbits;
1105 unsigned blocksize_mask = (1 << blkbits) - 1; 1104 unsigned blocksize_mask = (1 << blkbits) - 1;
1106 ssize_t retval = -EINVAL; 1105 ssize_t retval = -EINVAL;
1107 loff_t end = offset + iov_iter_count(iter); 1106 size_t count = iov_iter_count(iter);
1107 loff_t end = offset + count;
1108 struct dio *dio; 1108 struct dio *dio;
1109 struct dio_submit sdio = { 0, }; 1109 struct dio_submit sdio = { 0, };
1110 struct buffer_head map_bh = { 0, }; 1110 struct buffer_head map_bh = { 0, };
@@ -1287,10 +1287,9 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
1287 */ 1287 */
1288 BUG_ON(retval == -EIOCBQUEUED); 1288 BUG_ON(retval == -EIOCBQUEUED);
1289 if (dio->is_async && retval == 0 && dio->result && 1289 if (dio->is_async && retval == 0 && dio->result &&
1290 ((rw == READ) || (dio->result == sdio.size))) 1290 (rw == READ || dio->result == count))
1291 retval = -EIOCBQUEUED; 1291 retval = -EIOCBQUEUED;
1292 1292 else
1293 if (retval != -EIOCBQUEUED)
1294 dio_await_completion(dio); 1293 dio_await_completion(dio);
1295 1294
1296 if (drop_refcount(dio) == 0) { 1295 if (drop_refcount(dio) == 0) {