device-mapper-multipath/0200-uevent_dispatch-use-while-in-wait-loop.patch
Benjamin Marzinski 51ade5ca63 device-mapper-multipath-0.8.7-43
Add 0198-multipathd-print-path-offline-message-even-without-a.patch
  * Fixes RHEL-133814 ("log_checker_err is not printing messages
    repeatedly for failed path [rhel-9]")
Add 0199-libmultipath-improve-cleanup-of-uevent-queues-on-exi.patch
Add 0200-uevent_dispatch-use-while-in-wait-loop.patch
Add 0201-libmultipath-uevent_dispatch-process-uevents-one-by-.patch
Add 0202-libmultipath-uevent_listen-don-t-delay-uevents.patch
Add 0203-libmultipath-uevent-use-struct-to-pass-parameters-ar.patch
Add 0204-libmultipath-is_uevent_busy-check-servicing_uev-unde.patch
Add 0205-multipathd-make-multipathd-show-status-busy-checker-.patch
  * Fixes RHEL-135904 (VM reboot in RHOSP environment fails with error
    "Could not open '/dev/dm-95': No such file or directory")
Resolves: RHEL-133814
Resolves: RHEL-135904
2026-01-23 00:57:37 -05:00

39 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 29 Mar 2022 16:06:25 +0200
Subject: [PATCH] uevent_dispatch(): use while in wait loop
Callers of pthread_cond_wait() should generally use a while loop
to test the condition. Also, remove the misleading comment.
Condition variables aren't unreliable, they're just not strictly
tied to the condition tested.
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/uevent.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c
index 80941f87..e3ec1ac1 100644
--- a/libmultipath/uevent.c
+++ b/libmultipath/uevent.c
@@ -445,13 +445,10 @@ int uevent_dispatch(int (*uev_trigger)(struct uevent *, void * trigger_data),
pthread_cleanup_push(cleanup_mutex, uevq_lockp);
pthread_mutex_lock(uevq_lockp);
servicing_uev = 0;
- /*
- * Condition signals are unreliable,
- * so make sure we only wait if we have to.
- */
- if (list_empty(&uevq)) {
+
+ while (list_empty(&uevq))
pthread_cond_wait(uev_condp, uevq_lockp);
- }
+
servicing_uev = 1;
list_splice_init(&uevq, &uevq_tmp);
pthread_cleanup_pop(1);