scsi-disk: release AioContext in unaligned WRITE SAME case
commit24355b79bdaf6ab12f7c610b032fc35ec045cd55
authorStefan Hajnoczi <stefanha@redhat.com>
Thu, 4 Jan 2018 14:25:02 +0000 (4 14:25 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 16 Jan 2018 13:54:50 +0000 (16 14:54 +0100)
treea823bbf47f289882dbaf508eb6054f437fd71b85
parent02a2ad217b0de16cc6c4f36fe325907cdbe7766b
scsi-disk: release AioContext in unaligned WRITE SAME case

scsi_write_same_complete() can retry the write if the request was
unaligned.  Make sure to release the AioContext when that code path is
taken!

This patch fixes a hang when QEMU terminates after an unaligned WRITE
SAME request has been processed with dataplane.  The hang occurs because
iothread_stop_all() cannot acquire the AioContext lock that was leaked
by the IOThread in scsi_write_same_complete().

Fixes: b9e413dd37 ("block: explicitly acquire aiocontext in aio callbacks that need it").
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-stable@nongnu.org
Reported-by: Cong Li <coli@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20180104142502.15175-1-stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/scsi/scsi-disk.c