Skip to content

Commit 2651806

Browse files
committed
block: Drop detached child from ignore list
bdrv_attach_child_common_abort() restores the parent's AioContext. To do so, the child (which was supposed to be attached, but is now detached again by this abort handler) is added to the ignore list for the AioContext changing functions. However, since we modify a BDS's children list in the BdrvChildClass's .attach and .detach handlers, the child is already effectively detached from the parent by this point. We do not need to put it into the ignore list. Use this opportunity to clean up the empty line structure: Keep setting the ignore list, invoking the AioContext function, and freeing the ignore list in blocks separated by empty lines. Signed-off-by: Hanna Reitz <[email protected]> Reviewed-by: Kevin Wolf <[email protected]> Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]> Message-Id: <[email protected]> Signed-off-by: Kevin Wolf <[email protected]> Message-Id: <[email protected]> Signed-off-by: Hanna Reitz <[email protected]>
1 parent 04c9c3a commit 2651806

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

block.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2774,14 +2774,16 @@ static void bdrv_attach_child_common_abort(void *opaque)
27742774
}
27752775

27762776
if (bdrv_child_get_parent_aio_context(child) != s->old_parent_ctx) {
2777-
GSList *ignore = g_slist_prepend(NULL, child);
2777+
GSList *ignore;
27782778

2779+
/* No need to ignore `child`, because it has been detached already */
2780+
ignore = NULL;
27792781
child->klass->can_set_aio_ctx(child, s->old_parent_ctx, &ignore,
27802782
&error_abort);
27812783
g_slist_free(ignore);
2782-
ignore = g_slist_prepend(NULL, child);
2783-
child->klass->set_aio_ctx(child, s->old_parent_ctx, &ignore);
27842784

2785+
ignore = NULL;
2786+
child->klass->set_aio_ctx(child, s->old_parent_ctx, &ignore);
27852787
g_slist_free(ignore);
27862788
}
27872789

0 commit comments

Comments
 (0)