1 Star 0 Fork 98

Mingtai/systemd

forked from src-openEuler/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-sleep-don-t-skip-resume-device-with-low-priority-ava.patch 2.38 KB
一键复制 编辑 原始数据 按行查看 历史
From 20c776c5e92201e01d4bfbea4ecbc4df758bcf09 Mon Sep 17 00:00:00 2001
From: Egor <egor@opensrc.club>
Date: Sun, 3 Oct 2021 03:42:50 +0300
Subject: [PATCH] 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
(cherry picked from commit 936a7cb66a0b423e75ceef87f02537067ad17002)
Conflict:NA
Reference:https://github.com/systemd/systemd/commit/20c776c5e92201e01d4bfbea4ecbc4df758bcf09
---
src/shared/sleep-config.c | 20 +++++++++++---------
1 file 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;
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yangmingtaip/systemd.git
git@gitee.com:yangmingtaip/systemd.git
yangmingtaip
systemd
systemd
master

搜索帮助