[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 3/6] vduse-blk: Don't unlink the reconnect file if device exis
From: |
Xie Yongji |
Subject: |
[PATCH v2 3/6] vduse-blk: Don't unlink the reconnect file if device exists |
Date: |
Tue, 14 Jun 2022 13:15:29 +0800 |
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
- [PATCH v2 0/6] Some fixes and improvements for vduse-blk, Xie Yongji, 2022/06/14
- [PATCH v2 1/6] libvduse: Fix some compile errors with clang, Xie Yongji, 2022/06/14
- [PATCH v2 2/6] libvduse: Fix resources leak in vduse_dev_destroy(), Xie Yongji, 2022/06/14
- [PATCH v2 3/6] vduse-blk: Don't unlink the reconnect file if device exists,
Xie Yongji <=
- [PATCH v2 4/6] vduse-blk: Don't delete the export until all inflight I/Os completed, Xie Yongji, 2022/06/14
- [PATCH v2 5/6] vduse-blk: Add serial option, Xie Yongji, 2022/06/14
- [PATCH v2 6/6] vduse-blk: Add name option, Xie Yongji, 2022/06/14