platform/upstream/multipath-tools.git
12 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>
13 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>
13 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().

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

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

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

13 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

13 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

13 years agoReload map for device read-only setting changes
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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 years agoalua: Handle LBA_DEPENDENT state
Hannes Reinecke [Mon, 13 Sep 2010 09:06:13 +0000 (11:06 +0200)]
alua: Handle LBA_DEPENDENT state

SPC-4 added another state, LBA_DEPENDENT. This patch
adds basic support for it.

Signed-off-by: Hannes Reinecke <hare@suse.de>
13 years agoUpdate multipathd init script for SuSE
Hannes Reinecke [Wed, 18 May 2011 11:28:04 +0000 (13:28 +0200)]
Update multipathd init script for SuSE

As we know have the 'show daemon' CLI command we can be using
it to track startup and shutdown.

Signed-off-by: Hannes Reinecke <hare@suse.de>
13 years agomultipathd: Add PID to 'show daemon' cli command
Hannes Reinecke [Wed, 18 May 2011 11:22:13 +0000 (13:22 +0200)]
multipathd: Add PID to 'show daemon' cli command

We might want to know the PID of the daemon itself.
So adding it to the 'show daemon' cli command.

Signed-off-by: Hannes Reinecke <hare@suse.de>
13 years agoUpdate pid file handling
Hannes Reinecke [Wed, 18 May 2011 11:12:24 +0000 (13:12 +0200)]
Update pid file handling

As we now have a shutdown CLI command we don't actually need the
pid file anymore. So any errors on creation can be ignored.

Signed-off-by: Hannes Reinecke <hare@suse.de>
13 years agoSerialize startup on large machines
Hannes Reinecke [Tue, 4 May 2010 09:02:37 +0000 (11:02 +0200)]
Serialize startup on large machines

On large installations the startup can take quite long.
So to better integration with the init scripts I've added
the CLI command 'show daemon' which returns the internal
running state of the daemon.
With this the init scripts can wait until the daemon
is properly started.

Signed-off-by: Hannes Reinecke <hare@suse.de>
13 years agoAdd 'shutdown' cli command
Hannes Reinecke [Tue, 28 Apr 2009 09:11:23 +0000 (11:11 +0200)]
Add 'shutdown' cli command

Rather than sending a signal to the process (which might get caught
by any thread, possibly blocking it) we can as well implement a
'shutdown' cli command, making sure the daemon will be terminated.

Signed-off-by: Hannes Reinecke <hare@suse.de>
13 years agomultipathd: Update 'max_fds' handling
Hannes Reinecke [Thu, 27 May 2010 08:37:58 +0000 (10:37 +0200)]
multipathd: Update 'max_fds' handling

We don't need to update the 'max_fds' setting if it's already
higher than we need. And we should be issuing a debug message
when we did.

Signed-off-by: Hannes Reinecke <hare@suse.de>
13 years agomultipathd: crash in reconfigure CLI command
Hannes Reinecke [Fri, 18 Feb 2011 08:34:18 +0000 (09:34 +0100)]
multipathd: crash in reconfigure CLI command

The 'reconfigure' CLI command doesn't take the vector lock,
so if multipathd is processing a table / udev event at the
same time it'll crash.

Signed-off-by: Hannes Reinecke <hare@suse.de>
13 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>
13 years agolibmultipath: Only count UP and GHOST paths for prio update
Hannes Reinecke [Thu, 10 Feb 2011 09:35:28 +0000 (10:35 +0100)]
libmultipath: Only count UP and GHOST paths for prio update

When calculating the priority of a pathgroup we should be
counting only UP and GHOST paths; all other values might
be stale.

References: bnc#665289

Signed-off-by: Hannes Reinecke <hare@suse.de>
13 years agoAlways synchronize with dm state
Hannes Reinecke [Thu, 2 Jul 2009 12:53:53 +0000 (14:53 +0200)]
Always synchronize with dm state

When running on iSCSI the connection might suffer intermediate
errors, causing the path to fail. But by the time the path checker
runs these errors will be cleared by the iSCSI internal connection
recovery, which means the daemon will never see any error and not
reinstated any failed paths.

References: bnc#447887

Signed-off-by: Hannes Reinecke <hare@suse.de>
13 years agomultipathd is not starting waitevent checker for single paths
Hannes Reinecke [Mon, 9 Feb 2009 13:04:25 +0000 (14:04 +0100)]
multipathd is not starting waitevent checker for single paths

After multipathd was started, any SCSI disks that would be added afterwards
would not trigger multipathd to create a waitevent thread.

The waitevent thread listens for kernel's offline/online events and thoroughly
checks what the kernel sees with what multipathd thinks and if something is
off,
whacks multipathd to the right state.

For devices which did not have a kernel device mapper helper (hp_sw, rdac,
etc) and only have one single path, when the link experiences a momentary blib
with I/O on it the path would be marked as failed _only_ by the kernel. This
event
would _not_ be propagated to multipathd (b/c it did not have a waitevent thread
create). Multipathd would only do the path checker which would provide a
PATH_UP event (rightly so - as the path would only be down for a second or so).
However, the device mapper path group would be marked as failed, and any
incoming I/O would be blocked (if queue_if_no_path was set) or fail.

The end result was the multipathd would think everything was peachy while the
kernel would be failing (or queueing) the I/O to the multipath device.

References: bnc#473841

Signed-off-by: Hannes Reinecke <hare@suse.de>
13 years agoMore debugging output when synchronizing path states
Hannes Reinecke [Wed, 21 Jan 2009 14:01:38 +0000 (15:01 +0100)]
More debugging output when synchronizing path states

When synchronizing path state we might end up removing a path.
However, if this path is not in state PATH_DOWN there is an
error somewhere. So modify the messages accordingly.

Signed-off-by: Hannes Reinecke <hare@suse.de>
13 years agolibmultipath: Make path state message unique
Hannes Reinecke [Wed, 12 May 2010 06:01:18 +0000 (08:01 +0200)]
libmultipath: Make path state message unique

There are two identical messages 'state =', so we
should modify them to have them better identified.

Signed-off-by: Hannes Reinecke <hare@suse.de>
13 years agoUpdate dev_loss_tmo for no_path_retry
Hannes Reinecke [Mon, 11 Jan 2010 14:06:08 +0000 (15:06 +0100)]
Update dev_loss_tmo for no_path_retry

When 'no_path_retry' is active we have to update the dev_loss_tmo
setting accordingly to ensure that no devices are removed during
an all-paths-down scenario.

Signed-off-by: Hannes Reinecke <hare@suse.de>
13 years agoCheck for valid argument in update_multipath_strings()
Hannes Reinecke [Mon, 26 Apr 2010 10:01:40 +0000 (12:01 +0200)]
Check for valid argument in update_multipath_strings()

We need to check for a valid argument here.

Signed-off-by: Hannes Reinecke <hare@suse.de>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 years agomultipathd: Disassociate from /dev/console when daemonizing
Ankit Jain [Wed, 11 May 2011 17:44:24 +0000 (23:14 +0530)]
multipathd: Disassociate from /dev/console when daemonizing

Currently, multipathd redirects stdout/stderr to /dev/console,
to be able to show error messages when all else fails.

This patch redirects them to /dev/null instead, to make it a
well behaving daemon. This corresponds to FATE request
https://fate.novell.com/310684 .

This is based on -
git://git.kernel.org/pub/scm/linux/storage/multipath-tools/

----
commit a3dd997d1b0b55a934103e0b28648003675743e3
Author: Ankit Jain <jankit@suse.de>
Date:   Wed May 11 22:18:33 2011 +0530

    multipathd: Disassociate from /dev/console

    When daemonizing, redirect stdout/stderr to /dev/null
    instead of /dev/console. Also, chdir("/") before the redirection,
    so that any error can be reported.
    FATE#310684.

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