From 7ed8309747a2947ff1ea0f4149e0501f1eb81271 Mon Sep 17 00:00:00 2001
From: gaoyi <gaoyi15@huawei.com>
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

