multipath: revert fstack-protector-strong gcc option

In my "enable gcc format-security check" (9b7741c) commit, I changed
fstack-protector to fstack-protector-strong. This new option only exists
in gcc 4.9, which is relatively new.  This patch reverts to the
fstack-protector option for now, until gcc 4.9 has been around for longer.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Tested-by: Sebastian Herbszt <herbszt@gmx.de>
ALUA prioritizer: Remove an unused variable

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
libmultipath: Simplify read_line()

Let read_line() zero-terminate the buffer it returns such that its
callers do not have to clear that buffer before calling read_line().

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
libmultipath: Zero-terminate sysfs_attr_get_value() result

The callers of sysfs_attr_get_value() expect a '\0'-terminated string.
Hence terminate the string returned by this function with '\0'. Detected
by Valgrind.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
libmultipath: Print line number for which parsing failed

Make it easier to figure out which line contains a syntax error
by printing the line number and the offending line itself.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
libmultipath: Accept "*" as a valid regular expression

Inside libmultipath regcomp() is used to compile regular expressions
specified in /etc/multipath.conf. Many multipath.conf examples contain
'product_type "*"'. However, "*" is not a valid POSIX regular expression.
Hence this patch that changes the regular expression "*" into ".*".

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
multipath: Wrong sysfs attribute used for iSCSI settings.

Wrong sysfs parameter used to configure iSCSI settings.

/sys/class/iscsi_session/session<n>/tgtname
It's always
/sys/class/iscsi_session/session<n>/targetname

This is the reason recovery_tmo was not getting set to
fast_io_fail_tmo value for iscsi sessions.

Signed-off-by: Shiva Krishna Merla<shivakrishna.merla@netapp.com>
multipath: add option '-i' to ignore wwids file

When called from udev the multipath program is used to check
if a device should be handled by multipath. Any new device,
however, will not be present in /etc/multipath/wwids, and
the check will always fail.
This patch implements the option '-i' to multipath to skip
checking the wwids file for these scenarios.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Make multipathd orphan paths that were removed externally

Multipathd was only orphaning paths that it removed, not ones that were
removed by the multipath command.  This could cause problems if a path
was failed but not removed, and "multipath -r" was run.  multipath would
remove the path, and when multipathd updated itself, it would remove
that path from the multipath device's path list, but not orphan it.
When the path became active again, multipathd crashed trying to adjust
the pathgroups of the multipath device it had previously belonged to.

This patch makes sure that whenever multipathd updates the multipath device
table, it first makes sure the mpp->paths is uptodate.  Once it has
finished updating the device table, it orphans any paths in mpp->paths
that are no longer part of the multipath device.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
orphan paths on failed add

When multipathd tries to add a path but fails doing the table reload, it
wasn't orphaning the path.  This can cause problems later if multipathd
tries to switch the pathgroup of this path which isn't actually part of
the multipath device.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Improve multipath.conf syntax checking

multipath's parser for multipath.conf is neither very verbose or forgiving
about errors.  This patch improves both.  multipath will now warn about
obviously missing quotes and curly braces, but will still do the right thing.
It will also give more verbose error messages including a line number when
it can't parse a line.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
make prioritizers use checker_timeout, if set

The multipath prioritizers can get stuck issuing scsi commands that
don't return quickly, just like the checkers. So if checker_timeout
is set, the prioritizers should should it for their cmd timeouts as
well.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Add multipath.conf force_sync option

Normally multipathd runs the path checkers asynchronously. However if there
are a lot of paths, this can cause large CPU spikes (for instance, in
cases where they are all competing for the Big Kernel Lock). In these
situations, overall machine performance is better if multipath doesn't have
hundreds or even thousands of path checkers running at the same time. This
patch lets users turn off the asynchronous mode of these checks if they
see this problem.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>