|
|
4eda52 |
From 13293ddc7822025cb9f785262655f928634395f6 Mon Sep 17 00:00:00 2001
|
|
|
4295f9 |
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
|
|
4295f9 |
Date: Sun, 12 Sep 2021 16:05:51 +0900
|
|
|
4295f9 |
Subject: [PATCH] udev-node: simplify the example of race
|
|
|
4295f9 |
|
|
|
4295f9 |
(cherry picked from commit 3df566a66723490914ef3bae0ca8046044b70dce)
|
|
|
4295f9 |
|
|
|
4eda52 |
Related: #2005024
|
|
|
4295f9 |
---
|
|
|
4295f9 |
src/udev/udev-node.c | 10 +++++-----
|
|
|
4295f9 |
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
|
4295f9 |
|
|
|
4295f9 |
diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c
|
|
|
4295f9 |
index bb551d86b0..61cb9a449b 100644
|
|
|
4295f9 |
--- a/src/udev/udev-node.c
|
|
|
4295f9 |
+++ b/src/udev/udev-node.c
|
|
|
4295f9 |
@@ -272,14 +272,14 @@ static int update_timestamp(sd_device *dev, const char *path, struct stat *prev)
|
|
|
4295f9 |
|
|
|
4295f9 |
/* Even if a symlink in the stack directory is created/removed, the mtime of the directory may
|
|
|
4295f9 |
* not be changed. Why? Let's consider the following situation. For simplicity, let's assume
|
|
|
4295f9 |
- * there exist three udev workers (A, B, and C) and all of them calls link_update() for the
|
|
|
4295f9 |
- * same devlink simultaneously.
|
|
|
4295f9 |
+ * there exist two udev workers (A and B) and all of them calls link_update() for the same
|
|
|
4295f9 |
+ * devlink simultaneously.
|
|
|
4295f9 |
*
|
|
|
4295f9 |
- * 1. B creates/removes a symlink in the stack directory.
|
|
|
4295f9 |
+ * 1. A creates/removes a symlink in the stack directory.
|
|
|
4295f9 |
* 2. A calls the first stat() in the loop of link_update().
|
|
|
4295f9 |
* 3. A calls link_find_prioritized().
|
|
|
4295f9 |
- * 4. C creates/removes another symlink in the stack directory, so the result of the step 3 is outdated.
|
|
|
4295f9 |
- * 5. B and C finish link_update().
|
|
|
4295f9 |
+ * 4. B creates/removes another symlink in the stack directory, so the result of the step 3 is outdated.
|
|
|
4295f9 |
+ * 5. B finishes link_update().
|
|
|
4295f9 |
* 6. A creates/removes devlink according to the outdated result in the step 3.
|
|
|
4295f9 |
* 7. A calls the second stat() in the loop of link_update().
|
|
|
4295f9 |
*
|