From d5bc38ae27ef0e204c6c5a37b432cd91b0e7cef1 Mon Sep 17 00:00:00 2001 From: xujing Date: Tue, 12 Apr 2022 14:48:19 +0800 Subject: [PATCH] print the real reason for link update (cherry picked from commit 18658f18e3f08121f506ec0ba4127ed03a9c25e7) --- ...rint-the-real-reason-for-link-update.patch | 39 +++++++++++++++++++ systemd.spec | 6 ++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 0027-print-the-real-reason-for-link-update.patch diff --git a/0027-print-the-real-reason-for-link-update.patch b/0027-print-the-real-reason-for-link-update.patch new file mode 100644 index 0000000..7028773 --- /dev/null +++ b/0027-print-the-real-reason-for-link-update.patch @@ -0,0 +1,39 @@ +From 7ed8309747a2947ff1ea0f4149e0501f1eb81271 Mon Sep 17 00:00:00 2001 +From: gaoyi +Date: Tue, 20 Jul 2021 15:09:28 +0800 +Subject: [PATCH] print the real reason for link update + +reduce retries to improve performance and print the real +reaseon when the max retries reached +--- + src/udev/udev-node.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c +index 9e52906..8b7996d 100644 +--- a/src/udev/udev-node.c ++++ b/src/udev/udev-node.c +@@ -29,7 +29,7 @@ + #include "user-util.h" + + #define CREATE_LINK_MAX_RETRIES 128 +-#define LINK_UPDATE_MAX_RETRIES 128 ++#define LINK_UPDATE_MAX_RETRIES 4 + #define TOUCH_FILE_MAX_RETRIES 128 + #define UDEV_NODE_HASH_KEY SD_ID128_MAKE(b9,6a,f1,ce,40,31,44,1a,9e,19,ec,8b,ae,f3,e3,2f) + +@@ -353,7 +353,10 @@ static int link_update(sd_device *dev, const char *slink_in, bool add) { + } + } + +- return i < LINK_UPDATE_MAX_RETRIES ? 0 : -ELOOP; ++ if (i >= LINK_UPDATE_MAX_RETRIES) ++ log_device_debug(dev, "Exceeded max retries for link update"); ++ ++ return 0; + } + + int udev_node_update_old_links(sd_device *dev, sd_device *dev_old) { +-- +2.27.0 + diff --git a/systemd.spec b/systemd.spec index c149012..e2aed26 100644 --- a/systemd.spec +++ b/systemd.spec @@ -20,7 +20,7 @@ Name: systemd Url: https://www.freedesktop.org/wiki/Software/systemd Version: 249 -Release: 23 +Release: 24 License: MIT and LGPLv2+ and GPLv2+ Summary: System and Service Manager @@ -72,6 +72,7 @@ Patch0023: 0023-delay-to-restart-when-a-service-can-not-be-auto-restarted.p Patch0024: 0024-disable-initialize_clock.patch Patch0025: 0025-systemd-solve-that-rsyslog-reads-journal-s-object-of.patch Patch0026: 0026-check-whether-command_prev-is-null-before-assigning-.patch +Patch0027: 0027-print-the-real-reason-for-link-update.patch #backport Patch6000: backport-core-fix-free-undefined-pointer-when-strdup-failed-i.patch @@ -1503,6 +1504,9 @@ fi %{_libdir}/security/pam_systemd.so %changelog +* Tue Apr 12 2022 xujing - 249-24 +- print the real reason for link update + * Tue Apr 12 2022 xujing - 249-23 - check whether command_prev is null before assigning value