Blame SOURCES/kvm-scsi-disk-release-AioContext-in-unaligned-WRITE-SAME.patch

4a2fec
From 81bdf75b893c852a9daae615b4ab41106eb364db Mon Sep 17 00:00:00 2001
4a2fec
From: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
Date: Thu, 18 Jan 2018 12:12:04 +0100
4a2fec
Subject: [PATCH 06/21] scsi-disk: release AioContext in unaligned WRITE SAME
4a2fec
 case
4a2fec
4a2fec
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
Message-id: <20180118121204.17287-2-stefanha@redhat.com>
4a2fec
Patchwork-id: 78663
4a2fec
O-Subject: [RHV7.5 qemu-kvm-rhev PATCH 1/1] scsi-disk: release AioContext in unaligned WRITE SAME case
4a2fec
Bugzilla: 1526423
4a2fec
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
4a2fec
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
4a2fec
RH-Acked-by: John Snow <jsnow@redhat.com>
4a2fec
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
4a2fec
4a2fec
scsi_write_same_complete() can retry the write if the request was
4a2fec
unaligned.  Make sure to release the AioContext when that code path is
4a2fec
taken!
4a2fec
4a2fec
This patch fixes a hang when QEMU terminates after an unaligned WRITE
4a2fec
SAME request has been processed with dataplane.  The hang occurs because
4a2fec
iothread_stop_all() cannot acquire the AioContext lock that was leaked
4a2fec
by the IOThread in scsi_write_same_complete().
4a2fec
4a2fec
Fixes: b9e413dd37 ("block: explicitly acquire aiocontext in aio callbacks that need it").
4a2fec
Cc: Paolo Bonzini <pbonzini@redhat.com>
4a2fec
Cc: qemu-stable@nongnu.org
4a2fec
Reported-by: Cong Li <coli@redhat.com>
4a2fec
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
Message-Id: <20180104142502.15175-1-stefanha@redhat.com>
4a2fec
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4a2fec
(cherry picked from commit 24355b79bdaf6ab12f7c610b032fc35ec045cd55)
4a2fec
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 hw/scsi/scsi-disk.c | 1 +
4a2fec
 1 file changed, 1 insertion(+)
4a2fec
4a2fec
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
4a2fec
index c676355..25cbd7b 100644
4a2fec
--- a/hw/scsi/scsi-disk.c
4a2fec
+++ b/hw/scsi/scsi-disk.c
4a2fec
@@ -1747,6 +1747,7 @@ static void scsi_write_same_complete(void *opaque, int ret)
4a2fec
                                        data->sector << BDRV_SECTOR_BITS,
4a2fec
                                        &data->qiov, 0,
4a2fec
                                        scsi_write_same_complete, data);
4a2fec
+        aio_context_release(blk_get_aio_context(s->qdev.conf.blk));
4a2fec
         return;
4a2fec
     }
4a2fec
 
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec