From: Mike Yuan Date: Mon, 10 Jul 2023 13:04:49 +0000 (+0800) Subject: hibernate-resume: use devnode_same to compare device nodes X-Git-Tag: v254-rc2~38^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F28344%2Fhead;p=thirdparty%2Fsystemd.git hibernate-resume: use devnode_same to compare device nodes Addresses https://github.com/systemd/systemd/pull/28321#discussion_r1257866179 When devnode_same() fails we only debug log about it, because the device nodes might not have appeared by the time the generator is run. Fixes #28340 --- diff --git a/src/hibernate-resume/hibernate-resume-generator.c b/src/hibernate-resume/hibernate-resume-generator.c index b6d3d257ac6..23c1a0a3c8a 100644 --- a/src/hibernate-resume/hibernate-resume-generator.c +++ b/src/hibernate-resume/hibernate-resume-generator.c @@ -8,6 +8,7 @@ #include "sd-id128.h" #include "alloc-util.h" +#include "device-nodes.h" #include "dropin.h" #include "efivars.h" #include "fd-util.h" @@ -170,9 +171,16 @@ static int parse_efi_hibernate_location(void) { arg_resume_device = TAKE_PTR(device); arg_resume_offset = location.offset; } else { - if (!path_equal_or_inode_same(arg_resume_device, device, 0)) - log_warning("resume=%s doesn't match with HibernateLocation device '%s', proceeding anyway with resume=.", - arg_resume_device, device); + if (!path_equal(arg_resume_device, device)) { + r = devnode_same(arg_resume_device, device); + if (r < 0) + log_debug_errno(r, + "Failed to check if resume=%s is the same device as HibernateLocation device '%s', ignoring: %m", + arg_resume_device, device); + if (r == 0) + log_warning("resume=%s doesn't match with HibernateLocation device '%s', proceeding anyway with resume=.", + arg_resume_device, device); + } if (arg_resume_offset != location.offset) log_warning("resume_offset=%" PRIu64 " doesn't match with HibernateLocation offset %" PRIu64 ", proceeding anyway with resume_offset=.",