On 12/02/2015 06:21, Fam Zheng wrote:
> Before processing a request, virtio-scsi dataplane will check if the
> backend runs on the same context with it. If not, it has to be moved,
> with bdrv_set_aio_context.
> 
> However this function is unsafe to be called from IOThread outside BQL.
> The reason is that it calls bdrv_drain_all(), to acquire and drain all
> existing BDS. Therefore there is a deadlock problem.
> 
> Fix it by offloading the bdrv_set_aio_context to main loop thread,
> through a BH (#1). This main loop BH will set the context, then notify
> the calling thread with another BH (#2). In BH (#2), we can continue the
> virtio-scsi request processing.
> 
> A queue is added to VirtIOSCSI for tracking the pending requests, so in
> virtio_scsi_dataplane_stop, we have to drain them for migration.
> 
> Signed-off-by: Fam Zheng <f...@redhat.com>

Could you just do set_aio_context for all devices when starting
dataplane?  For example with a new scsi_device_set_aio_context function
(and a new method in SCSIDeviceClass).

Maybe I'm missing the obvious. :)

Paolo

Reply via email to