Skip to content

Commit

Permalink
core: Do not check child freezability when thawing slice
Browse files Browse the repository at this point in the history
We want thawing operations to still succeed even in the presence of an
unfreezable unit type (e.g. mount) appearing under a slice after the
slice was frozen. The appearance of such units should never cause the
slice thawing operation to fail to prevent potential future repeats of
systemd/systemd#25356.

(cherry picked from commit b458659)
  • Loading branch information
msizanoen1 authored and keszybz committed May 31, 2023
1 parent 077c4b0 commit 242ee3f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/slice.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ static int slice_freezer_action(Unit *s, FreezerAction action) {
assert(s);
assert(IN_SET(action, FREEZER_FREEZE, FREEZER_THAW));

if (!slice_freezer_action_supported_by_children(s)) {
if (action == FREEZER_FREEZE && !slice_freezer_action_supported_by_children(s)) {
log_unit_warning(s, "Requested freezer operation is not supported by all children of the slice");
return 0;
}
Expand All @@ -386,8 +386,11 @@ static int slice_freezer_action(Unit *s, FreezerAction action) {

if (action == FREEZER_FREEZE)
r = UNIT_VTABLE(member)->freeze(member);
else
else if (UNIT_VTABLE(member)->thaw)
r = UNIT_VTABLE(member)->thaw(member);
else
/* Thawing is requested but no corresponding method is available, ignore. */
r = 0;
if (r < 0)
return r;
}
Expand Down

0 comments on commit 242ee3f

Please sign in to comment.