backend: always clean up pending aios
authorNaohiro Aota <naohiro.aota@wdc.com>
Fri, 28 Feb 2020 07:12:46 +0000 (16:12 +0900)
committerJens Axboe <axboe@kernel.dk>
Wed, 18 Mar 2020 02:05:54 +0000 (20:05 -0600)
cleanup_pending_aios() is called when a thread exits with error, so all the
call site of this function is under "if (td->error)". However, commit
d28174f0189c ("workqueue: ensure we see deferred error for IOs"), for some
reason, added "if (td->error) return" at the head of this function, making
this function practically void. Revert this part to ensure cleaning up
pending aios.

Besides, cleanup_pending_aios() should not return even when
io_u_queued_complete() failed. Because, it keeps in-flight aios left.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Tested-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
backend.c

index 936203dcb1c4858b1b3f7ddea23ab5f965e04bb4..feb34e51382fbabcae94167ae98706babbe33416 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -237,15 +237,10 @@ static void cleanup_pending_aio(struct thread_data *td)
 {
        int r;
 
 {
        int r;
 
-       if (td->error)
-               return;
-
        /*
         * get immediately available events, if any
         */
        r = io_u_queued_complete(td, 0);
        /*
         * get immediately available events, if any
         */
        r = io_u_queued_complete(td, 0);
-       if (r < 0)
-               return;
 
        /*
         * now cancel remaining active events
 
        /*
         * now cancel remaining active events