Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 2983
b: refs/heads/master
c: 63e6880
h: refs/heads/master
i:
  2981: 5fd04ae
  2979: 52a82c7
  2975: 3cf8646
v: v3
  • Loading branch information
Benjamin LaHaise authored and Linus Torvalds committed Jun 23, 2005
1 parent 64948ae commit f4bbcb4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4452ea509e29df2f019bed2f7a1e0f5eea092b26
refs/heads/master: 63e6880918e75dcb92d60aff218a76e063a471ef
20 changes: 18 additions & 2 deletions trunk/fs/read_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,27 @@ int rw_verify_area(int read_write, struct file *file, loff_t *ppos, size_t count
return -EINVAL;
}

static void wait_on_retry_sync_kiocb(struct kiocb *iocb)
{
set_current_state(TASK_UNINTERRUPTIBLE);
if (!kiocbIsKicked(iocb))
schedule();
else
kiocbClearKicked(iocb);
__set_current_state(TASK_RUNNING);
}

ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos)
{
struct kiocb kiocb;
ssize_t ret;

init_sync_kiocb(&kiocb, filp);
kiocb.ki_pos = *ppos;
ret = filp->f_op->aio_read(&kiocb, buf, len, kiocb.ki_pos);
while (-EIOCBRETRY ==
(ret = filp->f_op->aio_read(&kiocb, buf, len, kiocb.ki_pos)))
wait_on_retry_sync_kiocb(&kiocb);

if (-EIOCBQUEUED == ret)
ret = wait_on_sync_kiocb(&kiocb);
*ppos = kiocb.ki_pos;
Expand Down Expand Up @@ -258,7 +271,10 @@ ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, lof

init_sync_kiocb(&kiocb, filp);
kiocb.ki_pos = *ppos;
ret = filp->f_op->aio_write(&kiocb, buf, len, kiocb.ki_pos);
while (-EIOCBRETRY ==
(ret = filp->f_op->aio_write(&kiocb, buf, len, kiocb.ki_pos)))
wait_on_retry_sync_kiocb(&kiocb);

if (-EIOCBQUEUED == ret)
ret = wait_on_sync_kiocb(&kiocb);
*ppos = kiocb.ki_pos;
Expand Down

0 comments on commit f4bbcb4

Please sign in to comment.