mirror of
https://github.com/systemd/systemd
synced 2024-07-21 10:17:21 +00:00
sleep: don't skip resume device with low priority/available space
this fixes hibernation when there's a higher priority swap preceding the resume swap in /proc/swaps. fixes #19486
This commit is contained in:
parent
105bb924a9
commit
936a7cb66a
|
@ -392,15 +392,17 @@ int find_hibernate_location(HibernateLocation **ret_hibernate_location) {
|
|||
}
|
||||
|
||||
/* prefer resume device or highest priority swap with most remaining space */
|
||||
if (hibernate_location && swap->priority < hibernate_location->swap->priority) {
|
||||
log_debug("%s: ignoring device with lower priority", swap->device);
|
||||
continue;
|
||||
}
|
||||
if (hibernate_location &&
|
||||
(swap->priority == hibernate_location->swap->priority
|
||||
&& swap->size - swap->used < hibernate_location->swap->size - hibernate_location->swap->used)) {
|
||||
log_debug("%s: ignoring device with lower usable space", swap->device);
|
||||
continue;
|
||||
if (sys_resume == 0) {
|
||||
if (hibernate_location && swap->priority < hibernate_location->swap->priority) {
|
||||
log_debug("%s: ignoring device with lower priority", swap->device);
|
||||
continue;
|
||||
}
|
||||
if (hibernate_location &&
|
||||
(swap->priority == hibernate_location->swap->priority
|
||||
&& swap->size - swap->used < hibernate_location->swap->size - hibernate_location->swap->used)) {
|
||||
log_debug("%s: ignoring device with lower usable space", swap->device);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
dev_t swap_device;
|
||||
|
|
Loading…
Reference in a new issue