libmultipath: fix segfault when vector is null

While performing tests that caused paths to get added
and deleted, we hit a segfault. We traced it to the
vector struct being NULL. This patch fixes the problem
by checking for a NULL vector before accessing it.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
libmultipath: Invalid check for mpp->wwid in dm_addmap()

mpp->wwid is an array, and so a check against NULL
is wrong; we need to use strlen here.
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Remove newline from condlog()

condlog() already adds a newline to each message.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Fixup pathgroup allocation in disassemble_map()

The check for empty path groups in disassemble_map() is not quite
correct; we might end up removing the pathgroup vector even though
there are some entries in it.

Signed-off-by: Hannes Reinecke <hare@suse.de>
libmultipath: resource leak in read_value_block()

read_value_block() allocates the vector 'elements', but
doesn't free it on error.

Signed-off-by: Hannes Reinecke <hare@suse.de>
prio: fix merging of prioritizers with different args

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
Accept several whitespaces in bindings file

Prior versions of multipathd would accept several whitespaces
in the bindings file.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Add TAGS makefile target

Signed-off-by: Hannes Reinecke <hare@suse.de>
libmultipath: Fix typo in mp_prio_handler()

The mpentry is found in conf->mptable, not conf->hwtable.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Do not trigger a map reload on priority updates

update_path_groups() is just there to update the priority groups,
so it should trigger a table reload only if the priority has
indeed changed.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Introduce MP_FAST_IO_FAIL_UNSET

For completeness; all other special values are encoded with
defines, so 'unset' should be, too.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Checker name is not displayed on failure

If add_checker() isn't able to locate the checker
it won't display the name in free_checker().

Signed-off-by: Hannes Reinecke <hare@suse.de>
Valgrind fixes for prioritizer

Declaring an array does not zero out its contents. So we might
be reading random garbage here.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Incorrect inquiry vendor length in hds prioritizer

The inquiry vendor length is 8 bytes, but snprintf writes
the given number of bytes _including_ the NULL byte. So
we need to supply a 9 byte buffer here.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Print out multipath alias for flush_on_last_del messages

Added for consistency.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Clarify setting origin in propsel.c

We should differentiate between config file and internal default.
And the controller settings are not defaults.

Signed-off-by: Hannes Reinecke <hare@suse.de>
libmultipath: error checking in remove_features()

An error check was missing in remove_features().

Signed-off-by: Hannes Reinecke <hare@suse.de>
Increase parameter buffer

Multipath is using an internal static buffer for assembling
device-mapper tables, which might be too small for large setups.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Check return code from pathinfo()

Pathinfo might fail, which indicates that the path is not
available anymore. So check the return value and take
appropriate action.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Inconsistent string quoting

When printing the hardware table strings are quoted twice, and
even numerical values have single quotes. This patch removes
the double quotes and retains single quotes only for string
values.

Signed-off-by: Hannes Reinecke <hare@suse.de>