[AIO] restore aio_default_wake function after aio_down succeeds In order to ensure correct operation of future code in the iocb retry path, we need to restore the wait queue function to aio_wake_function before kick_iocb() triggers the retry path. Signed-off-by: Benjamin LaHaise diff -purN --exclude=description 51_aio_down_cancel_fix/fs/aio.c 52_aio_down_reset_wakefn/fs/aio.c --- 51_aio_down_cancel_fix/fs/aio.c 2005-08-08 17:15:37.000000000 -0400 +++ 52_aio_down_reset_wakefn/fs/aio.c 2005-08-08 17:15:41.000000000 -0400 @@ -1475,8 +1475,7 @@ static ssize_t aio_setup_iocb(struct kio * because this callback isn't used for wait queues which * are nested inside ioctx lock (i.e. ctx->wait) */ -static int aio_wake_function(wait_queue_t *wait, unsigned mode, - int sync, void *key) +int aio_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key) { struct kiocb *iocb = container_of(wait, struct kiocb, ki_wait); diff -purN --exclude=description 51_aio_down_cancel_fix/include/linux/aio.h 52_aio_down_reset_wakefn/include/linux/aio.h --- 51_aio_down_cancel_fix/include/linux/aio.h 2004-12-24 16:35:50.000000000 -0500 +++ 52_aio_down_reset_wakefn/include/linux/aio.h 2005-08-08 17:15:41.000000000 -0400 @@ -154,6 +154,7 @@ struct kioctx { /* prototypes */ extern unsigned aio_max_size; +extern int aio_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key); extern ssize_t FASTCALL(wait_on_sync_kiocb(struct kiocb *iocb)); extern int FASTCALL(aio_put_req(struct kiocb *iocb)); extern void FASTCALL(kick_iocb(struct kiocb *iocb)); diff -purN --exclude=description 51_aio_down_cancel_fix/lib/semaphore-sleepers.c 52_aio_down_reset_wakefn/lib/semaphore-sleepers.c --- 51_aio_down_cancel_fix/lib/semaphore-sleepers.c 2005-08-12 12:44:31.000000000 -0400 +++ 52_aio_down_reset_wakefn/lib/semaphore-sleepers.c 2005-08-16 15:43:24.000000000 -0400 @@ -16,6 +16,7 @@ #include #include #include +#include #include /* @@ -103,6 +104,7 @@ static int aio_down_wait(wait_queue_t *w * the wait_queue_head. */ if (!atomic_add_negative(sleepers - 1, &sem->count)) { + iocb->ki_wait.func = aio_wake_function; iocb->ki_cancel = NULL; sem->sleepers = 0; sem->aio_owner = iocb;