engines/sg: ensure we flag EIO on the right io_u
authorJens Axboe <axboe@kernel.dk>
Thu, 28 Feb 2019 17:07:38 +0000 (10:07 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 28 Feb 2019 17:08:08 +0000 (10:08 -0700)
For sync complete, set it on the io_u that corresponds to the hdr
we just read.

Fixes: a999bc49d7aa ("engines/sg: ensure we complete the right command for sync IO")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
engines/sg.c

index a5a4b13..c46b9ab 100644 (file)
@@ -448,11 +448,12 @@ static enum fio_q_status fio_sgio_rw_doio(struct thread_data *td,
                        if (ret < 0)
                                return ret;
 
+                       __io_u = hdr->usr_ptr;
+
                        /* record if an io error occurred */
                        if (hdr->info & SG_INFO_CHECK)
-                               io_u->error = EIO;
+                               __io_u->error = EIO;
 
-                       __io_u = hdr->usr_ptr;
                        if (__io_u == io_u)
                                break;