multipath-tools/.git
9 years agoImplement 'bindings_file' option
Hannes Reinecke [Wed, 23 Jul 2008 08:42:16 +0000 (10:42 +0200)]
Implement 'bindings_file' option

Early in boot /var might not be accessible, so this patch implements
a 'bindings_file' option which allows to place the persisting bindings
file at a different location.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agokpartx: Intendation fix in devmapper.c
Hannes Reinecke [Fri, 13 May 2011 07:55:54 +0000 (09:55 +0200)]
kpartx: Intendation fix in devmapper.c

Wrong intendation.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoUse regmatch when checking for duplicates in hwtable
Hannes Reinecke [Thu, 5 May 2011 06:53:43 +0000 (08:53 +0200)]
Use regmatch when checking for duplicates in hwtable

When elimininating duplicates in the config file we should
rather be using regmatch, otherwise it's near to impossible to
guess how the actual regexp in the built-in hardware table
is specified.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoUpdate hwtable factorization
Hannes Reinecke [Thu, 5 May 2011 06:35:01 +0000 (08:35 +0200)]
Update hwtable factorization

During hwtable factorization we should _not_ merge the entries,
as the original entries might be regular expressions. Thus they
might match more devices than the new, user-provided one.
So during factorization we should _not_ remove duplicate
entries, but rather update the new entries with the missing
defaults and scan the table backwards.
With this we'll be using the modified entries for the matching
devices _only_, leaving all others intact.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoSpecify prioritizer in the multipath section, too
Hannes Reinecke [Wed, 4 May 2011 09:56:40 +0000 (11:56 +0200)]
Specify prioritizer in the multipath section, too

We should allow to set the prioritizer in the multipath section,
too, as some arrays might be configured to run in different
modes.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoStatic Load balancing prioritizer
Hannes Reinecke [Wed, 4 May 2011 09:38:53 +0000 (11:38 +0200)]
Static Load balancing prioritizer

'Weighted path' is a new path prioritizer for device mapper
multipath, where specific paths and the corresponding priority
values can be provided as arguments.
This prioritizer assigns the priority value provided in the
configuration file based on the comparison made between the
specified paths and the path instance for which this is called.
Paths can be specified as a regular expression of devname
of the path or as hbtl information of the path.

Syntax:
weightedpath  <hbtl|devname> <regex1> <prio1> <regex2> <prio2> ...

Examples:
prio  "weightedpath"
prio_args "hbtl 1:.:.:. 2 4:.:.:. 4"

prio  "weightedpath"
prio_args "devname sda$ 10 sde$ 20"

This prioritizer allows user to set static load balancing
for devices. Useful when user has prior knowledge of path
performance difference or unavailability of certain paths.

Signed-off-by: Vijayakumar Balasubramanian <vijaykumar@hp.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoSynchronize dm states for IO errors
Hannes Reinecke [Thu, 20 Mar 2008 09:50:40 +0000 (10:50 +0100)]
Synchronize dm states for IO errors

When a real hardware IO error occurs, the path checker will return
PATH_UP, causing the dm state from the kernel never to be updated.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoAdd 'max_polling_interval' config variable
Hannes Reinecke [Mon, 1 Feb 2010 08:46:57 +0000 (09:46 +0100)]
Add 'max_polling_interval' config variable

We should be able to set the 'max_polling_interval' variable
manually. Especially systems requiring precise failover timing
will want to disable the automatic polling interval increase.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agolibmultipath: do not access dm structures after dm_task_destroy
Hannes Reinecke [Thu, 17 Feb 2011 08:05:57 +0000 (09:05 +0100)]
libmultipath: do not access dm structures after dm_task_destroy

device-mapper has the habit of freeing up all internal structures
after dm_task_destroy. So we shouldn't try to access any of these
later on.

References: bnc#672857

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoCorrectly remove logical partition maps
Hannes Reinecke [Thu, 28 Jan 2010 14:31:02 +0000 (15:31 +0100)]
Correctly remove logical partition maps

kpartx will generate logical partition maps inside maps for the
extended partition. So we need to update multipath -f to handle
this situation.

Signed-off-by: Cong Meng <cmeng@novell.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agordac checker: Whitespace cleanup
Hannes Reinecke [Wed, 4 May 2011 06:29:27 +0000 (08:29 +0200)]
rdac checker: Whitespace cleanup

Some whitespace fixes for rdac checker.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agolibmultipath: Fix possible string overflow
Hannes Reinecke [Tue, 3 May 2011 14:27:29 +0000 (16:27 +0200)]
libmultipath: Fix possible string overflow

basenamecpy() and devt2devname() need to be passed in the
length of the string into which the modified value should
be copied. Otherwise a string overflow can be induced.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoMore debugging output for feature changes
Hannes Reinecke [Tue, 3 May 2011 14:13:16 +0000 (16:13 +0200)]
More debugging output for feature changes

Add some more debugging output to track feature changes.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoFixup debugging in dmparser.c
Hannes Reinecke [Tue, 3 May 2011 15:04:27 +0000 (17:04 +0200)]
Fixup debugging in dmparser.c

Update all call to 'fprintf' to use condlog().
And add some more debugging output.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoCorrectly update feature strings
Hannes Reinecke [Tue, 3 May 2011 13:55:39 +0000 (15:55 +0200)]
Correctly update feature strings

The 'features' string might contain arbitrary features,
so we shouldn't assume anything here.
This patch implements a parser for properly adding
and removing selected features whilst keeping the
'features' string syntactically correct.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoSelect 'features' from multipath configuration
Hannes Reinecke [Fri, 13 Mar 2009 14:21:29 +0000 (15:21 +0100)]
Select 'features' from multipath configuration

For some setups we need to set the 'features' keyword from the
multipath configuration setting.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoIncrease uevent buffer size
Hannes Reinecke [Wed, 4 Mar 2009 12:36:46 +0000 (13:36 +0100)]
Increase uevent buffer size

The default kernel buffer size for uevent has been increased to
2k, we should be doing this in multipath, too.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agolibmultipath: remove strcmp_chomp()
Hannes Reinecke [Thu, 27 May 2010 13:02:56 +0000 (15:02 +0200)]
libmultipath: remove strcmp_chomp()

We can as well sanitize the strings before calling
find_path_by_devt(), thus removing the need for
strcmp_chomp() altogether.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoRemove sysfs_lookup_devpath_by_subsys_id()
Hannes Reinecke [Tue, 3 May 2011 09:14:26 +0000 (11:14 +0200)]
Remove sysfs_lookup_devpath_by_subsys_id()

Unused, should be removed.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agolibmultipath: resolve hash collisions in pgcmp()
Hannes Reinecke [Tue, 3 May 2011 11:45:49 +0000 (13:45 +0200)]
libmultipath: resolve hash collisions in pgcmp()

pgcmp() is using a simple xor algorithm for hashing. Main intention
here is to have a quick comparison if two paths are identical.
However, this algorithm is prone to hash collisions, so even if
two hashes match we should still check the individual paths to
avoid collisions.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agolibmultipath: correct path count in setup_map()
Hannes Reinecke [Fri, 18 Feb 2011 07:25:59 +0000 (08:25 +0100)]
libmultipath: correct path count in setup_map()

We should be counting both, UP and GHOST paths when counting the
number of available paths. Otherwise the count might become
negative and multipath would never switch into recovery mode.

References: bz#677821

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoMake status variable local
Hannes Reinecke [Tue, 3 May 2011 11:47:13 +0000 (13:47 +0200)]
Make status variable local

The 'status' structure field in struct multipath can also be made
local.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoMake params variable local
Hannes Reinecke [Thu, 22 Oct 2009 14:25:57 +0000 (16:25 +0200)]
Make params variable local

The 'params' structure field in struct multipath is a purely local
variable, and as such shouldn't be part of the main structure.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agomultipath segfaults if configuration file contains errors
Hannes Reinecke [Thu, 5 Nov 2009 13:52:05 +0000 (14:52 +0100)]
multipath segfaults if configuration file contains errors

This patch prevents multipath from crashing on invalid
configuration file when mandatory configuration values
are missing.

References: bnc#540118

Signed-off-by: Leonardo Chiquitto <lchiquitto@novell.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoUse '--replace-whitespace' option for scsi_id
Hannes Reinecke [Wed, 27 Jan 2010 07:48:11 +0000 (08:48 +0100)]
Use '--replace-whitespace' option for scsi_id

Some SCSI devices will return an identifier with spaces in it.
As we're using this name as the default device-mapper name we
should be reformatting it to replace all spaces with underscores
so as not to confuse device-mapper.

References: bnc#572209

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoAsynchronous mode for tur checker
Hannes Reinecke [Tue, 3 May 2011 08:30:47 +0000 (10:30 +0200)]
Asynchronous mode for tur checker

When a path is going down I/O will stall until the underlying
device becomes unblocked. This will stall the entire checker loop
and cause severe delays.
This patch implements an asynchronous mode for the 'TUR' checker,
whereby the actual ioctl is executed in its own thread. The
checkerloop then just examines the state of this separate thread
and can continue even if the ioctl is blocked.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoMove setup_thread_attr() to uevent.c
Hannes Reinecke [Tue, 3 May 2011 08:29:28 +0000 (10:29 +0200)]
Move setup_thread_attr() to uevent.c

The function will be used by other instances, too, so move it
over to the library.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoTUR checker should not return 'failed' for reservation conflict
Hannes Reinecke [Wed, 16 Sep 2009 10:23:30 +0000 (12:23 +0200)]
TUR checker should not return 'failed' for reservation conflict

Some SCSI-3 arrays might return 'Reservation conflict' even
for TEST UNIT READY. But this doesn't indicate that the path
is faulty. So we should return the proper status here.

References: bnc#498413

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agodirectio: Reset 'running' parameter
Hannes Reinecke [Fri, 18 Jun 2010 10:34:43 +0000 (12:34 +0200)]
directio: Reset 'running' parameter

Upon failure the 'running' parameter is not updated correctly,
which might cause the directio checker to always report failure.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoUse timeout parameter for directio
Hannes Reinecke [Tue, 3 May 2011 07:07:52 +0000 (09:07 +0200)]
Use timeout parameter for directio

As checkers now have a timeout we should be using this one for
directio, too.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agolibmultipath: check argument length in execute_program()
Hannes Reinecke [Wed, 2 Jun 2010 10:49:37 +0000 (12:49 +0200)]
libmultipath: check argument length in execute_program()

The 'path' argument of execute_program() is actually an
array with fixed length. So we should be using the same
length here to avoid overflows. And we should check the
number or arguments, too, as the list we're using is
static, too.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoreadsector0: block count calculation wrong
Hannes Reinecke [Tue, 3 May 2011 08:06:59 +0000 (10:06 +0200)]
readsector0: block count calculation wrong

readsector0/libsg is getting the number of blocks wrong, as it
doesn't check the length of the buffer.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agocheckers: argument paranoia
Hannes Reinecke [Mon, 2 May 2011 14:11:50 +0000 (16:11 +0200)]
checkers: argument paranoia

After suffering from the umpteenth crash it's time to add
argument validation to checkers.c

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoUse refcounting for checkers
Hannes Reinecke [Mon, 26 Apr 2010 08:15:05 +0000 (10:15 +0200)]
Use refcounting for checkers

The checkers are not accessed directly but rather via private
copies of the original instance. However, the pointers in the
private copy point to the original ones, making them potentially
invalid when the original instance is deleted.
So we need to introduce proper refcounting here.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agokpartx: Add option '-f' to force devmap creation
Hannes Reinecke [Mon, 6 Dec 2010 07:38:10 +0000 (08:38 +0100)]
kpartx: Add option '-f' to force devmap creation

Under some circumstances the user needs to override the
'no_partitions' feature of a multipath device.
This patch adds an option '-f' to facilitate this.

Signed-off-by: Libor Pechacek <lpechacek@novell.com>
Acked-by: Hannes Reinecke <hare@suse.de>
9 years agoAdd 'no_partitions' feature
Hannes Reinecke [Wed, 23 Jul 2008 12:15:12 +0000 (14:15 +0200)]
Add 'no_partitions' feature

The 'no_partitions' feature serves as a trigger for kpartx for not
creating any partitions on that device. This is required if eg
the device is used as a system disk for VM guests.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoImplement 'update' option for kpartx
Hannes Reinecke [Fri, 21 Aug 2009 13:57:55 +0000 (15:57 +0200)]
Implement 'update' option for kpartx

Currently kpartx only knows about 'add' or 'remove'; however,
it should also be invoked when someone had changed the partition
table. Only in this case it should do a combination of both,
namely add new partition mappings and remove stale ones.
Hence an 'update' option is required.

Signed-off-by: Petr Uzel <puzel@novell.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agokpartx: Indentation fix
Hannes Reinecke [Mon, 2 May 2011 13:44:43 +0000 (15:44 +0200)]
kpartx: Indentation fix

Another small step in the neverending war between
indents and spaces.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoAdd compability flag LIBDM_API_COOKIE
Hannes Reinecke [Tue, 3 May 2011 07:38:30 +0000 (09:38 +0200)]
Add compability flag LIBDM_API_COOKIE

Newer device-mapper versions use 'cookies' to synchronize with udev.
As this is not available with older versions we need to add stubs
to make it compile on older versions.
And we only need to update the device-mapper version in
dm_lib_prereq() if the flag is set.

Signed-off-by: Hannes Reinecke <hare@suse.de>
9 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/storage/multipath-tools/
Hannes Reinecke [Mon, 2 May 2011 10:03:21 +0000 (12:03 +0200)]
Merge branch 'master' of git://git./linux/storage/multipath-tools/

9 years agomultipath: clear checker message
Benjamin Marzinski [Wed, 27 Apr 2011 19:52:14 +0000 (14:52 -0500)]
multipath: clear checker message

Clear the checker message at the start of get_state, so that stale checker
messages aren't accidentally printed.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
9 years agomultipath: rename netapp.c to ontap.c
Benjamin Marzinski [Wed, 27 Apr 2011 03:23:57 +0000 (22:23 -0500)]
multipath: rename netapp.c to ontap.c

This is the second part of the NetApp patch from George Martin. It simply
renames netapp.c to ontap.c and edits the Makefile to build it.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
9 years agomultipath: changes to NetApp's prioritizer
Benjamin Marzinski [Mon, 25 Apr 2011 04:02:59 +0000 (23:02 -0500)]
multipath: changes to NetApp's prioritizer

This is a patch sent to me by Martin George from NetApp. It changes the
prioriziter name from netapp to ontap, and adds some minor enchancements to
the prioritizer. I can send another patch to change the file names to match,
but that makes it harder to see the full file history in git.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
9 years agomultipath: recheck all priorities when a path comes back up
Benjamin Marzinski [Mon, 25 Apr 2011 03:48:00 +0000 (22:48 -0500)]
multipath: recheck all priorities when a path comes back up

For group_by_prio paths, when a path goes down, its possible that the
priorities of the paths will be readjusted, and the multipath device will be
reloaded with a different path layout. However, downed paths don't get their
priority checked, so when the path comes back up and the original priorities
are restored, multipathd may not notice that the path layout needs to be
recalculated. This patch makes multipathd recalculate the the priorities of all
the paths when a path is restored, and reloads the map if any of them have
changed.  Also, when a path is restored, multipathd checks twice in
check_path if the pathgroup needs switching.  This should only happen once.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
9 years agomultipathd: use 0 for initial pg if there are no priority groups
Mike Snitzer [Wed, 20 Apr 2011 21:24:00 +0000 (17:24 -0400)]
multipathd: use 0 for initial pg if there are no priority groups

dm-multipath now accommodates a DM table that doesn't have any priority
groups, see: http://git.kernel.org/linus/a490a07a67b7a37

That kernel change imposes that multipathd must pass 0 for the initial
priority group if there aren't any priority groups (currently passes 1).

There is no need to check the multipath target version to decide whether
to pass an initial_pg of 0 or 1 because until recently dm-multipath
never accommodated a DM table with no priority groups.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
9 years agomultipath-tools: Add new NEC diskarray to internal hardware table
Jun'ichi Nomura [Wed, 20 Apr 2011 09:20:09 +0000 (18:20 +0900)]
multipath-tools: Add new NEC diskarray to internal hardware table

Hi Christophe,

This patch adds an entry for new NEC Storage M series to internal hwtable.

Could you include this change in your tree?

Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
9 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/storage/multipath-tools/
Hannes Reinecke [Fri, 15 Apr 2011 12:01:25 +0000 (14:01 +0200)]
Merge branch 'master' of git://git./linux/storage/multipath-tools/

9 years agoRemove tmp loopdev created by 'kpartx -l' if no partitions were found
Benjamin Marzinski [Sat, 9 Apr 2011 08:03:22 +0000 (10:03 +0200)]
Remove tmp loopdev created by 'kpartx -l' if no partitions were found

9 years agomultipath-tools: report different piority value for rdac if io-shipping is enabled
Moger, Babu [Fri, 8 Apr 2011 19:06:15 +0000 (13:06 -0600)]
multipath-tools: report different piority value for rdac if io-shipping is enabled

This patch adds code to report different priority value if the storage is configured with io-shipping.
It sets  the bit 3 if io-shipping is enabled. This is to differentiate between different modes.

Signed-off-by: Babu Moger <babu.moger@lsi.com>
Reviewed-by : Yanling Qi <yanling.qi@lsi.com>
Reviewed-by : Somasundaram Krishnasamy <Somasundaram.Krishnasamy@lsi.com>

9 years agomultipath-tools: report PATH_UP for both path groups in rdac if io-shipping is enabled
Moger, Babu [Fri, 8 Apr 2011 19:04:45 +0000 (13:04 -0600)]
multipath-tools: report PATH_UP for both path groups in rdac if io-shipping is enabled

This patch reports PATH_UP for both the path groups if the RDAC storage is configured with i/o shipping.

Signed-off-by: Babu Moger <babu.moger@lsi.com>
Reviewed-by: Yanling Qi <yanling.qi@lsi.com>
Reviewed-by: Somasundaram Krishnasamy <Somasundaram.Krishnasamy@lsi.com>
9 years agomultipath-tools: Set the rdac TAS bit if it changeable
Moger, Babu [Fri, 8 Apr 2011 19:02:44 +0000 (13:02 -0600)]
multipath-tools: Set the rdac TAS bit if it changeable

This patch sets the rdac TAS bit if it is changeable. This is called only once
per lun during the discovery.
The Task Aborted Status (TAS) bit in Control Mode Page (Page 0x0A) controls
the behavior of aborted tasks. By default, the TAS bit is set to zero. The
rdac checker should issue a mode sense page 0x0A to determine the TAS bit
value and whether or not the TAS bit is changeable. If the TAS bit is set
to 0 and changeable, the rdac checker should issue a mode select page 0x0A
to change TAS to 1 and save it.

Signed-off-by: Babu Moger <babu.moger@lsi.com>
Reviewed-by  : Yanling Qi <yanling.qi@lsi.com>
Reviewed-by  : Somasundaram Krishnasamy <Somasundaram.Krishnasamy@lsi.com>

9 years agomultipath: Retry host transient errors for rdac checker
Moger, Babu [Tue, 1 Mar 2011 19:08:24 +0000 (12:08 -0700)]
multipath: Retry host transient errors for rdac checker

Sometimes if the host is in transient state, we need to wait till the devloss timeout to
expire before switching path group. We have seen in some cases path group switch happens
even before the devloss timeout expire. This patch fixes the problem for rdac checker..

Signed-off-by: Babu Moger <babu.moger@lsi.com>
9 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/storage/multipath-tools/
Hannes Reinecke [Tue, 8 Feb 2011 08:24:46 +0000 (09:24 +0100)]
Merge branch 'master' of git://git./linux/storage/multipath-tools/

9 years agomultipath: add allow users to set revision in multipath.conf
Benjamin Marzinski [Mon, 20 Dec 2010 06:02:09 +0000 (00:02 -0600)]
multipath: add allow users to set revision in multipath.conf

Since multipath is able to select hardware entries based on the revision
parameter, users should be allowed to set it in their devices configurations.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
9 years ago[lib] respect LDFLAGS, correct linking order
Kacper Kowalik [Wed, 2 Feb 2011 17:17:54 +0000 (18:17 +0100)]
[lib] respect LDFLAGS, correct linking order

current HEAD of libmultipath  fails to build with -Wl,--as-needed[1] and
doesn't respect LDFLAGS when creating shared libs.
I've attached a patch to fix those issues.

9 years agoadd -r to make resulting device read-only
Ritesh Raj Sarraf [Wed, 2 Feb 2011 14:21:46 +0000 (19:51 +0530)]
add -r to make resulting device read-only

This patch adds the ability to create targets which are read-only to
keep from accidentally modifying the newly created device.  In some cases,
mounting with -o ro still modifies the device (in the case of ext3
filesystems).  I created a small patch that will do this.  I have tested it
only to the point that using -a with or without -r produces the desired
effects.

Signed-off-by: Ritesh Raj Sarraf <rsarraf@netapp.com>
Signed-off-by: Wakko Warner <wakko@animx.eu.org>
9 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/storage/multipath-tools/
Hannes Reinecke [Tue, 1 Feb 2011 08:54:31 +0000 (09:54 +0100)]
Merge branch 'master' of git://git./linux/storage/multipath-tools/

9 years agoFix Malahal Naineni commit 2b68b83 review highlights
Christophe Varoqui [Tue, 1 Feb 2011 08:53:20 +0000 (09:53 +0100)]
Fix Malahal Naineni commit 2b68b83 review highlights

1/ use local stack allocation in dm_drv_get_rq() and dm_drv_prereq()

2/ don't pass argument to dm_drv_prereq() as it's dm-multipath specific

Also rename dm_drvprereq() to dm_drv_prereq() and dm_libprereq() to
dm_lib_prereq() for consistency with dm_drv_get_rq() naming.

9 years ago[lib] Fix reversion of dm_drvprereq() return codes
Christophe Varoqui [Mon, 31 Jan 2011 23:52:02 +0000 (00:52 +0100)]
[lib] Fix reversion of dm_drvprereq() return codes

9 years agoSupport different 'minio' values for rq and bio based dm-multipath
Christophe Varoqui [Mon, 31 Jan 2011 23:21:17 +0000 (00:21 +0100)]
Support different 'minio' values for rq and bio based dm-multipath

rq based dm-multipath wants a low minio value for optimal performance
(1-2?) whereas bio-based dm-multipath wants a greater value (128-1000)

Introduce a internal DEFAULT_MINIO_RQ set to 1, and new configuration
parameter name 'rr_min_io_rq' useable in 'default', 'device' and
'multipath' sections. The internal hardware table entries also have
the new 'minio_rq' field.

When dm-multipath driver version is detected >= 1.1.0, only the
rr_min_io_rq (cf), minio_rq (hwe) and DEFAULT_MINIO_RQ (default) are
used. Else, preserve the legacy behaviour.

9 years ago[lib] Add missing prototype for vector_move_up()
Christophe Varoqui [Mon, 31 Jan 2011 21:28:25 +0000 (22:28 +0100)]
[lib] Add missing prototype for vector_move_up()

9 years agoIn case of not connected device, only first condition is checked for PQ in rdac path...
Chaskiel Grundman [Wed, 8 Dec 2010 06:40:13 +0000 (07:40 +0100)]
In case of not connected device, only first condition is checked for PQ in rdac path checker. This patch
corrects the check by masking MSB 3 bits and comparing it with 0x20.

Signed-off-by: Vijay Chauhan <vijay.chauhan@lsi.com>
9 years agomake "show config" show the whole config
Benjamin Marzinski [Tue, 7 Dec 2010 22:44:41 +0000 (23:44 +0100)]
make "show config" show the whole config

Show config wasn't displaying particularly useful results. It only showed
the configuration values if they were different from what they would default
to.  This made it harder for users to figure out how multipath was actually
configured. If multipath.conf.defaults was not uptodate, they were
occasionally forced to read the source, wade through debugging output, or
find out experimentally.  Even more confusing, after looking at the devices
section, users would mistakenly believe that a device didn't set any value
for an attribute, because the device had it configured to the same thing
as the defaults section.  Only after the user tried to change the value
by editting the defaults section, would the attribute appear the devices
section. This has caused some annoyance.

This patch makes the defaults section print out all the default configuration
values, unless they really do have an undefined value when left unconfigured.
For the multipaths and hardware handler sections, all attributes that are
configured are printed.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
9 years agomultipath: standardize on path_selector
Benjamin Marzinski [Fri, 3 Dec 2010 23:58:46 +0000 (17:58 -0600)]
multipath: standardize on path_selector

Since the devices and multipaths sections of multipath.conf use
"path_selector", set the defaults section to use it was well, instead of
"selector".

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
9 years agomultipath: update multipathd man page
Benjamin Marzinski [Fri, 3 Dec 2010 23:32:53 +0000 (17:32 -0600)]
multipath: update multipathd man page

Add missing items to the multipathd man page.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
9 years agomultipath: add checker_timeout default config option
Benjamin Marzinski [Fri, 19 Nov 2010 04:34:11 +0000 (22:34 -0600)]
multipath: add checker_timeout default config option

Due to errors with some storage arrays, occasionally a scsi request will get
competely dropped. When this happens, fast_io_fail_tmo and dev_loss_tmo don't
get triggered, and a sychronous checker function might have to wait for the
full timeout.  Right now those timeouts are hard-coded to 5 minutes.  This
patch changes them to use the scsi cmd timeout,
/sys/block/sd<x>/device/timeout, by default.  This can be overridden by the new
default config parameter, checker_timeout, so that user can manually set
an upper bound on how long a sychronous checker might be blocked, without
modifying the generic scsi cmd timeout.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
9 years agomultipath: update default configurations
Benjamin Marzinski [Fri, 19 Nov 2010 03:33:18 +0000 (21:33 -0600)]
multipath: update default configurations

Here are some default configuration changes that I've been sent.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
9 years agomultipath: clean up path orphaning and adoption
Benjamin Marzinski [Sun, 14 Nov 2010 21:02:14 +0000 (15:02 -0600)]
multipath: clean up path orphaning and adoption

Make sure that multipathd orphans paths when they don't get included in maps,
to reset them to a consistent state, and make sure that multipath adopts paths
that get picked up during a table reload. However, multipathd shouldn't change
the state or priority of paths when it's updating due to a table reload,
since this can interfere with the checkerloop.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
9 years agomultipath: sort all pathgroups by priority
Benjamin Marzinski [Wed, 10 Nov 2010 18:52:20 +0000 (12:52 -0600)]
multipath: sort all pathgroups by priority

Right now, the only path grouping policy that sorts pathgroups by priority is
group_by_prio.  For the others, the pathgroups are setup in the order that
their paths are discovered.  This can cause a problem when the kernel needs to
switch pathgroups, such as when a path fails.  The kernel will simply pick the
first valid pathgroup.  If failback isn't set to manual, this can cause
needless pathgroup switching.  Even worse, with failback set to manual, which
is the default, the kernel will just continue to use the non-optimal pathgroup
until it fails.  This patch makes all path grouping policies except multibus
sort the pathgroups by priority.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
9 years agodm-multipath: typo, strncat instead of strncpy
Malahal Naineni [Wed, 28 Jul 2010 00:46:19 +0000 (17:46 -0700)]
dm-multipath: typo, strncat instead of strncpy

strncat here doesn't seem right, strncpy should be correct!

Signed-off-by: Malahal Naineni (malahal@us.ibm.com)
PS: But why bother correcting an entry that is going to be deleted
anyway? IMO, just deleting the strncat/strncpy line should be fine too.
Any comments???

10 years agoSet geometry information for multipath maps
Hannes Reinecke [Fri, 18 Jun 2010 10:32:21 +0000 (12:32 +0200)]
Set geometry information for multipath maps

Some programs (most notably grub) try to get the device geometry
information via the HDIO_GETGEO ioctl. While device-mapper provides
this ioctl, it's values have to be set previously.
So we can just use the geometry information from the first path
to set this information for the multipath map.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agoSet geometry information for multipath maps
Hannes Reinecke [Fri, 18 Jun 2010 10:32:21 +0000 (12:32 +0200)]
Set geometry information for multipath maps

Some programs (most notably grub) try to get the device geometry
information via the HDIO_GETGEO ioctl. While device-mapper provides
this ioctl, it's values have to be set previously.
So we can just use the geometry information from the first path
to set this information for the multipath map.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/storage/multipath-tools/
Hannes Reinecke [Tue, 30 Nov 2010 07:29:13 +0000 (08:29 +0100)]
Merge branch 'master' of git://git./linux/storage/multipath-tools/

10 years agolibmultipath: fix snprintf buffer overflows
Tim Harder [Sun, 28 Nov 2010 21:12:30 +0000 (13:12 -0800)]
libmultipath: fix snprintf buffer overflows

Hi,

I've attached a patch against the latest git version of multipath-tools
to fix a couple snprintf buffer overflows.

Thanks,
Tim

>From 2d51194853342ba24f3b76e9343b8467a8e55400 Mon Sep 17 00:00:00 2001
From: Tim Harder <radhermit@gentoo.org>
Date: Sun, 28 Nov 2010 12:37:08 -0800
Subject: [PATCH] libmultipath: fix snprintf buffer overflows

10 years agomultipath-tools overflow
Arkadiusz Miskiewicz [Sat, 27 Nov 2010 18:21:21 +0000 (19:21 +0100)]
multipath-tools overflow

On Saturday 27 of November 2010, you wrote:

[...]

> the whole logarea is memset to 0 by logarea_init(), and each dequeued
> message is also memset to 0 by log_dequeue(), so it seems normal that
> msg->str value is 0x0, but it's really its address that matters.

Ok, got it. Pointers, memory areas in my debugging session - are looking
good then.

>
> It's not clear to me : are you actually hitting a bug or is it your
> debug session that puzzles you ?

I'm hitting a bug. multipathd dies for me at that strcpy(). Now I think
the bug is strcpy usage instead of memcpy because I'm building with
-O2 -D_FORTIFY_SOURCE=2 which turns on special glibc overflow
detection.

That detection seem to be smart enough to know that &str area is not
a string memory and aborts the program.

Found similar problem discussed here
http://sourceware.org/ml/binutils/2005-11/msg00308.html

glibc aborts the program:
[pid 13432] writev(2, [{"*** ", 4}, {"buffer overflow detected", 24},
{" ***: ", 6}, {"/home/users/arekm/rpm/BUILD/multipath-tools-0.4.9
/multipathd/multipathd", 71}, {" terminated\n", 12}], 5) = 117

same for valgrind:
**13436** *** strcpy_chk: buffer overflow detected ***: program terminated
==13436==    at 0x4024997: VALGRIND_PRINTF_BACKTRACE (valgrind.h:4477)
==13436==    by 0x40265F8: __strcpy_chk (mc_replace_strmem.c:781)
==13436==    by 0x40EDC06: log_enqueue (string3.h:107)
==13436==    by 0x40ED68A: log_safe (log_pthread.c:24)
==13436==    by 0x40E296A: dlog (debug.c:36)
==13436==    by 0x804ECEC: pidfile_create (pidfile.c:37)
==13436==    by 0x804E731: main (main.c:1424)

The bug is not visible if I run multipathd in debug mode (-d).

This patch fixes the problem for me by avoiding false positive on strcpy_chk.

10 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/storage/multipath-tools/
Hannes Reinecke [Tue, 16 Nov 2010 09:19:23 +0000 (10:19 +0100)]
Merge branch 'master' of git://git./linux/storage/multipath-tools/

10 years agoMerge branch 'master' of git+ssh://master.kernel.org/pub/scm/linux/storage/multipath...
Christophe Varoqui [Fri, 5 Nov 2010 07:09:44 +0000 (08:09 +0100)]
Merge branch 'master' of git+ssh:///linux/storage/multipath-tools

10 years agomultipath: fix multipath locking
Benjamin Marzinski [Fri, 5 Nov 2010 04:59:46 +0000 (23:59 -0500)]
multipath: fix multipath locking

In lock_multipath(), if multipathd fails halfway though locking the the path
devices, it doesn't unlock the ones that it already has locked.  This
patch fixes that.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
10 years agode-alloc the buf variable if we fail on the first do_rtpg call
Konrad Rzeszutek [Wed, 3 Nov 2010 22:13:02 +0000 (23:13 +0100)]
de-alloc the buf variable if we fail on the first do_rtpg call

10 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/storage/multipath-tools/
Hannes Reinecke [Tue, 7 Sep 2010 08:42:10 +0000 (10:42 +0200)]
Merge branch 'master' of git://git./linux/storage/multipath-tools/

10 years agoFix for bz #566685.
Benjamin Marzinski [Thu, 2 Sep 2010 08:07:15 +0000 (10:07 +0200)]
Fix for bz #566685.

Multipathd now will reload the device if it notices that the
priorities have changed during the checkerloop.

10 years agoFix for bz #560892.
Benjamin Marzinski [Thu, 2 Sep 2010 07:59:26 +0000 (09:59 +0200)]
Fix for bz #560892.

multipath now prints some warnings if it notices problems
with /etc/multipath.conf.

10 years agooption to multipath to not modify the bindinfs file
Malahal Naineni [Mon, 16 Aug 2010 22:57:02 +0000 (15:57 -0700)]
option to multipath to not modify the bindinfs file

initramfs is mounted read-write causing multipath to update the
initramfs bindings file and name all multipath devices it finds using
friendly names. The actual changes to the file are thrown away as they
are only written to the memory image rather than to the disk image. This
may cause the in memory updated initramfs bindings file inconsistent
with the actual bindings file in the active root file system image when
devices are added or removed.

In other words, the boot time updated initramfs bindings file may have
'uuid1 map to mpatha' and 'uuid2 map to mpathb', but the active root fs
bindings file may have 'uuid1 map to mpathb' and 'uuid2 map to mpatha'

The option, -B, will not modify the bindings file. It will only use the
bindings file if needed.  This option to multipath should be used when
invoked in the initramfs context to avoid the inconsistency.

Signed-off-by: Malahal Naineni (malahal@us.ibm.com)
10 years agomultipath-tools/multipath multipath.conf.5
bmarzins@sourceware.org [Wed, 11 Aug 2010 23:18:45 +0000 (23:18 +0000)]
multipath-tools/multipath multipath.conf.5

CVSROOT: /cvs/dm
Module name: multipath-tools
Branch:  RHEL5_FC6
Changes by: bmarzins@sourceware.org 2010-08-11 23:18:43

Modified files:
multipath      : multipath.conf.5

Log message:
Fix for bz #599686
Small manpage clarification.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath/multipath.conf.5.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.1.2.3&r2=1.1.2.4

10 years agomultipath-tools ./multipath.conf.defaults libm ...
bmarzins@sourceware.org [Mon, 9 Aug 2010 21:35:58 +0000 (21:35 +0000)]
multipath-tools ./multipath.conf.defaults libm ...

CVSROOT: /cvs/dm
Module name: multipath-tools
Branch:  RHEL5_FC6
Changes by: bmarzins@sourceware.org 2010-08-09 21:35:58

Modified files:
.              : multipath.conf.defaults
libmultipath   : hwtable.c

Log message:
Fix for bz565579  New default configurations.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipath.conf.defaults.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.5.4.21&r2=1.5.4.22
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/hwtable.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.20.2.28&r2=1.20.2.29

10 years agomultipath: add fast_io_fail and dev_loss_tmo config parameters
Jun'ichi Nomura [Fri, 30 Jul 2010 09:13:14 +0000 (18:13 +0900)]
multipath: add fast_io_fail and dev_loss_tmo config parameters

Hi,

(03/23/10 11:44), Benjamin Marzinski wrote:
> This patch adds two new configuration parameters to multipath.conf,
> fast_io_fail_tmo and dev_loss_tmo which set
>
> /sys/class/fc_remote_ports/rport-<host>:<channel>-<rport_id>/fast_io_fail_tmo and
> /sys/class/fc_remote_ports/rport-<host>:<channel>-<rport_id>/dev_loss_tmo
...

This is nice feature but the code uses scsi_id instead of rport_id:

> +sysfs_set_scsi_tmo (struct multipath *mpp)
...
> + vector_foreach_slot(mpp->paths, pp, i) {
> + if (safe_snprintf(attr_path, SYSFS_PATH_SIZE,
> +                    "/class/fc_remote_ports/rport-%d:%d-%d",
> +   pp->sg_id.host_no, pp->sg_id.channel,
> +   pp->sg_id.scsi_id)) {
> + condlog(0, "attr_path '/class/fc_remote_ports/rport-%d:%d-%d' too large", pp->sg_id.host_no, pp->sg_id.channel, pp->sg_id.scsi_id);
> + return 1;
> + }

So it sets fast_io_fail_tmo/dev_loss_tmo for wrong rport.

For example, I have a storage with node_id 0x2000003013842bcb
connected via switch, whose node_id is 0x100000051e09ee30.
When I set 'fast_io_fail_tmo = 8' in multipath.conf,
multipath command sets the timeout like this:
  # for f in /sys/class/fc_remote_ports/rport-*/fast_io_fail_tmo; do d=$(dirname $f); echo $(basename $d):$(cat $d/node_name):$(cat $f); done
  rport-0:0-0:0x100000051e09ee30:8
  rport-0:0-1:0x100000051e09ee30:8
  rport-0:0-2:0x2000003013842bcb:off
  rport-0:0-3:0x2000003013842bcb:off
  rport-1:0-0:0x100000051e09ee30:8
  rport-1:0-1:0x100000051e09ee30:8
  rport-1:0-2:0x2000003013842bcb:off
  rport-1:0-3:0x2000003013842bcb:off
As a result, when a link is down for the storage and fast_io_fail_tmo
has passed, I/O will be still blocked.

Attached is a quick patch for this problem.

With this patch, fast_io_fail_tmo is set like this:
  rport-0:0-0:0x100000051e09ee30:8
  rport-0:0-1:0x100000051e09ee30:8
  rport-0:0-2:0x2000003013842bcb:off
  rport-0:0-3:0x2000003013842bcb:off
  rport-1:0-0:0x100000051e09ee30:8
  rport-1:0-1:0x100000051e09ee30:8
  rport-1:0-2:0x2000003013842bcb:off
  rport-1:0-3:0x2000003013842bcb:off

Others might have better idea about resolving rport_id from target.
Mike, Hannes, any comments?

Thanks,
--
Jun'ichi Nomura, NEC Corporation

rport_id != scsi_id

multipath should find rport_id from the target_id.

10 years agoBuild fixes
Heath Kehoe [Mon, 2 Aug 2010 18:33:59 +0000 (20:33 +0200)]
Build fixes

the -L argument for a library must come before the library itself
(otherwise it's going to link against the library in /usr/lib and
not the one in the build directory)

10 years agolibmultipath: simplify dm_get_name()
Hannes Reinecke [Tue, 20 Jul 2010 08:10:29 +0000 (10:10 +0200)]
libmultipath: simplify dm_get_name()

dm_get_name() should just return the device-mapper table
name corresponding to a given uuid. Happily the uuid is
another primary key in the device-mapper hash table, so
we can just use it directly and do not have to loop over
all existing tables.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agoFix typo in coalesce_paths
Hannes Reinecke [Tue, 20 Jul 2010 08:10:25 +0000 (10:10 +0200)]
Fix typo in coalesce_paths

We allocate space for the alias, but never use it.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agolibmultipath: always allocate space for alias
Hannes Reinecke [Tue, 20 Jul 2010 08:10:14 +0000 (10:10 +0200)]
libmultipath: always allocate space for alias

We should always allocating space for alias. This makes
freeing up and allocation tracking far easier.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agomultipath-tools: Intialize pointer passed to get_cmdvec
Christof Schmitt [Thu, 22 Jul 2010 16:36:48 +0000 (18:36 +0200)]
multipath-tools: Intialize pointer passed to get_cmdvec

get_cmdvec can return before the vector argument has been initialized. Fix this
by initializing the pointer before passing it to get_cmdvec. This fixes a
segfault in the interactive mode when hitting the tab key directly on the
command prompt.

Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
10 years agomultipath-tools: Assign correct pointer from REALLOC
Christof Schmitt [Thu, 22 Jul 2010 16:36:47 +0000 (18:36 +0200)]
multipath-tools: Assign correct pointer from REALLOC

Assign the pointer returned from REALLOC to v->slot; this is the memory area to
be changed.

Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
10 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/storage/multipath-tools/
Hannes Reinecke [Tue, 20 Jul 2010 07:19:03 +0000 (09:19 +0200)]
Merge branch 'master' of git://git./linux/storage/multipath-tools/

10 years agoReorder final multipathd linking command to satisfy --as-needed ld flag
Christophe Varoqui [Sun, 18 Jul 2010 22:31:02 +0000 (00:31 +0200)]
Reorder final multipathd linking command to satisfy --as-needed ld flag

Some distributions use --as-needed by default, which make the linker
complain about unresolved dependencies if the libs are positioned
before the object files using their symbols.

Reported by ptchinster (at) archlinux (dot) us

10 years agoAdd alias_prefix to get multipath names based on storage type
Malahal Naineni [Wed, 23 Jun 2010 02:27:33 +0000 (19:27 -0700)]
Add alias_prefix to get multipath names based on storage type

The current multipath tools use "mpath" prefix for all LUNs when
user_friendly_names is set. It would be nice if the names are generated
based on the storage subsystem. For example, all EMC LUNs would be named
emc_a, emc_b, elm_c etc., and all IBM's SVC LUNs would be named svc_a,
svc_b, svc_c. This patch attempts to do that using only multipath.conf.
Patches can be added to the internal hardware table, if needed.

Signed-off-by: Malahal Naineni (malahal@us.ibm.com)
10 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/storage/multipath-tools/
Hannes Reinecke [Tue, 6 Jul 2010 11:05:32 +0000 (13:05 +0200)]
Merge branch 'master' of git://git./linux/storage/multipath-tools/

10 years agoMerge the 'path count' cli command with 'show status'. 0.4.9
Christophe Varoqui [Sat, 22 May 2010 12:01:58 +0000 (14:01 +0200)]
Merge the 'path count' cli command with 'show status'.

Document 'show status' in the multipathd manpage.

10 years agoPrioritizers enhancement
Christophe Varoqui [Fri, 21 May 2010 14:41:30 +0000 (16:41 +0200)]
Prioritizers enhancement

1/ add the 'prio_args' config keyword to allow passing arguments
   to the getprio function

2/ merge the datacore prioritizer. Adapt the legacy datacore
   prioritizer callout to the libprio framework. First use of the
   'prio_args'

3/ fix the 'show config' multipathd cli command to display the
   prio and prio_args values. Also fix a bunch of other values
   affected by the same bug (features, ...).

4/ update docs

5/ remove some heading whitespaces

6/ remove useless prioritizers include files

10 years agomultipath: don't clear daemon setting on reconfigure
Benjamin Marzinski [Thu, 20 May 2010 04:00:45 +0000 (23:00 -0500)]
multipath: don't clear daemon setting on reconfigure

When you reconfigure multipathd, it needs to set the daemon flag in the
new config structure, so that the daemon only-code will still work.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
10 years agomultipath: close sysfs file after setting value
Benjamin Marzinski [Thu, 20 May 2010 03:59:57 +0000 (22:59 -0500)]
multipath: close sysfs file after setting value

We need to close the sysfs file after setting its value.

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