[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH 12/22] nbd/server: Simplify export shutdown
From: |
Max Reitz |
Subject: |
Re: [RFC PATCH 12/22] nbd/server: Simplify export shutdown |
Date: |
Mon, 17 Aug 2020 16:32:12 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
On 13.08.20 18:29, Kevin Wolf wrote:
> Closing export is somewhat convoluted because nbd_export_close() and
> nbd_export_put() call each other and the ways they actually end up being
> nested is not necessarily obvious.
>
> However, it is not really necessary to call nbd_export_close() from
> nbd_export_put() when putting the last reference because it only does
> three things:
>
> 1. Close all clients. We're going to refcount 0 and all clients hold a
> reference, so we know there is no active client any more.
>
> 2. Close the user reference (represented by exp->name being non-NULL).
> The same argument applies: If the export were still named, we would
> still have a reference.
>
> 3. Freeing exp->description. This is really cleanup work to be done when
> the export is finally freed. There is no reason to already clear it
> while clients are still in the process of shutting down.
Convincing.
> So after moving the cleanup of exp->description, the code can be
> simplified so that only nbd_export_close() calls nbd_export_put(), but
> never the other way around.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> nbd/server.c | 17 ++++-------------
> 1 file changed, 4 insertions(+), 13 deletions(-)
Reviewed-by: Max Reitz <mreitz@redhat.com>
signature.asc
Description: OpenPGP digital signature
Re: [RFC PATCH 09/22] nbd: Add writethrough to block-export-add, Eric Blake, 2020/08/19
[RFC PATCH 12/22] nbd/server: Simplify export shutdown, Kevin Wolf, 2020/08/13