multipath-tools/.git
8 years agomultipath: Fix warnings from stricter compile options.
Benjamin Marzinski [Fri, 25 May 2012 04:57:43 +0000 (23:57 -0500)]
multipath: Fix warnings from stricter compile options.

With stricter compilation options, multipath printed number of
warnings during compilation. Some of them were actual bugs. Others
couldn't cause any problems.  This patch cleans up all the new
warnings.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: Build with standard rpm cflags
Benjamin Marzinski [Fri, 25 May 2012 04:57:42 +0000 (23:57 -0500)]
multipath: Build with standard rpm cflags

This patch makes multipath build with the standard redhat rpm cflags, which
can help catch some code errors.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: Some device configuration changes for NetApp LUNs
Benjamin Marzinski [Wed, 23 May 2012 21:42:20 +0000 (16:42 -0500)]
multipath: Some device configuration changes for NetApp LUNs

NetApp has asked for these configuration changes.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: fix scsi async tur checker corruption
Benjamin Marzinski [Wed, 23 May 2012 21:05:20 +0000 (16:05 -0500)]
multipath: fix scsi async tur checker corruption

Since the tur checker runs asynchronously in its own thread, there is nothing
that keeps a path from being orphaned or deleted before the tur thread has
finished. When this happenes the checker struct gets deleted.  However, the tur
thread might still we writing to that memory.  This can lead to memory
corruption.  This patch adds all of the necessary data to the checker context,
and makes the tur thread only use that. This way, if the checker is deleted
while the thread is still using the context, the thread will clean up the
context itself.

Since the context can only be freed when both the thread and the paths checker
structure have stopped needing it, and these can get get finished with the
context asychronously with respect to each other, the context has a holders
counter, protected by a spinlock, to keep track of the users.  When the
counter drops to zero, the context gets freed.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: Allow user_friendly_names in more config sections
Benjamin Marzinski [Wed, 23 May 2012 20:36:30 +0000 (15:36 -0500)]
multipath: Allow user_friendly_names in more config sections

This patch adds support for setting user_friendly_names in the devices and
multipaths config sections.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: Make sure we store all the hwentry attributes.
Benjamin Marzinski [Wed, 23 May 2012 20:29:05 +0000 (15:29 -0500)]
multipath: Make sure we store all the hwentry attributes.

Not all of the attributes from the hardware table entries were getting stored
when the built-in devices configurations were being setup.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agoMinor typo in multipath.conf.annotated
Cedric Buissart [Wed, 23 May 2012 20:25:45 +0000 (22:25 +0200)]
Minor typo in multipath.conf.annotated

8 years agomultipath: clean up code for stopping the waiter threads
Benjamin Marzinski [Sat, 19 May 2012 06:37:03 +0000 (01:37 -0500)]
multipath: clean up code for stopping the waiter threads

The way multipathd currently stops the waiter threads needs some work.
Right now they are stopped by being sent the SIGUSR1 signal. However their
cleanup code assumes that they are being cancelled, just like all the other
threads are.  There's no reason for them to be so unnecessarily
complicated and different from the other threads

This patch does a couple of things.  First, it removes the mutex from
the event_thread.  This wasn't doing anything. It was designed to protect
the wp->mapname variable, which the waiter threads were checking to see
if they should quit. However, the mutex was only ever being used by the
thread itself, and it clearly didn't need to serialize with itself.  Also,
the function to clear the mapname, signal_waiter(), was set with
pthread_cleanup_push(), which never got called early, since the threads
weren't being cancelled.  Thus, the mapname never got cleared
until the pthreads were about to shut down.

The patch also rips out all the signal stopping code, and just uses
pthread_cancel.  There already are cancellation points in the waiter
thread code. Between the cancellation points, both explicit and implicit,
and the fact that the waiter threads will never be killed except when the
killer is holding the vecs lock, there shouldn't be any place where the
waiter thread can access freed data.

To make sure the waiter thread cleans itself up properly, the dmt
has been moved into the event_thread structure, and is destroyed in
free_waiter() if necessary.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: fix select_no_path_retry for flushing devices.
Benjamin Marzinski [Fri, 18 May 2012 22:33:26 +0000 (17:33 -0500)]
multipath: fix select_no_path_retry for flushing devices.

The select_no_path_retry code was falling through if a flush was
in progress, and so it wasn't honoring flush_on_last_del.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agoFix compilation on older udev versions
Hannes Reinecke [Thu, 19 Apr 2012 12:03:47 +0000 (14:03 +0200)]
Fix compilation on older udev versions

Older udev versions do not export 'udev_monitor_set_receive_buffer_size',
so we need to comment it out on those systems.

Signed-off-by: Hannes Reinecke <hare@suse.de>
8 years agoCompilation fix for system not providing OOM_SCORE_ADJ_MIN
Hannes Reinecke [Thu, 19 Apr 2012 12:03:26 +0000 (14:03 +0200)]
Compilation fix for system not providing OOM_SCORE_ADJ_MIN

Newer systems do not provide a definition for OOM_SCORE_ADJ_MIN,
so we need to test against this.

Signed-off-by: Hannes Reinecke <hare@suse.de>
8 years agoRemove all references to hand-craftes sysfs code
Hannes Reinecke [Thu, 19 Apr 2012 09:09:06 +0000 (11:09 +0200)]
Remove all references to hand-craftes sysfs code

We've now converted everything to libudev, so we can get rid
of all the variables etc.

Signed-off-by: Hannes Reinecke <hare@suse.de>
8 years agoUse udev devices during discovery
Hannes Reinecke [Thu, 19 Apr 2012 09:09:05 +0000 (11:09 +0200)]
Use udev devices during discovery

Remove all hand-crafted sysfs access code and replace it with
libudev functions.

Signed-off-by: Hannes Reinecke <hare@suse.de>
8 years agoUse udev attribute instead of getuid_callout()
Hannes Reinecke [Thu, 19 Apr 2012 09:09:04 +0000 (11:09 +0200)]
Use udev attribute instead of getuid_callout()

By the time we're receiving an event udev already figured out
a unique ID. So we can just use that and get rid of the
callout.

Signed-off-by: Hannes Reinecke <hare@suse.de>
8 years agodiscovery: Fixup cciss discovery
Hannes Reinecke [Thu, 19 Apr 2012 09:09:03 +0000 (11:09 +0200)]
discovery: Fixup cciss discovery

We can get the sysfs attributes directly from the parent.

Signed-off-by: Hannes Reinecke <hare@suse.de>
8 years agoUse struct udev_device instead of sysdev
Hannes Reinecke [Thu, 19 Apr 2012 09:09:02 +0000 (11:09 +0200)]
Use struct udev_device instead of sysdev

Remove hand-crafted sysdev and use struct udev_device instead.

Signed-off-by: Hannes Reinecke <hare@suse.de>
8 years agoRemove stale variable in sysfs_attr_get_value
Hannes Reinecke [Thu, 19 Apr 2012 09:09:01 +0000 (11:09 +0200)]
Remove stale variable in sysfs_attr_get_value

Signed-off-by: Hannes Reinecke <hare@suse.de>
8 years agouse struct udev_device during discovery
Hannes Reinecke [Thu, 19 Apr 2012 09:09:00 +0000 (11:09 +0200)]
use struct udev_device during discovery

We can save quite some parsing etc. by just using struct udev_device.

Signed-off-by: Hannes Reinecke <hare@suse.de>
8 years agoUse udev enumeration during discovery
Hannes Reinecke [Thu, 19 Apr 2012 09:08:59 +0000 (11:08 +0200)]
Use udev enumeration during discovery

Instead of scanning /sys/block by hand we should be using enumeration
provided by udev.

Signed-off-by: Hannes Reinecke <hare@suse.de>
8 years agoAdd global udev reference pointer to config
Hannes Reinecke [Thu, 19 Apr 2012 09:08:58 +0000 (11:08 +0200)]
Add global udev reference pointer to config

Instead of using a local reference to udev we should be moving it
to the global config structure.

Signed-off-by: Hannes Reinecke <hare@suse.de>
8 years agomultipathd: use struct path as argument for event processing
Hannes Reinecke [Thu, 19 Apr 2012 09:08:57 +0000 (11:08 +0200)]
multipathd: use struct path as argument for event processing

ev_add/remove_path should be using struct path as the argument,
this makes transitioning to use libudev easier.

Signed-off-by: Hannes Reinecke <hare@suse.de>
8 years agomultipathd: remove references to sysfs_device
Hannes Reinecke [Thu, 19 Apr 2012 09:08:56 +0000 (11:08 +0200)]
multipathd: remove references to sysfs_device

When processing events we don't need to take a reference to the
sysfs_device; it will be done later on during pathinfo.

Signed-off-by: Hannes Reinecke <hare@suse.de>
8 years agoUse devpath as argument for sysfs functions
Hannes Reinecke [Thu, 19 Apr 2012 09:08:55 +0000 (11:08 +0200)]
Use devpath as argument for sysfs functions

Whenever we pass in a sysfs structure to functions we're only
ever interested in the devpath. So we can as well pass in the
device path directly, without reference to the sysfs structure.

Signed-off-by: Hannes Reinecke <hare@suse.de>
8 years agomultipath: enable getting uevents through libudev
Benjamin Marzinski [Tue, 10 Apr 2012 04:01:54 +0000 (23:01 -0500)]
multipath: enable getting uevents through libudev

udev is removing support for RUN+="socket:..." rules. For now, I've kept
all the existing uevent code, but I've added a new method for getting the
uevent information using libudev that will be tried first.

This version includes more error checking.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: lower the log level for rdac TAS messages
Moger, Babu [Fri, 6 Apr 2012 21:49:19 +0000 (21:49 +0000)]
multipath: lower the log level for rdac TAS messages

This patch lowers the log level for rdac TAS related messages.
These calls are expected to fail in cluster configurations due to reservations.

Signed-off-by: Babu Moger <babu.moger@netapp.com>
8 years agomultipath: blacklist all the management Luns by default
Moger, Babu [Wed, 14 Mar 2012 21:20:22 +0000 (21:20 +0000)]
multipath: blacklist all the management Luns by default

This patch adds the blacklisting for all the management luns. Otherwise
user has to manually add blacklisting in multipath.conf for these luns.

Signed-off-by: Babu Moger <babu.moger@netapp.com>
8 years agoFix fast_io_fail capping
Jun'ichi Nomura [Mon, 12 Mar 2012 11:56:52 +0000 (20:56 +0900)]
Fix fast_io_fail capping

Hi Christophe,

fast_io_fail is only meaningful if it is smaller than dev_loss_tmo.
Setting dev_loss_tmo value to fast_io_fail ends up with -EINVAL.
If the fast_io_fail is not configured properly, turning it off
seems to be the right behavior.

MP_FAST_IO_FAIL_OFF is -1, defined in the following patch:
  [PATCH] Fix for setting '0' to fast_io_fail
  http://www.redhat.com/archives/dm-devel/2012-March/msg00047.html

--
Jun'ichi Nomura, NEC Corporation

8 years agoFix for setting '0' to fast_io_fail
Jun'ichi Nomura [Mon, 12 Mar 2012 11:43:55 +0000 (20:43 +0900)]
Fix for setting '0' to fast_io_fail

Hi Christophe,

In kernel, '0' is valid value for fast_io_fail, meaning immediate
termination of ios on rport delete.
However, '0' is treated as 'not-configured' in various places of
multipath-tools and it is not possible to set 0 to fast_io_fail.

Attached patch fixes that by introducing MP_FAST_IO_FAIL_ZERO
as internal representation of zero value.

--
Jun'ichi Nomura, NEC Corporation

8 years agomultipath: Set 'tur' as the default path checker for NetApp LUNs
Martin George [Mon, 12 Mar 2012 08:22:11 +0000 (13:52 +0530)]
multipath: Set 'tur' as the default path checker for NetApp LUNs

In our tests, we've noticed that the 'tur' checker provides
better performance compared to 'directio' primarily because 'tur'
does not use FS-based requests unlike 'directio'. Moreover with
Hannes' recent async tur enhancement, the 'tur' checker is more
efficient now than before.

So we'd prefer using 'tur' as the default path checker for NetApp
LUNs now. The below patch enables the same by updating the
.checker_name in the hwtable for NetApp LUNs.

Signed-off-by: Martin George <marting@netapp.com>
8 years agomultipath-tools: cleanup for all unused-but-set-variable variables in mpathpersist
Chauhan, Vijay [Tue, 6 Mar 2012 15:11:38 +0000 (15:11 +0000)]
multipath-tools: cleanup for all unused-but-set-variable variables in mpathpersist

This patch is a cleanup for all unused-but-set-variable variables
in mpathpersist.

Signed-off-by: Vijay Chauhan <vijay.chauhan@netapp.com>
8 years agomultipath-tools: Implementation for hex output (-H) for mpathpersist
Chauhan, Vijay [Tue, 6 Mar 2012 15:10:15 +0000 (15:10 +0000)]
multipath-tools: Implementation for hex output (-H) for mpathpersist

Adding missing implementation for hex output(-H).

Signed-off-by: Vijay Chauhan <vijay.chauhan@netapp.com>
8 years agomultipath-tools: Generalizing the vpd 0x83 processing with correct buffer length
Moger, Babu [Wed, 22 Feb 2012 18:09:10 +0000 (18:09 +0000)]
multipath-tools: Generalizing the vpd 0x83 processing with correct buffer length

Right now the buffer length for inquiry vpd 0x83 is hardcoded to 128 bytes.
This can cause problems if the length of all the designation descriptors
exceed 128 bytes. This was causing me issues while configuring my storage
with alua. I have generalized the processing with correct buffer length.
Patch has been tested with NetApp E-series storage.

Signed-off-by: Babu Moger <babu.moger@netapp.com>
8 years agomultipath-tools: fix the bug while processing vpd 0x83 designation descriptors
Moger, Babu [Wed, 22 Feb 2012 18:09:00 +0000 (18:09 +0000)]
multipath-tools: fix the bug while processing vpd 0x83 designation descriptors

This patch fixes the bug while processing the vpd 0x83 designation descriptors.
Removing the buggy check(> sizeof(buf))while loping the descriptors. Sizeof(buf) will
always return 8 (in 64 bit machine). Descriptor length can be more than 8 bytes in
some cases. This was causing problems while configuring my storage with alua.

Signed-off-by: Babu Moger <babu.moger@netapp.com>
8 years agompathpersist build fix
Christophe Varoqui [Sat, 11 Feb 2012 08:33:45 +0000 (09:33 +0100)]
mpathpersist build fix

remove -lsysfs from Makefiles. sysfs.h is provided through
-lmultipath.

8 years agomultipath: another manpage update
Benjamin Marzinski [Fri, 10 Feb 2012 18:18:38 +0000 (12:18 -0600)]
multipath: another manpage update

Missed an option with my last manpage update.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: adjust messages
Benjamin Marzinski [Fri, 10 Feb 2012 18:16:50 +0000 (12:16 -0600)]
multipath: adjust messages

Stop the rport_id messages from being dispalyed all the time, and add a message
alerting users when multipath tries to setup a map and fails, or ends up
removing the map.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agokpartx: verify GUID partition entry size
Benjamin Marzinski [Fri, 10 Feb 2012 18:14:39 +0000 (12:14 -0600)]
kpartx: verify GUID partition entry size

This patch pulls in some kernel code to catch a corrupt GUID partition
table with the wrong size.

Signed-off-by: Boris Ranto <branto@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: don't remove map twice
Benjamin Marzinski [Fri, 10 Feb 2012 18:13:12 +0000 (12:13 -0600)]
multipath: don't remove map twice

If setup_mutipath fails, it removes the map itself, so don't try to again.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: cleanup dev_loss_tmo issues
Benjamin Marzinski [Fri, 10 Feb 2012 18:11:37 +0000 (12:11 -0600)]
multipath: cleanup dev_loss_tmo issues

There are a couple of issues with the dev_loss_tmo code.  First, the
comparison between fast_io_fail and dev_loss was failing for
fast_io_fail = -1. Second, if fast_io_fail_tmo was set to off, and
dev_loss was greater than 600, dev_loss_tmo would not be set. Finally,
verify_paths was calling sysfs_set_scsi_tmo without ever calling
select_fast_io_fail.  However, this hasn't be causing problems since
setup_map is always called immediately after verify_paths, and it calls
all the select_ functions correctly.  This patch fixes all these.  Now,
if setting dev_loss_tmo fails, and fast_io_fail is set to off, it will
retry will dev_loss_tmo set to 600. Also, the calls that are duplicated
between verify_paths and setup_map have been removed.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: fix shutdown crashes
Benjamin Marzinski [Fri, 10 Feb 2012 18:10:11 +0000 (12:10 -0600)]
multipath: fix shutdown crashes

A number of processes don't reach a pthread cancellation point
before they use the pathvec or mpvec vectors, after they've
locked the vecs lock.  This can cause crashes on shutdown, since
these vectors are deallocated.  Also, the log thread accesses a
number of resources which may have been deallocated during shutdown
without holding any locks. This patch avoids these issues by
adding pthread_testcancel() checks after acquiring the vecs lock,
and having the child process make sure the log thread has exitted
before deallocating the resources.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agompathpersist: Add new utility for managing persistent reservation on dm multipath...
Vijay Chauhan [Thu, 9 Feb 2012 15:00:20 +0000 (10:00 -0500)]
mpathpersist: Add new utility for managing persistent reservation on dm multipath device

Persistent reservation management utility (mpathpersist) allows cluster management software to manage
persistent reservation through mpath device. It processes management request from caller
and hides the management task details. It also handles persistent reservation management of
data path life cycle and state changes.

Signed-off-by: Vijay Chauhan <vijay.chauhan@netapp.com>
8 years ago[kpartx] Don't add 'p' delimiter when you shouldn't
Phillip Susi [Thu, 9 Feb 2012 20:16:21 +0000 (21:16 +0100)]
[kpartx] Don't add 'p' delimiter when you shouldn't

The 'p' delimiter is supposed to be added when the base disk name
ends in a digit.  This decision was based on the name given on the
command line, not the canonical device name, so giving /dev/dm-0
instead of /dev/mapper/foo triggered the digit test and added the
'p'.  Changed test to use the canonical name rather than the given
name.

8 years agoAdd Fujitsu Eternus defaults
Gerhard Wichert [Wed, 8 Feb 2012 20:52:26 +0000 (21:52 +0100)]
Add Fujitsu Eternus defaults

8 years agomultipath: Update multipath device on show topology
Benjamin Marzinski [Fri, 27 Jan 2012 20:41:49 +0000 (14:41 -0600)]
multipath: Update multipath device on show topology

when multipathd's show_map_topology or show_maps_topology commands are
called, multipathd doesn't update its device state from the kernel.  So,
if you do something like call disablequeueing first, show_map_topology won't
register the change. This patche makes multipathd update the device before
printing the topology. This also requires a change to setup_multipath, to
allow it to just read the kernel state, and not update anything.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: Update multipath.conf man page
Benjamin Marzinski [Fri, 27 Jan 2012 20:42:45 +0000 (14:42 -0600)]
multipath: Update multipath.conf man page

Update the multipath.conf man page.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: don't remove dm device on remove uevent
Benjamin Marzinski [Fri, 13 Jan 2012 04:17:21 +0000 (22:17 -0600)]
multipath: don't remove dm device on remove uevent

multipathd gets remove uevents for dm devices when the devices have
been removed.  It shouldn't try to actually remove the device itself,
since that has already been done, or it wouldn't have gotten the uevent.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: make tgt_node_name work for iscsi devices
Benjamin Marzinski [Fri, 13 Jan 2012 04:14:56 +0000 (22:14 -0600)]
multipath: make tgt_node_name work for iscsi devices

tgt_node_name wasn't displaying anything for iscsi devices. With this
change, if multipath can't get the node_name, it will check
sys/devices/platform/hostX/sessionY/iscsi_session/sessionY/targetname
and if this is available, it will get the node name from there.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agoAdd default values for IBM XIV Storage System.
Oren Held [Fri, 30 Dec 2011 11:45:09 +0000 (12:45 +0100)]
Add default values for IBM XIV Storage System.

8 years agomultipath: add option to change the number of error messages
Benjamin Marzinski [Mon, 19 Dec 2011 21:41:57 +0000 (15:41 -0600)]
multipath: add option to change the number of error messages

This patch adds a new default config parameter, log_checker_err.  It accepts
two values, "once" and "always", and defaults of "always".  It controls
how multipathd logs checker error messages.  If it's set to "once", only the
first checker error message is logged at logging level 2. All future messages
are logged at level 3, until the device is restored or removed. If it's set
to "always", all messages are logged at level 2, like multipathd currently does.

This version actually compiles.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: fix scsi timeout code
Benjamin Marzinski [Mon, 19 Dec 2011 22:19:56 +0000 (16:19 -0600)]
multipath: fix scsi timeout code

sysfs_attr_set_value() returns the amount written on on success, or -1 on
failure.  sysfs_setc_scsi_tmo() was checking if the return was nonzero, and
failing if it was. This meant that it always failed out silently after writing
the first value. I've changed the check, and added some error messages.  I also
made sysfs_attr_set_value return -1 for all errors.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath-tools: Remove bad udev rules
Phillip Susi [Tue, 6 Dec 2011 16:12:58 +0000 (11:12 -0500)]
multipath-tools: Remove bad udev rules

This sample udev rules file contains some rules relating to dmraid
that both should not be there and are broken anyhow.  They should
not be there because firstly, what is a dmraid rule doing in a
kpartx rule file, and secondly, dmraid already activates partitions
itself, so there is no need to run kpartx to do that.  The rule is
broken because it is matching on the DM_UUID starting with "dmraid-",
but this comparison is case sensitive, and it actually starts with
"DMRAID-".

Signed-off-by: Phillip Susi <psusi@cfl.rr.com>
8 years agoRevert "multipath: rlookup WWIDs with spaces by alias"
Christophe Varoqui [Tue, 15 Nov 2011 20:39:34 +0000 (21:39 +0100)]
Revert "multipath: rlookup WWIDs with spaces by alias"

This reverts commit 1620040c3b1a4c4f6762d7e606a83c9f5ab8ebff.

wwid can have not whitespace anyway. scsi_id make sure of that.

8 years agoUpdate man page for multipath -r
Aruna Balakrishnaiah [Tue, 15 Nov 2011 15:09:57 +0000 (20:39 +0530)]
Update man page for multipath -r

Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
8 years agokpartx man page update
hegdevasant [Tue, 15 Nov 2011 20:33:34 +0000 (21:33 +0100)]
kpartx man page update

This patch updates the kpartx man page.

Signed-off-by: Vasant Hegde <hegdevasant@in.ibm.com>
8 years agoFix prio default value in multipath.conf.annotated
Christophe Varoqui [Sat, 12 Nov 2011 13:38:26 +0000 (14:38 +0100)]
Fix prio default value in multipath.conf.annotated

"none" to "const"

8 years agoFix polling insterval reported by multipath -t
Christophe Varoqui [Sat, 12 Nov 2011 12:04:19 +0000 (13:04 +0100)]
Fix polling insterval reported by multipath -t

polling interval default value was not set in the multipath
code path, but only in multipathd (where it is used).

Move the default value setting to load_config, where it belongs,
to have it set in both multipath and multipathd.

8 years agoupdate prioritizer for iet target
Olivier Lambert [Thu, 10 Nov 2011 11:36:23 +0000 (12:36 +0100)]
update prioritizer for iet target

Add missing free(), remove spurious whitespaces

8 years agomultipath: don't print so many add map messages
Benjamin Marzinski [Sat, 12 Nov 2011 05:12:49 +0000 (23:12 -0600)]
multipath: don't print so many add map messages

Whenever a dm device gets a change uevent, multipathd prints an add map
message.  This can get confusing for users, so change that message to
not print at the default log level, and add a new message that only
prints if multipathd will actually try to add a map

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: Set the default max_fds to the system max
Benjamin Marzinski [Sat, 12 Nov 2011 05:10:21 +0000 (23:10 -0600)]
multipath: Set the default max_fds to the system max

Since many people don't realize that they need to set max_fds until they run
out of file descriptors, default to the system max.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: rlookup WWIDs with spaces by alias
Benjamin Marzinski [Sat, 12 Nov 2011 04:54:26 +0000 (22:54 -0600)]
multipath: rlookup WWIDs with spaces by alias

If a WWID contained spaces, the rlookup code wasn't able to look it up
by its user_friendly_name, since the code was only reading the wwid till
the first space.  It now reads to the end of the line.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agoAdd missing break statement in kpartx
hegdevasant [Wed, 9 Nov 2011 23:00:01 +0000 (00:00 +0100)]
Add missing break statement in kpartx

Signed-off-by: Vasant Hegde <vahegde1@linux.vnet.ibm.com>
8 years agoMerge a prioritizer for IET scsi software target
Christophe Varoqui [Wed, 9 Nov 2011 22:53:03 +0000 (23:53 +0100)]
Merge a prioritizer for IET scsi software target

Written by Olivier Lambert <lambert.olivier@gmail.com>

8 years agoVendor/product comparisons are too broad
Anton Blanchard [Wed, 9 Nov 2011 22:48:12 +0000 (23:48 +0100)]
Vendor/product comparisons are too broad

We have a POWER machine with a broken multipath setup. Analysis shows
that the RDAC driver is being used even though it shouldn't.

The vendor/product is:

IBM,IPR-0   65C61818

There is an entry for this device:

                /* IBM IPR */
                .vendor        = "IBM",
                .product       = "IPR.*",

Unfortunately it looks like a previous entry is matching against this
(since we do a regex match):

            /* IBM DS5000 */
                .vendor        = "IBM",
                .product       = "1818",

There are a number of IBM entries that have this issue. The following
patch ensures we match against the entire product ID.

8 years agoFix for Red Hat bz #737072.
bmarzins@sourceware.org [Wed, 2 Nov 2011 21:44:58 +0000 (22:44 +0100)]
Fix for Red Hat bz #737072.

CVSROOT:        /cvs/dm
Module name:    multipath-tools
Branch:         RHEL5_FC6
Changes by:     bmarzins@sourceware.org    2011-10-24 13:41:32

Modified files:
        path_priority/pp_alua: rtpg.c

Log message:
        Fix for bz #737072. Shorten the timeout for the alua prio callout function
        from 5 minutes to 1 minute.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/path_priority/pp_alua/rtpg.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.3.2.5&r2=1.3.2.6

8 years agomultipath-tools/kpartx gpt.c
bmarzins@sourceware.org [Mon, 24 Oct 2011 13:37:18 +0000 (13:37 +0000)]
multipath-tools/kpartx gpt.c

CVSROOT: /cvs/dm
Module name: multipath-tools
Branch:  RHEL5_FC6
Changes by: bmarzins@sourceware.org 2011-10-24 13:37:18

Modified files:
kpartx         : gpt.c

Log message:
Fix for bz #719575.  Validate size of GPT partitions.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/kpartx/gpt.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.3&r2=1.3.2.1

8 years agomultipath: handle offlined paths
Benjamin Marzinski [Mon, 17 Oct 2011 21:16:02 +0000 (16:16 -0500)]
multipath: handle offlined paths

The kernel does not allow multipath to load tables containing offline
devices. Because of this, if you try add a path to a multipath device with
an offline path, the multipathd will continually, retry and fail to reload
the table. I've limited the retries to three to avoid livelocking.

Also, if you map included a offline path, multipath was crashing because
it couldn't get the required sysfs information before calling get_state().
It now checks for this in multipath, like it does in multipathd

Lastly, multipathd would keep reprinting the last checker message for
offlined paths, instead of something useful. It now prints a "path offline"
message.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: better argument type checking
Benjamin Marzinski [Tue, 11 Oct 2011 03:18:09 +0000 (22:18 -0500)]
multipath: better argument type checking

The way that multipath decided what you passed in as an argument didn't
always work.  If the argument was the name of a file, then multipath
assumed that it was a path.  That meant if you were in /dev/mapper and ran

# multipath -f <mpath_device_name>

It would fail, since it thought you gave it a path name, instead of a
multipath device name.  Now multipath will only treat the argument
as a path name if it is a block device with a different major number than
device-mapper's.  Also, I've switched the MAJOR/MINOR/MKDEV macros to
work like kpartx, so that they can handle minor numbers over 255.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: set ACT_RESIZE when the size has changed
Benjamin Marzinski [Tue, 11 Oct 2011 03:19:13 +0000 (22:19 -0500)]
multipath: set ACT_RESIZE when the size has changed

When the multipath path devices change size, multipath can't be reloaded
with noflush set.  So, don't set the action to ACT_RELOAD, which will
cause the multipath device to get stuck in SUSPEND. Use ACT_RESIZE.

Also, I was seeing some messages that were getting cut off with the
128 byte messages size, so I doubled that, and the log area size.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: better check for daemon mode
Benjamin Marzinski [Tue, 11 Oct 2011 03:16:51 +0000 (22:16 -0500)]
multipath: better check for daemon mode

With the existing check, if a multipath device gets created with a
blacklisted path (because, for instance, the path was unblacklisted,
but multipathd was not reconfigured), multipathd will crash.  This is
because multipathd will add the path when it adds the multipath device,
but it won't have all the necessary information to use the path. The
new check makes sure multipathd won't add blacklisted paths, simply
because they are part of a multipath device.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years ago'multipath' with -h and -t option, it returns '1' (fail) for successful command execution
Aruna Balakrishnaiah [Wed, 5 Oct 2011 14:36:14 +0000 (20:06 +0530)]
'multipath' with -h and -t option, it returns '1' (fail) for successful command execution

      Fix exit status for -h and -t options in multipath command

8 years agomultipath: make sure all the hwe attributes get merged
Benjamin Marzinski [Wed, 5 Oct 2011 04:13:49 +0000 (23:13 -0500)]
multipath: make sure all the hwe attributes get merged

Not all of the hwe attributes were getting merged.  Also,
multipathd show config was putting an extra set of quotes around the entries
in the devices section.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: get right sysfs value for checker_timeout
Benjamin Marzinski [Wed, 5 Oct 2011 04:15:05 +0000 (23:15 -0500)]
multipath: get right sysfs value for checker_timeout

sysfs_get_timeout() wasn't looking in the correct directory for the
checker timeout value. It was looking at .../block/<devname>/timeout,
instead of  .../block/<devname>/device/timeout

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: add default hardware configs.
Benjamin Marzinski [Tue, 27 Sep 2011 20:50:52 +0000 (15:50 -0500)]
multipath: add default hardware configs.

Here are some hardware configs I've received from vendors, that haven't made it
upstream yet, along with a little bit of cleanup. The changes come from Redhat
BZ #622569, #636213, and #694602

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: don't set queue_if_no_path without multipathd
Benjamin Marzinski [Mon, 26 Sep 2011 14:50:58 +0000 (09:50 -0500)]
multipath: don't set queue_if_no_path without multipathd

If multipathd is not running, when all paths to a device have failed, there's
no way for them to automatically get restored.  If the device is set to queue,
whatever is accessing it will hang forever. This can lead to problems if it
happens at boot-up.  This patch unsets queue_if_no_path for all devices created
when multipathd is not running. When multipathd starts, it will automatically
get reset queue_if_no_path to the proper value.  This new behaviour can be
overridden using the new "-q" option to multipath.

This version of the patch contacts multipathd's client socket to tell if it's
running.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
8 years agomultipath: add support for setting oom_score_adj
Benjamin Marzinski [Fri, 23 Sep 2011 14:35:59 +0000 (09:35 -0500)]
multipath: add support for setting oom_score_adj

The oom_adj procfs interface is deprecated. I've added support for using the
new oom_score_adj interface.  The code still falls back to using oom_adj
if oom_score_adj doesn't exist.

Resending, since I was obviously working far too late last night.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
9 years agomultipath-tools: Adding Netapp as a brand name for RDAC
Chauhan, Vijay [Fri, 2 Sep 2011 13:22:46 +0000 (18:52 +0530)]
multipath-tools: Adding Netapp as a brand name for RDAC

Resending this patch. Previous post had indentation issue due to my mail settings.

9 years agoRemove useless alias pointer reset to NULL
Christophe Varoqui [Thu, 1 Sep 2011 19:43:27 +0000 (21:43 +0200)]
Remove useless alias pointer reset to NULL

This is already done by free_multipath()

9 years agomultipath: systemd unit file
Benjamin Marzinski [Thu, 1 Sep 2011 17:08:29 +0000 (12:08 -0500)]
multipath: systemd unit file

Here is a systemd unit file for managing multipathd.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
9 years agomultipath: check setup_multipath return value.
Benjamin Marzinski [Wed, 13 Jul 2011 18:30:42 +0000 (13:30 -0500)]
multipath: check setup_multipath return value.

When setup_multipath() fails, it removes the map. So update_path_groups()
needs check the return value, and fail without touching the map anymore if
setup_multipath() fails.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
9 years agomultipath: strdup multipath alias, so that it isn't deleted
Benjamin Marzinski [Thu, 1 Sep 2011 06:50:54 +0000 (08:50 +0200)]
multipath: strdup multipath alias, so that it isn't deleted

When a multipath device is added to multipathd with ev_add_map(),
the alias is not duplicated, and is freed immediately after ev_add_map()
returns, causing a memory error. This patch corrects that.

9 years agomultipath-tools: service mode changes for RDAC storage
Moger, Babu [Mon, 29 Aug 2011 16:24:37 +0000 (12:24 -0400)]
multipath-tools: service mode changes for RDAC storage

This patch was not picked up yet, so resubmitting it again. There no change except it was generated on top of the latest file.

This patch handles the recent changes in NetApp RDAC storage firmware to report service mode. Firmware changed the inquiry page 0xc9 to report service mode. Purpose this change is to avoid DMMP going into infinite loop of switching back and forth between controllers when a controller is placed in service mode. This fixes the problem and reports the path as failed if the controller is placed in service mode.

Signed-off-by: Babu Moger <babu.moger@netapp.com>
Reviewed-by: Yanling Qi <yanling.qi@netapp.com>
Reviewed-by: Somasundaram Krishnasamy <Somasundaram.Krishnasamy@netapp.com>
9 years agoAdd kpartx example to manpage master/master
Ritesh Raj Sarraf [Wed, 17 Aug 2011 17:40:37 +0000 (23:10 +0530)]
Add kpartx example to manpage

Thanks: Lars Wirzenius
Closes: 637538

Signed-off-by: Ritesh Raj Sarraf <rrs@debian.org>
9 years agofix-linebreaks
Craig [Fri, 19 Aug 2011 22:16:55 +0000 (00:16 +0200)]
fix-linebreaks

Hi,

error messages (DM message failed) in the logs look like this in multipath:

Jul 24 06:17:47 onosendai multipathd: DM message failed [queue_if_no_path
Jul 24 06:17:47 onosendai ]
Jul 24 06:17:47 onosendai multipathd: sdc: alua not supported
Jul 24 06:17:47 onosendai multipathd: sdd: alua not supported
Jul 24 06:17:47 onosendai multipathd: DM message failed [queue_if_no_path
Jul 24 06:17:47 onosendai ]

The patch fixes the unneccessary \n in libmultipath/devmapper.c

Best regards,

Craig

>From bb1354f917b7bd205605a41016e0a3e1aff6feac Mon Sep 17 00:00:00 2001
From: craig <craig@haquarter.de>
Date: Sun, 24 Jul 2011 06:38:55 +0200
Subject: [PATCH] fix linebreaks

9 years agoRemove prio_callout as a valid option from man page
Oren Held [Sun, 21 Aug 2011 10:05:22 +0000 (13:05 +0300)]
Remove prio_callout as a valid option from man page

Signed-off-by: Oren Held <orenhe@il.ibm.com>
9 years agomultipath-tools: Manual failback fix when priority changes
Moger, Babu [Fri, 27 May 2011 14:30:19 +0000 (10:30 -0400)]
multipath-tools: Manual failback fix when priority changes

Current code switches the path-group when there is a change in priority. However,
this is not the right thing to do when failback is set to manual. This patch fixes
this problem. Call update_path_groups only if failback is immediate.

Signed-off-by: Babu Moger <babu.moger@netapp.com>
9 years agoFix hang on reconfigure CLI command
Christophe Varoqui [Wed, 25 May 2011 21:21:42 +0000 (23:21 +0200)]
Fix hang on reconfigure CLI command

Restore the vector locking outside the reconfigure() function.
Moving it inside caused a double-lock hang situation. The
first locker being uxsock_trigger(), caller of reconfigure().

Discussion on-going on wether we'd better stop locking from
uxsock_trigger().

9 years agoUse refcounting for sysfs devices
Hannes Reinecke [Wed, 25 May 2011 12:40:42 +0000 (14:40 +0200)]
Use refcounting for sysfs devices

As we're caching sysfs devices we need to introduce some sort
of refcounting here. Otherwise the device might be removed from
other threads while we're still accessing it.

References: bnc#642846

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agomultipathd: Do not attempt to rename a device
Hannes Reinecke [Wed, 25 May 2011 12:40:31 +0000 (14:40 +0200)]
multipathd: Do not attempt to rename a device

If a device-mapper device got renamed we should be notified
via the waiter thread; no need to do it in the main loop.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoRace condition when calling stop_waiter_thread()
Hannes Reinecke [Wed, 25 May 2011 12:40:19 +0000 (14:40 +0200)]
Race condition when calling stop_waiter_thread()

We cannot access the waiter structure from other threads as
the lifetime is totally different and it might be deleted
at any time.
So we better store the pthread id in the calling thread and
just send a signal to the thread.

References: bnc#642846

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoQuick and dirty adaption of the debian startup file
Christophe Varoqui [Wed, 25 May 2011 12:04:35 +0000 (14:04 +0200)]
Quick and dirty adaption of the debian startup file

For the pidfile is no longer created.

9 years agoFix segfault in dm reassign code path
Christophe Varoqui [Wed, 25 May 2011 12:00:52 +0000 (14:00 +0200)]
Fix segfault in dm reassign code path

alias is allocated and freed in multipathd/main.c:uev_add_map().

Don't free it in ev_add_map() called from uev_add_map() to avoid
double free.

9 years agoSet an internal default for feature
Christophe Varoqui [Wed, 25 May 2011 11:59:53 +0000 (13:59 +0200)]
Set an internal default for feature

Fix segfault when no /etc/multipath.conf is present.

9 years agoRevert "Add 'max_polling_interval' config variable"
Christophe Varoqui [Wed, 25 May 2011 09:43:58 +0000 (11:43 +0200)]
Revert "Add 'max_polling_interval' config variable"

This reverts commit efc8ace4b335e752a7d28aca6040af0f9fe37530.

Spurious patch in Hannes branch

9 years agoMerge remote-tracking branch 'hannes/for-christophe'
Christophe Varoqui [Wed, 25 May 2011 06:35:34 +0000 (08:35 +0200)]
Merge remote-tracking branch 'hannes/for-christophe'

Conflicts:
multipathd/main.c

9 years agoReload map for device read-only setting changes hannes/for-christophe
Hannes Reinecke [Thu, 4 Dec 2008 13:20:06 +0000 (14:20 +0100)]
Reload map for device read-only setting changes

Whenever the read-only setting for a device changes we have
to reload the map. This patch implements the required cli command
and also a uevent handler if a uevent with 'DISK_RO=' setting
has been received.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoIncrease priority value for emc priority callout
Hannes Reinecke [Fri, 20 Mar 2009 09:30:04 +0000 (10:30 +0100)]
Increase priority value for emc priority callout

For non-default paths the emc priority callout should
not return '0', as this will inhibit the daemon to switch
paths. And we should be returning 'PRIO_UNDEF' in the
case of failure.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoAllow dev_loss to be set to 'infinity'
Hannes Reinecke [Wed, 18 May 2011 13:33:18 +0000 (15:33 +0200)]
Allow dev_loss to be set to 'infinity'

With this patch we can set dev_loss to infinity, so that
failed devices will never removed from the system.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoUpdate manpages
Hannes Reinecke [Wed, 18 May 2011 12:29:07 +0000 (14:29 +0200)]
Update manpages

The man pages are in dire need of updating. Do it now.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agomultipath: add '-t' option to dump internal hwtable
Hannes Reinecke [Mon, 30 Apr 2007 07:37:38 +0000 (09:37 +0200)]
multipath: add '-t' option to dump internal hwtable

This patch adds an option '-t' to dump the internal hardware table.
Quite handy if you want to know the default settings.
In doing so it also fixes the keyword allocation; currently the
keywords are only initialised if a configuration file is used.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoReassign existing device-mapper maps
Hannes Reinecke [Wed, 18 May 2011 12:02:00 +0000 (14:02 +0200)]
Reassign existing device-mapper maps

When a multipath device is created other maps might already be
in place pointing to the same block device. To ensure uninterrupted
access these maps should be reassigned to point to the
multipath devices instead.
This patch also adds a configuration variable 'reassign_maps'
to toggle this behaviour.

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