]> www.infradead.org Git - users/jedix/linux-maple.git/commit
xen-blkfront: fix mq start/stop race
authorJunxiao Bi <junxiao.bi@oracle.com>
Mon, 19 Jun 2017 07:56:36 +0000 (15:56 +0800)
committerChuck Anderson <chuck.anderson@oracle.com>
Sun, 9 Jul 2017 01:21:01 +0000 (18:21 -0700)
commit20a524d9cdbcb1f7f83700b34ea4f2da14f8da7d
treeb39bb3bec8040704fbf215dac2b8ff01f2d3c140
parenta754dcf6a1971fe52d74bbfb467e4cebb43b4386
xen-blkfront: fix mq start/stop race

Orabug: 26397415

When ring buf full, hw queue will be stopped. While blkif interrupt consume
request and make free space in ring buf, hw queue will be started again.
But since start queue is protected by spin lock while stop not, that will
cause a race.

interrupt:                                      process:
blkif_interrupt()                               blkif_queue_rq()
 kick_pending_request_queues_locked()
  blk_mq_start_stopped_hw_queues()
   clear_bit(BLK_MQ_S_STOPPED, &hctx->state)
                                                 blk_mq_stop_hw_queue(hctx)
   blk_mq_run_hw_queue(hctx, async)

If ring buf is made empty in this case, interrupt will never come, then the
hw queue will be stopped forever, all processes waiting for the pending io
in the queue will hung.

Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
Reviewed-by: Ankur Arora <ankur.a.arora@oracle.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
drivers/block/xen-blkfront.c