engines/sg: improve error handling
authorVincent Fu <Vincent.Fu@wdc.com>
Mon, 27 Aug 2018 20:40:11 +0000 (16:40 -0400)
committerJens Axboe <axboe@kernel.dk>
Mon, 3 Sep 2018 15:01:14 +0000 (09:01 -0600)
commit53ee8c17adb00e3db4f2c9441777ba777390cb9f
tree4f2405a7e7669309ff7c77d0adc458217001c6e1
parent7df9ac895f4af7ac4500379d5a5e204be9210fb2
engines/sg: improve error handling

The Linux sg driver accepts only 16 SCSI commands in flight
at a time per file descriptor. fio does not exit gracefully
when it attempts to queue up 17 or more trim commands via
the sg ioengine. This patch improves error handling in the
sg ioengine commit function to achieve a graceful exit if
fio attempts to queue up too many trim commands. The key to
this is calling clear_io_u on each io_u in the 17th trim
command. With this patch fio no longer loops forever
waiting for the IOs in the (not succesffully submitted)
17th trim command to complete.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
engines/sg.c