device-mapper-multipath/0060-UP-uevent-loop-udev.patch
Benjamin Marzinski aba856f28c device-mapper-multipath-0.4.9-55
Modify 0015-RH-fix-output-buffer.patch
  * Fix memory leak
Add 0048-RH-print-defaults.patch
Add 0049-RH-remove-ID_FS_TYPE.patch
  * remove ID_FS_TYPE udev enviroment variable for multipath devices
Add 0051-UP-fix-cli-resize.patch
  * check before dereferencing variables
Add 0052-RH-fix-bad-derefs.patch
  * setup multipath free the multipath device when it fails, so don't keep
    using it.
Add 0053-UP-fix-failback.patch
  * setting failback in the devices section was broken
Add 0054-UP-keep-udev-ref.patch
  * multipathd needs to keep the same udev object across reconfigures
Add 0055-UP-handle-quiesced-paths.patch
  * quiesced paths should be treated as down
Add 0056-UP-alua-prio-fix.patch
  * Don't count the preferred bit for paths that are active/optimized
Add 0057-UP-fix-tmo.patch
  * Cleanup how multipath sets dev_loss_tmo and fast_io_fail_tmo.  Also
    make multipath get changing values directly from sysfs, instead of
    from udev, which caches them.
Add 0058-UP-fix-failback.patch
  * make failback print the default value when you show configs.
Add 0059-UP-flush-failure-queueing.patch
  * If you can't flush a multipath device, restore the queue_if_no_paths
    value
Add 0060-UP-uevent-loop-udev.patch
  * make ueventloop grab it's own udev reference, since it is cancelled
    asychnrously.
2013-07-25 10:15:48 -05:00

128 lines
3.7 KiB
Diff

---
libmultipath/uevent.c | 17 ++++++++++++-----
libmultipath/uevent.h | 4 +++-
multipathd/main.c | 8 +++++---
3 files changed, 20 insertions(+), 9 deletions(-)
Index: multipath-tools-130222/libmultipath/uevent.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/uevent.c
+++ multipath-tools-130222/libmultipath/uevent.c
@@ -47,7 +47,6 @@
#include "list.h"
#include "uevent.h"
#include "vector.h"
-#include "config.h"
typedef int (uev_trigger)(struct uevent *, void * trigger_data);
@@ -127,11 +126,14 @@ service_uevq(struct list_head *tmpq)
static void uevq_stop(void *arg)
{
+ struct udev *udev = arg;
+
condlog(3, "Stopping uev queue");
pthread_mutex_lock(uevq_lockp);
my_uev_trigger = NULL;
pthread_cond_signal(uev_condp);
pthread_mutex_unlock(uevq_lockp);
+ udev_unref(udev);
}
void
@@ -399,9 +401,9 @@ exit:
return 1;
}
-int uevent_listen(void)
+int uevent_listen(struct udev *udev)
{
- int err;
+ int err = 2;
struct udev_monitor *monitor = NULL;
int fd, socket_flags;
int need_failback = 1;
@@ -411,9 +413,14 @@ int uevent_listen(void)
* thereby not getting to empty the socket's receive buffer queue
* often enough.
*/
- pthread_cleanup_push(uevq_stop, NULL);
+ if (!udev) {
+ condlog(1, "no udev context");
+ return 1;
+ }
+ udev_ref(udev);
+ pthread_cleanup_push(uevq_stop, udev);
- monitor = udev_monitor_new_from_netlink(conf->udev, "udev");
+ monitor = udev_monitor_new_from_netlink(udev, "udev");
if (!monitor) {
condlog(2, "failed to create udev monitor");
goto out;
Index: multipath-tools-130222/libmultipath/uevent.h
===================================================================
--- multipath-tools-130222.orig/libmultipath/uevent.h
+++ multipath-tools-130222/libmultipath/uevent.h
@@ -13,6 +13,8 @@
#define NETLINK_KOBJECT_UEVENT 15
#endif
+struct udev;
+
struct uevent {
struct list_head node;
struct udev_device *udev;
@@ -27,7 +29,7 @@ struct uevent {
int is_uevent_busy(void);
void setup_thread_attr(pthread_attr_t *attr, size_t stacksize, int detached);
-int uevent_listen(void);
+int uevent_listen(struct udev *udev);
int uevent_dispatch(int (*store_uev)(struct uevent *, void * trigger_data),
void * trigger_data);
int uevent_get_major(struct uevent *uev);
Index: multipath-tools-130222/multipathd/main.c
===================================================================
--- multipath-tools-130222.orig/multipathd/main.c
+++ multipath-tools-130222/multipathd/main.c
@@ -840,7 +840,7 @@ out:
static void *
ueventloop (void * ap)
{
- if (uevent_listen())
+ if (uevent_listen(udev))
condlog(0, "error starting uevent listener");
return NULL;
@@ -1593,7 +1593,7 @@ static int
child (void * param)
{
pthread_t check_thr, uevent_thr, uxlsnr_thr, uevq_thr;
- pthread_attr_t log_attr, misc_attr;
+ pthread_attr_t log_attr, misc_attr, uevent_attr;
struct vectors * vecs;
struct multipath * mpp;
int i;
@@ -1606,6 +1606,7 @@ child (void * param)
udev = udev_new();
setup_thread_attr(&misc_attr, 64 * 1024, 1);
+ setup_thread_attr(&uevent_attr, 128 * 1024, 1);
setup_thread_attr(&waiter_attr, 32 * 1024, 1);
if (logsink) {
@@ -1671,10 +1672,11 @@ child (void * param)
/*
* Start uevent listener early to catch events
*/
- if ((rc = pthread_create(&uevent_thr, &misc_attr, ueventloop, vecs))) {
+ if ((rc = pthread_create(&uevent_thr, &uevent_attr, ueventloop, udev))) {
condlog(0, "failed to create uevent thread: %d", rc);
exit(1);
}
+ pthread_attr_destroy(&uevent_attr);
if ((rc = pthread_create(&uxlsnr_thr, &misc_attr, uxlsnrloop, vecs))) {
condlog(0, "failed to create cli listener: %d", rc);
exit(1);