qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org
Subject: [PULL 10/11] block/export: Conditionally ignore set-context error
Date: Tue, 20 Jul 2021 17:10:52 +0200	[thread overview]
Message-ID: <20210720151053.226144-11-kwolf@redhat.com> (raw)
In-Reply-To: <20210720151053.226144-1-kwolf@redhat.com>

From: Max Reitz <mreitz@redhat.com>

When invoking block-export-add with some iothread and
fixed-iothread=false, and changing the node's iothread fails, the error
is supposed to be ignored.

However, it is still stored in *errp, which is wrong.  If a second error
occurs, the "*errp must be NULL" assertion in error_setv() fails:

  qemu-system-x86_64: ../util/error.c:59: error_setv: Assertion
  `*errp == NULL' failed.

So if fixed-iothread=false, we should ignore the error by passing NULL
to bdrv_try_set_aio_context().

Fixes: f51d23c80af73c95e0ce703ad06a300f1b3d63ef
       ("block/export: add iothread and fixed-iothread options")
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20210624083825.29224-2-mreitz@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/export/export.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/block/export/export.c b/block/export/export.c
index fec7d9f738..6d3b9964c8 100644
--- a/block/export/export.c
+++ b/block/export/export.c
@@ -111,6 +111,7 @@ BlockExport *blk_exp_add(BlockExportOptions *export, Error **errp)
     if (export->has_iothread) {
         IOThread *iothread;
         AioContext *new_ctx;
+        Error **set_context_errp;
 
         iothread = iothread_by_id(export->iothread);
         if (!iothread) {
@@ -120,7 +121,9 @@ BlockExport *blk_exp_add(BlockExportOptions *export, Error **errp)
 
         new_ctx = iothread_get_aio_context(iothread);
 
-        ret = bdrv_try_set_aio_context(bs, new_ctx, errp);
+        /* Ignore errors with fixed-iothread=false */
+        set_context_errp = fixed_iothread ? errp : NULL;
+        ret = bdrv_try_set_aio_context(bs, new_ctx, set_context_errp);
         if (ret == 0) {
             aio_context_release(ctx);
             aio_context_acquire(new_ctx);
-- 
2.31.1



  parent reply	other threads:[~2021-07-20 15:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-20 15:10 [PULL 00/11] Block layer patches Kevin Wolf
2021-07-20 15:10 ` [PULL 01/11] block/mirror: set .co for active-write MirrorOp objects Kevin Wolf
2021-07-20 15:10 ` [PULL 02/11] iotest 151: add test-case that shows active mirror dead-lock Kevin Wolf
2021-07-20 15:10 ` [PULL 03/11] block/mirror: fix active mirror dead-lock in mirror_wait_on_conflicts Kevin Wolf
2021-07-20 15:10 ` [PULL 04/11] block: Add option to use driver whitelist even in tools Kevin Wolf
2021-07-20 15:10 ` [PULL 05/11] replication: Remove s->active_disk Kevin Wolf
2021-07-20 15:10 ` [PULL 06/11] replication: Reduce usage of s->hidden_disk and s->secondary_disk Kevin Wolf
2021-07-20 15:10 ` [PULL 07/11] replication: Properly attach children Kevin Wolf
2021-07-20 15:10 ` [PULL 08/11] replication: Remove workaround Kevin Wolf
2021-07-20 15:10 ` [PULL 09/11] block/vvfat: fix: drop backing Kevin Wolf
2021-07-20 15:10 ` Kevin Wolf [this message]
2021-07-20 15:10 ` [PULL 11/11] iotests/307: Test iothread conflict for exports Kevin Wolf
2021-07-20 18:29 ` [PULL 00/11] Block layer patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210720151053.226144-11-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).