Skip to contentSkip to conversation

scsi-disk: release AioContext in unaligned WRITE SAME case

PATCH In review Stefan Hajnoczi 2 participants 2 messages Jan 4, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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").

---
 hw/scsi/scsi-disk.c | 1 +
 1 file changed, 1 insertion(+)
hw/scsi/scsi-disk.c +1 -0
index e58833a087..49d2559d93 100644
@@ -1755,6 +1755,7 @@ static void scsi_write_same_complete(void *opaque, int ret)
                                        data->sector << BDRV_SECTOR_BITS,
                                        &data->qiov, 0,
                                        scsi_write_same_complete, data);
+        aio_context_release(blk_get_aio_context(s->qdev.conf.blk));
         return;
     }
 
Signature · 1 line
2.14.3
#1 lore raw
Quoted 24 lines · Stefan Hajnoczi

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").

---
 hw/scsi/scsi-disk.c | 1 +
 1 file changed, 1 insertion(+)
hw/scsi/scsi-disk.c +0 -0
index e58833a087..49d2559d93 100644

hw/scsi/scsi-disk.c static void scsi_write_same_complete(void *opaque, int ret) · line 1761

Quoted 7 lines
hw/scsi/scsi-disk.c +1 -0
@@ -1755,6 +1755,7 @@ static void scsi_write_same_complete(void *opaque, int ret)
                                        data->sector << BDRV_SECTOR_BITS,
                                        &data->qiov, 0,
                                        scsi_write_same_complete, data);
+        aio_context_release(blk_get_aio_context(s->qdev.conf.blk));
         return;
     }
 

Queued,t hanks!

Paolo