nbd/server.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
exp->common.blk cannot be NULL, nbd_export_delete() is only called from
blk_exp_unref() and in turn that can only happen after blk_exp_add()
has asserted exp->blk != NULL.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
nbd/server.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/nbd/server.c b/nbd/server.c
index 4305d4f0edf3..cb41b56095ee 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -1847,15 +1847,13 @@ static void nbd_export_delete(BlockExport *blk_exp)
g_free(exp->description);
exp->description = NULL;
- if (exp->common.blk) {
- if (exp->eject_notifier_blk) {
- notifier_remove(&exp->eject_notifier);
- blk_unref(exp->eject_notifier_blk);
- }
- blk_remove_aio_context_notifier(exp->common.blk, blk_aio_attached,
- blk_aio_detach, exp);
- blk_set_disable_request_queuing(exp->common.blk, false);
+ if (exp->eject_notifier_blk) {
+ notifier_remove(&exp->eject_notifier);
+ blk_unref(exp->eject_notifier_blk);
}
+ blk_remove_aio_context_notifier(exp->common.blk, blk_aio_attached,
+ blk_aio_detach, exp);
+ blk_set_disable_request_queuing(exp->common.blk, false);
for (i = 0; i < exp->nr_export_bitmaps; i++) {
bdrv_dirty_bitmap_set_busy(exp->export_bitmaps[i], false);
--
2.39.2
On Wed, Apr 05, 2023 at 12:16:34PM +0200, Paolo Bonzini wrote: > exp->common.blk cannot be NULL, nbd_export_delete() is only called from > blk_exp_unref() and in turn that can only happen after blk_exp_add() > has asserted exp->blk != NULL. Commit message is a bit imprecise (maybe due to refactoring in the meantime?): drv->delete is only called from blk_exp_delete_bh(), but that in turn is indeed only called from blk_exp_unref(), so the logic is sound. > > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> > --- > nbd/server.c | 14 ++++++-------- > 1 file changed, 6 insertions(+), 8 deletions(-) Reviewed-by: Eric Blake <eblake@redhat.com> As this is only removal of a useless conditional, it can wait for 8.1. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
On Wed, Apr 05, 2023 at 07:54:50AM -0500, Eric Blake wrote: > On Wed, Apr 05, 2023 at 12:16:34PM +0200, Paolo Bonzini wrote: > > exp->common.blk cannot be NULL, nbd_export_delete() is only called from > > blk_exp_unref() and in turn that can only happen after blk_exp_add() > > has asserted exp->blk != NULL. > > Commit message is a bit imprecise (maybe due to refactoring in the > meantime?): drv->delete is only called from blk_exp_delete_bh(), but > that in turn is indeed only called from blk_exp_unref(), so the logic > is sound. > > > > > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> > > --- > > nbd/server.c | 14 ++++++-------- > > 1 file changed, 6 insertions(+), 8 deletions(-) > > Reviewed-by: Eric Blake <eblake@redhat.com> > > As this is only removal of a useless conditional, it can wait for 8.1. Thanks; queued on my NBD tree for a pull request this week. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
© 2016 - 2024 Red Hat, Inc.