Update hwtable for EMC XtremIO

References: bnc#880510

Signed-off-by: Hannes Reinecke <hare@suse.de>
check info.exists to get valid value

dm_task_get_info will still return 1 if device doesn't exist.
Check info.exists to ensure major and minor values are valid.

There is no reason to assign info.open_count to @r here.

Signed-off-by: Vaughan Cao <vaughan.cao@oracle.com>
Don't forget to reload table when both reload and rename is required

We encounter the following case:

@ After adding a multipaths section into /etc/multipath.conf to specify 'alias'
@ and other attributes for a particular multipath device and
@ reloading/restarting the multipathd service, only renaming of the multipath
@ device is done, other attribute changes are ignored.
@
@ It is more evident if you directly run 'multipath -r' to reload devmap after
@ adding the 'multipaths' section with alias into /etc/multipath.conf.
@
@ When reload/restart multipathd service or 'multipath -r' again, new settings
@ can be applied right.

It's because that in select_action() when force_reload is set, if we also need
rename the mpp device, reload action won't be taken any more.

I did this patch by introducing a new action ACT_RENAME2 to group these two
action. Test passed. However, it seems to be a rough patch and I am not
certain if this bind is fine refering to dm_reassign. Please comment, Thanks.

Signed-off-by: Vaughan Cao <vaughan.cao@oracle.com>
Fix memory issues in path reordering failure code paths

There were some possible NULL pointer dereferences and multiple frees
in the failure code paths of the path reordering code.  This patch
cleans them up.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Return the correct size buffer in set_value()

When multipath was mallocing the buffer in set_value, it was using
sizeof(char *), instead of sizeof(char), so it was allocating a buffer
big enough for an array of pointers instead of characters.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
enable gcc format-security check

-Wformat-security warns about format-strigs that represent possible
security problems.  This is check is now enabled for fedora builds, and it
seems like a reasonable thing to always be checking.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
change conf->dry_run to conf->cmd

conf->dry_run is getting used for many different things besides running
multipath in dry_run mode, and the name and values were getting
increasingly confusing.  This patch switches the variable from
conf->dry_run to conf->cmd, and folds in conf->list.  It also changes
the value to a enum.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
allow users to add wwids to /etc/multipath/wwids with -a

The patch adds a "-a" option to multipath, that allows it to add wwids
to the /etc/multipath wwids file.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Add missing interactive commands to multipathd man page

This patch adds the missing options from the multipathd.8 man page.  It
also fixes a typo in a log message from the alua prioritizer.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
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>