fix(sleep): follow-ups for hibernate-util device handling#70
Conversation
sleep: don't log duplicate error when write_resume_config() fails as it already logs the error on its own. hibernate-util: make sure we use blockdev path for HibernationDevice.path. Before this, the field could spuriously contain the path of the swapfile instead of the block device. hibernate-util: remove unused code in write_resume_config() where device could be NULL, as all callers now pass non-NULL device. Changes: - Add debian/patches/fix-sleep-hibernation-device-follow-ups.patch - Modify debian/patches/series - Modify debian/changelog Upstream: systemd/systemd#30641 Generated-By: glm-5-turbo Co-Authored-By: deepin-ci-robot <packages@deepin.org>
|
TAG Bot TAG: 255.2-4deepin37 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Patch 1/3 — 修复 swapfile 场景下的设备路径 当休眠使用的是 swapfile(而非swap 分区)时,HibernationDevice.path 之前存的是 swapfile 的文件路径(如 /swapfile),而写入 /sys/power/resume 需要的是底层块设备路径(如 /dev/sda)。补丁在 swapfile 场景下调用 device_path_make_canonical() 将 devno 转换成正确的块设备路径。 Patch 2/3 — 清理 write_resume_config 的冗余代码 Patch 1/3 已经确保传入的 device 参数始终是块设备路径,所以 write_resume_config 里if (!device) 的兜底逻辑不再需要,删掉。同时修复了一个格式化字符串 bug:原来用 %" PRIu64 " 打印 offset(整数),改为打印已格式化好的 offset_str(字符串),错误日志更准确。 Patch 3/3 — 去掉重复的错误日志 write_resume_config() 内部已经会记录错误,调用处再log_error_errno 一次会导致同一个错误打印两遍,删掉外层的重复日志。 对系统的实际影响:使用 swapfile 休眠时,内核/sys/power/resume 能收到正确的块设备路径,休眠恢复才能正常工作;之前可能因路径错误导致唤醒失败。 |
Summary
Backport upstream PR systemd/systemd#30641 with follow-up fixes for hibernate-util:
write_resume_config()already logs the error on its own, so remove the duplicatelog_error_errno()call in the caller.pathfield could spuriously contain the swapfile path instead of the block device path. Now correctly resolves the blockdev path when using a swapfile.write_resume_config()now pass non-NULL device, so the NULL fallback code path is removed.Changes
debian/patches/fix-sleep-hibernation-device-follow-ups.patchdebian/patches/seriesdebian/changelogUpstream
9e7cd6bed14a,fe33920c2aee,66b9956082f4,6e819bd2bd86