* Fri Sep 27 2019 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 4.1.0-13.el8
- kvm-nbd-server-attach-client-channel-to-the-export-s-Aio.patch [bz#1748253] - kvm-virtio-blk-schedule-virtio_notify_config-to-run-on-m.patch [bz#1744955] - Resolves: bz#1744955 (Qemu hang when block resize a qcow2 image) - Resolves: bz#1748253 (QEMU crashes (core dump) when using the integrated NDB server with data-plane)
This commit is contained in:
parent
4172d6971a
commit
1eb8acbee7
@ -0,0 +1,60 @@
|
||||
From 394dd52ce4dbd69cd5eca9a9928c442650cc3fd2 Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Date: Fri, 27 Sep 2019 11:13:24 +0100
|
||||
Subject: [PATCH 1/2] nbd/server: attach client channel to the export's
|
||||
AioContext
|
||||
|
||||
RH-Author: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Message-id: <20190927111324.17949-2-slp@redhat.com>
|
||||
Patchwork-id: 90905
|
||||
O-Subject: [RHEL-AV-8.1.0 qemu-kvm PATCH 1/1] nbd/server: attach client channel to the export's AioContext
|
||||
Bugzilla: 1748253
|
||||
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||||
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
On creation, the export's AioContext is set to the same one as the
|
||||
BlockBackend, while the AioContext in the client QIOChannel is left
|
||||
untouched.
|
||||
|
||||
As a result, when using data-plane, nbd_client_receive_next_request()
|
||||
schedules coroutines in the IOThread AioContext, while the client's
|
||||
QIOChannel is serviced from the main_loop, potentially triggering the
|
||||
assertion at qio_channel_restart_[read|write].
|
||||
|
||||
To fix this, as soon we have the export corresponding to the client,
|
||||
we call qio_channel_attach_aio_context() to attach the QIOChannel
|
||||
context to the export's AioContext. This matches with the logic at
|
||||
blk_aio_attached().
|
||||
|
||||
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1748253
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Message-Id: <20190912110032.26395-1-slp@redhat.com>
|
||||
Reviewed-by: Eric Blake <eblake@redhat.com>
|
||||
Signed-off-by: Eric Blake <eblake@redhat.com>
|
||||
(cherry picked from commit b4961249af0403fa55aae57c4c8806b24f7a7b33)
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
nbd/server.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/nbd/server.c b/nbd/server.c
|
||||
index 10faedc..ea0353a 100644
|
||||
--- a/nbd/server.c
|
||||
+++ b/nbd/server.c
|
||||
@@ -1296,6 +1296,11 @@ static coroutine_fn int nbd_negotiate(NBDClient *client, Error **errp)
|
||||
return ret;
|
||||
}
|
||||
|
||||
+ /* Attach the channel to the same AioContext as the export */
|
||||
+ if (client->exp && client->exp->ctx) {
|
||||
+ qio_channel_attach_aio_context(client->ioc, client->exp->ctx);
|
||||
+ }
|
||||
+
|
||||
assert(!client->optlen);
|
||||
trace_nbd_negotiate_success();
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,91 @@
|
||||
From 6b292920dbdd463bb80b82bef2063623a8e2da17 Mon Sep 17 00:00:00 2001
|
||||
From: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Date: Fri, 27 Sep 2019 11:46:41 +0100
|
||||
Subject: [PATCH 2/2] virtio-blk: schedule virtio_notify_config to run on main
|
||||
context
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
RH-Author: Sergio Lopez Pascual <slp@redhat.com>
|
||||
Message-id: <20190927114641.20992-2-slp@redhat.com>
|
||||
Patchwork-id: 90907
|
||||
O-Subject: [RHEL-AV-8.1.0 qemu-kvm PATCH 1/1] virtio-blk: schedule virtio_notify_config to run on main context
|
||||
Bugzilla: 1744955
|
||||
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
||||
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
||||
|
||||
virtio_notify_config() needs to acquire the global mutex, which isn't
|
||||
allowed from an iothread, and may lead to a deadlock like this:
|
||||
|
||||
- main thead
|
||||
* Has acquired: qemu_global_mutex.
|
||||
* Is trying the acquire: iothread AioContext lock via
|
||||
AIO_WAIT_WHILE (after aio_poll).
|
||||
|
||||
- iothread
|
||||
* Has acquired: AioContext lock.
|
||||
* Is trying to acquire: qemu_global_mutex (via
|
||||
virtio_notify_config->prepare_mmio_access).
|
||||
|
||||
If virtio_blk_resize() is called from an iothread, schedule
|
||||
virtio_notify_config() to be run in the main context BH.
|
||||
|
||||
[Removed unnecessary newline as suggested by Kevin Wolf
|
||||
<kwolf@redhat.com>.
|
||||
--Stefan]
|
||||
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
|
||||
Message-id: 20190916112411.21636-1-slp@redhat.com
|
||||
Message-Id: <20190916112411.21636-1-slp@redhat.com>
|
||||
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
(cherry picked from commit f9a7e3698a737ee75a7b0af34203303df982550f)
|
||||
Signed-off-by: Sergio Lopez <slp@redhat.com>
|
||||
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
||||
---
|
||||
hw/block/virtio-blk.c | 16 +++++++++++++++-
|
||||
1 file changed, 15 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
|
||||
index cbb3729..0d9adcd 100644
|
||||
--- a/hw/block/virtio-blk.c
|
||||
+++ b/hw/block/virtio-blk.c
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "qemu/iov.h"
|
||||
#include "qemu/module.h"
|
||||
#include "qemu/error-report.h"
|
||||
+#include "qemu/main-loop.h"
|
||||
#include "trace.h"
|
||||
#include "hw/block/block.h"
|
||||
#include "sysemu/blockdev.h"
|
||||
@@ -1082,11 +1083,24 @@ static int virtio_blk_load_device(VirtIODevice *vdev, QEMUFile *f,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static void virtio_resize_cb(void *opaque)
|
||||
+{
|
||||
+ VirtIODevice *vdev = opaque;
|
||||
+
|
||||
+ assert(qemu_get_current_aio_context() == qemu_get_aio_context());
|
||||
+ virtio_notify_config(vdev);
|
||||
+}
|
||||
+
|
||||
static void virtio_blk_resize(void *opaque)
|
||||
{
|
||||
VirtIODevice *vdev = VIRTIO_DEVICE(opaque);
|
||||
|
||||
- virtio_notify_config(vdev);
|
||||
+ /*
|
||||
+ * virtio_notify_config() needs to acquire the global mutex,
|
||||
+ * so it can't be called from an iothread. Instead, schedule
|
||||
+ * it to be run in the main context BH.
|
||||
+ */
|
||||
+ aio_bh_schedule_oneshot(qemu_get_aio_context(), virtio_resize_cb, vdev);
|
||||
}
|
||||
|
||||
static const BlockDevOps virtio_block_ops = {
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -67,7 +67,7 @@ Obsoletes: %1-rhev
|
||||
Summary: QEMU is a machine emulator and virtualizer
|
||||
Name: qemu-kvm
|
||||
Version: 4.1.0
|
||||
Release: 12%{?dist}
|
||||
Release: 13%{?dist}
|
||||
# Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped
|
||||
Epoch: 15
|
||||
License: GPLv2 and GPLv2+ and CC-BY
|
||||
@ -216,6 +216,10 @@ Patch65: kvm-block-qcow2-Fix-corruption-introduced-by-commit-8ac0.patch
|
||||
Patch66: kvm-block-qcow2-refactor-encryption-code.patch
|
||||
# For bz#1745922 - Luks-inside-qcow2 snapshot cannot boot after 'qemu-img rebase'
|
||||
Patch67: kvm-qemu-iotests-Add-test-for-bz-1745922.patch
|
||||
# For bz#1748253 - QEMU crashes (core dump) when using the integrated NDB server with data-plane
|
||||
Patch68: kvm-nbd-server-attach-client-channel-to-the-export-s-Aio.patch
|
||||
# For bz#1744955 - Qemu hang when block resize a qcow2 image
|
||||
Patch69: kvm-virtio-blk-schedule-virtio_notify_config-to-run-on-m.patch
|
||||
|
||||
BuildRequires: wget
|
||||
BuildRequires: rpm-build
|
||||
@ -1157,6 +1161,14 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Sep 27 2019 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 4.1.0-13.el8
|
||||
- kvm-nbd-server-attach-client-channel-to-the-export-s-Aio.patch [bz#1748253]
|
||||
- kvm-virtio-blk-schedule-virtio_notify_config-to-run-on-m.patch [bz#1744955]
|
||||
- Resolves: bz#1744955
|
||||
(Qemu hang when block resize a qcow2 image)
|
||||
- Resolves: bz#1748253
|
||||
(QEMU crashes (core dump) when using the integrated NDB server with data-plane)
|
||||
|
||||
* Thu Sep 26 2019 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 4.1.0-12.el8
|
||||
- kvm-block-Use-QEMU_IS_ALIGNED.patch [bz#1745922]
|
||||
- kvm-block-qcow2-Fix-corruption-introduced-by-commit-8ac0.patch [bz#1745922]
|
||||
|
Loading…
Reference in New Issue
Block a user