11 years agoHonour ALUA preference indicator
Colin Watson [Fri, 12 Feb 2010 12:18:59 +0000 (12:18 +0000)]
Honour ALUA preference indicator

SPC defines the preference indicator (bit 7 of the first byte returned
by REPORT TARGET PORT GROUPS) as indicating a preferred primary target
port group, and says that applications may use it to influence path
selection.  Choose TPGs with this bit set over TPGs with it unset.

This fixes failback handling with the Intel Modular Server.

Signed-off-by: Yingying Zhao <>
Signed-off-by: Colin Watson <>
11 years agoMail address change
Christophe Varoqui [Sat, 6 Feb 2010 22:21:01 +0000 (23:21 +0100)]
Mail address change

11 years agoLatest git -master is not compilable
Rumko [Fri, 5 Feb 2010 20:02:23 +0000 (21:02 +0100)]
Latest git -master is not compilable

Content-Type: text/plain;
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline


In latest git -master on line 1443 of multipathd/main.c lock() is called on=
exit_mutex, but since exit_mutex is a pthread_mutex_t, pthread_mutex_lock()=
is needed.

Attached is the one-liner patch, tested it on a gentoo machine and seems to=

From a6bf54d588c2d0c9d3a97541bcb7b605fd1f3ae0 Mon Sep 17 00:00:00 2001
From: Rumko <>
Date: Fri, 5 Feb 2010 20:59:21 +0100
Subject: [PATCH] Use pthread_mutex_lock() instead of lock() since we are dealing with a
 mutex directly.

11 years agoUpdate path_offline() to return device status
Hannes Reinecke [Wed, 3 Feb 2010 13:22:22 +0000 (14:22 +0100)]
Update path_offline() to return device status

A SCSI device can have for more states than just 'offline' and
'running'. In fact, any device _not_ in state 'running' is
unaccessible to I/O, so running a path checker on these devices
will cause the checker to be delayed and hence stall the entire

This patch updates the path_offline() function to return the
actual device state. Path checkers will only be run if the
state is PATH_UP. A 'blocked' device state will be translated
into PATH_PENDING, causing the checkerloop to skip this device
and recheck as soon as possible.

Signed-off-by: Hannes Reinecke <>
11 years ago[libmultipath] the entry for EMC Envista is broken
Hannes Reinecke [Wed, 3 Feb 2010 14:26:11 +0000 (15:26 +0100)]
[libmultipath] the entry for EMC Envista is broken

It is referring to an unknown field 'getprio'.
Fix that up and use 'prio_name = DEFAULT_PRIO' instead

11 years ago[multipathd] Fix pthread bug in multipath-tools.
Alex Zeffertt [Wed, 3 Feb 2010 12:29:37 +0000 (13:29 +0100)]
[multipathd] Fix pthread bug in multipath-tools.

You should lock the mutex before doing a pthread_cond_wait otherwise
undefined results occur.  In fact we get away with this with glibc,
but with uclibc it causes a segfault.

11 years agoAdd hardware defaults for EMC Invista
Benjamin Marzinski [Tue, 26 Jan 2010 13:01:49 +0000 (14:01 +0100)]
Add hardware defaults for EMC Invista

11 years agoAdd nexenta comstart hardware defaults.
Christophe Varoqui [Fri, 22 Jan 2010 17:45:39 +0000 (18:45 +0100)]
Add nexenta comstart hardware defaults.
Testing was sponsored by Alyseo SARL.

11 years agoAdd checks before use conf->xxx now that they can be null alyseo/master
Christophe Varoqui [Fri, 22 Jan 2010 11:26:39 +0000 (12:26 +0100)]
Add checks before use conf->xxx now that they can be null

11 years agoAdd %z path wildcard to display path serial
Christophe Varoqui [Fri, 22 Jan 2010 09:51:29 +0000 (10:51 +0100)]
Add %z path wildcard to display path serial

11 years ago[lib] don't pretend config file has setup parameters
Christophe Varoqui [Thu, 21 Jan 2010 22:46:19 +0000 (23:46 +0100)]
[lib] don't pretend config file has setup parameters

we already have fallbacks coming from propsel.c functions.
This change make 'multipath -v3' correctly report what set
the value of a parameter (mpe, hwe, cf or internal)

11 years ago[git] Ignore libmultipath/
Christophe Varoqui [Thu, 21 Jan 2010 22:26:25 +0000 (23:26 +0100)]
[git] Ignore libmultipath/

11 years agoDots are special in groff
Guido Günther [Sun, 10 Jan 2010 17:14:59 +0000 (18:14 +0100)]
Dots are special in groff

so don't start a line with it or the rest of the line will be dropped.

12 years agomultipath-tools: fix soname
Benjamin Marzinski [Thu, 3 Dec 2009 01:45:56 +0000 (19:45 -0600)]
multipath-tools: fix soname

I assume that the soname wasn't supposed to have a 'd' at the end.


Signed-off-by: Benjamin Marzinski <>
12 years ago[multipathd] give ev_add_path() separated failure messages
Christophe Varoqui [Sun, 22 Nov 2009 00:16:00 +0000 (01:16 +0100)]
[multipathd] give ev_add_path() separated failure messages

when the multipath already exists and
1/ new path size is 0
2/ new path size is different than the multipath known size

as per Chandra Seetharaman  recommendation.

12 years agomultipath-tools: multipath should allow only path with valid size to get added in...
Chauhan, Vijay [Fri, 20 Nov 2009 15:08:18 +0000 (20:38 +0530)]
multipath-tools: multipath should allow only path with valid size to get added in the map


If READ_CAPACITY fails during device discovery, sd device gets attached with device size 0. Currently multipath discover these paths and adds into the map. RDAC patch checker sends inquiry on each path to check path status, which eventually marks this path as up. If this path is from owning controller then mode select will be issued to switch the pathgroup. But any I/O sent to this path(path with size 0) will eventually fail in sd_prep_fn due to incorrect device size and resulting to ping pong between pathgroups.  We should only allow valid paths to get added in the map. Below patch checks two cases before adding paths; i.e.:
1) device size of path is not 0
2) there is no mismatch between mpp size and new path size.


multipath should only add paths with valid size to the map. If there is mismatch between map and path size it should not be added. This patch also check if the device size is not 0 before adding path. During device discovery if READ_CAPACITY fails, sd device get attached with device size 0. multipath should not allow the such device to get added in the map.

Signed-off-by: Vijay Chauhan <>
12 years agomultipath-toosl: Use current name of the divice node ($name)
Guido Günther [Sat, 21 Nov 2009 20:29:52 +0000 (21:29 +0100)]
multipath-toosl: Use current name of the divice node ($name)

instead of the kernel's name ($kernel). Otherwise we might end up
looking at a wrong or nonexistant node.

12 years agomultipath-tools: fix udev rule for dmraid
Guido Günther [Sat, 21 Nov 2009 17:10:10 +0000 (18:10 +0100)]
multipath-tools: fix udev rule for dmraid

attach patch fixes the udev rule for dmraid by not abusing the mpath
prefix. It also drops the superflous path from kpartx_id.
 -- Guido

From: Hannes Reinecke <>
Date: Tue, 24 Jun 2008 16:38:37 +0200
Subject: [PATCH] Fix udev rules for dmraid

The kpartx_id program is located under /lib/udev, so we don't need to
call it with the full pathname.
And we should also create persistent links for dmraid tables.

12 years agomultipath-tools: add library dependencies
Guido Günther [Sat, 21 Nov 2009 17:19:55 +0000 (18:19 +0100)]
multipath-tools: add library dependencies

attached patch adds dependent libraries when building the shared lib.
This allows other tools like dpkg-shlibdeps to deduce the needed
dependencies automatically.
 -- Guido

From: =?UTF-8?q?Guido=20G=C3=BCnther?= <>
Date: Sun, 30 Aug 2009 14:18:21 +0200
Subject: [PATCH] add library dependencies

12 years agomultipath-tools: add a soname to the library
Guido Günther [Sat, 21 Nov 2009 17:17:20 +0000 (18:17 +0100)]
multipath-tools: add a soname to the library

attached patch adds a fake soname to the created lib making tools such
as lintian happy. I can keep this debian specific if need be but having
a soname certainly won't hurt.
 -- Guido

From: =?UTF-8?q?Guido=20G=C3=BCnther?= <>
Date: Sun, 30 Aug 2009 14:30:34 +0200
Subject: [PATCH] set a soname

12 years agomultipath-tools: check header file instead of intalled lib
Guido Günther [Sat, 21 Nov 2009 17:15:25 +0000 (18:15 +0100)]
multipath-tools: check header file instead of intalled lib

attached patch checks the header file instead of an installed lib for
dm_task_struct. Since distros have this lib add different patchs the
check should be more reliable.
 -- Guido

From: =?UTF-8?q?Guido=20G=C3=BCnther?= <>
Date: Sun, 30 Aug 2009 13:38:55 +0200
Subject: [PATCH] check header file for defintion of dm_task_no_flush

instead of checking the so for the symbol (which seems to be hard to

12 years agomultipath-tools: fix path to FAQ
Guido Günther [Sat, 21 Nov 2009 17:12:26 +0000 (18:12 +0100)]
multipath-tools: fix path to FAQ

attached patch fixes the URL to the FAQ.
 -- Guido

From: Vincent McIntyre <>
Date: Fri, 9 Jan 2009 18:18:46 +0100
Subject: [PATCH] fix URL to FAQ

12 years agomultipath-tools: Default configuration changes
Benjamin Marzinski [Tue, 20 Oct 2009 19:49:47 +0000 (14:49 -0500)]
multipath-tools: Default configuration changes

Add support for some more MSA arrays.

Signed-off-by: Benjamin Marzinski <>
12 years agomultipath-tools: Minor doc fix
Benjamin Marzinski [Tue, 20 Oct 2009 19:48:54 +0000 (14:48 -0500)]
multipath-tools: Minor doc fix

The polling_interval increases caused some confusion, so I'm adding it
to the documentation.

Signed-off-by: Benjamin Marzinski <>
12 years agomultipath-tools: Change default configs to look for "hp_sw" not "hp-sw"
Benjamin Marzinski [Tue, 20 Oct 2009 18:20:42 +0000 (13:20 -0500)]
multipath-tools: Change default configs to look for "hp_sw" not "hp-sw"

The kernel hp_sw handler now wants the hwhandler string to be "hp_sw", not
"hp-sw".  This fixes the default configs to match.

Signed-off-by: Fabio M. Di Nitto <>
Signed-off-by: Benjamin Marzinski <>
12 years agomultipath-tools: rdac path checked leads to I/O hang when volumes are unmapped from...
Chauhan, Vijay [Tue, 20 Oct 2009 13:09:15 +0000 (18:39 +0530)]
multipath-tools: rdac path checked leads to I/O hang when volumes are unmapped from storage.


We are seeing I/O hang when volumes (configured with rdac path checker) are unmapped from the storage. Expected is I/O should fail. Please see the syslog snippet below:

Oct  15 14:40:43 linux kernel: sd 6:0:0:0: queueing MODE_SELECT command.
Oct  15 14:40:43 linux kernel: sd 6:0:0:0: MODE_SELECT failed with sense 0x59100.
Oct  15 14:40:43 linux kernel: end_request: I/O error, dev sdh, sector 18509824
Oct  15 14:40:43 linux kernel: device-mapper: multipath: Failing path 8:112.
Oct  15 14:40:43 linux kernel: end_request: I/O error, dev sdh, sector 0
Oct  15 14:40:43 linux kernel: end_request: I/O error, dev sdh, sector 18512896
Oct  15 14:40:43 linux kernel: end_request: I/O error, dev sdh, sector 18511872
Oct  15 14:40:43 linux kernel: end_request: I/O error, dev sdh, sector 18510848
Oct  15 14:40:43 linux multipathd: 8:112: mark as failed
Oct  15 14:40:43 linux multipathd: 3600a0b800029ea52000097bc4acde51e: Entering recovery mode: max_retries=30
Oct  15 14:40:44 linux multipathd: 3600a0b800029eb0a0000f2af4acde4d1: queue_if_no_path enabled
Oct  15 14:40:44 linux multipathd: 3600a0b800029eb0a0000f2af4acde4d1: Recovered to normal mode
Oct  15 14:40:44 linux kernel: sd 5:0:0:1: queueing MODE_SELECT command.
Oct  15 14:40:44 linux kernel: sd 5:0:0:1: MODE_SELECT failed with sense 0x59100.
Oct  15 14:40:44 linux kernel: end_request: I/O error, dev sdc, sector 0
Oct  15 14:40:44 linux kernel: device-mapper: multipath: Failing path 8:32.
Oct  15 14:40:44 linux kernel: end_request: I/O error, dev sdc, sector 16089088
Oct  15 14:40:44 linux kernel: end_request: I/O error, dev sdc, sector 16090112
Oct  15 14:40:44 linux kernel: end_request: I/O error, dev sdc, sector 16091136
Oct  15 14:40:44 linux kernel: end_request: I/O error, dev sdc, sector 16092160
Oct  15 14:40:44 linux multipathd: 8:32: mark as failed

Below is the patch that fix this issue. When devices are unmapped from storage, rdac patch checker sets the path state for those devices as ghost. As a reason dm issues mode select to failover path group and fails with 0x59100, which eventually ends up with ping pong between path groups resulting in I/O hang. In rdac path checker, we need to check if devices are not connected, mark it as failed. This patch adds check for Peripheral Qualifier (PQ) & Peripheral Device type(PDT) of Inquiry data and fails the path if either 1) PQ is set to 0x1 or 2) PQ set to 0x11 and PDT set to 0x1F.

Signed-off-by: Vijay Chauhan <>
Reviewed-by: Babu Moger <>
12 years agomultipath-tools: Fix dry-run output
Benjamin Marzinski [Mon, 28 Sep 2009 17:19:00 +0000 (12:19 -0500)]
multipath-tools: Fix dry-run output

When multipath checks whether or not the multipath device needs to be renamed,
it only does the check if dry-run isn't selected.  This means that you will
instead see all your renames as creates during a dry-run.  The attached patch
fixes this.

Signed-off-by: Benjamin Marzinski <>
12 years ago[lib] remove spurious and obsolete kdev_t.h include in directio checker
Christophe Varoqui [Fri, 2 Oct 2009 20:06:21 +0000 (22:06 +0200)]
[lib] remove spurious and obsolete kdev_t.h include in directio checker

12 years ago[kpartx] make kpartx deal with more than 256 minor numbers
Benjamin Marzinski [Fri, 2 Oct 2009 20:01:24 +0000 (22:01 +0200)]
[kpartx] make kpartx deal with more than 256 minor numbers

Fix for bz #526550.  Fix kpartx MAKEDEV macro so it can deal with more
than 256 minor numbers.

12 years agoqueue-length/service-time path selectors map parser fix
Kiyoshi Ueda [Fri, 18 Sep 2009 01:37:53 +0000 (10:37 +0900)]
queue-length/service-time path selectors map parser fix

Actual device configuration seems to be working fine, but the getting
information from the configured device seems to be failing due to
table parsing problem in disassemble_map().

I guess the attached patch works around the problem. Please try it.
Please note that this patch may *NOT* be a complete fix.
Some more codes for new dynamic load balancers may be needed.

12 years agomultipath-tools: Fix rtpg buffer length calculation
Benjamin Marzinski [Wed, 2 Sep 2009 19:40:17 +0000 (14:40 -0500)]
multipath-tools: Fix rtpg buffer length calculation

Since you use scsi_buflen to allocate the correct size for the
SCSI RTPG request buffer, You need to have the "+4" in its
calculation, not just in the check to see if the request buffer is
already big enough, otherwise, you'll fail the check, but you
won't allocate a new buffer that is big enough.

Signed-off-by: Benjamin Marzinski <>
12 years agoUpdate multipathd manpage
Ritesh Raj Sarraf [Mon, 31 Aug 2009 05:12:41 +0000 (10:42 +0530)]
Update multipathd manpage

New commands added to the multipathd -k command mode.
Document them in the manpage

Signed-off-by: Ritesh Raj Sarraf <>
12 years ago[doc] comment to not set the alias config option to mpath<n>
Benjamin Marzinski [Mon, 31 Aug 2009 20:38:42 +0000 (22:38 +0200)]
[doc] comment to not set the alias config option to mpath<n>

... since it will conflict with user_friendly_names.
(redhat bz #481239)

12 years ago[FAQ] document directio error when aio-max-nr is exhausted
Bryn M.Reeves [Sun, 30 Aug 2009 20:36:22 +0000 (22:36 +0200)]
[FAQ] document directio error when aio-max-nr is exhausted

12 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

12 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

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

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

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

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

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

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