[AIO] fix sync iocb use of retry mechanism When the sync infrastructure is used to run a retry using read/write, we need to correctly use the buffer offset and byte counts from the iocb on subsequent calls to the aio method. Signed-off-by: Benjamin LaHaise diff -purN --exclude=description 50_aio_down_cancel/fs/read_write.c 55_iocb_intr/fs/read_write.c --- 50_aio_down_cancel/fs/read_write.c 2005-07-13 11:26:03.000000000 -0400 +++ 55_iocb_intr/fs/read_write.c 2005-07-27 16:24:37.000000000 -0400 @@ -205,11 +205,13 @@ Einval: static void wait_on_retry_sync_kiocb(struct kiocb *iocb) { - set_current_state(TASK_UNINTERRUPTIBLE); + set_current_state(kiocbIsIntr(iocb) ? TASK_INTERRUPTIBLE + : TASK_UNINTERRUPTIBLE); if (!kiocbIsKicked(iocb)) schedule(); else kiocbClearKicked(iocb); + kiocbClearIntr(iocb); __set_current_state(TASK_RUNNING); } diff -purN --exclude=description 50_aio_down_cancel/include/linux/aio.h 55_iocb_intr/include/linux/aio.h --- 50_aio_down_cancel/include/linux/aio.h 2004-12-24 16:35:50.000000000 -0500 +++ 55_iocb_intr/include/linux/aio.h 2005-07-27 16:24:37.000000000 -0400 @@ -27,6 +27,7 @@ struct kioctx; #define KIF_LOCKED 0 #define KIF_KICKED 1 #define KIF_CANCELLED 2 +#define KIF_INTR 3 /* use TASK_INTERRUPTIBLE waits */ #define kiocbTryLock(iocb) test_and_set_bit(KIF_LOCKED, &(iocb)->ki_flags) #define kiocbTryKick(iocb) test_and_set_bit(KIF_KICKED, &(iocb)->ki_flags) @@ -34,14 +35,17 @@ struct kioctx; #define kiocbSetLocked(iocb) set_bit(KIF_LOCKED, &(iocb)->ki_flags) #define kiocbSetKicked(iocb) set_bit(KIF_KICKED, &(iocb)->ki_flags) #define kiocbSetCancelled(iocb) set_bit(KIF_CANCELLED, &(iocb)->ki_flags) +#define kiocbSetIntr(iocb) set_bit(KIF_INTR, &(iocb)->ki_flags) #define kiocbClearLocked(iocb) clear_bit(KIF_LOCKED, &(iocb)->ki_flags) #define kiocbClearKicked(iocb) clear_bit(KIF_KICKED, &(iocb)->ki_flags) #define kiocbClearCancelled(iocb) clear_bit(KIF_CANCELLED, &(iocb)->ki_flags) +#define kiocbClearIntr(iocb) clear_bit(KIF_INTR, &(iocb)->ki_flags) #define kiocbIsLocked(iocb) test_bit(KIF_LOCKED, &(iocb)->ki_flags) #define kiocbIsKicked(iocb) test_bit(KIF_KICKED, &(iocb)->ki_flags) #define kiocbIsCancelled(iocb) test_bit(KIF_CANCELLED, &(iocb)->ki_flags) +#define kiocbIsIntr(iocb) test_bit(KIF_INTR, &(iocb)->ki_flags) struct kiocb { struct list_head ki_run_list;