Skip to contentSkip to conversation

Block patches

GIT PULL Applied Fam Zheng 2 participants 4 messages Oct 12, 2018 Block layer

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

The following changes since commit 75e50c80e051423a6f55a34ee4a1eec842444a5b:

Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2018-10-10' into staging (2018-10-11 10:43:37 +0100)

are available in the Git repository at:

git://github.com/famz/qemu.git tags/block-pull-request

for you to fetch changes up to 6388147296cd4c841a7d4409ba622c200332a8c7:

nvme: correct locking around completion (2018-10-12 09:46:14 +0800)

----------------------------------------------------------------
Block patches

One fix from Marc-André for iothread.
One fix from Paolo on nvme:// driver.

----------------------------------------------------------------

Marc-André Lureau (1):
iothread: fix crash with invalid properties

Paolo Bonzini (1):
nvme: correct locking around completion

 block/nvme.c | 2 --
 iothread.c   | 9 ++++++---
 2 files changed, 6 insertions(+), 5 deletions(-)
Signature · 1 line
2.17.1
author
#1 lore raw

[Qemu-devel] [PULL 1/2] iothread: fix crash with invalid properties

From: Marc-André Lureau <[email protected]>

-object iothread,id=foo,? will crash qemu:

qemu-system-x86_64:qemu-thread-posix.c:128: qemu_cond_destroy: Assertion `cond->initialized' failed.

Use thread_id != -1 to check if iothread_complete() finished successfully and the mutex/cond have been initialized.

Message-Id: <[email protected]>

---
 iothread.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
iothread.c +6 -3
index aff1281257..2fb1cdf55d 100644
@@ -110,6 +110,7 @@ static void iothread_instance_init(Object *obj)
     IOThread *iothread = IOTHREAD(obj);
 
     iothread->poll_max_ns = IOTHREAD_POLL_MAX_NS_DEFAULT;
+    iothread->thread_id = -1;
 }
 
 static void iothread_instance_finalize(Object *obj)
@@ -117,6 +118,11 @@ static void iothread_instance_finalize(Object *obj)
     IOThread *iothread = IOTHREAD(obj);
 
     iothread_stop(iothread);
+
+    if (iothread->thread_id != -1) {
+        qemu_cond_destroy(&iothread->init_done_cond);
+        qemu_mutex_destroy(&iothread->init_done_lock);
+    }
     /*
      * Before glib2 2.33.10, there is a glib2 bug that GSource context
      * pointer may not be cleared even if the context has already been
@@ -135,8 +141,6 @@ static void iothread_instance_finalize(Object *obj)
         g_main_context_unref(iothread->worker_context);
         iothread->worker_context = NULL;
     }
-    qemu_cond_destroy(&iothread->init_done_cond);
-    qemu_mutex_destroy(&iothread->init_done_lock);
 }
 
 static void iothread_complete(UserCreatable *obj, Error **errp)
@@ -147,7 +151,6 @@ static void iothread_complete(UserCreatable *obj, Error **errp)
 
     iothread->stopping = false;
     iothread->running = true;
-    iothread->thread_id = -1;
     iothread->ctx = aio_context_new(&local_error);
     if (!iothread->ctx) {
         error_propagate(errp, local_error);
Signature · 1 line
2.17.1
author
#2 lore raw

[Qemu-devel] [PULL 2/2] nvme: correct locking around completion

In reply to Fam Zheng

From: Paolo Bonzini <[email protected]>

nvme_poll_queues is already protected by q->lock, and AIO callbacks are invoked outside the AioContext lock. So remove the acquire/release pair in nvme_handle_event.

Message-Id: <[email protected]>

---
 block/nvme.c | 2 --
 1 file changed, 2 deletions(-)
block/nvme.c +0 -2
index 781d77d6d2..29294038fc 100644
@@ -489,10 +489,8 @@ static void nvme_handle_event(EventNotifier *n)
     BDRVNVMeState *s = container_of(n, BDRVNVMeState, irq_notifier);
 
     trace_nvme_handle_event(s);
-    aio_context_acquire(s->aio_context);
     event_notifier_test_and_clear(n);
     nvme_poll_queues(s);
-    aio_context_release(s->aio_context);
 }
 
 static bool nvme_add_io_queue(BlockDriverState *bs, Error **errp)
Signature · 1 line
2.17.1
#3 lore raw
In reply to Fam Zheng
Quoted 23 lines · Fam Zheng

The following changes since commit 75e50c80e051423a6f55a34ee4a1eec842444a5b:

Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2018-10-10' into staging (2018-10-11 10:43:37 +0100)

are available in the Git repository at:

git://github.com/famz/qemu.git tags/block-pull-request

for you to fetch changes up to 6388147296cd4c841a7d4409ba622c200332a8c7:

nvme: correct locking around completion (2018-10-12 09:46:14 +0800)

----------------------------------------------------------------
Block patches

One fix from Marc-André for iothread.
One fix from Paolo on nvme:// driver.

----------------------------------------------------------------

Marc-André Lureau (1):
iothread: fix crash with invalid properties

Quoted 6 lines

Paolo Bonzini (1):
nvme: correct locking around completion

 block/nvme.c | 2 --
 iothread.c   | 9 ++++++---
 2 files changed, 6 insertions(+), 5 deletions(-)

Applied, thanks.

-- PMM