multipath-tools/.git
10 years agolibmultipath: Remove duplicate calls to path_offline()
Hannes Reinecke [Thu, 27 May 2010 11:53:43 +0000 (13:53 +0200)]
libmultipath: Remove duplicate calls to path_offline()

When calling pathinfo() path_offline() is called several times
in a row, which is quite unnecessary.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agoCheck for offline path in get_prio()
Hannes Reinecke [Wed, 18 May 2011 07:35:34 +0000 (09:35 +0200)]
Check for offline path in get_prio()

We need to check for an offline path in get_prio(), otherwise
the priority callout might stall.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agoUse state name in get_state()
Hannes Reinecke [Wed, 18 May 2011 07:34:13 +0000 (09:34 +0200)]
Use state name in get_state()

Rather than to display the numerical value we should be returning
the path status string.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agoOnly check offline status for SCSI devices
Hannes Reinecke [Wed, 18 May 2011 07:32:15 +0000 (09:32 +0200)]
Only check offline status for SCSI devices

Only SCSI devices can be checked for offline status, so we
should return PATH_UP for every other type.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agolibmultipath: zero out sense buffer in do_inq()
Hannes Reinecke [Wed, 18 May 2011 07:24:29 +0000 (09:24 +0200)]
libmultipath: zero out sense buffer in do_inq()

We should be zero out the sense buffer when doing an inquiry
so as not to have invalid contents being passed up.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agomultipathd: fix memory issues in cli.c
Hannes Reinecke [Tue, 17 May 2011 12:46:56 +0000 (14:46 +0200)]
multipathd: fix memory issues in cli.c

Some memory issues in cli.c have been found by valgrind.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agomultipathd: Remove handling of 'umount' events
Hannes Reinecke [Tue, 17 May 2011 12:42:31 +0000 (14:42 +0200)]
multipathd: Remove handling of 'umount' events

umount uevents are gone, so we should be removing
handling for it, too.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agoSafe memory allocation in cli_handlers
Hannes Reinecke [Tue, 28 Apr 2009 09:05:39 +0000 (11:05 +0200)]
Safe memory allocation in cli_handlers

Valgrind pointed out that the memory returned from realloc() is
not initialized. So do that explicitely.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agomultipathd: Fix uxlsnr race condition on shutdown
Hannes Reinecke [Wed, 12 Jan 2011 09:13:04 +0000 (10:13 +0100)]
multipathd: Fix uxlsnr race condition on shutdown

The multipath daemon deallocates some memory structures
upon shutdown which have been allocated in the thread
context of uxlsnr. Upon shutdown this thread is already
done for, taking it's memory structures with it.
So we need to establish a proper pthread cleanup
handler here to ensure the memory structures are
freed correctly.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agoRework sysfs device handling in multipathd
Hannes Reinecke [Thu, 20 Nov 2008 11:14:42 +0000 (12:14 +0100)]
Rework sysfs device handling in multipathd

Relying on sysfs devices has the disadvantage that the device
might already been gone by the time we look at it. And we don't
actually need it for eg device-mapper events as we can get all
required information via the device-mapper ioctl.
So only access sysfs if we absolutely have to and try to get
the information from other places if possible.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agomultipath: add SuSE init file
Hannes Reinecke [Tue, 17 May 2011 10:52:39 +0000 (12:52 +0200)]
multipath: add SuSE init file

This patch adds /etc/init.d/boot.multipath file for SuSE.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agoChecker name is not displayed on failure
Hannes Reinecke [Tue, 13 Jan 2009 14:28:23 +0000 (15:28 +0100)]
Checker name is not displayed on failure

If add_checker() isn't able to locate the checker
it won't display the name in free_checker().

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agoUnload priority modules
Hannes Reinecke [Tue, 18 Nov 2008 09:57:27 +0000 (10:57 +0100)]
Unload priority modules

We only load the priority modules, but never unload them.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agoDisplay avg priority as group priority
Hannes Reinecke [Wed, 17 Mar 2010 07:32:51 +0000 (08:32 +0100)]
Display avg priority as group priority

Now average priority is used as path group priority, instead of sum of
priorities of the paths. But while displaying group priority, sum is
being displayed. Change it to print the average priority.

When there are no enabled paths, print 0 as priority.

Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>
Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agolibmultipath: Improve debugging of log messages
Hannes Reinecke [Wed, 12 Jan 2011 09:07:58 +0000 (10:07 +0100)]
libmultipath: Improve debugging of log messages

With the current definition of log messages we
only see something utterly pointless when using
gdb:
(gdb) print *(struct logmsg *)la->buff
$15 = {prio = 6, next = 0x80015a68,
  str = 0x73687574646f776e <Address 0x73687574646f776e out of bounds>}

With this fix we are able to see the message
directly:

(gdb) print *(struct logmsg *)la->buff
$6 = {prio = 5, next = 0x8001b220,
  str = 0x8001d240 "--------shut down-------\n"}

References: bnc#659859

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agolibmultipath: rework sysfs handling
Hannes Reinecke [Thu, 27 May 2010 11:51:23 +0000 (13:51 +0200)]
libmultipath: rework sysfs handling

sysfs_get_device() is called extremely often, so we need
to make sure to have that as streamlined as possible.
So remove all unused fields and use caching as often as
possible.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agolibmultipath: update waiter handling
Hannes Reinecke [Mon, 4 May 2009 14:46:58 +0000 (16:46 +0200)]
libmultipath: update waiter handling

The current 'waiter' structure accesses fields which belong
to the main 'mpp' structure, which has a totally different
lifetime. With this patch most of these dependencies are
removed and the 'waiter' structure can run independently
of the main 'mpp' structure, reducing the risk of
use-after-free faults.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agolibmultipath: do not fallback to search /proc/partitions
Hannes Reinecke [Fri, 28 Jan 2011 08:21:15 +0000 (09:21 +0100)]
libmultipath: do not fallback to search /proc/partitions

devt2devname() reverse-maps the device number to the
device name. However, when a device is not found in
/sys/block/dev it's pointless to retry searching for
it in /proc/partitions, as both carry the same information.
And the search in /proc/partitions is only meant for
systems not providing /sys/block.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agoStart uevent service handler from main thread
Hannes Reinecke [Tue, 30 Mar 2010 08:53:05 +0000 (10:53 +0200)]
Start uevent service handler from main thread

We should start the uevent handler as early as possible so as
to not miss out any events. However, we cannot process these
events until after all paths have been discovered. So we
should be starting the uevent service routine only after
the discovery process.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agoUse lists for uevent processing
Hannes Reinecke [Wed, 25 Feb 2009 15:10:16 +0000 (16:10 +0100)]
Use lists for uevent processing

We now have proper list definitions, so we might as well use them
for uevent processing. And we can clean up signalling, too;
the pthreads condition signalling is unreliable, as a condition
signal might be lost if we're in the middle of processing. So
we should rather check the queue status prior to wait for a
condition.
And we can introduce a pthread cleanup handler, as well.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agoRemove sysfs_attr cache
Hannes Reinecke [Mon, 4 May 2009 12:11:18 +0000 (14:11 +0200)]
Remove sysfs_attr cache

The sysfs attribute cache was meant to speed up sysfs accesses.
However, we need to update the cache values on each access, so
there is no speedup to be had.
So remove it and save memory.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agoFixup strip trailing whitespaces for getuid return value
Hannes Reinecke [Fri, 25 Sep 2009 09:51:25 +0000 (11:51 +0200)]
Fixup strip trailing whitespaces for getuid return value

The getuid callout might return a wwid with trailing
spaces (or containing only spaces). The existing
fixup code will only work if the getuid callout
returns a wwid with the entire space used up.
So fixup this and also update the logging output
to correctly state '<empty>' if the getuid was
found to be empty.

References: bnc#542085

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agoCheck return value for select_alias()
Hannes Reinecke [Tue, 15 Mar 2011 10:25:38 +0000 (11:25 +0100)]
Check return value for select_alias()

select_alias() might fail, so we need to check the return code
here.

References: bnc#642846

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agoUse enum free_path_mode for free_paths argument
Hannes Reinecke [Tue, 15 Mar 2011 10:32:34 +0000 (11:32 +0100)]
Use enum free_path_mode for free_paths argument

The 'free_paths' argument is really an enum, so we can as well
mark it as such.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agovector paranoia
Hannes Reinecke [Fri, 13 May 2011 10:21:16 +0000 (12:21 +0200)]
vector paranoia

As usual error checking in vector.c is non-existent.
In this case, if realloc fails we will return NULL but
leave ->allocated on the previous value.
And checking for empty vectors isn't a bad idea, either.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 years agoUpdate cli request processing
Hannes Reinecke [Tue, 28 Apr 2009 09:03:10 +0000 (11:03 +0200)]
Update cli request processing

Add error checking to cli packet processing and some whitespace fixes.

Signed-off-by: Hannes Reinecke <hare@suse.de>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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/

10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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/

10 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

10 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>

10 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>
10 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>

10 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>
10 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/

10 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>
10 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.

10 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>
10 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/

10 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.

10 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

10 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.

10 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()

10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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