All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] scsi-disk: release AioContext in unaligned WRITE SAME case
@ 2018-01-04 14:25 Stefan Hajnoczi
  2018-01-04 14:28 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hajnoczi @ 2018-01-04 14:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, famz, 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").
Cc: Paolo Bonzini <pbonzini@redhat.com>
Reported-by: Cong Li <coli@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/scsi/scsi-disk.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index e58833a087..49d2559d93 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -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;
     }
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] scsi-disk: release AioContext in unaligned WRITE SAME case
  2018-01-04 14:25 [Qemu-devel] [PATCH] scsi-disk: release AioContext in unaligned WRITE SAME case Stefan Hajnoczi
@ 2018-01-04 14:28 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2018-01-04 14:28 UTC (permalink / raw)
  To: Stefan Hajnoczi, qemu-devel; +Cc: famz

On 04/01/2018 15:25, Stefan Hajnoczi wrote:
> 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>
> Reported-by: Cong Li <coli@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  hw/scsi/scsi-disk.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
> index e58833a087..49d2559d93 100644
> --- a/hw/scsi/scsi-disk.c
> +++ b/hw/scsi/scsi-disk.c
> @@ -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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-04 14:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-04 14:25 [Qemu-devel] [PATCH] scsi-disk: release AioContext in unaligned WRITE SAME case Stefan Hajnoczi
2018-01-04 14:28 ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.