multipath: Allow whitespace before or after exit and quit command in multipathd

This problem is reported by IBM internal test team.

In multipathd interactive mode, commands allow preceding and appending
whitespace while quit and exit do not. If we have whitespace before or
after quit|exit command, multipathd won't recognize exit and quit
command and exit the interactive mode.

This patch provide support whitespace in the quit and exit command.

Signed-off-by: Zheng Huai Cheng <zhenghch@linux.vnet.ibm.com>
multipathd: revert mpp size update if map update fails

If updating the dm device in the kernel fails we cannot leave
the mpp size updated, because if we correct the problem and
try to resize later multipathd prevents resizing the device
of the size has not changed.

I hit this when all paths to a dm-multipath device where not
yet updated but multipathd resize was run.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
libmultipath/discovery.c: Fix a condition that will lead to a table reload during every check.

If path_offline says PATH_UP and the checker says PATH_DOWN.  In
this case, pathinfo gets called twice, and the first call, from
update_prio sets it to -1 because the checker says it's down.  On the
second pathinfo call, from update_path_groups, it will call the
prioritizer based on the fact that the prio is -1. This leads to a flip
flop of the priority value and a reload on every check.

Signed-off-by: Sean Stewart <sean.stewart@netapp.com>
libmultipath/checkers/rdac.c: Use RTPG data in RDAC checker

Make the RDAC checker utilize the RTPG data given in the 0xC9 inquiry
page to make intelligent decisions about path status, and print more
descriptive path down messages.

Signed-off-by: Sean Stewart <sean.stewart@netapp.com>
Improve logging for orphan_path()

orphan_path() is called from various sections, so add a
description to the call to aid debugging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Set priority to '0' for PATH_BLOCKED or PATH_DOWN

When a path is down or blocked we need to initialize the priority
to '0'. Otherwise multipathd will discard the maps during reload
and fail to start if all paths are temporarily down.

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

The final comparison was wrong; 'size' was never decreased.

Signed-off-by: Hannes Reinecke <hare@suse.de>
libmultipath: return error numbers from sysfs_get_XXX

Instead of returning hand-crafted error values from sysfs_get_XXX
functions we should be using the standard error numbers.

Signed-off-by: Hannes Reinecke <hare@suse.de>
libmultipath: do not stall on recv_packet()

The CLI socket might have been closed or the daemon might have
been terminated by systemd without closing the CLI socket.
Hence we need to poll the socket if further data is avalailable,
otherwise the read() call will hang.

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