2 Star 0 Fork 91

yangshicheng / systemd

forked from src-openEuler / systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-udev-only-ignore-ENOENT-or-friends-which-suggest-the-block.patch 1.36 KB
一键复制 编辑 原始数据 按行查看 历史
From ef400c3878ad23aa02bd5bb47f089bdef49e9d8c Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Sat, 12 Mar 2022 20:40:58 +0900
Subject: [PATCH] udev: only ignore ENOENT or friends which suggest the block
device is not exist
The ENOENT, ENXIO, and ENODEV error can happen easily when a block
device appears and soon removed. So, it is reasonable to ignore the
error. But other errors should not occur here, and hence let's handle
them as critical.
Reference:https://github.com/systemd/systemd/commit/ef400c3878ad23aa02bd5bb47f089bdef49e9d8c
Conflict:NA
---
src/udev/udevd.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 8389c39f652f..f1f864a4610c 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -399,8 +399,10 @@ static int worker_lock_block_device(sd_device *dev, int *ret_fd) {
fd = open(val, O_RDONLY|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK);
if (fd < 0) {
- log_device_debug_errno(dev, errno, "Failed to open '%s', ignoring: %m", val);
- return 0;
+ bool ignore = ERRNO_IS_DEVICE_ABSENT(errno);
+
+ log_device_debug_errno(dev, errno, "Failed to open '%s'%s: %m", val, ignore ? ", ignoring" : "");
+ return ignore ? 0 : -errno;
}
if (flock(fd, LOCK_SH|LOCK_NB) < 0)
1
https://gitee.com/yangshicheng/systemd.git
git@gitee.com:yangshicheng/systemd.git
yangshicheng
systemd
systemd
master

搜索帮助