qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Xie Yongji <xieyongji@bytedance.com>
To: kwolf@redhat.com, stefanha@redhat.com
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org
Subject: [PATCH 2/5] vduse-blk: Don't unlink the reconnect file if device exists
Date: Mon, 13 Jun 2022 20:45:00 +0800	[thread overview]
Message-ID: <20220613124503.156-3-xieyongji@bytedance.com> (raw)
In-Reply-To: <20220613124503.156-1-xieyongji@bytedance.com>

We should not unlink the reconnect file if vduse_dev_destroy()
fails with -EBUSY which means the VDUSE device has not been
removed from the vDPA bus. Otherwise, we might fail on
the reconnection later.

Fixes: 730abef0e873 ("libvduse: Add support for reconnecting")
Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
---
 block/export/vduse-blk.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/block/export/vduse-blk.c b/block/export/vduse-blk.c
index 3b10349173..c3a89894ae 100644
--- a/block/export/vduse-blk.c
+++ b/block/export/vduse-blk.c
@@ -316,12 +316,15 @@ static int vduse_blk_exp_create(BlockExport *exp, BlockExportOptions *opts,
 static void vduse_blk_exp_delete(BlockExport *exp)
 {
     VduseBlkExport *vblk_exp = container_of(exp, VduseBlkExport, export);
+    int ret;
 
     blk_remove_aio_context_notifier(exp->blk, blk_aio_attached, blk_aio_detach,
                                     vblk_exp);
     blk_set_dev_ops(exp->blk, NULL, NULL);
-    vduse_dev_destroy(vblk_exp->dev);
-    unlink(vblk_exp->recon_file);
+    ret = vduse_dev_destroy(vblk_exp->dev);
+    if (ret != -EBUSY) {
+        unlink(vblk_exp->recon_file);
+    }
     g_free(vblk_exp->recon_file);
 }
 
-- 
2.20.1



  parent reply	other threads:[~2022-06-13 12:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-13 12:44 [PATCH 0/5] Some fixes and improvements for vduse-blk Xie Yongji
2022-06-13 12:44 ` [PATCH 1/5] libvduse: Fix resources leak in vduse_dev_destroy() Xie Yongji
2022-06-13 12:45 ` Xie Yongji [this message]
2022-06-13 12:45 ` [PATCH 3/5] vduse-blk: Don't delete the export until all inflight I/Os completed Xie Yongji
2022-06-13 12:45 ` [PATCH 4/5] vduse-blk: Add serial option Xie Yongji
2022-06-13 12:45 ` [PATCH 5/5] vduse-blk: Add name option Xie Yongji

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=20220613124503.156-3-xieyongji@bytedance.com \
    --to=xieyongji@bytedance.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).