teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame SOURCES/0135-homed-handle-EINTR-gracefully-when-waiting-for-devic.patch

2aacef
From b546d82758e0149fd235d2ff8f9c4fdc8d0bd29c Mon Sep 17 00:00:00 2001
2aacef
From: Lennart Poettering <lennart@poettering.net>
2aacef
Date: Tue, 22 Nov 2022 12:55:10 +0100
2aacef
Subject: [PATCH] homed: handle EINTR gracefully when waiting for device node
2aacef
2aacef
(cherry picked from commit f3d9278f38f0a9e03ed29215f27d8ca21c1fa6a1)
2aacef
2aacef
Related: #2137584
2aacef
---
2aacef
 src/home/homework-luks.c | 7 +++++--
2aacef
 1 file changed, 5 insertions(+), 2 deletions(-)
2aacef
2aacef
diff --git a/src/home/homework-luks.c b/src/home/homework-luks.c
2aacef
index 97fb5a1051..5e1d5bbd65 100644
2aacef
--- a/src/home/homework-luks.c
2aacef
+++ b/src/home/homework-luks.c
2aacef
@@ -2017,9 +2017,12 @@ static int wait_for_devlink(const char *path) {
2aacef
                 if (w >= until)
2aacef
                         return log_error_errno(SYNTHETIC_ERRNO(ETIMEDOUT), "Device link %s still hasn't shown up, giving up.", path);
2aacef
 
2aacef
-                r = fd_wait_for_event(inotify_fd, POLLIN, usec_sub_unsigned(until, w));
2aacef
-                if (r < 0)
2aacef
+                r = fd_wait_for_event(inotify_fd, POLLIN, until - w);
2aacef
+                if (r < 0) {
2aacef
+                        if (ERRNO_IS_TRANSIENT(r))
2aacef
+                                continue;
2aacef
                         return log_error_errno(r, "Failed to watch inotify: %m");
2aacef
+                }
2aacef
 
2aacef
                 (void) flush_fd(inotify_fd);
2aacef
         }