richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
ac3a84
From 2edd56af85a0360df8bc49a6ee19e0f1051a2d68 Mon Sep 17 00:00:00 2001
ac3a84
From: Yu Watanabe <watanabe.yu+github@gmail.com>
ac3a84
Date: Fri, 11 Nov 2022 09:34:17 +0900
ac3a84
Subject: [PATCH] find-esp: downgrade and ignore error on retrieving
ac3a84
 PART_ENTRY_SCHEME when searching
ac3a84
ac3a84
Fixes #25332.
ac3a84
ac3a84
(cherry picked from commit 01f234c6f5672926d6cfe4fbfcdb48326ce06250)
ac3a84
ac3a84
Related: #2138081
ac3a84
---
ac3a84
 src/shared/find-esp.c | 14 ++++++++++----
ac3a84
 1 file changed, 10 insertions(+), 4 deletions(-)
ac3a84
ac3a84
diff --git a/src/shared/find-esp.c b/src/shared/find-esp.c
ac3a84
index dfe0574aba..aa0b02cc2f 100644
ac3a84
--- a/src/shared/find-esp.c
ac3a84
+++ b/src/shared/find-esp.c
ac3a84
@@ -177,7 +177,9 @@ static int verify_esp_udev(
ac3a84
 
ac3a84
         r = sd_device_get_property_value(d, "ID_PART_ENTRY_SCHEME", &v);
ac3a84
         if (r < 0)
ac3a84
-                return log_error_errno(r, "Failed to get device property: %m");
ac3a84
+                return log_full_errno(searching && r == -ENOENT ? LOG_DEBUG : LOG_ERR,
ac3a84
+                                      searching && r == -ENOENT ? SYNTHETIC_ERRNO(EADDRNOTAVAIL) : r,
ac3a84
+                                      "Failed to get device property: %m");
ac3a84
         if (!streq(v, "gpt"))
ac3a84
                 return log_full_errno(searching ? LOG_DEBUG : LOG_ERR,
ac3a84
                                       SYNTHETIC_ERRNO(searching ? EADDRNOTAVAIL : ENODEV),
ac3a84
@@ -572,10 +574,11 @@ static int verify_xbootldr_blkid(
ac3a84
         else if (r != 0)
ac3a84
                 return log_error_errno(errno ?: SYNTHETIC_ERRNO(EIO), "%s: Failed to probe file system: %m", node);
ac3a84
 
ac3a84
-        errno = 0;
ac3a84
         r = blkid_probe_lookup_value(b, "PART_ENTRY_SCHEME", &type, NULL);
ac3a84
         if (r != 0)
ac3a84
-                return log_error_errno(errno ?: SYNTHETIC_ERRNO(EIO), "%s: Failed to probe PART_ENTRY_SCHEME: %m", node);
ac3a84
+                return log_full_errno(searching ? LOG_DEBUG : LOG_ERR,
ac3a84
+                                      searching ? SYNTHETIC_ERRNO(EADDRNOTAVAIL) : SYNTHETIC_ERRNO(EIO),
ac3a84
+                                      "%s: Failed to probe PART_ENTRY_SCHEME: %m", node);
ac3a84
         if (streq(type, "gpt")) {
ac3a84
 
ac3a84
                 errno = 0;
ac3a84
@@ -638,7 +641,10 @@ static int verify_xbootldr_udev(
ac3a84
 
ac3a84
         r = sd_device_get_property_value(d, "ID_PART_ENTRY_SCHEME", &type);
ac3a84
         if (r < 0)
ac3a84
-                return log_device_error_errno(d, r, "Failed to query ID_PART_ENTRY_SCHEME: %m");
ac3a84
+                return log_device_full_errno(d,
ac3a84
+                                             searching && r == -ENOENT ? LOG_DEBUG : LOG_ERR,
ac3a84
+                                             searching && r == -ENOENT ? SYNTHETIC_ERRNO(EADDRNOTAVAIL) : r,
ac3a84
+                                             "Failed to query ID_PART_ENTRY_SCHEME: %m");
ac3a84
 
ac3a84
         if (streq(type, "gpt")) {
ac3a84