summaryrefslogtreecommitdiff
path: root/src/shared/sleep-config.c
diff options
context:
space:
mode:
authorEgor <egor@opensrc.club>2021-10-03 03:42:50 +0300
committerLennart Poettering <lennart@poettering.net>2021-10-04 10:23:42 +0200
commit936a7cb66a0b423e75ceef87f02537067ad17002 (patch)
treed1f8409fc9d588f3568f9bc79052bf937ce6ec61 /src/shared/sleep-config.c
parent105bb924a98c52276862e758dc83c3d5b4ed6203 (diff)
downloadsystemd-936a7cb66a0b423e75ceef87f02537067ad17002.tar.gz
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
Diffstat (limited to 'src/shared/sleep-config.c')
-rw-r--r--src/shared/sleep-config.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index dbaecb3a0f..8ec3d09a58 100644
--- a/src/shared/sleep-config.c
+++ b/src/shared/sleep-config.c
@@ -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;