diff options
Diffstat (limited to 'fs/read_write.c')
-rw-r--r-- | fs/read_write.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/fs/read_write.c b/fs/read_write.c index d4cb3183c99c..679dd535380f 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -227,14 +227,20 @@ static void wait_on_retry_sync_kiocb(struct kiocb *iocb) | |||
227 | 227 | ||
228 | ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos) | 228 | ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos) |
229 | { | 229 | { |
230 | struct iovec iov = { .iov_base = buf, .iov_len = len }; | ||
230 | struct kiocb kiocb; | 231 | struct kiocb kiocb; |
231 | ssize_t ret; | 232 | ssize_t ret; |
232 | 233 | ||
233 | init_sync_kiocb(&kiocb, filp); | 234 | init_sync_kiocb(&kiocb, filp); |
234 | kiocb.ki_pos = *ppos; | 235 | kiocb.ki_pos = *ppos; |
235 | while (-EIOCBRETRY == | 236 | kiocb.ki_left = len; |
236 | (ret = filp->f_op->aio_read(&kiocb, buf, len, kiocb.ki_pos))) | 237 | |
238 | for (;;) { | ||
239 | ret = filp->f_op->aio_read(&kiocb, &iov, 1, kiocb.ki_pos); | ||
240 | if (ret != -EIOCBRETRY) | ||
241 | break; | ||
237 | wait_on_retry_sync_kiocb(&kiocb); | 242 | wait_on_retry_sync_kiocb(&kiocb); |
243 | } | ||
238 | 244 | ||
239 | if (-EIOCBQUEUED == ret) | 245 | if (-EIOCBQUEUED == ret) |
240 | ret = wait_on_sync_kiocb(&kiocb); | 246 | ret = wait_on_sync_kiocb(&kiocb); |
@@ -279,14 +285,20 @@ EXPORT_SYMBOL(vfs_read); | |||
279 | 285 | ||
280 | ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos) | 286 | ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos) |
281 | { | 287 | { |
288 | struct iovec iov = { .iov_base = (void __user *)buf, .iov_len = len }; | ||
282 | struct kiocb kiocb; | 289 | struct kiocb kiocb; |
283 | ssize_t ret; | 290 | ssize_t ret; |
284 | 291 | ||
285 | init_sync_kiocb(&kiocb, filp); | 292 | init_sync_kiocb(&kiocb, filp); |
286 | kiocb.ki_pos = *ppos; | 293 | kiocb.ki_pos = *ppos; |
287 | while (-EIOCBRETRY == | 294 | kiocb.ki_left = len; |
288 | (ret = filp->f_op->aio_write(&kiocb, buf, len, kiocb.ki_pos))) | 295 | |
296 | for (;;) { | ||
297 | ret = filp->f_op->aio_write(&kiocb, &iov, 1, kiocb.ki_pos); | ||
298 | if (ret != -EIOCBRETRY) | ||
299 | break; | ||
289 | wait_on_retry_sync_kiocb(&kiocb); | 300 | wait_on_retry_sync_kiocb(&kiocb); |
301 | } | ||
290 | 302 | ||
291 | if (-EIOCBQUEUED == ret) | 303 | if (-EIOCBQUEUED == ret) |
292 | ret = wait_on_sync_kiocb(&kiocb); | 304 | ret = wait_on_sync_kiocb(&kiocb); |