From: Chris Mason While testing fsaio here, I hit an oops in kick_iocb because iocb->mm was null. This was right as the program was exiting. With the patch below, I wasn't able to reproduce, it makes sure we flush the workqueue every time __put_ioctx gets called. aio.c | 6 +----- 1 files changed, 1 insertion(+), 5 deletions(-) --- aio/fs/aio.c 2004-06-21 11:09:50.143627384 -0700 +++ aio-putioctx-flushworkqueue/fs/aio.c 2004-06-21 11:12:55.359470296 -0700 @@ -367,6 +367,7 @@ void fastcall __put_ioctx(struct kioctx if (unlikely(ctx->reqs_active)) BUG(); + flush_workqueue(aio_wq); aio_free_ring(ctx); mmdrop(ctx->mm); ctx->mm = NULL; @@ -1205,11 +1206,6 @@ static void io_destroy(struct kioctx *io aio_cancel_all(ioctx); wait_for_all_aios(ioctx); - /* - * this is an overkill, but ensures we don't leave - * the ctx on the aio_wq - */ - flush_workqueue(aio_wq); put_ioctx(ioctx); /* once for the lookup */ }