aio: fix kioctx not being freed after cancellation at exit time
aio: fix kioctx not being freed after cancellation at exit time

The recent changes overhauling fs/aio.c introduced a bug that results in
the kioctx not being freed when outstanding kiocbs are cancelled at
exit_aio() time.  Specifically, a kiocb that is cancelled has its
completion events discarded by batch_complete_aio(), which then fails to
wake up the process stuck in free_ioctx().  Fix this by modifying the
wait_event() condition in free_ioctx() appropriately.

This patch was tested with the cancel operation in the thread based code
posted yesterday.

[5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org: fix build]
Signed-off-by: Benjamin LaHaise <b05c66fa21e46731bb89a779db663748f3df8f6a@kvack.org>
Signed-off-by: Kent Overstreet <8f464ad20d7f95b5ede78c4772dc4f5cc3ffa553@google.com>
Cc: Kent Overstreet <8f464ad20d7f95b5ede78c4772dc4f5cc3ffa553@google.com>
Cc: Josh Boyer <94755a79aca753e683bb6d0e796d473b797056eb@redhat.com>
Cc: Zach Brown <bdd5a5f42152ba789e24c1ef8132eb16704ed8a4@redhat.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas,TeamVee-Kanas/android_kernel_samsung_kanas,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,TeamVee-Kanas/android_kernel_samsung_kanas