summaryrefslogtreecommitdiff
path: root/libmultipath/structs_vec.c
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2008-11-21 14:20:34 +0100
committerChristophe Varoqui <christophe.varoqui@free.fr>2009-04-22 00:46:47 +0200
commited5f5a7a49e1efb452255ff114a27ec5169fa6a2 (patch)
treed9a2c9dc8841c5a3e0e7f47239160d7cf6ea19ac /libmultipath/structs_vec.c
parent1e5332642c96f44b43e6daa6c1b71077b43d2f0a (diff)
downloadmultipath-tools-ed5f5a7a49e1efb452255ff114a27ec5169fa6a2.tar.gz
multipath-tools-ed5f5a7a49e1efb452255ff114a27ec5169fa6a2.tar.bz2
multipath-tools-ed5f5a7a49e1efb452255ff114a27ec5169fa6a2.zip
multipathd crashes in update_multipath()
For an all-paths-down scenario we can have an mpp with no paths attached. So check for it. Signed-off-by: Hannes Reinecke <hare@suse.de>
Diffstat (limited to 'libmultipath/structs_vec.c')
-rw-r--r--libmultipath/structs_vec.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 11ec58e..e27827c 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -163,6 +163,9 @@ _remove_maps (struct vectors * vecs, int stop_waiter)
int i;
struct multipath * mpp;
+ if (!vecs->mpvec)
+ return;
+
vector_foreach_slot (vecs->mpvec, mpp, i) {
_remove_map(mpp, vecs, stop_waiter, 1);
i--;
@@ -440,6 +443,9 @@ verify_paths(struct multipath * mpp, struct vectors * vecs, vector rpvec)
int count = 0;
int i, j;
+ if (!mpp->paths)
+ return 0;
+
vector_foreach_slot (mpp->paths, pp, i) {
/*
* see if path is in sysfs
@@ -485,6 +491,9 @@ int update_multipath (struct vectors *vecs, char *mapname)
if (setup_multipath(vecs, mpp))
return 1; /* mpp freed in setup_multipath */
+ if (!mpp->pg)
+ return 0; /* Can happen when all paths are down */
+
/*
* compare checkers states with DM states
*/