From: Suparna Bhattacharya Flush out the workqueue before destroying the ioctx which may be sitting on it. 25-akpm/fs/aio.c | 10 ++++++++++ 1 files changed, 10 insertions(+) diff -puN fs/aio.c~aio-11-workqueue-flush fs/aio.c --- 25/fs/aio.c~aio-11-workqueue-flush Tue Jul 8 16:07:31 2003 +++ 25-akpm/fs/aio.c Tue Jul 8 16:07:31 2003 @@ -346,6 +346,11 @@ void exit_aio(struct mm_struct *mm) aio_cancel_all(ctx); wait_for_all_aios(ctx); + /* + * this is an overkill, but ensures we don't leave + * the ctx on the aio_wq + */ + flush_workqueue(aio_wq); if (1 != atomic_read(&ctx->users)) printk(KERN_DEBUG @@ -1146,6 +1151,11 @@ 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 */ } _