提交 f02b9ac3 编写于 作者: S Shaohua Li 提交者: Jens Axboe

virtio-blk: virtqueue_kick() must be ordered with other virtqueue operations

It isn't safe to call it without holding the vblk->vq_lock.
Reported-by: NDave Chinner <david@fromorbit.com>
Signed-off-by: NShaohua Li <shli@fusionio.com>

Fixed another condition of virtqueue_kick() not holding the lock.
Signed-off-by: NJens Axboe <axboe@kernel.dk>
上级 94eddfbe
......@@ -199,15 +199,16 @@ static int virtio_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *req)
spin_lock_irqsave(&vblk->vq_lock, flags);
if (__virtblk_add_req(vblk->vq, vbr, vbr->sg, num) < 0) {
virtqueue_kick(vblk->vq);
spin_unlock_irqrestore(&vblk->vq_lock, flags);
blk_mq_stop_hw_queue(hctx);
virtqueue_kick(vblk->vq);
return BLK_MQ_RQ_QUEUE_BUSY;
}
spin_unlock_irqrestore(&vblk->vq_lock, flags);
if (last)
virtqueue_kick(vblk->vq);
spin_unlock_irqrestore(&vblk->vq_lock, flags);
return BLK_MQ_RQ_QUEUE_OK;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册