[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 17/29] block/export: Add blk_exp_close_all(_type)
From: |
Max Reitz |
Subject: |
Re: [PATCH 17/29] block/export: Add blk_exp_close_all(_type) |
Date: |
Thu, 10 Sep 2020 15:22:53 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 |
On 07.09.20 20:19, Kevin Wolf wrote:
> This adds a function to shut down all block exports, and another one to
> shut down the block exports of a single type. The latter is used for now
> when stopping the NBD server. As soon as we implement support for
> multiple NBD servers, we'll need a per-server list of exports and it
> will be replaced by a function using that.
>
> As a side effect, the BlockExport layer has a list tracking all existing
> exports now. closed_exports loses its only user and can go away.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> include/block/export.h | 15 ++++++++
> include/block/nbd.h | 2 --
> block.c | 2 +-
> block/export/export.c | 79 ++++++++++++++++++++++++++++++++++++++++--
> blockdev-nbd.c | 2 +-
> nbd/server.c | 34 +++---------------
> qemu-nbd.c | 2 +-
> 7 files changed, 100 insertions(+), 36 deletions(-)
[...]
> /* Callers must hold exp->ctx lock */
> void blk_exp_unref(BlockExport *exp)
> {
> assert(exp->refcount > 0);
> if (--exp->refcount == 0) {
> - exp->drv->delete(exp);
> - g_free(exp);
> + /* Touch the block_exports list only in the main thread */
> + aio_bh_schedule_oneshot(qemu_get_aio_context(), blk_exp_delete_bh,
> + exp);
Looks safe.
Reviewed-by: Max Reitz <mreitz@redhat.com>
(The effort of special-casing this to delete the export immediately if
we already run in the main thread doesn’t look worth it.)
signature.asc
Description: OpenPGP digital signature
- [PATCH 11/29] qemu-nbd: Use blk_exp_add() to create the export, (continued)
- [PATCH 11/29] qemu-nbd: Use blk_exp_add() to create the export, Kevin Wolf, 2020/09/07
- [PATCH 12/29] nbd/server: Simplify export shutdown, Kevin Wolf, 2020/09/07
- [PATCH 13/29] block/export: Move refcount from NBDExport to BlockExport, Kevin Wolf, 2020/09/07
- [PATCH 14/29] block/export: Move AioContext from NBDExport to BlockExport, Kevin Wolf, 2020/09/07
- [PATCH 16/29] block/export: Allocate BlockExport in blk_exp_add(), Kevin Wolf, 2020/09/07
- [PATCH 15/29] block/export: Add node-name to BlockExportOptions, Kevin Wolf, 2020/09/07
- [PATCH 17/29] block/export: Add blk_exp_close_all(_type), Kevin Wolf, 2020/09/07
- Re: [PATCH 17/29] block/export: Add blk_exp_close_all(_type),
Max Reitz <=
- [PATCH 19/29] block/export: Move strong user reference to block_exports, Kevin Wolf, 2020/09/07
- [PATCH 20/29] block/export: Add block-export-del, Kevin Wolf, 2020/09/07
- [PATCH 18/29] block/export: Add 'id' option to block-export-add, Kevin Wolf, 2020/09/07
- [PATCH 21/29] block/export: Add BLOCK_EXPORT_DELETED event, Kevin Wolf, 2020/09/07