From b4ad8b418f65e8fbe8719344415758e6e62602f6 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Wed, 2 Jun 2021 19:10:49 +0900
Subject: [PATCH] udev: ignore the case that the device is already removed

See #19788.

(cherry picked from commit 6be1feb1d7e30c0e7591121b74d4c3c7079de6b3)

Conflict:NA
Reference:https://github.com/systemd/systemd-stable/commit/b4ad8b418f65e8fbe8719344415758e6e62602f6
---
 src/udev/udev-builtin-blkid.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/udev/udev-builtin-blkid.c b/src/udev/udev-builtin-blkid.c
index 2daafb1150..cfb74b9cf8 100644
--- a/src/udev/udev-builtin-blkid.c
+++ b/src/udev/udev-builtin-blkid.c
@@ -298,8 +298,11 @@ static int builtin_blkid(sd_device *dev, int argc, char *argv[], bool test) {
                 return log_device_debug_errno(dev, r, "Failed to get device name: %m");
 
         fd = open(devnode, O_RDONLY|O_CLOEXEC|O_NONBLOCK);
-        if (fd < 0)
-                return log_device_debug_errno(dev, errno, "Failed to open block device %s: %m", devnode);
+        if (fd < 0) {
+                log_device_debug_errno(dev, errno, "Failed to open block device %s%s: %m",
+                                       devnode, errno == ENOENT ? ", ignoring" : "");
+                return errno == ENOENT ? 0 : -errno;
+        }
 
         errno = 0;
         r = blkid_probe_set_device(pr, fd, offset, 0);
-- 
2.27.0

