systemd/0368-sd-event-drop-inotify-event-from-buffer-when-no-even.patch
Jan Macku ee560ada81 systemd-257-12
Resolves: RHEL-100553,RHEL-103354,RHEL-104555,RHEL-106260,RHEL-44419,RHEL-72701,RHEL-79976,RHEL-97625,RHEL-97762
2025-08-13 13:54:24 +02:00

38 lines
1.3 KiB
Diff

From ba15d9e3ef0a9f076c8f7f0dff01ea79013eb138 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Sun, 20 Jul 2025 02:12:00 +0900
Subject: [PATCH] sd-event: drop inotify event from buffer when no event source
is triggered
Even when we receive an inotify event, there is no relevant event source
exists. In that case, we need to drop the event from the buffer,
otherwise we cannot escape from the loop.
Fixes #38265.
(cherry picked from commit 064b9b2bb3544707171662f548677259c3d6aa7f)
Resolves: RHEL-104555
---
src/libsystemd/sd-event/sd-event.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index 7aea7d2581..f5a38b31d1 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -4023,9 +4023,12 @@ static int event_inotify_data_process(sd_event *e, struct inotify_data *d) {
}
}
- /* Something pending now? If so, let's finish, otherwise let's read more. */
+ /* Something pending now? If so, let's finish. */
if (d->n_pending > 0)
return 1;
+
+ /* otherwise, drop the event and let's read more */
+ event_inotify_data_drop(e, d, sz);
}
return 0;