[PATCH 3/3] multipathd: stop waiter in __setup_multipath

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



__setup_multipath can remove a multipath device from multipathd, and it
can be called by either by the waiter thread or another thread.
Previously, it dealt with this by never stopping the waiter thread.  It
simply relied on the waiter thread to notice and stop itself.  Now, when
called by another thread, it explicitly stops the waiter thread.

Signed-off-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx>
---
 multipathd/main.c   | 2 +-
 multipathd/waiter.c | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/multipathd/main.c b/multipathd/main.c
index 70aff5d..3ae0442 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -398,7 +398,7 @@ int __setup_multipath(struct vectors *vecs, struct multipath *mpp,
 
 	return 0;
 out:
-	remove_map(mpp, vecs, PURGE_VEC);
+	remove_map_and_stop_waiter(mpp, vecs, PURGE_VEC);
 	return 1;
 }
 
diff --git a/multipathd/waiter.c b/multipathd/waiter.c
index c70ad21..595c69a 100644
--- a/multipathd/waiter.c
+++ b/multipathd/waiter.c
@@ -57,6 +57,11 @@ void stop_waiter_thread (struct multipath *mpp, struct vectors *vecs)
 			mpp->alias);
 		return;
 	}
+	/* Don't cancel yourself. __setup_multipath is called by
+	   by the waiter thread, and may remove a multipath device */
+	if (pthread_equal(mpp->waiter, pthread_self()))
+		return;
+
 	condlog(2, "%s: stop event checker thread (%lu)", mpp->alias,
 		mpp->waiter);
 	thread = mpp->waiter;
-- 
2.7.4

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel



[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux