10 years ago[lib] Add default config for Sun StorageTek 2500 and 2530
Charlie Brady [Sun, 30 Aug 2009 20:30:47 +0000 (22:30 +0200)]
[lib] Add default config for Sun StorageTek 2500 and 2530

10 years ago[lib] Add Dell 32xx/i support into hardware table
Yanqing Liu [Sun, 30 Aug 2009 20:27:50 +0000 (22:27 +0200)]
[lib] Add Dell 32xx/i support into hardware table

10 years agomultipath-tools: miscellaneous code cleanups
Benjamin Marzinski [Mon, 3 Aug 2009 22:03:22 +0000 (17:03 -0500)]
multipath-tools: miscellaneous code cleanups

io_getevents can return < 0 if it is interrupted, but it doesn't set errno.
This patch sets errno to zero first to avoid printing garbage. Also the
log_thread and uevq_thread functions need to return NULL to avoid compiler

Signed-off-by: Benjamin Marzinski <>
10 years agomultipath-tools: install libraries to /lib64 where appriopriate
Benjamin Marzinski [Mon, 3 Aug 2009 22:02:29 +0000 (17:02 -0500)]
multipath-tools: install libraries to /lib64 where appriopriate

Multipath currently installs all of it's libraries to /lib, even on 64-bit
machines with a /lib64 directory.  With this patch, multipath will install
the libraries under /lib64 if it exists.  This can be overridden by running
# make LIB=<lib>

Signed-off-by: Benjamin Marzinski <>
10 years agomultipath-tools: uninstall libraries correctly
Benjamin Marzinski [Mon, 3 Aug 2009 22:01:33 +0000 (17:01 -0500)]
multipath-tools: uninstall libraries correctly

The unistall action for checker libraries doesn't work. Also, the uninstall
action for the prioritizer libraries runs the risk of uninstalling something
that we didn't install.  This patch changes them to correctly uninstall the
files listed in LIBS.

Signed-off-by: Benjamin Marzinski <>
10 years agomultipath-tools: Log all messages
Benjamin Marzinski [Mon, 3 Aug 2009 22:00:03 +0000 (17:00 -0500)]
multipath-tools: Log all messages

When the log thread pulls the last message off the buffer, it sets
la->empty.  However, then it returns la->empty, which means that the log is
empty, instead of 0, which means that it found a message.  This means that
multipathd is not logging the last message in the buffer when the log threa
runs. This patch changes the return code, so that multipathd logs all the
messages in the buffer.

Signed-off-by: Benjamin Marzinski <>
10 years agomultipath-tools: Fix uevent handling code
Benjamin Marzinski [Mon, 3 Aug 2009 21:59:05 +0000 (16:59 -0500)]
multipath-tools: Fix uevent handling code

Multipathd wasn't setting buflen when it read in a uevent message.  This was
causing buflen to be used unitialized, and would often keep multipathd from
processing uevents.  This patch correctly initializes buflen to the size of the
buffer received.

Signed-off-by: Benjamin Marzinski <>
10 years ago[lib] correct tab-before-whitespace errors introduce by the prev commit
Christophe Varoqui [Tue, 4 Aug 2009 21:29:29 +0000 (23:29 +0200)]
[lib] correct tab-before-whitespace errors introduce by the prev commit

10 years agoUse Average path priority value for path switching
Chandra Seetharaman [Thu, 30 Jul 2009 20:13:55 +0000 (13:13 -0700)]
Use Average path priority value for path switching

Hi Christophe,

I submitted this patch on Jul 2
( Resending it.

Only change is a field name from up_paths to enabled_paths.

Hi Hannes,

Need an ACK from you :-).



Failback happens only when the sum of priorities of all paths
(on the higher priority path group) is greater than the sum
of priorities of all paths on the lower priority path group.

This leads into problems when there are more than one paths
in each of the path groups, and the sum of all paths in the
lower priority path group is greater than that of path priority
of a single high priority path.

This patch fixes the problem by using average priority of
the path group to decide on which path group to switch over.

Signed-off-by: Chandra Seetharaman <>
10 years agoFix minor error in multipath.conf manpage
Ritesh Raj Sarraf [Wed, 29 Jul 2009 12:37:03 +0000 (18:07 +0530)]
Fix minor error in multipath.conf manpage

Signed-off-by: Ritesh Raj Sarraf <>
10 years agomultipath-tools: no_path_retry for time based queuing is queuing I/O for ever
Chauhan, Vijay [Tue, 28 Jul 2009 12:51:13 +0000 (18:21 +0530)]
multipath-tools: no_path_retry for time based queuing is queuing I/O for ever

Even though no_path_retry is set for time based queuing(i.e no_path_retry <N>), I/O is getting queued for ever. During all path failure condition, setup_feature() resets no_path_retry of multipath structure to NO_PATH_RETRY_QUEUE which queues I/O for ever. This patch skips resetting no_path_retry until no_path_retry is set with queue.

Signed-off-by: Vijay Chauhan <>
10 years ago[kpartx] add DASD large volume support
Stefan Weinhuber [Tue, 7 Jul 2009 21:51:29 +0000 (23:51 +0200)]
[kpartx] add DASD large volume support

With kernel 2.6.30 the DASD device driver supports devices with more
then 65520 cylinders. As the traditional record layouts and hardware
interfaces only allow for 16-bit cylinder values, the new larger
cylinder addresses have to be partially encoded into the head part
of a cylinder/head address. To make things complicated, old kernels
will recognize a large volume device, but with a maximum of 65535
cylinders, so a large volume that has been formatted with old tools
will only be partially formatted. To handle these issues our disk
layouts and partition detection code had to be extended, and to use
large volumes with the multipath tools, the DASD partition detection
code in kpartx needs to be extended as well.

compatible disk layout (VOL1 label):
We use the same address encoding as the hardware interfaces.
To prevent old tools and kernels from misinterpreting the encoded
partition sizes, the new VTOC entries have the format number 8
instead of 1.

linux disk layout (LNX1 label):
Here we will still create one partition for the whole disk.
To make sure that the whole disk has been formatted, large volumes
use a new version of the disk label, which contains the number of
formatted blocks. If the disk contains an old volume label, we know
it was formatted with the number of cylinders as reported by the

CMS disk layout (CMS1 label):
Already contains the number of formatted blocks in the label, we
just have to use it.

Signed-off-by: Stefan Weinhuber <>
11 years ago[lib] add defaults for SUN/LSI LCSM100_I master/dev
Charlie Brady [Wed, 24 Jun 2009 22:24:00 +0000 (00:24 +0200)]
[lib] add defaults for SUN/LSI LCSM100_I

same as LCSM100_F

11 years ago[lib] rdac checker message fix
Charlie Brady [Wed, 24 Jun 2009 22:06:03 +0000 (00:06 +0200)]
[lib] rdac checker message fix

when unplugging a link to the controller, that the path is seen as down,
but then is reported again as down when the link is restored.

Here's a sample log:

Jun 23 14:12:25 sun4150node1 iscsid: connection1:0 is operational after
recovery (4 attempts)
Jun 23 14:13:10 sun4150node1 kernel: ping timeout of 10 secs expired, last
rx 172050, last ping 177050,
now 187050
Jun 23 14:13:10 sun4150node1 kernel:  connection1:0: iscsi: detected conn
error (1011)
Jun 23 14:13:11 sun4150node1 multipathd: sdb: rdac checker reports path is
Jun 23 14:13:11 sun4150node1 multipathd: checker failed path 8:16 in map
Jun 23 14:13:11 sun4150node1 kernel: device-mapper: multipath: Failing
path 8:16.
Jun 23 14:13:11 sun4150node1 multipathd: mpath0: remaining active paths: 1
Jun 23 14:13:11 sun4150node1 multipathd: dm-2: add map (uevent)
Jun 23 14:13:11 sun4150node1 multipathd: dm-2: devmap already registered
Jun 23 14:13:12 sun4150node1 iscsid: Kernel reported iSCSI connection 1:0
error (1011) state (3)
Jun 23 14:13:37 sun4150node1 multipathd: sdb: rdac checker reports path is
Jun 23 14:13:37 sun4150node1 multipathd: 8:16: reinstated
Jun 23 14:13:37 sun4150node1 multipathd: mpath0: remaining active paths: 2

Notice the first message at 14:13:37.

11 years agomultipath_tools: Add IBM Virtual SCSI to hwtable
Brian King [Thu, 4 Jun 2009 18:10:38 +0000 (13:10 -0500)]
multipath_tools: Add IBM Virtual SCSI to hwtable

Add entry to the hwtable for IBM Power Virtual SCSI devices.

Signed-off-by: Brian King <>
11 years agomultipath-tools: Improvement to max_fds
Benjamin Marzinski [Thu, 14 May 2009 04:38:28 +0000 (23:38 -0500)]
multipath-tools: Improvement to max_fds

Setting max_fds to unlimited doesn't actually work.  In the kernel, there is a
fixed limit to the maximum number of open fds a process can have.  If you try
to set max_fds to greater than this, it fails.  This patch replaces the special
value "unlimited" with a new special value, "max".  If you set max_fds to "max",
multipath will use the actual system limit, which it looks up from

Signed-off-by: Benjamin Marzinski <>
11 years agoAdd uid, gid, and mode config attributes
Benjamin Marzinski [Thu, 30 Apr 2009 16:31:37 +0000 (11:31 -0500)]
Add uid, gid, and mode config attributes

This adds the ability to set uid, gid, and mode for the multipath device
nodes. Also, kpartx created device nodes will inherit the uid, gid, and
mode of their parent device. These attributes can be set in either the
defaults or the multipaths section of /etc/multipath.conf

Signed-off-by: Benjamin Marzinski <>
11 years agomultipathd: restrict /var/run/multipathd.sock permissions further
Mike Snitzer [Wed, 29 Apr 2009 19:26:32 +0000 (15:26 -0400)]
multipathd: restrict /var/run/multipathd.sock permissions further

Use a more restrictive umask for /var/run/multipathd.sock
Group and Other do not need to access the socket.

Signed-off-by: Mike Snitzer <>
11 years agofix small issues in cli_handlers
Mike Snitzer [Wed, 29 Apr 2009 19:26:16 +0000 (15:26 -0400)]
fix small issues in cli_handlers

- properly check cli_list_wildcards()'s MALLOC returned pointer
- add missing newline to "blacklisted" reply

Signed-off-by: Mike Snitzer <>
11 years agocleanup various MALLOC/REALLOC callers
Mike Snitzer [Wed, 29 Apr 2009 19:25:42 +0000 (15:25 -0400)]
cleanup various MALLOC/REALLOC callers

- alloc_hwe and alloc_mpe should've been used
- MALLOC and REALLOC returned pointer must be checked before use

Signed-off-by: Mike Snitzer <>
11 years agodo not allow relative path names to be added to the pathvec
Mike Snitzer [Wed, 29 Apr 2009 19:25:09 +0000 (15:25 -0400)]
do not allow relative path names to be added to the pathvec

CVE-2009-0115 taught us that such paths should not be tolerated

Signed-off-by: Mike Snitzer <>
11 years agoavoid NULL pointers in discovery code
Mike Snitzer [Wed, 29 Apr 2009 19:24:24 +0000 (15:24 -0400)]
avoid NULL pointers in discovery code

Both sysfs_pathinfo() and path_offline() could hit NULL pointers when
trying to dereference the newly acquired parent sysfs_device.  By being
more defensive a crash I experienced in path_offline() is avoided.

Signed-off-by: Mike Snitzer <>
11 years agomultipathd: add error checking to client's process_req
Mike Snitzer [Wed, 29 Apr 2009 19:23:28 +0000 (15:23 -0400)]
multipathd: add error checking to client's process_req

If multipathd (server) crashes fail any multipathd (client)
communication gracefully.  This patch adds error checking that prevents
calls to recv_packet() if the send_packet() call failed.

Signed-off-by: Mike Snitzer <>
11 years ago[lib] fix double frees
Mike Snitzer [Tue, 28 Apr 2009 21:50:21 +0000 (23:50 +0200)]
[lib] fix double frees

A careless merge from Hannes' repo introduced double frees.

11 years ago[lib] prio_arg leaked here through cherry-picks
Christophe Varoqui [Wed, 22 Apr 2009 00:09:39 +0000 (02:09 +0200)]
[lib] prio_arg leaked here through cherry-picks

main patch is not yet merged. Remove for now.

11 years agoStrip trailing blanks from wwid
Hannes Reinecke [Wed, 4 Mar 2009 12:37:43 +0000 (13:37 +0100)]
Strip trailing blanks from wwid

We should be stripping any trailing blanks from the wwid to catch
invalid wwid with just blanks.

Signed-off-by: Hannes Reinecke <>
11 years agoOnly pass block events to multipath
Hannes Reinecke [Wed, 25 Feb 2009 15:09:15 +0000 (16:09 +0100)]
Only pass block events to multipath

We can easily preselect the events from a udev rule; this takes some
load off the multipath daemon itself.

Signed-off-by: Hannes Reinecke <>
11 years agoFixup multibus zero-path handling
Hannes Reinecke [Tue, 24 Feb 2009 13:13:56 +0000 (14:13 +0100)]
Fixup multibus zero-path handling

The 'multibus' pgpolicy function currently always adds a pathgroup,
even when no paths are present. This confuses setup_map() which
doesn't expect this behaviour.

References: 476330

Signed-off-by: Hannes Reinecke <>
11 years agoReturn 'ghost' state when port is in standby
Hannes Reinecke [Thu, 19 Feb 2009 15:19:45 +0000 (16:19 +0100)]
Return 'ghost' state when port is in standby

Currently, issuing a TUR command on a path in standby
mode, it returns a Unit Attention status. This is
reported as a Failed path by the SLES11 tur checker.
Instead, this has to be reported as Ghost path based
on the additional sense code and sense code qualifier values.

References: 475816

Signed-off-by: Hannes Reinecke <>
11 years agoUse noflush for kpartx
Hannes Reinecke [Mon, 9 Feb 2009 12:59:57 +0000 (13:59 +0100)]
Use noflush for kpartx

kpartx has to use 'noflush' to be able to complete for an all-paths
down scenario. Otherwise no uevent might be sent and multipath
will stall.

References: 473352

Signed-off-by: Hannes Reinecke <>
11 years agoleastpending IO loadbalancing is not displayed properly
Hannes Reinecke [Fri, 6 Feb 2009 13:57:12 +0000 (14:57 +0100)]
leastpending IO loadbalancing is not displayed properly

While using least pending IO lb policy for the LUN, the
dm_least_pending module is getting loaded and devices
are getting created properly. But multipath
display command does not display the paths for this LUN.

This is due to some explicit parsing for 'round-robin' in
dmparser.c, which has to be updated to accomodate other
load-balancing policies.

References: 444199

Signed-off-by: Hannes Reinecke <>
11 years agoRetry tur on driver errors
Hannes Reinecke [Wed, 4 Feb 2009 10:34:15 +0000 (11:34 +0100)]
Retry tur on driver errors

Sending SG_IO commands might return driver errors, too. And
some of these errors should cause the tur to be retried.

References: bnc#456961

Signed-off-by: Hannes Reinecke <>
11 years agoPlug memory leaks
Hannes Reinecke [Wed, 28 Jan 2009 08:24:10 +0000 (09:24 +0100)]
Plug memory leaks

Running the internal memory checker revealed quite some memory

Signed-off-by: Hannes Reinecke <>
11 years agoCorrect definition of dbg_malloc()
Hannes Reinecke [Wed, 28 Jan 2009 08:19:36 +0000 (09:19 +0100)]
Correct definition of dbg_malloc()

Any malloc function should return 'void *' to avoid type
mismatch errors.

Signed-off-by: Hannes Reinecke <>
11 years agoError checking for VECTOR_XXX defines
Hannes Reinecke [Mon, 26 Jan 2009 12:01:33 +0000 (13:01 +0100)]
Error checking for VECTOR_XXX defines

Christophe doesn't believe in error checking. I, however, have
been tripping over them all the time.

References: bnc#469269

Signed-off-by: Hannes Reinecke <>
11 years agoFixup whitespace issues
Hannes Reinecke [Fri, 23 Jan 2009 12:04:15 +0000 (13:04 +0100)]
Fixup whitespace issues

Signed-off-by: Hannes Reinecke <>
11 years agoFix 'remove' uevent handling
Hannes Reinecke [Wed, 21 Jan 2009 13:11:38 +0000 (14:11 +0100)]
Fix 'remove' uevent handling

A remove event might be handled after the failed devices have already
been purged from the multipath structure, so a failure here is not
an error.

Signed-off-by: Hannes Reinecke <>
11 years agoUpdate misleading debug messages for directio checker
Hannes Reinecke [Wed, 21 Jan 2009 12:26:51 +0000 (13:26 +0100)]
Update misleading debug messages for directio checker

io_getevents returns the number of events received, so '1'
is actual a success. And calling 'strerror(errno)' unconditionally
here will lead to false errors as the errno value won't be
updated then.

Signed-off-by: Hannes Reinecke <>
11 years agoAdd new HP arrays to internal hardware table
Hannes Reinecke [Thu, 15 Jan 2009 11:03:34 +0000 (12:03 +0100)]
Add new HP arrays to internal hardware table

This patch is to include entries for 2 new HP arrays in the hwtable.

References: bnc#442133

Signed-off-by: Vijayakumar Balasubramanian <>
Signed-off-by: Hannes Reinecke <>
11 years agoAdd more debugging output
Hannes Reinecke [Wed, 7 Jan 2009 10:05:45 +0000 (11:05 +0100)]
Add more debugging output

Signed-off-by: Hannes Reinecke <>
11 years agoShuffle to the call to memset in logarea_init()
Hannes Reinecke [Wed, 7 Jan 2009 09:59:46 +0000 (10:59 +0100)]
Shuffle to the call to memset in logarea_init()

We should call memset only after we know the area has been

Signed-off-by: Hannes Reinecke <>
11 years agoFix sysfs_attr_get_value()
Hannes Reinecke [Wed, 7 Jan 2009 09:52:25 +0000 (10:52 +0100)]
Fix sysfs_attr_get_value()

sysfs_attr_get_value() should return NULL if the attribute was not
found or found to be empty. And we should increase the attribute
value size to avoid overflows.
And overflows should be truncated, not ignored.

References: bnc#456747

Signed-off-by: Hannes Reinecke <>
11 years agoUsing condlog() for sysfs debugging output
Hannes Reinecke [Fri, 19 Dec 2008 08:43:23 +0000 (09:43 +0100)]
Using condlog() for sysfs debugging output

The sysfs code still used 'printf' for debugging. Changed that
to using condlog().

Signed-off-by: Hannes Reinecke <>
11 years agoAdd missing unlock() on exit path
Hannes Reinecke [Thu, 18 Dec 2008 15:20:09 +0000 (16:20 +0100)]
Add missing unlock() on exit path

We forgot to unlock the paths on exit.

Signed-off-by: Hannes Reinecke <>
11 years agoRemove kdev_t.h include
Hannes Reinecke [Thu, 18 Dec 2008 09:03:15 +0000 (10:03 +0100)]
Remove kdev_t.h include

Pointless and giving the users the wrong impression.

Signed-off-by: Hannes Reinecke <>
11 years agoSet 'max_fds' parameter for multipath
Hannes Reinecke [Tue, 9 Dec 2008 11:26:49 +0000 (12:26 +0100)]
Set 'max_fds' parameter for multipath

max_fds should be enabled for multipath, too.

References: 457443

Signed-off-by: Hannes Reinecke <>
11 years agoSplit off IBM ESS entries
Hannes Reinecke [Wed, 3 Dec 2008 09:38:04 +0000 (10:38 +0100)]
Split off IBM ESS entries

For some reason the regular expression doesn't work properly.
So split off the two entries.

References: bnc#439763

Signed-off-by: Hannes Reinecke <>
11 years agoCheck vector_foreach_slot for NULL argument
Hannes Reinecke [Mon, 24 Nov 2008 07:31:28 +0000 (08:31 +0100)]
Check vector_foreach_slot for NULL argument

Most crashes are due to vector_foreach_slot not checking for NULL
argument. Do that now, and add some more checks for not accessing
a NULL pointer indirection.

Signed-off-by: Hannes Reinecke <>
11 years agomultipathd crashes in update_multipath()
Hannes Reinecke [Fri, 21 Nov 2008 13:20:34 +0000 (14:20 +0100)]
multipathd crashes in update_multipath()

For an all-paths-down scenario we can have an mpp with no
paths attached. So check for it.

Signed-off-by: Hannes Reinecke <>
11 years agoAllow zero paths for device-mapper strings
Hannes Reinecke [Thu, 20 Nov 2008 12:33:10 +0000 (13:33 +0100)]
Allow zero paths for device-mapper strings

There is no reason why we shouldn't allow zero paths in the device
mapper output.

References: 435688

Signed-off-by: Hannes Reinecke <>
11 years agoSearch for correct hwe in update_multipath()
Hannes Reinecke [Thu, 20 Nov 2008 11:33:39 +0000 (12:33 +0100)]
Search for correct hwe in update_multipath()

When updating the multipath structure we only should update the
hardware entry if it doesn't exist anymore. And we should take
care of not selecting invalid entries in the paths vector as
the hardware entry for this is invalid, too.

Signed-off-by: Hannes Reinecke <>
11 years agoValgrind fixes for checkers
Hannes Reinecke [Wed, 19 Nov 2008 10:04:40 +0000 (11:04 +0100)]
Valgrind fixes for checkers

Declare an array does not zero it out. Hence we might read some
random garbage here.

Signed-off-by: Hannes Reinecke <>
11 years agoMore valgrind fixes
Hannes Reinecke [Tue, 18 Nov 2008 10:33:09 +0000 (11:33 +0100)]
More valgrind fixes

valgrind found some memory which wasn't freed on exit.
Do it now.

Signed-off-by: Hannes Reinecke <>
11 years agolibmultipath: zero out lines in print.c
Hannes Reinecke [Fri, 14 Nov 2008 09:02:56 +0000 (10:02 +0100)]
libmultipath: zero out lines in print.c

static declaration of line within a function doesn't place them in
the bss segment, hence they are not zeroed automatically.
Gives funny effects occasionally.

Signed-off-by: Hannes Reinecke <>
11 years agoUpdate hardware table for new HP arrays
Hannes Reinecke [Tue, 11 Nov 2008 12:44:09 +0000 (13:44 +0100)]
Update hardware table for new HP arrays

References: 442133

Signed-off-by: Vijayakumar Balasubramanian <>
Signed-off-by: Hannes Reinecke <>
11 years agoCheck for empty mpvecs in mpvec_garbage_collector()
Hannes Reinecke [Tue, 4 Nov 2008 08:40:26 +0000 (09:40 +0100)]
Check for empty mpvecs in mpvec_garbage_collector()

During shutdown the mpvec pointer can indeed be empty, so we should
check it first before trying to access it.

References: 437245

Signed-off-by: Hannes Reinecke <>
11 years agoDo not check for valid mp context in get_state()
Hannes Reinecke [Thu, 30 Oct 2008 12:46:15 +0000 (13:46 +0100)]
Do not check for valid mp context in get_state()

When called from 'multipath -ll' get_state() does not
have a valid context. But the checkers should run nevertheless
as we need the state here but are not interested in any long-term

References: 433659

Signed-off-by: Hannes Reinecke <>
11 years agoFixup %n to handle '!' special case
Hannes Reinecke [Wed, 29 Oct 2008 15:58:52 +0000 (16:58 +0100)]
Fixup %n to handle '!' special case

The kernel name may contain an '!', which should be translated
into a '/'. So do it here.

Signed-off-by: Hannes Reinecke <>
11 years agoIncrease buffer size in find_loop_by_file()
Hannes Reinecke [Tue, 21 Oct 2008 08:22:16 +0000 (10:22 +0200)]
Increase buffer size in find_loop_by_file()

find_loop_by_file() uses an internal buffer of 20 chars, which is compared
to a buffer of the size of 64 chars. Not good.

References: 436428

Signed-off-by: Hannes Reinecke <>
11 years agokpartx -l does not remove it's loop device
Hannes Reinecke [Tue, 14 Oct 2008 06:38:29 +0000 (08:38 +0200)]
kpartx -l does not remove it's loop device

When doing a kpartx -l it does not remove it's loop device when done.

The appended patch to multipath-tools could fix this.

References: 417266

Signed-off-by: Philipp Zimmer <>
Signed-off-by: Hannes Reinecke <>
11 years agoRead the verbosity level from multipath.conf configuration file
Hannes Reinecke [Tue, 14 Oct 2008 06:21:02 +0000 (08:21 +0200)]
Read the verbosity level from multipath.conf configuration file

With this patch, multipathd can read the verbosity level from
the multipath.conf configuration file.
For example:
verbosity       5

References: 388284

Signed-off-by: Ritesh Raj Sarraf <>
Signed-off-by: Hannes Reinecke <>
11 years agofopen returns NULL on failure, not -1
Hannes Reinecke [Thu, 9 Oct 2008 10:53:38 +0000 (12:53 +0200)]
fopen returns NULL on failure, not -1

References: 432598

Signed-off-by: Hannes Reinecke <>
11 years agomultipath: Check return value for get_inq()
Hannes Reinecke [Fri, 26 Sep 2008 13:31:07 +0000 (15:31 +0200)]
multipath: Check return value for get_inq()

Check the return value of get_inq() to correctly handle devices
with unconnected LUNs.

References: 419123
Signed-off-by: Hannes Reinecke <>
11 years agoFurther whitespace cleanup
Hannes Reinecke [Wed, 23 Jul 2008 10:11:08 +0000 (12:11 +0200)]
Further whitespace cleanup

Signed-off-by: Hannes Reinecke <>
11 years agoIncrease RDAC priority values
Hannes Reinecke [Wed, 23 Jul 2008 10:04:40 +0000 (12:04 +0200)]
Increase RDAC priority values

A priority value of '0' will cause a path to never be selected,
so we should make sure to return always a non-zero value for
available paths.

Signed-off-by: Hannes Reinecke <>
11 years agoValgrind fixes
Hannes Reinecke [Wed, 23 Jul 2008 09:20:53 +0000 (11:20 +0200)]
Valgrind fixes

Valgrind found some issues. And clear up whitespaces while we're at it.

Signed-off-by: Hannes Reinecke <>
11 years ago[lib] set PASSCRED netlink socket option
Christophe Varoqui [Sun, 19 Apr 2009 22:44:38 +0000 (00:44 +0200)]
[lib] set PASSCRED netlink socket option

11 years ago[lib] check udev and netlink messages sender uid
Christophe Varoqui [Sun, 19 Apr 2009 22:16:58 +0000 (00:16 +0200)]
[lib] check udev and netlink messages sender uid

Ignore if not 0.
This change was suggested by Kay Sievers. It required switching from
recv() to recvmsg().

11 years agomultipath-tools: install in $syslibdir
Mike Snitzer [Fri, 17 Apr 2009 22:07:58 +0000 (18:07 -0400)]
multipath-tools: install in $syslibdir

Allows to be installed in the proper lib dir
(e.g. /lib64).  $libdir is already used for /lib/multipath

Signed-off-by: Mike Snitzer <>
11 years agomultipath-tools: update multipathd.init.redhat
Mike Snitzer [Fri, 17 Apr 2009 22:07:59 +0000 (18:07 -0400)]
multipath-tools: update multipathd.init.redhat

Various small improvements to Red Hat's multipathd initscript.

Signed-off-by: Mike Snitzer <>
11 years agomultipath-tools: update scsi_id arguments
Mike Snitzer [Fri, 17 Apr 2009 22:07:57 +0000 (18:07 -0400)]
multipath-tools: update scsi_id arguments

Switch over to using --whitelisted and --device

Signed-off-by: Mike Snitzer <>
11 years ago[lib] define _GNU_SOURCE in preparation for using recvmsg()
Christophe Varoqui [Sun, 19 Apr 2009 21:44:28 +0000 (23:44 +0200)]
[lib] define _GNU_SOURCE in preparation for using recvmsg()

And deal with consequences :
1/ rename util::basename() to util::basenamecpy() to resolve
   namespace conflict GNU version
2/ don't redefine _GNU_SOURCE if already set in regex.c to avoid
   a build warning

11 years ago[lib] more selective mask to catch uevent from netlink
Christophe Varoqui [Wed, 15 Apr 2009 19:47:01 +0000 (21:47 +0200)]
[lib] more selective mask to catch uevent from netlink

Kay Sievers reports 0x01 is the only group used by the kernel.
As udev will start using other groups, pollution will result from
our lack of filtering.

11 years ago[lib] bump version to 0.4.9 in preparation for release
Christophe Varoqui [Fri, 3 Apr 2009 22:33:25 +0000 (00:33 +0200)]
[lib] bump version to 0.4.9 in preparation for release

11 years ago[multipathd] actually propose restorequeuing et disablequeuing in CLI
Christophe Varoqui [Fri, 3 Apr 2009 22:29:49 +0000 (00:29 +0200)]
[multipathd] actually propose restorequeuing et disablequeuing in CLI

this bit was missing from the forward-port

11 years ago[multipathd] Add options to multipathd to turn off queueing
Benjamin Marzinski [Fri, 3 Apr 2009 22:09:55 +0000 (00:09 +0200)]
[multipathd] Add options to multipathd to turn off queueing

Even when the last path of a multipath device is deleted, it can't be
removed until all the queued IO is flushed. For devices that have
no_path_retry set to queue, this doesn't automatically happen.

This patch adds a "flush_on_last_del" config file option, that causes the
multipath device to automatically turn off queueing when the last path is
deleted.  It also adds the "disablequeueing" and "restorequeueing"
multipathd cli commands.

11 years agoset pthread stack size to at least PTHREAD_STACK_MIN
Benjamin Marzinski [Fri, 13 Mar 2009 20:55:14 +0000 (15:55 -0500)]
set pthread stack size to at least PTHREAD_STACK_MIN

Setting the stacksize too small just causes
pthread_attr_setstacksize() to fail, leaving you with the default stack
size. On some architectures, the default stacksize is large, like 10Mb.
Since you start one waiter thread per multipath device, every 100
devices eats up 1Gb of memory.

The other problem is that when I actually read the pthread_attr_init man
page (it can fail. who knew?), I saw that it can fail with ENOMEM. Also,
that it had a function to free it, and that the result of reinitializing
an attr that hadn't been freed was undefined.  Clearly, this function
wasn't intended to be called over and over without ever freeing the
attr, which is how we've been using it in multipathd. So, in the spirit
of writing code to the interface, instead of to how it appears to be
currently implemented, how about this.

11 years agoremove deleted path from pathvec
Benjamin Marzinski [Thu, 12 Mar 2009 18:38:11 +0000 (13:38 -0500)]
remove deleted path from pathvec

When the last path in a multipath map was removed, the path wasn't getting
deleted from the pathvec before it was getting freed.

Signed-off-by: Benjamin Marzinski <>
11 years agoClean up multipath linking
Benjamin Marzinski [Fri, 3 Apr 2009 04:19:36 +0000 (23:19 -0500)]
Clean up multipath linking

This is a patch to fix up the linking. It does two things.  First, it makes install to /lib/ just like a normal shared library, so you
don't have to use -rpath to link to it.  Second, and more importantly,
it moves the libaio linking into, where it belongs.  Since is a dynamic shared object, multipath and multipathd don't
know what functions they need to link in from libaio. This fixes the directio
lockup for me.

Signed-off-by: Benjamin Marzinski <>
11 years agoMiscellaneous multipath bugfixes
Benjamin Marzinski [Fri, 3 Apr 2009 04:44:19 +0000 (23:44 -0500)]
Miscellaneous multipath bugfixes

This is mostly a cleanup of some bugs that recently got introduced. In
ACT_RESIZE we were trying to create a read-only device before we tried
to create a read/write one (I also added the ability to fail back to
read-only in ACT_RELOAD).  There were some printouts that I assume were
for debugging, and some duplicate code.  And I switched it so that
dm_simplecmd_flush did flushing, and dm_simplecmd_noflush didn't.

Signed-off-by: Benjamin Marzinski <>
11 years ago[multipathd] minor logging fix for the resize handler
Christophe Varoqui [Thu, 2 Apr 2009 21:23:12 +0000 (23:23 +0200)]
[multipathd] minor logging fix for the resize handler

add missing format param

11 years ago[lib] use explicit names dm_simplecmd_{flush,noflush}
Christophe Varoqui [Thu, 2 Apr 2009 21:17:29 +0000 (23:17 +0200)]
[lib] use explicit names dm_simplecmd_{flush,noflush}

easier than the magic value used in static dm_simple_cmd to drive
the flush/noflush behaviour

11 years agoSupport resizing of multipath maps.
Konrad Rzeszutek [Thu, 2 Apr 2009 21:04:17 +0000 (23:04 +0200)]
Support resizing of multipath maps.

This is patch that initially showed up on dm-devel mailing list:
which was posted on dm-devel mailing list, but never ported
over to work with the git version. This forward-port by me

11 years ago[multipathd] signal deadlock
Benjamin Marzinski [Thu, 2 Apr 2009 20:36:41 +0000 (22:36 +0200)]
[multipathd] signal deadlock

If multipathd is run with -v3, both the SIGHUP, and the SIGUSR1 signal handlers
will log a message.  If a multipathd thread receives one of these signals while
it has a log lock held, it deadlocks itself. Also, the SIGHUP handler will grab
the vecs lock, so if any thread receives a SIGHUP while holding the vecs lock,
it deadlocks itself.  This commit blocks the appropriate signals to guard
against this.

11 years ago[multipathd] /var/run/multipathd.sock is world-writable
Hannes Reinecke [Wed, 1 Apr 2009 20:31:01 +0000 (22:31 +0200)]
[multipathd] /var/run/multipathd.sock is world-writable

Due to an stray 'umask()' the socket file is in fact world-writable,
allowing for an easy exploit.

References: 458598

11 years agoStack overflow in uev_trigger()
Hannes Reinecke [Fri, 27 Mar 2009 22:50:18 +0000 (23:50 +0100)]
Stack overflow in uev_trigger()

uev_discard uses sscanf to write a 10 byte string into an array,
but I forgot to take the trailing NULL byte into account.

11 years agoDon't display the state of the newly added map during addition in the daemon
Konrad Rzeszutek [Tue, 24 Mar 2009 18:14:37 +0000 (19:14 +0100)]
Don't display the state of the newly added map during addition in the daemon
and don't switch groups.

A previous commit mass-changed #ifdef DAEMON to check for 'mpp->waiter'.
Unfortunatly when the 'domap' function is called with ACT_CREATE in the daemon,
the mpp->waiter is not set, hence the multipath client mode logic is choosen.
Fixing this triggers another issues which is that newly added path via
ACT_CREATE won't have their waitevent thread created as the caller checks
mpp->action (which changed to ACT_NOTHING) and won't start the thread.

11 years agoFree prio_name and checker_name now that we dynamically allocate them.
Konrad Rzeszutek [Tue, 24 Mar 2009 18:04:31 +0000 (19:04 +0100)]
Free prio_name and checker_name now that we dynamically allocate them.

In earlier releases the prio_name and checker_name would point
to statically allocated values. Now that we strdup them, we need
to free them during shutdown.

11 years agoUnload prio and checkers libraries during shutdown.
Konrad Rzeszutek [Tue, 24 Mar 2009 18:01:05 +0000 (19:01 +0100)]
Unload prio and checkers libraries during shutdown.

Our statup sequence is 'load_config', 'init_checkers', and 'init_prio'.
Both init_* functions reset the list of prio and checkers, which is
unfortunate as in load_config, depending on the multipat.conf, would
load prio and checker libraries. This results in double-loading of
the libraries and a memory leak.

11 years agoRace-condition fix with free_waiter threads during shutdown.
Konrad Rzeszutek [Tue, 24 Mar 2009 17:49:14 +0000 (18:49 +0100)]
Race-condition fix with free_waiter threads during shutdown.

When we shutdown, the main process locks the mutex, causing
all of the free_waiter functions to pile up on their lock.
Once we unlock in the main process, all of the free_waiters
start working. However the next instruction in the main proces
is to destroy the mutex. The short window is all the free_waiter
threads have to do their cleanup before they attempt to unlock
the mutex - which might have been de-allocated (and set to NULL).
End result can be a seg-fault.

This fix adds a ref-count to the mutex so that during shutdown
we spin and wait until all of the free_waiter functions
have completed and the ref-count is set to zero.

11 years ago[checkers] update doc for path checkers and use MALLOC instead of malloc
Konrad Rzeszutek [Tue, 24 Mar 2009 17:22:06 +0000 (18:22 +0100)]
[checkers] update doc for path checkers and use MALLOC instead of malloc

The internal memory debugger throws a fit if the path checkers are
using the malloc instead of the 'MALLOC' macro.

11 years ago[checkers] Allocate only once the EMC-clariion global checker's stage area
Konrad Rzeszutek [Tue, 24 Mar 2009 17:16:48 +0000 (18:16 +0100)]
[checkers] Allocate only once the EMC-clariion global checker's stage area

The multi-path global context on every path checker init would be
set. In scenarios where you have four paths per multipath, that context
would be set four times instead of once causing a small memory leak
(4 bytes per block disk).

11 years ago[lib] add LSI hardware settings to internal defaults
Babu Moger [Sat, 7 Mar 2009 14:49:10 +0000 (15:49 +0100)]
[lib] add LSI hardware settings to internal defaults

This patch adds the hwtable for LSI rdac generic storage. Also sets the feature pg_init_retries to maximum(50).

11 years ago[lib] plug fd leak in callout error path and and error messages
Benjamin Marzinski [Sun, 18 Jan 2009 22:44:51 +0000 (23:44 +0100)]
[lib] plug fd leak in callout error path and and error messages

multipathd was not releasing fds when a fork failed in execute_program.
Also, the error messages from execute_program were not very
helpful. This patch fixes both

11 years ago[lib] dm_flush_map on a non-multipath devmap do nothing and returns 0
Christophe Varoqui [Wed, 17 Dec 2008 23:13:30 +0000 (00:13 +0100)]
[lib] dm_flush_map on a non-multipath devmap do nothing and returns 0

So that "multipath -F" can succeed when non-multipath maps are active
on the system.

11 years ago[lib] don't add up errors in dm_flush_maps()
Christophe Varoqui [Wed, 17 Dec 2008 23:01:37 +0000 (00:01 +0100)]
[lib] don't add up errors in dm_flush_maps()

to avoid return code overflow, as pointed by "Bryn M. Reeves",

11 years ago[multipathd] log the uevent discarding as debug information
Christophe Varoqui [Wed, 17 Dec 2008 22:39:47 +0000 (23:39 +0100)]
[multipathd] log the uevent discarding as debug information

11 years ago[lib] Memory leak when deleting and re-adding device-mapper entries.
Konrad Rzeszutek [Wed, 17 Dec 2008 22:24:40 +0000 (23:24 +0100)]
[lib] Memory leak when deleting and re-adding device-mapper entries.

If we remove a map (with configuration details specified in the multipath.conf file)
and later re-add it, the pointer to the config is over-written without first
de-allocating the values.

11 years ago[multipathd] Memory leak in ev_add_map.
Konrad Rzeszutek [Wed, 17 Dec 2008 22:23:09 +0000 (23:23 +0100)]
[multipathd] Memory leak in ev_add_map.

When using dm_mapname it makes a strdup of the returned value. We use
the dm_mapname return value (alias) in our function but neglected
to free it at the exit points.

11 years ago[lib] The internal debug memory leak printout has output jumbled.
Konrad Rzeszutek [Wed, 17 Dec 2008 22:22:01 +0000 (23:22 +0100)]
[lib] The internal debug memory leak printout has output jumbled.

When using the internal memory leak the function that call realloc get a
confused output. The fix puts the list of operation in the right