]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
hibernate-resume: use devnode_same to compare device nodes 28344/head
authorMike Yuan <me@yhndnzj.com>
Mon, 10 Jul 2023 13:04:49 +0000 (21:04 +0800)
committerMike Yuan <me@yhndnzj.com>
Tue, 11 Jul 2023 10:04:22 +0000 (18:04 +0800)
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

src/hibernate-resume/hibernate-resume-generator.c

index b6d3d257ac699de4758ec74ddc0eed2a1ab340ee..23c1a0a3c8a32d1bb883c11ecd95e22e1dcd7d02 100644 (file)
@@ -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=.",