File multipath-tools-fixup-multibus-zero-path-handling of Package multipath-tools

From d6e2e5a35418a624cabcd792257508f18bd7725b Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 24 Feb 2009 14:13:56 +0100
Subject: [PATCH] Fixup multibus zero-path handling

The 'multibus' pgpolicy function currently always adds a pathgroup,
even when no paths are present. This confuses setup_map() which
doesn't expect this behaviour.

References: 476330

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 libmultipath/pgpolicies.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/libmultipath/pgpolicies.c b/libmultipath/pgpolicies.c
index 0c7eee8..cfaf1c3 100644
--- a/libmultipath/pgpolicies.c
+++ b/libmultipath/pgpolicies.c
@@ -251,17 +251,19 @@ one_group (struct multipath * mp)	/* aka multibus */
 	if (!mp->pg)
 		return 1;
 
-	pgp = alloc_pathgroup();
+	if (VECTOR_SIZE(mp->paths) > 0) {
+		pgp = alloc_pathgroup();
 
-	if (!pgp)
-		goto out;
+		if (!pgp)
+			goto out;
 
-	vector_free(pgp->paths);
-	pgp->paths = mp->paths;
-	mp->paths = NULL;
+		vector_free(pgp->paths);
+		pgp->paths = mp->paths;
+		mp->paths = NULL;
 
-	if (store_pathgroup(mp->pg, pgp))
-		goto out;
+		if (store_pathgroup(mp->pg, pgp))
+			goto out;
+	}
 
 	return 0;
 out:
-- 
1.6.0.2

openSUSE Build Service is sponsored by