multipath-tools/.git
3 years agodmparser: use 'is_daemon' as argument for disassemble_map()
Hannes Reinecke [Mon, 6 Jun 2016 09:58:12 +0000 (11:58 +0200)]
dmparser: use 'is_daemon' as argument for disassemble_map()

Use 'is_daemon' as argument for disassemble_map() so that
dmparser.c doesn't need to access 'struct config' anymore.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agodevmapper: explicit config settings
Hannes Reinecke [Mon, 6 Jun 2016 09:52:42 +0000 (11:52 +0200)]
devmapper: explicit config settings

Rather than access 'conf' from within the code this patch moves
those settings to function arguments. So with this patch we don't
need to access 'struct config' anymore.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agoconfig: set 'deferred_remove' defaults at correct call
Hannes Reinecke [Mon, 6 Jun 2016 09:47:41 +0000 (11:47 +0200)]
config: set 'deferred_remove' defaults at correct call

We should be setting the defaults for 'deferred_remove' when
loading the configuration file, not when creating the hardware
entries.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agoUse 'mptable' as argument for find_mpe() and get_mpe_wwid()
Hannes Reinecke [Mon, 6 Jun 2016 09:41:39 +0000 (11:41 +0200)]
Use 'mptable' as argument for find_mpe() and get_mpe_wwid()

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agoRevert patch 'move filter_devnode() under vector lock'
Hannes Reinecke [Wed, 15 Jun 2016 07:02:13 +0000 (09:02 +0200)]
Revert patch 'move filter_devnode() under vector lock'

Patch was causing a segfault during booting and is being
replaced by the following series.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agomultipath-tools: fix up Apple controller family
Xose Vazquez Perez [Tue, 7 Jun 2016 17:54:23 +0000 (19:54 +0200)]
multipath-tools: fix up Apple controller family

Fix regex and delete space.

Cc: Shyam Sundar <g.shyamsundar@yahoo.co.in>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agoRemove duplicate Infinidat and Tegile hwtable entries
Christophe Varoqui [Mon, 20 Jun 2016 08:00:09 +0000 (10:00 +0200)]
Remove duplicate Infinidat and Tegile hwtable entries

3 years agoUpdate kpartx manpage with current output
Ritesh Raj Sarraf [Mon, 13 Jun 2016 08:40:47 +0000 (14:10 +0530)]
Update kpartx manpage with current output

See Debian Bug #796948 for details
Many users are reported to be consuming the output in a scripted setup

Signed-off-by: Ritesh Raj Sarraf <rrs@debian.org>
3 years agomultipath-tools: remove USER_FRIENDLY_NAMES_OFF
Xose Vazquez Perez [Fri, 17 Jun 2016 14:52:46 +0000 (16:52 +0200)]
multipath-tools: remove USER_FRIENDLY_NAMES_OFF

This is up to sysadmins, and it is already off by default.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: dm-devel list is only for subscribers
Xose Vazquez Perez [Fri, 17 Jun 2016 14:52:45 +0000 (16:52 +0200)]
multipath-tools: dm-devel list is only for subscribers

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: group ONTAP family
Xose Vazquez Perez [Fri, 17 Jun 2016 14:52:48 +0000 (16:52 +0200)]
multipath-tools: group ONTAP family

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: clean up comments at hwtable.c
Xose Vazquez Perez [Fri, 17 Jun 2016 14:52:47 +0000 (16:52 +0200)]
multipath-tools: clean up comments at hwtable.c

Remove redundant info and update company names.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: new email address for Srinivas Ramani
Xose Vazquez Perez [Fri, 17 Jun 2016 14:52:44 +0000 (16:52 +0200)]
multipath-tools: new email address for Srinivas Ramani

*This one needs a mandatory ACK from Srinivas Ramani*
Otherwise it must be removed.

Cc: Srinivas Ramani <srinivas.ramani@oracle.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: unreachable controllers maintainers
Xose Vazquez Perez [Fri, 17 Jun 2016 14:52:43 +0000 (16:52 +0200)]
multipath-tools: unreachable controllers maintainers

Delete 3 unreachable controllers maintainers, their emails are bounced.

Compellent Technologies, Inc.: Jim Lester <jim.lester@compellent.com>
NETAPP controller family: Dave Wysochanski <davidw@netapp.com>
IBM NSeries (NETAPP) controller family: Dave Wysochanski <davidw@netapp.com>

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: remove current maintainer from orphan array families.
Xose Vazquez Perez [Fri, 17 Jun 2016 14:52:42 +0000 (16:52 +0200)]
multipath-tools: remove current maintainer from orphan array families.

Redundant.

Cc: Hannes Reinecke <hare@suse.de>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: add TEGILE devices to hardware table
Xose Vazquez Perez [Fri, 17 Jun 2016 14:52:41 +0000 (16:52 +0200)]
multipath-tools: add TEGILE devices to hardware table

based on documentation provided by manufacturer:
http://pages.tegile.com/rs/568-BVY-995/images/Oracle%20BPG%201.0.pdf

vendor                  "TEGILE"
product                 "ZEBI-FC|INTELLIFLASH"
hardware_handler        "1 alua"
path_selector           "round- robin 0"
path_grouping_policy    "group_by_prio"
no_path_retry           10
dev_loss_tmo            50
path_checker            tur
prio                    alua
failback                30
rr_min_io               128

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: add INFINIDAT devices to hardware table
Xose Vazquez Perez [Fri, 17 Jun 2016 14:52:40 +0000 (16:52 +0200)]
multipath-tools: add INFINIDAT devices to hardware table

based on documentation provided by the manufacturer:
https://support.infinidat.com/hc/en-us/articles/202319222

  vendor "NFINIDAT"             <----- This is not a bug, it's _NFINIDAT_
  product "InfiniBox.*"
  prio alua
  path_grouping_policy group_by_prio
  path_checker tur
  path_selector "round-robin 0"
  features "0"
  failback 30
  rr_weight priorities
  no_path_retry fail
  rr_min_io 1    # for kernels up to 2.6.31
  rr_min_io_rq 1 # for kernels 2.6.31 or newer
  flush_on_last_del yes
  fast_io_fail_tmo 5
  dev_loss_tmo 30

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: add VIOLIN/CONCERTO ARRAY to hardware table
Xose Vazquez Perez [Fri, 17 Jun 2016 14:52:39 +0000 (16:52 +0200)]
multipath-tools: add VIOLIN/CONCERTO ARRAY to hardware table

based on documentation provided by manufacturer:
https://drive.google.com/open?id=0B_B6YmEmO7cDQlMzc1BsaUxZRVU

- Red Hat Enterprise Linux 7.x for Violin 7300
vendor "VIOLIN"
product "CONCERTO ARRAY"
path_selector "round-robin 0"
path_grouping_policy multibus
prio alua
path_checker tur
rr_min_io 100
rr_weight priorities
failback immediate
features "1 queue_if_no_path"
no_path_retry 300

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agoMerge branch 'coverity' of https://github.com/hreinecke/multipath-tools
Christophe Varoqui [Mon, 20 Jun 2016 06:44:01 +0000 (08:44 +0200)]
Merge branch 'coverity' of https://github.com/hreinecke/multipath-tools

3 years agomultipath-tools: add patchwork info to README
Xose Vazquez Perez [Wed, 15 Jun 2016 23:12:53 +0000 (01:12 +0200)]
multipath-tools: add patchwork info to README

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agoMultipath: Remove duplicated memset() for multipathd show command.
Gris Ge [Wed, 15 Jun 2016 14:50:38 +0000 (22:50 +0800)]
Multipath: Remove duplicated memset() for multipathd show command.

Problem:

 * The duplicated memset() wasted too much time. For example:
   with 5k paths, "sudo multipathd -k'show paths'" command will have
   at least 5k times of memset().

Reasons:

 * The memory passing to snprint_xxx(e.g. snprint_multipath) is already
   zeroed by MALLOC().

 * No need to zero memory before snprintf which will always terminate
   the string with '\0'.

Signed-off-by: Gris Ge <fge@redhat.com>
3 years agomultipath-tools: delete trailing spaces and tabs
Xose Vazquez Perez [Tue, 14 Jun 2016 20:59:34 +0000 (22:59 +0200)]
multipath-tools: delete trailing spaces and tabs

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: blacklist UX for RDAC arrays
Xose Vazquez Perez [Tue, 14 Jun 2016 20:59:35 +0000 (22:59 +0200)]
multipath-tools: blacklist UX for RDAC arrays

"Universal Xport" must be hidden for all RDAC arrays:
https://docs.oracle.com/cd/E19373-01/E24026/E24026-01.html
https://docs.oracle.com/cd/E19537-01/E24027/E24027-02.html

It was missing in: SUN STK6580_6780 and SUN_6180

Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: correct a syntax error in multipath.conf.5
Xose Vazquez Perez [Tue, 14 Jun 2016 17:52:50 +0000 (19:52 +0200)]
multipath-tools: correct a syntax error in multipath.conf.5

$ groff -z -b -wall ./multipath/multipath.conf.5
./multipath/multipath.conf.5:519: warning: macro `timeout' not defined (possibly missing space after `ti')

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: change checker in RDAC devices with the native
Xose Vazquez Perez [Mon, 13 Jun 2016 17:02:20 +0000 (19:02 +0200)]
multipath-tools: change checker in RDAC devices with the native

Replace TUR checker with RDAC for:
"OPENstorage D280"
"STK6580_6780"

I don't know if it's a bug or feature, but for all other RDAC devices
"hwhandler" "checker" and "prio" are rdac.

*This patch needs an explicit ACK from Hannes and Christophe*

Cc: Hannes Reinecke <hare@suse.de>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: add INFINIDAT devices to hardware table
Xose Vazquez Perez [Mon, 13 Jun 2016 22:46:56 +0000 (00:46 +0200)]
multipath-tools: add INFINIDAT devices to hardware table

based on documentation provided by the manufacturer:
https://support.infinidat.com/hc/en-us/articles/202319222

  vendor "NFINIDAT"             <----- This is not a bug, it's _NFINIDAT_
  product "InfiniBox.*"
  prio alua
  path_grouping_policy group_by_prio
  path_checker tur
  path_selector "round-robin 0"
  features "0"
  failback 30
  rr_weight priorities
  no_path_retry fail
  rr_min_io 1    # for kernels up to 2.6.31
  rr_min_io_rq 1 # for kernels 2.6.31 or newer
  flush_on_last_del yes
  fast_io_fail_tmo 5
  dev_loss_tmo 30

Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: add TEGILE devices to hardware table
Xose Vazquez Perez [Mon, 13 Jun 2016 14:38:50 +0000 (16:38 +0200)]
multipath-tools: add TEGILE devices to hardware table

based on documentation provided by manufacturer:
http://pages.tegile.com/rs/568-BVY-995/images/Oracle%20BPG%201.0.pdf

vendor                  "TEGILE"
product                 "ZEBI-FC|INTELLIFLASH"
hardware_handler        "1 alua"
path_selector           "round- robin 0"
path_grouping_policy    "group_by_prio"
no_path_retry           10
dev_loss_tmo            50
path_checker            tur
prio                    alua
failback                30
rr_min_io               128

Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: housekeeping at prioritizers
Xose Vazquez Perez [Sat, 11 Jun 2016 22:14:41 +0000 (00:14 +0200)]
multipath-tools: housekeeping at prioritizers

add PRIO_IET to libmultipath/prio.h and sort them alphabetically.

"datacore" and "iet" are missing in multipath.conf.5 !!!

Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agolibmultipath/discovery.c: Fixup possible range overflow
Hannes Reinecke [Thu, 16 Jun 2016 07:09:00 +0000 (09:09 +0200)]
libmultipath/discovery.c: Fixup possible range overflow

When checking the maximum value for dev_loss_tmo we need to
use a larger type, otherwise the comparison will always be false.
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath/devmapper.c: fixup possible buffer overflow
Hannes Reinecke [Thu, 16 Jun 2016 06:09:38 +0000 (08:09 +0200)]
libmultipath/devmapper.c: fixup possible buffer overflow

Fixup possible buffer overflow in dm_reassign_table().
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath: add spin_lock in tur.c
Hannes Reinecke [Wed, 15 Jun 2016 11:37:45 +0000 (13:37 +0200)]
libmultipath: add spin_lock in tur.c

When failing to start the pthread we still should be taking
the spin lock; there might be other threads pending.
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath: Ignore errors from fcntl() in directio.c
Hannes Reinecke [Wed, 15 Jun 2016 11:58:30 +0000 (13:58 +0200)]
libmultipath: Ignore errors from fcntl() in directio.c

Mark the return value from fcntl() as unused to avoid compiler
warnings.
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath: mark return value from dup() as unused
Hannes Reinecke [Wed, 15 Jun 2016 10:17:41 +0000 (12:17 +0200)]
libmultipath: mark return value from dup() as unused

We are redirecting stderr, and can safely ignore any
errors from dup() here. So mark the return value as
unused.
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agomultipathd: pid fd resource leak
Hannes Reinecke [Wed, 15 Jun 2016 09:10:17 +0000 (11:10 +0200)]
multipathd: pid fd resource leak

We open a PID filedescriptor, but never close them.
While this is not an error per se coverity complains here.
So be a good guy and close the PID fd properly.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agomultipathd: missing mpath_disconnect() in uxclnt()
Hannes Reinecke [Wed, 15 Jun 2016 09:16:05 +0000 (11:16 +0200)]
multipathd: missing mpath_disconnect() in uxclnt()

We should be calling mpath_disconnect() in uxclnt().
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath/sysfs.c: always terminate value from sysfs_attr_get_value()
Hannes Reinecke [Thu, 16 Jun 2016 09:02:41 +0000 (11:02 +0200)]
libmultipath/sysfs.c: always terminate value from sysfs_attr_get_value()

Coverity complained that the returned value is not always NULL
terminated.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agokpartx/lopart.c: use fstat() when reading device nodes
Hannes Reinecke [Thu, 16 Jun 2016 07:18:27 +0000 (09:18 +0200)]
kpartx/lopart.c: use fstat() when reading device nodes

Coverity pointed out that we shouldn't be using stat()/open(),
as the file might have vanished or changed in between those
two calls. So modify it to open()/fstat() instead.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agokpartx: use fstat() when reading sysfs attributes
Hannes Reinecke [Thu, 16 Jun 2016 06:03:54 +0000 (08:03 +0200)]
kpartx: use fstat() when reading sysfs attributes

Coverity pointed out that we shouldn't be using stat()/open(),
as the file might have vanished or changed in between those
two calls. So modify it to open()/fstat() instead.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agokpartx/devmapper.c: Remove unused 'next' argument
Hannes Reinecke [Wed, 15 Jun 2016 11:18:40 +0000 (13:18 +0200)]
kpartx/devmapper.c: Remove unused 'next' argument

Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agokpartx: Handle errors from lseek()
Hannes Reinecke [Wed, 15 Jun 2016 11:56:51 +0000 (13:56 +0200)]
kpartx: Handle errors from lseek()

Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agokpartx: do not use 'const' for mapname in get_hotplug_device()
Hannes Reinecke [Wed, 15 Jun 2016 09:51:23 +0000 (11:51 +0200)]
kpartx: do not use 'const' for mapname in get_hotplug_device()

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agokpartx: fixup filedescriptor leak in set_loop()
Hannes Reinecke [Wed, 15 Jun 2016 09:48:11 +0000 (11:48 +0200)]
kpartx: fixup filedescriptor leak in set_loop()

Upon error 'ffd' was never closed.
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agokpartx: Memory leak in get_hotplug_device()
Hannes Reinecke [Wed, 15 Jun 2016 09:12:19 +0000 (11:12 +0200)]
kpartx: Memory leak in get_hotplug_device()

We allocate a string for 'device', but never free it on error.
And the string 'mapname' is never freed at all.
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agokpartx: fixup fd leakage in lopart.c
Hannes Reinecke [Wed, 15 Jun 2016 08:50:00 +0000 (10:50 +0200)]
kpartx: fixup fd leakage in lopart.c

We're leaking filedescriptors when trying to figure out the loop
device.
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath: missing break in hds prioritizer
Hannes Reinecke [Wed, 15 Jun 2016 11:43:55 +0000 (13:43 +0200)]
libmultipath: missing break in hds prioritizer

Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmpathpersist: Handle send error
Hannes Reinecke [Thu, 16 Jun 2016 05:46:35 +0000 (07:46 +0200)]
libmpathpersist: Handle send error

Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmpathpersist: Pass sensebuffer as pointer
Hannes Reinecke [Wed, 15 Jun 2016 14:57:02 +0000 (16:57 +0200)]
libmpathpersist: Pass sensebuffer as pointer

It makes no sense to pass the entire sense buffer as a value,
we should rather pass the pointer to avoid exploding the stack.
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmpathpersist: memory leak in mpath_persistent_reserve_(in,out)()
Hannes Reinecke [Wed, 15 Jun 2016 09:25:37 +0000 (11:25 +0200)]
libmpathpersist: memory leak in mpath_persistent_reserve_(in,out)()

When either curmp or pathvec couldn't be allocated we never
free up the other one, too.
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmpathpersist: Fix possible overrun in devt2devname()
Hannes Reinecke [Wed, 15 Jun 2016 08:52:53 +0000 (10:52 +0200)]
libmpathpersist: Fix possible overrun in devt2devname()

pp->dev is of size FILE_NAME_SIZE, not PATH_SIZE.
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmpathcmd: limit size of the CLI buffer
Hannes Reinecke [Wed, 15 Jun 2016 14:49:54 +0000 (16:49 +0200)]
libmpathcmd: limit size of the CLI buffer

A malicious program might inject a large buffer via the CLI and
causing the daemon to abort due to OOM.
So limit the maximum CLI buffer size to 64k.
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath: memory leak in iet.c
Hannes Reinecke [Wed, 15 Jun 2016 09:18:18 +0000 (11:18 +0200)]
libmultipath: memory leak in iet.c

'pmatch' was never freed.
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath: fixup possible buffer overflow in alua_rtpg.c
Hannes Reinecke [Thu, 16 Jun 2016 07:03:36 +0000 (09:03 +0200)]
libmultipath: fixup possible buffer overflow in alua_rtpg.c

We need to reserve an additional 4 bytes for the length of
the response buffer, so add a proper range check to avoid
accidental wrap-arounds.
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath: use fstat() when reading sysfs attributes
Hannes Reinecke [Thu, 16 Jun 2016 05:49:24 +0000 (07:49 +0200)]
libmultipath: use fstat() when reading sysfs attributes

Coverity pointed out that we shouldn't be using stat()/open(),
as the file might have vanished or changed in between those
two calls. So modify it to open()/fstat() instead.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath: drop unused variable 'diop' in libsg.c
Hannes Reinecke [Wed, 15 Jun 2016 12:20:01 +0000 (14:20 +0200)]
libmultipath: drop unused variable 'diop' in libsg.c

Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath/discovery.c: handle errors from sscanf()
Hannes Reinecke [Wed, 15 Jun 2016 12:07:11 +0000 (14:07 +0200)]
libmultipath/discovery.c: handle errors from sscanf()

Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath/uevent.c: handle errors from setsockopt()
Hannes Reinecke [Wed, 15 Jun 2016 12:05:39 +0000 (14:05 +0200)]
libmultipath/uevent.c: handle errors from setsockopt()

Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath/devmapper.c: check for errors from sscanf()
Hannes Reinecke [Wed, 15 Jun 2016 12:01:28 +0000 (14:01 +0200)]
libmultipath/devmapper.c: check for errors from sscanf()

Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath/alias.c: check return value from strchr()
Hannes Reinecke [Wed, 15 Jun 2016 11:32:17 +0000 (13:32 +0200)]
libmultipath/alias.c: check return value from strchr()

Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath/devmapper.c: Remove unused 'next' argument
Hannes Reinecke [Wed, 15 Jun 2016 11:18:40 +0000 (13:18 +0200)]
libmultipath/devmapper.c: Remove unused 'next' argument

Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath: remove stale references to fd_ep in uevent_listen()
Hannes Reinecke [Wed, 15 Jun 2016 10:57:12 +0000 (12:57 +0200)]
libmultipath: remove stale references to fd_ep in uevent_listen()

Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath: missing NULL check in set_pgfailback()
Hannes Reinecke [Wed, 15 Jun 2016 10:55:44 +0000 (12:55 +0200)]
libmultipath: missing NULL check in set_pgfailback()

Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath: memory leak in add_map_without_path()
Hannes Reinecke [Wed, 15 Jun 2016 09:32:21 +0000 (11:32 +0200)]
libmultipath: memory leak in add_map_without_path()

If we call add_map_without_path() with an empty alias the
mpp structure is never freed.
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath: memory leak in remove_feature()
Hannes Reinecke [Wed, 15 Jun 2016 09:29:12 +0000 (11:29 +0200)]
libmultipath: memory leak in remove_feature()

Upon error the 'n' string was never freed.
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath: free pathgroup in group_by_prio()
Hannes Reinecke [Wed, 15 Jun 2016 09:22:28 +0000 (11:22 +0200)]
libmultipath: free pathgroup in group_by_prio()

If we encounter an error when storing the pathgroup or paths
the pathgroup is never deallocated.
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath: fixup uninitialized return value in dm_reassign_table()
Hannes Reinecke [Wed, 15 Jun 2016 09:01:18 +0000 (11:01 +0200)]
libmultipath: fixup uninitialized return value in dm_reassign_table()

Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmultipath: fixup string copy and comparison
Hannes Reinecke [Thu, 16 Jun 2016 08:38:04 +0000 (10:38 +0200)]
libmultipath: fixup string copy and comparison

When doing a strncpy or strncmp we need to omit the trailing
NULL in the length to avoid any possible overflow.
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agomultipathd: correctly free refwwid in cli_add_map()
Hannes Reinecke [Wed, 15 Jun 2016 08:37:07 +0000 (10:37 +0200)]
multipathd: correctly free refwwid in cli_add_map()

We need to free the refwwid only when present.
Found by coverity.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agomultipath-tools: remove useless init scripts
Xose Vazquez Perez [Fri, 3 Jun 2016 23:54:38 +0000 (01:54 +0200)]
multipath-tools: remove useless init scripts

Nobody uses them, relics.

Cc: Ritesh Raj Sarraf <rrs@debian.org>
Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: tarballs from gitweb
Xose Vazquez Perez [Fri, 3 Jun 2016 23:54:37 +0000 (01:54 +0200)]
multipath-tools: tarballs from gitweb

Releases can be got also from gitweb, more convenient
for untrained people or w/o a development environment.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath: validate devmap names
Benjamin Marzinski [Tue, 31 May 2016 23:16:48 +0000 (18:16 -0500)]
multipath: validate devmap names

Any device identifier given to multipath that isn't either a block
device or a major:minor id is assumed to be a multipath alias. This can
cause some confusing messages if the user accidentally enters something
that is clearly a pathname, but isn't a block device. Since multipath
device aliases are not allowed to have a "/" in them, multipath now
checks the identifier for this before assuming that is is a device
alias, and if there is a "/", it errors out with a helpful message.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 years agolibmultipath: remove calls to dm_udev_complete
Benjamin Marzinski [Tue, 31 May 2016 23:16:45 +0000 (18:16 -0500)]
libmultipath: remove calls to dm_udev_complete

There were two places where the code was calling dm_udev_complete, when
dm_task_set_cookie() failed and when a subsequent call dm_task_run()
failed.  It is correct in neither of these cases.  If
dm_task_set_cookie() fails, device mapper will zero out the cookie
before returning, so there is nothing to complete. If it succeeds and
there is a cookie, something has to wait on it, or it will hang around
in the system forever. dm_udev_complete() will not wait on the cookie or
clean it up. Its job is to signal to the waiters that they are done
waiting.  This is called for us when dm_task_run() fails, so calling
dm_udev_wait() then will not block but immediately clean up the cookie.

This patch simply removes all of the dm_udev_complete() calls.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 years agokpartx: fix dos partition rollover error
Benjamin Marzinski [Tue, 31 May 2016 23:16:50 +0000 (18:16 -0500)]
kpartx: fix dos partition rollover error

dos partitions are limited to 2^32 sectors. However these do not have to
be 512 byte sectors, which is what device-mapper tables use.  kpartx
stores the dos sectors in a 32 uint.  This means that on a 4k sector size
device with large enough partitions, when kpartx multiplies the
dos sector count by the sector size multiplier, it can rollover before
it gets stored in 64 bit slice sector count. This patch just changes the
multiplier to a 64 bit uint to match the slice sector count, and avoid
the rollover.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 years agolibmultipath: add Huawei Storage default config
Benjamin Marzinski [Tue, 31 May 2016 23:16:49 +0000 (18:16 -0500)]
libmultipath: add Huawei Storage default config

Add a default device config for the Huawei XSG1 arrary. This config
comes from Huawei.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 years agomultipathd: handler fixes
Benjamin Marzinski [Tue, 31 May 2016 23:16:44 +0000 (18:16 -0500)]
multipathd: handler fixes

We now have unlocked handlers, but these can't be used to call functions
that will access the pathvec, mpvec, or conf, since these are what the
vecs lock protects. cli_list_config and cli_list_blacklist both need to
access conf, so they can't be unlocked handlers.

Also, if parse_cmd fails to lock the vecs->lock when it calls
pthread_mutex_timedlock, we can't call unlock() on it, because unlocking
a mutex you haven't locked causes undefined behviour. So we need to
only execute the handler if didn't timeout trying to acquire the lock.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 years agolibmpathcmd: Fixup FSF address
Hannes Reinecke [Fri, 3 Jun 2016 06:41:57 +0000 (08:41 +0200)]
libmpathcmd: Fixup FSF address

Our build system complained that the header file still
refers to the old FSF snail mail address.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agolibmpathcmd: Do not install header file as executable
Hannes Reinecke [Fri, 3 Jun 2016 06:40:38 +0000 (08:40 +0200)]
libmpathcmd: Do not install header file as executable

Our build system complained that the mpath_cmd.h header file is
installed as executable.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agomultipath-tools: tarballs are not generated anymore
Xose Vazquez Perez [Thu, 2 Jun 2016 12:47:09 +0000 (14:47 +0200)]
multipath-tools: tarballs are not generated anymore

Add info how to get a specific release from git.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: remove FAQ
Xose Vazquez Perez [Wed, 27 Apr 2016 15:14:34 +0000 (17:14 +0200)]
multipath-tools: remove FAQ

It's old and incomplete information, website already
has a more complete FAQ

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: remove ChangeLog README from kpartx dir
Xose Vazquez Perez [Wed, 27 Apr 2016 15:14:33 +0000 (17:14 +0200)]
multipath-tools: remove ChangeLog README from kpartx dir

Right now this information is irrelevant.

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: fix mistyped kpartx in README
Xose Vazquez Perez [Wed, 27 Apr 2016 15:14:32 +0000 (17:14 +0200)]
multipath-tools: fix mistyped kpartx in README

replace kpartxrtx with kpartx

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agomultipath-tools: move AUTHOR to README
Xose Vazquez Perez [Wed, 27 Apr 2016 15:14:31 +0000 (17:14 +0200)]
multipath-tools: move AUTHOR to README

move AUTHOR content to README and delete it

Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
3 years agoadd display of map information in JSON format
Todd Gill [Tue, 24 May 2016 18:03:07 +0000 (14:03 -0400)]
add display of map information in JSON format

The changes add these commands:

multipathd show maps json
multipathd show map $map json

Each command will output the requested map(s) in JSON.

For the "show maps json" command, the change pre-allocates
INITIAL_REPLY_LEN * PRINT_JSON_MULTIPLIER(5) * map count.
The JSON text is about 5x the size of the "show maps topology"
text.  Multiplying by the map count helps decrease the number
of realloc calls.

Signed-off-by: Todd Gill <tgill@redhat.com>
Signed-off-by: Gris Ge <fge@redhat.com>
3 years agoRemove more unused files
Christophe Varoqui [Wed, 1 Jun 2016 14:51:52 +0000 (16:51 +0200)]
Remove more unused files

- suse example sysv init script
- rpm specfile template

3 years agoFix build failure on multiple arches
Ritesh Raj Sarraf [Wed, 1 Jun 2016 13:54:33 +0000 (19:24 +0530)]
Fix build failure on multiple arches

The build seems to be failing on common 32 bit architectures, where
"unsigned long" and "uint64_t" tend to produce a different values.
This anomaly is not seen on the common 64bit architectures.

Build failure
===============

cc -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -static-libgcc -Wdate-time -D_FORTIFY_SOURCE=2 -O2 -g -pipe -Wformat-security -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wunused -Wstrict-prototypes -fPIC -DLIB_STRING=\"/lib\" -DRUN_DIR=\"run\" -I../libmultipath -I../libmpathpersist -I../libmpathcmd -c -o cli.o cli.c
cli.c:112:1: error: conflicting types for 'set_unlocked_handler_callback'
 set_unlocked_handler_callback (unsigned long fp,int (*fn)(void *, char **, int *, void *))
 ^
In file included from cli.c:16:0:
cli.h:110:5: note: previous declaration of 'set_unlocked_handler_callback' was here
 int set_unlocked_handler_callback (uint64_t fp, int (*fn)(void *, char **, int *, void *));
     ^
../Makefile.inc:74: recipe for target 'cli.o' failed
make[2]: *** [cli.o] Error 1
make[2]: Leaving directory '/«PKGBUILDDIR»/multipathd'
Makefile:42: recipe for target 'recurse' failed
make[1]: *** [recurse] Error 2
make[1]: Leaving directory '/«PKGBUILDDIR»'
debian/rules:45: recipe for target 'build-multipath-udeb-stamp' failed
make: *** [build-multipath-udeb-stamp] Error 2
dpkg-buildpackage: error: debian/rules build-arch gave error exit status 2
────────────────────────────────────────────────────────────────────────────────
Build finished at 20160531-1405

Signed-off-by: Ritesh Raj Sarraf <rrs@debian.org>
3 years agoMerge Dell MD3XXX hardware table entries
Hannes Reinecke [Mon, 30 Mar 2015 06:23:23 +0000 (08:23 +0200)]
Merge Dell MD3XXX hardware table entries

Remove duplicate entries and merge MD36xxi/MD36xxf into a single
one.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoIncrease kpartx retries
Ritesh Raj Sarraf [Wed, 11 May 2016 17:27:10 +0000 (19:27 +0200)]
Increase kpartx retries

3 years agolibmultipath: use poll() in uevent_listen()
Hannes Reinecke [Wed, 11 May 2016 10:35:53 +0000 (12:35 +0200)]
libmultipath: use poll() in uevent_listen()

As we're not modifying the signal mask anymore we can switch
back to normal 'poll' instead of 'ppoll'.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agomultipathd: move 'filter_devnode' under vector lock
Hannes Reinecke [Wed, 11 May 2016 10:35:41 +0000 (12:35 +0200)]
multipathd: move 'filter_devnode' under vector lock

Ben Marzinski pointed out that filter_devnode() is used
without any lock or configuration settings in uev_trigger(),
and hence might be invalid when processing events during
reconfiguration.
So move it into the individual functions and handle it
with the vector lock held.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agoBump the version code to 0.6.1 0.6.1
Christophe Varoqui [Tue, 10 May 2016 06:12:35 +0000 (08:12 +0200)]
Bump the version code to 0.6.1

3 years agoDrop the multipath.conf.* files
Christophe Varoqui [Tue, 10 May 2016 06:02:19 +0000 (08:02 +0200)]
Drop the multipath.conf.* files

multipath.conf.synthetic is useless.

multipath.conf.defaults can be extracted from a live daemon.

multipath.conf.annotated information is all in the man page.

3 years agolibmultipath: Fixup 'DM_DEVICE_RELOAD' handling
Hannes Reinecke [Mon, 9 May 2016 10:53:05 +0000 (12:53 +0200)]
libmultipath: Fixup 'DM_DEVICE_RELOAD' handling

libdevmapper has the 'quirk' that DM_DEVICE_CREATE is translated
internally into a create/load/resume sequence, and the associated
cookie will wait for the last 'resume' to complete.
However, DM_DEVICE_RELOAD has no such translation, so if there
is a cookie assigned to it the caller _cannot_ wait for it,
as the cookie will only ever be completed upon the next
DM_DEVICE_RESUME.
multipathd already has some provisions for that (but even there
the cookie handling is dodgy), but 'multipath -r' doesn't know
about this.
So to avoid any future irritations this patch updates the
dm_addmad_reload() call to handle the call to DM_DEVICE_RESUME
correctly and removes the special handling from domap().

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agodevmapper: remove 'udev_sync' argument from dm_simplecmd_noflush()
Hannes Reinecke [Mon, 9 May 2016 10:53:04 +0000 (12:53 +0200)]
devmapper: remove 'udev_sync' argument from dm_simplecmd_noflush()

The 'udev_sync' argument is always '1', so we can remove it.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agomultipathd: wait for udev in cli_resume()
Hannes Reinecke [Mon, 9 May 2016 10:53:03 +0000 (12:53 +0200)]
multipathd: wait for udev in cli_resume()

When calling 'cli_resume()' we should be waiting for udev to
ensure the device really has been resumed.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agodevmapper: wait for udev in dm_simplecmd_noflush()
Hannes Reinecke [Mon, 9 May 2016 10:53:02 +0000 (12:53 +0200)]
devmapper: wait for udev in dm_simplecmd_noflush()

When calling dm_simplecmd_noflush() with udev_flags set we
need to set the 'need_sync' flag otherwise the udev flags
will never be set.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agoconfigure: Rename ACT_RENAME2 to ACT_FORCERENAME
Hannes Reinecke [Mon, 9 May 2016 10:53:01 +0000 (12:53 +0200)]
configure: Rename ACT_RENAME2 to ACT_FORCERENAME

Use a more descriptive name instead of 'ACT_RENAME2'.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agodevmapper: do not call dm_udev_complete if dm_task_set_cookie() failed
Hannes Reinecke [Mon, 9 May 2016 10:53:00 +0000 (12:53 +0200)]
devmapper: do not call dm_udev_complete if dm_task_set_cookie() failed

As per Benjamin Marzinski libdevice-mapper will take care of cleaning
up the cookie for us.
So there's no need to call dm_udev_complete() if dm_task_set_cookie()
fails.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agodevmapper: do not flush I/O for DM_DEVICE_CREATE
Hannes Reinecke [Mon, 9 May 2016 10:52:59 +0000 (12:52 +0200)]
devmapper: do not flush I/O for DM_DEVICE_CREATE

DM_DEVICE_CREATE loads a new table, so there cannot be any
I/O pending. Hence we should be setting the 'no flush'
and 'skip lockfs' flag to avoid delays during creation.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoRevert 'multipathd: Do not print misleading message "not found in pathvec"'
Hannes Reinecke [Tue, 3 May 2016 09:18:53 +0000 (11:18 +0200)]
Revert 'multipathd: Do not print misleading message "not found in pathvec"'

As discussed on the mailing list the logging messages should remain,
so revert the patch, increase the logging level and update the
message itself to be more instructive.

Signed-off-by: Hannes Reinecke <hare@suse.com>
3 years agoAllow specific CLI commands to run unlocked
Hannes Reinecke [Thu, 24 Jul 2014 12:03:56 +0000 (14:03 +0200)]
Allow specific CLI commands to run unlocked

When multipath is busy with checking paths or processing udev
events it'll take the vector lock, causing the CLI
to become unresponsive.
This patch allows certain CLI commands to not wait for the vector
lock, so that those commands will always succeed.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agomultipathd: push down lock in checkerloop()
Hannes Reinecke [Thu, 24 Jul 2014 09:52:26 +0000 (11:52 +0200)]
multipathd: push down lock in checkerloop()

Instead of grabbing the lock at the start of the checkerloop
and releasing it at the end we should be holding it only
during the time when we actually need it.

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