Skip to content

Commit d901bfa

Browse files
msizanoen1bluca
authored andcommitted
core: Do not check child freezability when thawing slice
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) (cherry picked from commit ac380e4)
1 parent d2208e4 commit d901bfa

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/core/slice.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ static int slice_freezer_action(Unit *s, FreezerAction action) {
375375
assert(s);
376376
assert(IN_SET(action, FREEZER_FREEZE, FREEZER_THAW));
377377

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

387387
if (action == FREEZER_FREEZE)
388388
r = UNIT_VTABLE(member)->freeze(member);
389-
else
389+
else if (UNIT_VTABLE(member)->thaw)
390390
r = UNIT_VTABLE(member)->thaw(member);
391+
else
392+
/* Thawing is requested but no corresponding method is available, ignore. */
393+
r = 0;
391394
if (r < 0)
392395
return r;
393396
}

0 commit comments

Comments
 (0)