[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 19/29] block/export: Move strong user reference to block_expo
From: |
Max Reitz |
Subject: |
Re: [PATCH 19/29] block/export: Move strong user reference to block_exports |
Date: |
Thu, 10 Sep 2020 15:33:35 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 |
On 07.09.20 20:20, Kevin Wolf wrote:
> The reference owned by the user/monitor that is created when adding the
> export and dropped when removing it was tied to the 'exports' list in
> nbd/server.c. Every block export will have a user reference, so move it
> to the block export level and tie it to the 'block_exports' list in
> block/export/export.c instead. This is necessary for introducing a QMP
> command for removing exports.
>
> Note that exports are present in block_exports even after the user has
> requested shutdown. This is different from NBD's exports where exports
> are immediately removed on a shutdown request, even if they are still in
> the process of shutting down. In order to avoid that the user still
> interacts with an export that is shutting down (and possibly removes it
> a second time), we need to remember if the user actually still owns it.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> include/block/export.h | 8 ++++++++
> block/export/export.c | 6 ++++++
> blockdev-nbd.c | 5 -----
> nbd/server.c | 2 --
> 4 files changed, 14 insertions(+), 7 deletions(-)
Reviewed-by: Max Reitz <mreitz@redhat.com>
> diff --git a/include/block/export.h b/include/block/export.h
> index cdc6e161ea..4833947e89 100644
> --- a/include/block/export.h
> +++ b/include/block/export.h
> @@ -60,6 +60,14 @@ struct BlockExport {
> */
> int refcount;
>
> + /*
> + * True if one of the references in refcount belongs to the user. After
> the
> + * user has dropped their reference, they may not e.g. remove the same
> + * export a second time (which would decrease the refcount without having
> + * it incremented first).
Not sure though whether this (or the request_shutdown documentation)
should mention that request_shutdown drops the user reference.
Max
> + */
> + bool user_owned;
> +
signature.asc
Description: OpenPGP digital signature
- [PATCH 17/29] block/export: Add blk_exp_close_all(_type), (continued)
- [PATCH 17/29] block/export: Add blk_exp_close_all(_type), Kevin Wolf, 2020/09/07
- [PATCH 15/29] block/export: Add node-name to BlockExportOptions, Kevin Wolf, 2020/09/07
- [PATCH 16/29] block/export: Allocate BlockExport in blk_exp_add(), Kevin Wolf, 2020/09/07
- [PATCH 18/29] block/export: Add 'id' option to block-export-add, Kevin Wolf, 2020/09/07
- [PATCH 22/29] block/export: Move blk to BlockExport, Kevin Wolf, 2020/09/07
- [PATCH 19/29] block/export: Move strong user reference to block_exports, Kevin Wolf, 2020/09/07
- Re: [PATCH 19/29] block/export: Move strong user reference to block_exports,
Max Reitz <=
- [PATCH 21/29] block/export: Add BLOCK_EXPORT_DELETED event, Kevin Wolf, 2020/09/07
- [PATCH 20/29] block/export: Add block-export-del, Kevin Wolf, 2020/09/07
- [PATCH 23/29] block/export: Create BlockBackend in blk_exp_add(), Kevin Wolf, 2020/09/07
- [PATCH 24/29] block/export: Add query-block-exports, Kevin Wolf, 2020/09/07