skd: Avoid double completions in case of a timeout
authorBart Van Assche <bart.vanassche@wdc.com>
Wed, 23 Aug 2017 17:56:32 +0000 (10:56 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 23 Aug 2017 18:02:34 +0000 (12:02 -0600)
commitf2fe445986c8c53d2c324062f2e2c34263cd79a1
tree87289aeccf707a7a0d009f1c99c9e475139831b9
parentc39c6c773d61457460fcbe4209816db53cd3cad7
skd: Avoid double completions in case of a timeout

Avoid that normal request completion and the timeout handler can
run concurrently by calling blk_mq_complete_request() instead of
blk_mq_end_request() from skd_end_request(). Avoid that the block
layer can reuse a request while the firmware is still processing
it. Convert skd_softirq_done() to blk-mq. Pass the pointer to
skd_softirq_done() to the block layer core through
blk_mq_ops.complete instead of by calling blk_queue_softirq_done().
Pass the pointer to skd_timed_out() to the block layer core
through blk_mq_ops.timeout instead of by calling
blk_queue_timed_out(). The timeout handler has been tested as
follows:

    echo 1 > /sys/block/skd0/io-timeout-fail &&
    (cd /sys/kernel/debug/fail_io_timeout &&
      echo 100 > probability &&
      echo N > task-filter &&
      echo 1 > times)

Fixes: commit a74d5b76fab9 ("skd: Switch to block layer timeout mechanism")
Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/skd_main.c