Blame SOURCES/0188-RHBZ-1368501-dont-exit.patch

4ae388
---
4ae388
 libmultipath/configure.c |    8 +++--
4ae388
 multipathd/main.c        |   68 +++++++++++++++++++++++++++++++++++++----------
4ae388
 2 files changed, 59 insertions(+), 17 deletions(-)
4ae388
4ae388
Index: multipath-tools-130222/libmultipath/configure.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/configure.c
4ae388
+++ multipath-tools-130222/libmultipath/configure.c
4ae388
@@ -829,8 +829,10 @@ coalesce_paths (struct vectors * vecs, v
4ae388
 		 * at this point, we know we really got a new mp
4ae388
 		 */
4ae388
 		mpp = add_map_with_path(vecs, pp1, 0);
4ae388
-		if (!mpp)
4ae388
-			return 1;
4ae388
+		if (!mpp) {
4ae388
+			orphan_path(pp1);
4ae388
+			continue;
4ae388
+		}
4ae388
 
4ae388
 		if (pp1->priority == PRIO_UNDEF)
4ae388
 			mpp->action = ACT_REJECT;
4ae388
@@ -879,7 +881,7 @@ coalesce_paths (struct vectors * vecs, v
4ae388
 			condlog(3, "%s: domap (%u) failure "
4ae388
 				   "for create/reload map",
4ae388
 				mpp->alias, r);
4ae388
-			if (r == DOMAP_FAIL) {
4ae388
+			if (r == DOMAP_FAIL || conf->daemon) {
4ae388
 				condlog(2, "%s: %s map",
4ae388
 					mpp->alias, (mpp->action == ACT_CREATE)?
4ae388
 					"ignoring" : "removing");
4ae388
Index: multipath-tools-130222/multipathd/main.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/multipathd/main.c
4ae388
+++ multipath-tools-130222/multipathd/main.c
4ae388
@@ -821,7 +821,7 @@ map_discovery (struct vectors * vecs)
4ae388
 
4ae388
 	vector_foreach_slot (vecs->mpvec, mpp, i)
4ae388
 		if (setup_multipath(vecs, mpp))
4ae388
-			return 1;
4ae388
+			i--;
4ae388
 
4ae388
 	return 0;
4ae388
 }
4ae388
@@ -1523,21 +1523,29 @@ configure (struct vectors * vecs, int st
4ae388
 	vector mpvec;
4ae388
 	int i, ret;
4ae388
 
4ae388
-	if (!vecs->pathvec && !(vecs->pathvec = vector_alloc()))
4ae388
+	if (!vecs->pathvec && !(vecs->pathvec = vector_alloc())) {
4ae388
+		condlog(0, "couldn't allocate path vec in configure");
4ae388
 		return 1;
4ae388
+	}
4ae388
 
4ae388
-	if (!vecs->mpvec && !(vecs->mpvec = vector_alloc()))
4ae388
+	if (!vecs->mpvec && !(vecs->mpvec = vector_alloc())) {
4ae388
+		condlog(0, "couldn't allocate multipath vec in configure");
4ae388
 		return 1;
4ae388
+	}
4ae388
 
4ae388
-	if (!(mpvec = vector_alloc()))
4ae388
+	if (!(mpvec = vector_alloc())) {
4ae388
+		condlog(0, "couldn't allocate new maps vec in configure");
4ae388
 		return 1;
4ae388
+	}
4ae388
 
4ae388
 	/*
4ae388
 	 * probe for current path (from sysfs) and map (from dm) sets
4ae388
 	 */
4ae388
 	ret = path_discovery(vecs->pathvec, conf, DI_ALL);
4ae388
-	if (ret < 0)
4ae388
+	if (ret < 0) {
4ae388
+		condlog(0, "configure failed at path discovery");
4ae388
 		return 1;
4ae388
+	}
4ae388
 
4ae388
 	vector_foreach_slot (vecs->pathvec, pp, i){
4ae388
 		if (filter_path(conf, pp) > 0){
4ae388
@@ -1548,21 +1556,27 @@ configure (struct vectors * vecs, int st
4ae388
 		else
4ae388
 			pp->checkint = conf->checkint;
4ae388
 	}
4ae388
-	if (map_discovery(vecs))
4ae388
+	if (map_discovery(vecs)) {
4ae388
+		condlog(0, "configure failed at map discovery");
4ae388
 		return 1;
4ae388
+	}
4ae388
 
4ae388
 	/*
4ae388
 	 * create new set of maps & push changed ones into dm
4ae388
 	 */
4ae388
-	if (coalesce_paths(vecs, mpvec, NULL, 1))
4ae388
+	if (coalesce_paths(vecs, mpvec, NULL, 1)) {
4ae388
+		condlog(0, "configure failed while coalescing paths");
4ae388
 		return 1;
4ae388
+	}
4ae388
 
4ae388
 	/*
4ae388
 	 * may need to remove some maps which are no longer relevant
4ae388
 	 * e.g., due to blacklist changes in conf file
4ae388
 	 */
4ae388
-	if (coalesce_maps(vecs, mpvec))
4ae388
+	if (coalesce_maps(vecs, mpvec)) {
4ae388
+		condlog(0, "configure failed while coalescing maps");
4ae388
 		return 1;
4ae388
+	}
4ae388
 
4ae388
 	dm_lib_release();
4ae388
 
4ae388
@@ -1588,11 +1602,15 @@ configure (struct vectors * vecs, int st
4ae388
 	 * start dm event waiter threads for these new maps
4ae388
 	 */
4ae388
 	vector_foreach_slot(vecs->mpvec, mpp, i) {
4ae388
-		if (setup_multipath(vecs, mpp))
4ae388
-			return 1;
4ae388
+		if (setup_multipath(vecs, mpp)) {
4ae388
+			i--;
4ae388
+			continue;
4ae388
+		}
4ae388
 		if (start_waiters)
4ae388
-			if (start_waiter_thread(mpp, vecs))
4ae388
-				return 1;
4ae388
+			if (start_waiter_thread(mpp, vecs)) {
4ae388
+				remove_map(mpp, vecs, 1);
4ae388
+				i--;
4ae388
+			}
4ae388
 	}
4ae388
 	return 0;
4ae388
 }
4ae388
@@ -1857,15 +1875,23 @@ child (void * param)
4ae388
 	condlog(2, "--------start up--------");
4ae388
 	condlog(2, "read " DEFAULT_CONFIGFILE);
4ae388
 
4ae388
-	if (load_config(DEFAULT_CONFIGFILE, udev))
4ae388
+	if (load_config(DEFAULT_CONFIGFILE, udev)) {
4ae388
+		condlog(0, "failed to load config");
4ae388
+		if (logsink)
4ae388
+			log_thread_stop();
4ae388
 		exit(1);
4ae388
+	}
4ae388
 
4ae388
 	if (init_checkers()) {
4ae388
 		condlog(0, "failed to initialize checkers");
4ae388
+		if (logsink)
4ae388
+			log_thread_stop();
4ae388
 		exit(1);
4ae388
 	}
4ae388
 	if (init_prio()) {
4ae388
 		condlog(0, "failed to initialize prioritizers");
4ae388
+		if (logsink)
4ae388
+			log_thread_stop();
4ae388
 		exit(1);
4ae388
 	}
4ae388
 
4ae388
@@ -1898,8 +1924,12 @@ child (void * param)
4ae388
 	}
4ae388
 
4ae388
 	vecs = gvecs = init_vecs();
4ae388
-	if (!vecs)
4ae388
+	if (!vecs) {
4ae388
+		condlog(0, "failed to create vecs");
4ae388
+		if (logsink)
4ae388
+			log_thread_stop();
4ae388
 		exit(1);
4ae388
+	}
4ae388
 
4ae388
 	setscheduler();
4ae388
 	set_oom_adj();
4ae388
@@ -1911,11 +1941,15 @@ child (void * param)
4ae388
 	 */
4ae388
 	if ((rc = pthread_create(&uevent_thr, &uevent_attr, ueventloop, udev))) {
4ae388
 		condlog(0, "failed to create uevent thread: %d", rc);
4ae388
+		if (logsink)
4ae388
+			log_thread_stop();
4ae388
 		exit(1);
4ae388
 	}
4ae388
 	pthread_attr_destroy(&uevent_attr);
4ae388
 	if ((rc = pthread_create(&uxlsnr_thr, &misc_attr, uxlsnrloop, vecs))) {
4ae388
 		condlog(0, "failed to create cli listener: %d", rc);
4ae388
+		if (logsink)
4ae388
+			log_thread_stop();
4ae388
 		exit(1);
4ae388
 	}
4ae388
 	/*
4ae388
@@ -1927,6 +1961,8 @@ child (void * param)
4ae388
 	if (configure(vecs, 1)) {
4ae388
 		unlock(vecs->lock);
4ae388
 		condlog(0, "failure during configuration");
4ae388
+		if (logsink)
4ae388
+			log_thread_stop();
4ae388
 		exit(1);
4ae388
 	}
4ae388
 	unlock(vecs->lock);
4ae388
@@ -1936,10 +1972,14 @@ child (void * param)
4ae388
 	 */
4ae388
 	if ((rc = pthread_create(&check_thr, &misc_attr, checkerloop, vecs))) {
4ae388
 		condlog(0,"failed to create checker loop thread: %d", rc);
4ae388
+		if (logsink)
4ae388
+			log_thread_stop();
4ae388
 		exit(1);
4ae388
 	}
4ae388
 	if ((rc = pthread_create(&uevq_thr, &misc_attr, uevqloop, vecs))) {
4ae388
 		condlog(0, "failed to create uevent dispatcher: %d", rc);
4ae388
+		if (logsink)
4ae388
+			log_thread_stop();
4ae388
 		exit(1);
4ae388
 	}
4ae388
 	pthread_attr_destroy(&misc_attr);