[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 0/3] virtio-scsi: fix SCSIDevice hot unplug with IOThread
From: |
Kevin Wolf |
Subject: |
Re: [PATCH v3 0/3] virtio-scsi: fix SCSIDevice hot unplug with IOThread |
Date: |
Thu, 23 Feb 2023 18:21:21 +0100 |
Am 21.02.2023 um 22:22 hat Stefan Hajnoczi geschrieben:
> v3:
> - Fix s/see/sees/ typo in Patch 2 commit description [Eric]
> - Add call stack to Patch 3 commit description to make it clear how
> blk_drain()
> is invoked [Kevin]
>
> Unplugging SCSIDevices when virtio-scsi is using an IOThread suffers from race
> conditions:
> - scsi_device_purge_requests() is called from the IOThread in TMF emulation.
> This is unsafe, it should only be called from the BQL.
> - SCSIRequest->aiocb is not protected by a lock, so there are races between
> the
> main loop thread and the IOThread when scsi_device_purge_requests() runs in
> the main loop thread.
> - DMAAIOCB->acb is not protected by a lock, so there are races in the DMA
> helpers code when cancelling a request from the main loop thread.
>
> These fixes solve assertion failures during SCSIDevice hot unplug in
> virtio-scsi with IOThread. Expanding the use of the AioContext lock isn't
> great
> since we're in the midst of trying to remove it. However, I think this
> solution
> is appropriate so that stable trees or distros can backport the fix without
> depending on QEMU multi-queue block layer refactoring.
>
> Special thanks to Qing Wang, who helped me iterate these patches because I
> couldn't reproduce the assertion failures myself.
Thanks, applied to the block branch.
Kevin