OBS User unknown 2008-07-25 02:06:36 +00:00 committed by Git OBS Bridge
parent b39e94864b
commit 9b3f66cacd
21 changed files with 8596 additions and 11382 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1b48684c9ce956bb2294640a92f1da8ddea4e991e4d7b974697660de5e44a9d7
size 139312

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b76d93d244f51e328969203366939d4336c89bd572e275d6a0d50d0bc8b4cd23
size 160706

View File

@ -1,336 +0,0 @@
From 0331715b87326c106192b1dbf76f147af10140e6 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 29 Apr 2008 14:25:21 +0200
Subject: [PATCH] Add cciss_tur checker
The 'normal' SG_IO tur checker has some issues with cciss, so
we'd better use a dedicated path checker here.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/checkers.h | 1 +
libmultipath/checkers/Makefile | 1 +
libmultipath/checkers/cciss.h | 142 +++++++++++++++++++++++++++++++++++++
libmultipath/checkers/cciss_tur.c | 137 +++++++++++++++++++++++++++++++++++
4 files changed, 281 insertions(+), 0 deletions(-)
create mode 100644 libmultipath/checkers/cciss.h
create mode 100644 libmultipath/checkers/cciss_tur.c
diff --git a/libmultipath/checkers.h b/libmultipath/checkers.h
index 93337f1..4ff475d 100644
--- a/libmultipath/checkers.h
+++ b/libmultipath/checkers.h
@@ -61,6 +61,7 @@
#define RDAC "rdac"
#define EMC_CLARIION "emc_clariion"
#define READSECTOR0 "readsector0"
+#define CCISS_TUR "cciss_tur"
#define DEFAULT_CHECKER DIRECTIO
diff --git a/libmultipath/checkers/Makefile b/libmultipath/checkers/Makefile
index f37a0f9..9b517f2 100644
--- a/libmultipath/checkers/Makefile
+++ b/libmultipath/checkers/Makefile
@@ -5,6 +5,7 @@
include ../../Makefile.inc
LIBS= \
+ libcheckcciss_tur.so \
libcheckreadsector0.so \
libchecktur.so \
libcheckdirectio.so \
diff --git a/libmultipath/checkers/cciss.h b/libmultipath/checkers/cciss.h
new file mode 100644
index 0000000..f6a37d8
--- /dev/null
+++ b/libmultipath/checkers/cciss.h
@@ -0,0 +1,142 @@
+#ifndef CCISS_H
+#define CCISS_H
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+#define CCISS_IOC_MAGIC 'B'
+
+/*
+ * transfer direction
+ */
+#define XFER_NONE 0x00
+#define XFER_WRITE 0x01
+#define XFER_READ 0x02
+#define XFER_RSVD 0x03
+
+/*
+ * task attribute
+ */
+#define ATTR_UNTAGGED 0x00
+#define ATTR_SIMPLE 0x04
+#define ATTR_HEADOFQUEUE 0x05
+#define ATTR_ORDERED 0x06
+#define ATTR_ACA 0x07
+
+/*
+ * cdb type
+ */
+#define TYPE_CMD 0x00
+#define TYPE_MSG 0x01
+
+#define SENSEINFOBYTES 32
+
+/*
+ * Type defs used in the following structs
+ */
+#define BYTE __u8
+#define WORD __u16
+#define HWORD __u16
+#define DWORD __u32
+
+#pragma pack(1)
+
+//Command List Structure
+typedef union _SCSI3Addr_struct {
+ struct {
+ BYTE Dev;
+ BYTE Bus:6;
+ BYTE Mode:2; // b00
+ } PeripDev;
+ struct {
+ BYTE DevLSB;
+ BYTE DevMSB:6;
+ BYTE Mode:2; // b01
+ } LogDev;
+ struct {
+ BYTE Dev:5;
+ BYTE Bus:3;
+ BYTE Targ:6;
+ BYTE Mode:2; // b10
+ } LogUnit;
+} SCSI3Addr_struct;
+
+typedef struct _PhysDevAddr_struct {
+ DWORD TargetId:24;
+ DWORD Bus:6;
+ DWORD Mode:2;
+ SCSI3Addr_struct Target[2]; //2 level target device addr
+} PhysDevAddr_struct;
+
+typedef struct _LogDevAddr_struct {
+ DWORD VolId:30;
+ DWORD Mode:2;
+ BYTE reserved[4];
+} LogDevAddr_struct;
+
+typedef union _LUNAddr_struct {
+ BYTE LunAddrBytes[8];
+ SCSI3Addr_struct SCSI3Lun[4];
+ PhysDevAddr_struct PhysDev;
+ LogDevAddr_struct LogDev;
+} LUNAddr_struct;
+
+typedef struct _RequestBlock_struct {
+ BYTE CDBLen;
+ struct {
+ BYTE Type:3;
+ BYTE Attribute:3;
+ BYTE Direction:2;
+ } Type;
+ HWORD Timeout;
+ BYTE CDB[16];
+} RequestBlock_struct;
+
+typedef union _MoreErrInfo_struct{
+ struct {
+ BYTE Reserved[3];
+ BYTE Type;
+ DWORD ErrorInfo;
+ }Common_Info;
+ struct{
+ BYTE Reserved[2];
+ BYTE offense_size;//size of offending entry
+ BYTE offense_num; //byte # of offense 0-base
+ DWORD offense_value;
+ }Invalid_Cmd;
+}MoreErrInfo_struct;
+
+typedef struct _ErrorInfo_struct {
+ BYTE ScsiStatus;
+ BYTE SenseLen;
+ HWORD CommandStatus;
+ DWORD ResidualCnt;
+ MoreErrInfo_struct MoreErrInfo;
+ BYTE SenseInfo[SENSEINFOBYTES];
+} ErrorInfo_struct;
+
+#pragma pack()
+
+typedef struct _IOCTL_Command_struct {
+ LUNAddr_struct LUN_info;
+ RequestBlock_struct Request;
+ ErrorInfo_struct error_info;
+ WORD buf_size; /* size in bytes of the buf */
+ BYTE *buf;
+} IOCTL_Command_struct;
+
+typedef struct _LogvolInfo_struct{
+ __u32 LunID;
+ int num_opens; /* number of opens on the logical volume */
+ int num_parts; /* number of partitions configured on logvol */
+} LogvolInfo_struct;
+
+#define CCISS_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 11, IOCTL_Command_struct)
+#define CCISS_GETLUNINFO _IOR(CCISS_IOC_MAGIC, 17, LogvolInfo_struct)
+
+int cciss_init( struct checker *);
+void cciss_free (struct checker * c);
+int cciss_tur( struct checker *);
+
+#endif
+
diff --git a/libmultipath/checkers/cciss_tur.c b/libmultipath/checkers/cciss_tur.c
new file mode 100644
index 0000000..4c26901
--- /dev/null
+++ b/libmultipath/checkers/cciss_tur.c
@@ -0,0 +1,137 @@
+/*
+ *****************************************************************************
+ * *
+ * (C) Copyright 2007 Hewlett-Packard Development Company, L.P *
+ * *
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU General Public License as published by the Free*
+ * Software Foundation; either version 2 of the License, or (at your option)*
+ * any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY*
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
+ * for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License along *
+ * with this program; if not, write to the Free Software Foundation, Inc., *
+ * 675 Mass Ave, Cambridge, MA 02139, USA. *
+ * *
+ * The copy of the GNU General Public License is available at *
+ * /opt/hp/HPDMmultipath-tool directoy *
+ * *
+ *****************************************************************************
+*/
+
+/*
+ * This program originally derived from and inspired by
+ * Christophe Varoqui's tur.c, part of libchecker.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+
+#include "checkers.h"
+
+#include "cciss.h"
+
+#define TUR_CMD_LEN 6
+#define HEAVY_CHECK_COUNT 10
+
+#define MSG_CCISS_TUR_UP "cciss_tur checker reports path is up"
+#define MSG_CCISS_TUR_DOWN "cciss_tur checker reports path is down"
+
+struct cciss_tur_checker_context {
+ void * dummy;
+};
+
+int libcheck_init (struct checker * c)
+{
+ return 0;
+}
+
+void libcheck_free (struct checker * c)
+{
+ return;
+}
+
+extern int
+libcheck_check (struct checker * c)
+{
+ int rc;
+ int ret;
+ unsigned int lun = 0;
+ struct cciss_tur_checker_context * ctxt = NULL;
+ LogvolInfo_struct lvi; // logical "volume" info
+ IOCTL_Command_struct cic; // cciss ioctl command
+
+ if ((c->fd) <= 0) {
+ MSG(c,"no usable fd");
+ ret = -1;
+ goto out;
+ }
+
+ rc = ioctl(c->fd, CCISS_GETLUNINFO, &lvi);
+ if ( rc != 0) {
+ perror("Error: ");
+ fprintf(stderr, "cciss TUR failed in CCISS_GETLUNINFO: %s\n",
+ strerror(errno));
+ MSG(c,MSG_CCISS_TUR_DOWN);
+ ret = PATH_DOWN;
+ goto out;
+ } else {
+ lun = lvi.LunID;
+ }
+
+ memset(&cic, 0, sizeof(cic));
+ cic.LUN_info.LogDev.VolId = lun & 0x3FFFFFFF;
+ cic.LUN_info.LogDev.Mode = 0x01; /* logical volume addressing */
+ cic.Request.CDBLen = 6; /* need to try just 2 bytes here */
+ cic.Request.Type.Type = TYPE_CMD; // It is a command.
+ cic.Request.Type.Attribute = ATTR_SIMPLE;
+ cic.Request.Type.Direction = XFER_NONE;
+ cic.Request.Timeout = 0;
+
+ cic.Request.CDB[0] = 0;
+ cic.Request.CDB[1] = 0;
+ cic.Request.CDB[2] = 0;
+ cic.Request.CDB[3] = 0;
+ cic.Request.CDB[4] = 0;
+ cic.Request.CDB[5] = 0;
+
+ rc = ioctl(c->fd, CCISS_PASSTHRU, &cic);
+ if (rc < 0) {
+ fprintf(stderr, "cciss TUR failed: %s\n",
+ strerror(errno));
+ MSG(c,MSG_CCISS_TUR_DOWN);
+ ret = PATH_DOWN;
+ goto out;
+ }
+
+ if ((cic.error_info.CommandStatus | cic.error_info.ScsiStatus )) {
+ MSG(c,MSG_CCISS_TUR_DOWN);
+ ret = PATH_DOWN;
+ goto out;
+ }
+
+ MSG(c,MSG_CCISS_TUR_UP);
+
+ ret = PATH_UP;
+out:
+ /*
+ * caller told us he doesn't want to keep the context :
+ * free it
+ */
+ if (!c->context)
+ free(ctxt);
+
+ return(ret);
+}
--
1.5.2.4

View File

@ -1,211 +0,0 @@
diff --git a/kpartx/Makefile b/kpartx/Makefile
index d970d29..e6a7296 100644
--- a/kpartx/Makefile
+++ b/kpartx/Makefile
@@ -37,8 +37,10 @@ $(MULTIPATHLIB)-$(BUILD).a:
install: $(EXEC) $(EXEC).8
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)
+ $(INSTALL_PROGRAM) -m 755 activate_dm_linear $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) -d $(DESTDIR)$(libudevdir)
$(INSTALL_PROGRAM) -m 755 kpartx_id $(DESTDIR)$(libudevdir)
+ $(INSTALL_PROGRAM) -m 755 dm_linear $(DESTDIR)$(libudevdir)
$(INSTALL_PROGRAM) -d $(DESTDIR)/etc/udev/rules.d
$(INSTALL_PROGRAM) -m 644 kpartx.rules $(DESTDIR)/etc/udev/rules.d/70-kpartx.rules
$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)
@@ -46,6 +48,11 @@ install: $(EXEC) kpartx_id $(EXEC).8
uninstall:
rm -f $(DESTDIR)$(bindir)/$(EXEC)
+ rm -f $(DESTDIR)$(bindir)/activate_dm_linear
+ rm -f $(DESTDIR)$(libudevdir)/kpartx_id
+ rm -f $(DESTDIR)$(libudevdir)/dm_linear
+ rm -f $(DESTDIR)/etc/udev/rules.d/70-kpartx.rules
+ rm -f $(DESTDIR)$(mandir)/$(EXEC).8
clean:
rm -f core *.o $(EXEC)
diff --git a/kpartx/activate_dm_linear b/kpartx/activate_dm_linear
new file mode 100644
index 0000000..7481bd4
--- /dev/null
+++ b/kpartx/activate_dm_linear
@@ -0,0 +1,76 @@
+#!/bin/sh
+#
+# activate_dm_linear
+#
+# Activate a linear mapping on top of an existing block device.
+# This allows for partitions to be mapped via kpartx, so all
+# partitions on a device can be accessed.
+#
+
+RULE=/etc/udev/rules.d/62-dm_linear.rules
+
+if [ -z "$1" ] ; then
+ echo "Usage: $0 [-d] devname"
+ exit 1
+fi
+
+if [ "$1" == "-d" ] ; then
+ remove_only=1
+ shift
+fi
+
+if [ ! -b "$1" ] ; then
+ echo "$1 is not a block device"
+ exit 1
+fi
+
+dev=${1#/dev/}
+
+if [ ! -d /sys/block/$dev ] ; then
+ echo "$1 is not a disk device"
+ exit 1
+fi
+
+blksize=$(/sbin/blockdev --getsize $1)
+if [ $? -ne 0 ] ; then
+ echo "blockdev --getsize $1 failed: $?"
+ exit 1
+fi
+
+for link in $(udevinfo -q symlink -p /block/$dev) ; do
+ case "$link" in
+ */by-id/ata*)
+ atalink=${link#*/by-id/ata-}
+ ;;
+ */by-id/scsi*)
+ scsilink=${link#*/by-id/scsi-}
+ ;;
+ esac
+done
+if [ "$atalink" ] ; then
+ serial="$atalink"
+ bus="ata"
+fi
+if [ "$scsilink" ] ; then
+ unset atalink
+ serial="$scsilink"
+ bus="scsi"
+fi
+if [ "$serial" ]; then
+ # Remove existing rules
+ echo "/$serial/d
+w
+q
+" | ed $RULE > /dev/null 2>&1
+ [ "$remove_only" = 1 ] && exit 0
+ # And create a new one
+ if [ "$atalink" ] ; then
+ cat >> $RULE <<EOF
+ACTION=="add", KERNEL=="sd*[!0-9]", ENV{ID_VENDOR}=="ATA", ENV{ID_ATA_COMPAT}=="$serial", RUN+="dm_linear /dev/\$kernel $blksize ata-\$env{ID_ATA_COMPAT}"
+EOF
+ else
+ cat >> $RULE <<EOF
+ACTION=="add", KERNEL=="sd*[!0-9]", ENV{ID_BUS}=="$bus", ENV{ID_SERIAL}=="$serial", RUN+="dm_linear \$kernel /dev/$blksize \$env{ID_BUS}-\$env{ID_SERIAL}"
+EOF
+ fi
+fi
diff --git a/kpartx/dm_linear b/kpartx/dm_linear
new file mode 100755
index 0000000..d1de7e4
--- /dev/null
+++ b/kpartx/dm_linear
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Create a linear table on top of a given device
+# usage:
+# dm_linear <dev> <size> <name>
+#
+
+if [ -z "$1" ] ; then
+ exit 1
+fi
+
+if [ ! -b "$1" ] ; then
+ exit 2
+fi
+
+if [ -z "$2" ] ; then
+ exit 3
+fi
+
+if [ -z "$3" ] ; then
+ exit 4
+fi
+
+echo 0 $2 linear $1 0 | /sbin/dmsetup create "$3" -u "linear-$3"
+
+exit $?
+
diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules
index 9ab9a49..2746eff 100644
--- a/kpartx/kpartx.rules
+++ b/kpartx/kpartx.rules
@@ -21,6 +21,10 @@ ENV{DM_UUID}=="mpath-*", \
ENV{DM_UUID}=="dmraid-*", \
SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}"
+# Create persistent links for linear tables
+ENV{DM_UUID}=="linear-*", \
+ SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}"
+
# Create persistent links for partitions
ENV{DM_PART}=="?*", \
SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}-part$env{DM_PART}"
@@ -30,6 +34,8 @@ ENV{DM_STATE}=="ACTIVE", ENV{DM_UUID}=="mpath-*", \
RUN+="/sbin/kpartx -a -p _part /dev/$kernel"
ENV{DM_STATE}=="ACTIVE", ENV{DM_UUID}=="dmraid-*", \
RUN+="/sbin/kpartx -a -p -part /dev/$kernel"
+ENV{DM_STATE}=="ACTIVE", ENV{DM_UUID}=="linear-*", \
+ RUN+="/sbin/kpartx -a -p _part /dev/$kernel"
LABEL="kpartx_end"
diff --git a/kpartx/kpartx_id b/kpartx/kpartx_id
index 81f32bf..c402e98 100644
--- a/kpartx/kpartx_id
+++ b/kpartx/kpartx_id
@@ -50,7 +50,7 @@ else
fi
# Set the name of the table. We're only interested in dmraid,
-# multipath, and kpartx tables; everything else is ignored.
+# multipath, linear, and kpartx tables; everything else is ignored.
if [ "$dmtbl" = "part" ] ; then
# The name of the kpartx table is the name of the parent table
dmname=$($DMSETUP info -c --noheadings -o name -u $dmuuid)
@@ -61,6 +61,10 @@ if [ "$dmtbl" = "part" ] ; then
mpath-*)
dmdeps=$($DMSETUP deps -u $dmuuid)
;;
+ linear-*)
+ dmtbl=linear
+ dmuuid=${dmuuid#*-}
+ ;;
esac
elif [ "$dmtbl" = "mpath" ] ; then
dmname=$tblname
@@ -72,8 +76,8 @@ fi
[ -n "$dmpart" ] && echo "DM_PART=$dmpart"
-# Figure out the type of the map. For non-multipath maps it's
-# always 'raid'.
+# Figure out the type of the map. For non-multipath non-linear
+# maps it's always 'raid'.
if [ -n "$dmdeps" ] ; then
case "$dmdeps" in
*\(94,*)
@@ -86,6 +90,9 @@ if [ -n "$dmdeps" ] ; then
echo "DM_TYPE=scsi"
;;
esac
+elif [ "$dmtbl" = linear ]; then
+ echo "DM_TYPE=${dmuuid%%-*}"
+ echo "DM_NAME=${dmuuid#*-}"
else
echo "DM_TYPE=raid"
fi

View File

@ -1,58 +0,0 @@
From 9c15b6662a2cf05c70175e8afcbde5a98fe12639 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 29 Apr 2008 12:59:07 +0200
Subject: [PATCH] [libmultipath] block SIGPIPE before writing to a pipe
We have to block SIGPIPE before we're writing to the communication
pipe otherwise the daemon will be killed if the listening program
terminates prematurely.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/uxsock.c | 23 ++++++++++++++++++++---
1 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/libmultipath/uxsock.c b/libmultipath/uxsock.c
index abb9f85..cdc3dbc 100644
--- a/libmultipath/uxsock.c
+++ b/libmultipath/uxsock.c
@@ -14,6 +14,7 @@
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/poll.h>
+#include <signal.h>
#include <errno.h>
#include "memory.h"
@@ -127,9 +128,25 @@ size_t read_all(int fd, void *buf, size_t len)
*/
int send_packet(int fd, const char *buf, size_t len)
{
- if (write_all(fd, &len, sizeof(len)) != sizeof(len)) return -1;
- if (write_all(fd, buf, len) != len) return -1;
- return 0;
+ int ret = 0;
+#ifdef DAEMON
+ sigset_t set, old;
+
+ /* Block SIGPIPE */
+ sigemptyset(&set);
+ sigaddset(&set, SIGPIPE);
+ pthread_sigmask(SIG_BLOCK, &set, &old);
+#endif
+ if (write_all(fd, &len, sizeof(len)) != sizeof(len))
+ ret = -1;
+ if (!ret && write_all(fd, buf, len) != len)
+ ret = -1;
+
+#ifdef DAEMON
+ /* And unblock it again */
+ pthread_sigmask(SIG_SETMASK, &old, NULL);
+#endif
+ return ret;
}
/*
--
1.5.2.4

View File

@ -1,30 +0,0 @@
From a3b85c9eefa959db9a54d27ffc34a23e9bceaeeb Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 29 Apr 2008 13:07:39 +0200
Subject: [PATCH] multipathd crash on shutdown
On shutdown multipathd flushes its internal message queue;
but we have to check if the messages on the queue are not empty.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/log_pthread.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/libmultipath/log_pthread.c b/libmultipath/log_pthread.c
index 5a82b6a..8976bfb 100644
--- a/libmultipath/log_pthread.c
+++ b/libmultipath/log_pthread.c
@@ -33,7 +33,8 @@ static void flush_logqueue (void)
pthread_mutex_lock(logq_lock);
empty = log_dequeue(la->buff);
pthread_mutex_unlock(logq_lock);
- log_syslog(la->buff);
+ if (!empty)
+ log_syslog(la->buff);
} while (empty == 0);
}
--
1.5.2.4

View File

@ -1,30 +0,0 @@
From f59db7b23a40f4f3b7317a3963eafafce6198e08 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 29 Apr 2008 13:45:41 +0200
Subject: [PATCH] Fixup varags usage
We already call va_end() at the correct position, no need to
duplicate it in log_safe().
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/log_pthread.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/libmultipath/log_pthread.c b/libmultipath/log_pthread.c
index 8976bfb..8909440 100644
--- a/libmultipath/log_pthread.c
+++ b/libmultipath/log_pthread.c
@@ -15,9 +15,7 @@
void log_safe (int prio, const char * fmt, va_list ap)
{
pthread_mutex_lock(logq_lock);
- //va_start(ap, fmt);
log_enqueue(prio, fmt, ap);
- va_end(ap);
pthread_mutex_unlock(logq_lock);
pthread_mutex_lock(logev_lock);
--
1.5.2.4

File diff suppressed because it is too large Load Diff

View File

@ -1,37 +0,0 @@
commit 6d1bf23952e810ce41dd9f9d25e817eb56ecf93f
Author: Hannes Reinecke <hare@suse.de>
Date: Tue May 27 14:07:37 2008 +0200
kpartx: Fixup stacked device offset
For stacked devices we should calculate the offset relative to
the enclosing partition, not the entire device.
References: 394658
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c
index 13d039d..68f17c8 100644
--- a/kpartx/kpartx.c
+++ b/kpartx/kpartx.c
@@ -467,6 +467,7 @@ main(int argc, char **argv){
d = c;
while (c) {
for (j = 0; j < n; j++) {
+ uint64_t start;
int k = slices[j].container - 1;
if (slices[j].size == 0)
@@ -492,10 +493,11 @@ main(int argc, char **argv){
}
strip_slash(partname);
+ start = slices[j].start - slices[k].start;
if (safe_sprintf(params, "%d:%d %" PRIu64,
slices[k].major,
slices[k].minor,
- slices[j].start)) {
+ start)) {
fprintf(stderr, "params too small\n");
exit(1);
}

View File

@ -1,87 +0,0 @@
From 50cebd09cf3c79c25638b3c7befeb1219b1a04d9 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 29 Apr 2008 13:48:23 +0200
Subject: [PATCH] libdevmapper prints garbage on shutdown
This patch fixes 2 logging bugs:
o multipath command prints unexpected log message like
"libdevmapper: libdm-common.c(303): Created /dev/mapper/<mapname>"
o multipathd doesn't log messages like "--------shut down------"
during the exit path
What is the problem:
o multipath command and multipathd register dm_write_log() using
dm_log_init() and it can be called from libdevmapper codes like
dm_lib_release().
o dm_write_log() references the global "conf" to find the verbosity,
but it is freed before dm_lib_release() calls dm_write_log().
o So dm_write_log() reads garbage value like big vervosity.
What does the patch do:
o multipath command sets NULL to "conf" after freeing it.
This prevents dm_write_log() from reading garbage data.
o multipath command and multipathd free "conf" after all logging
are completed, because the logging functions reference it
to find the verbosity.
Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
multipath/main.c | 10 +++++++++-
multipathd/main.c | 10 ++++++++--
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/multipath/main.c b/multipath/main.c
index 0f4b2d2..b6ea6fd 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -429,9 +429,17 @@ main (int argc, char *argv[])
out:
sysfs_cleanup();
- free_config(conf);
dm_lib_release();
dm_lib_exit();
+
+ /*
+ * Freeing config must be done after dm_lib_exit(), because
+ * the logging function (dm_write_log()), which is called there,
+ * references the config.
+ */
+ free_config(conf);
+ conf = NULL;
+
#ifdef _DEBUG_
dbg_free_final(NULL);
#endif
diff --git a/multipathd/main.c b/multipathd/main.c
index 50e7441..385521c 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1373,8 +1373,6 @@ child (void * param)
vecs->lock = NULL;
FREE(vecs);
vecs = NULL;
- free_config(conf);
- conf = NULL;
condlog(2, "--------shut down-------");
@@ -1384,6 +1382,14 @@ child (void * param)
dm_lib_release();
dm_lib_exit();
+ /*
+ * Freeing config must be done after condlog() and dm_lib_exit(),
+ * because logging functions like dlog() and dm_write_log()
+ * reference the config.
+ */
+ free_config(conf);
+ conf = NULL;
+
#ifdef _DEBUG_
dbg_free_final(NULL);
#endif
--
1.5.2.4

View File

@ -1,123 +0,0 @@
From d9cc62aa19e92df154f016c167265fd74a848063 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 29 Apr 2008 14:02:49 +0200
Subject: [PATCH] Don't print failure messages for callouts by default
Calling 'multipath -ll' on devices with paths results in
lots of error messages; they really should be suppressed
for the normal output. The user can always have them printed
out by increasing verbosity.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/callout.c | 14 ++++++++++++--
libmultipath/discovery.c | 8 ++++----
libmultipath/prioritizers/alua.c | 6 +++++-
3 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/libmultipath/callout.c b/libmultipath/callout.c
index d54f3ca..4dd33c5 100644
--- a/libmultipath/callout.c
+++ b/libmultipath/callout.c
@@ -10,6 +10,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <stdlib.h>
+#include <fcntl.h>
#include <sys/wait.h>
#include <errno.h>
@@ -32,7 +33,7 @@ int execute_program(char *path, char *value, int len)
int retval;
int count;
int status;
- int fds[2];
+ int fds[2], null_fd;
pid_t pid;
char *pos;
char arg[PROGRAM_SIZE];
@@ -75,7 +76,16 @@ int execute_program(char *path, char *value, int len)
close(STDOUT_FILENO);
/* dup write side of pipe to STDOUT */
- dup(fds[1]);
+ if (dup(fds[1]) < 0)
+ return -1;
+
+ /* Ignore writes to stderr */
+ null_fd = open("/dev/null", O_WRONLY);
+ if (null_fd > 0) {
+ close(STDERR_FILENO);
+ dup(null_fd);
+ close(null_fd);
+ }
retval = execv(argv[0], argv);
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 83e1865..8cfb53f 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -623,8 +623,8 @@ get_state (struct path * pp)
}
pp->state = checker_check(c);
condlog(3, "%s: state = %i", pp->dev, pp->state);
- if (pp->state == PATH_DOWN)
- condlog(2, "%s: checker msg is \"%s\"",
+ if (pp->state == PATH_DOWN && strlen(checker_message(c)))
+ condlog(3, "%s: checker msg is \"%s\"",
pp->dev, checker_message(c));
return 0;
}
@@ -642,7 +642,7 @@ get_prio (struct path * pp)
}
pp->priority = prio_getprio(pp->prio, pp);
if (pp->priority < 0) {
- condlog(0, "%s: %s prio error", pp->dev, prio_name(pp->prio));
+ condlog(3, "%s: %s prio error", pp->dev, prio_name(pp->prio));
pp->priority = PRIO_UNDEF;
return 1;
}
@@ -663,7 +663,7 @@ get_uid (struct path * pp)
condlog(0, "error formatting uid callout command");
memset(pp->wwid, 0, WWID_SIZE);
} else if (execute_program(buff, pp->wwid, WWID_SIZE)) {
- condlog(0, "error calling out %s", buff);
+ condlog(3, "error calling out %s", buff);
memset(pp->wwid, 0, WWID_SIZE);
return 1;
}
diff --git a/libmultipath/prioritizers/alua.c b/libmultipath/prioritizers/alua.c
index 67e4adb..1b52b8e 100644
--- a/libmultipath/prioritizers/alua.c
+++ b/libmultipath/prioritizers/alua.c
@@ -22,6 +22,7 @@
#define ALUA_PRIO_NOT_SUPPORTED 1
#define ALUA_PRIO_RTPG_FAILED 2
#define ALUA_PRIO_GETAAS_FAILED 3
+#define ALUA_PRIO_TPGS_FAILED 4
int
get_alua_info(int fd)
@@ -38,7 +39,7 @@ get_alua_info(int fd)
rc = get_target_port_group_support(fd);
if (rc < 0)
- return rc;
+ return -ALUA_PRIO_TPGS_FAILED;
if (rc == TPGS_NONE)
return -ALUA_PRIO_NOT_SUPPORTED;
@@ -85,6 +86,9 @@ int getprio (struct path * pp)
case ALUA_PRIO_GETAAS_FAILED:
condlog(0, "%s: couln't get asymmetric access state", pp->dev);
break;
+ case ALUA_PRIO_TPGS_FAILED:
+ condlog(3, "%s: couln't get supported alua states", pp->dev);
+ break;
}
}
return rc;
--
1.5.2.4

View File

@ -1,491 +0,0 @@
From 09345f745f894b261bccef694bcd36d79095d2b6 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 29 Apr 2008 16:17:56 +0200
Subject: [PATCH] Remove DEAMON defines
We're now building just one multipath.so library, so any
DAEMON defines are pointless. And we should be setting
the correct dlopen path during compilation.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/Makefile | 13 ++++++-------
libmultipath/checkers.c | 3 ++-
libmultipath/configure.c | 26 +++++++++++++-------------
libmultipath/debug.c | 8 +-------
libmultipath/debug.h | 10 +---------
libmultipath/devmapper.c | 12 ++----------
libmultipath/discovery.c | 11 +----------
libmultipath/dmparser.c | 4 +---
libmultipath/prio.c | 17 +++++++++--------
libmultipath/structs.c | 4 +---
libmultipath/structs_vec.c | 11 +++++------
libmultipath/structs_vec.h | 2 --
libmultipath/uxsock.c | 10 ++++------
libmultipath/waiter.h | 3 ---
multipath/Makefile | 2 +-
multipath/main.c | 2 ++
multipathd/Makefile | 2 +-
multipathd/main.c | 2 ++
18 files changed, 52 insertions(+), 90 deletions(-)
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index 16bd978..55721e8 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -11,23 +11,22 @@ OBJS = memory.o parser.o vector.o devmapper.o callout.o \
structs.o discovery.o propsel.o dict.o \
pgpolicies.o debug.o regex.o defaults.o uevent.o \
switchgroup.o uxsock.o print.o alias.o log_pthread.o \
- log.o configure.o structs_vec.o sysfs.o prio.o checkers.o
+ log.o configure.o structs_vec.o sysfs.o prio.o checkers.o \
+ lock.o waiter.o
-#ifeq ($(strip $(DAEMON)),1)
- OBJS += lock.o waiter.o
- CFLAGS += -DDAEMON
-#endif
-LIBDM_API_FLUSH = $(shell objdump -T /lib/libdevmapper.so.* | grep -c dm_task_no_flush)
+LIBDM_API_FLUSH = $(shell if test -d /lib64 ; then objdump -T /lib64/libdevmapper.so* ; else objdump -T /lib/libdevmapper.so.* ; fi | grep -c dm_task_no_flush)
ifeq ($(strip $(LIBDM_API_FLUSH)),1)
CFLAGS += -DLIBDM_API_FLUSH
endif
+CFLAGS += -DLIBMULTIPATH=\"$(libdir)\"
+
all: $(LIBS)
$(LIBS): $(OBJS)
- $(CC) $(SHARED_FLAGS) $(CFLAGS) -o $@ $(OBJS)
+ $(CC) $(SHARED_FLAGS) $(CFLAGS) -o $@ $(OBJS)
install:
$(INSTALL_PROGRAM) -o root -g root -m 755 -d $(libdir)
diff --git a/libmultipath/checkers.c b/libmultipath/checkers.c
index ff606d0..ce9dd86 100644
--- a/libmultipath/checkers.c
+++ b/libmultipath/checkers.c
@@ -61,7 +61,8 @@ struct checker * add_checker (char * name)
c = alloc_checker();
if (!c)
return NULL;
- snprintf(libname, LIB_CHECKER_NAMELEN, "libcheck%s.so", name);
+ snprintf(libname, LIB_CHECKER_NAMELEN, "%s/libcheck%s.so",
+ LIBMULTIPATH, name);
condlog(3, "loading %s checker", libname);
handle = dlopen(libname, RTLD_NOW);
errstr = dlerror();
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index df31cdd..8fdc9f2 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -367,19 +367,19 @@ domap (struct multipath * mpp)
* DM_DEVICE_CREATE, DM_DEVICE_RENAME, or DM_DEVICE_RELOAD
* succeeded
*/
-#ifndef DAEMON
- dm_switchgroup(mpp->alias, mpp->bestpg);
- if (mpp->action != ACT_NOTHING)
- print_multipath_topology(mpp, conf->verbosity);
-#else
- mpp->stat_map_loads++;
- condlog(2, "%s: load table [0 %llu %s %s]", mpp->alias,
- mpp->size, DEFAULT_TARGET, mpp->params);
- /*
- * Required action is over, reset for the stateful daemon
- */
- mpp->action = ACT_NOTHING;
-#endif
+ if (!mpp->waiter) {
+ dm_switchgroup(mpp->alias, mpp->bestpg);
+ if (mpp->action != ACT_NOTHING)
+ print_multipath_topology(mpp, conf->verbosity);
+ } else {
+ mpp->stat_map_loads++;
+ condlog(2, "%s: load table [0 %llu %s %s]", mpp->alias,
+ mpp->size, DEFAULT_TARGET, mpp->params);
+ /*
+ * Required action is over, reset for the stateful daemon
+ */
+ mpp->action = ACT_NOTHING;
+ }
return DOMAP_OK;
}
return DOMAP_FAIL;
diff --git a/libmultipath/debug.c b/libmultipath/debug.c
index 05dfb06..d30517d 100644
--- a/libmultipath/debug.c
+++ b/libmultipath/debug.c
@@ -5,11 +5,9 @@
#include <stdlib.h>
#include <stdarg.h>
-#if DAEMON
#include "log_pthread.h"
#include <sys/types.h>
#include <time.h>
-#endif
#include "vector.h"
#include "config.h"
@@ -23,12 +21,11 @@ void dlog (int sink, int prio, const char * fmt, ...)
thres = (conf) ? conf->verbosity : 0;
if (prio <= thres) {
-#if DAEMON
if (!sink) {
time_t t = time(NULL);
struct tm *tb = localtime(&t);
char buff[16];
-
+
strftime(buff, sizeof(buff), "%b %d %H:%M:%S", tb);
buff[sizeof(buff)-1] = '\0';
@@ -37,9 +34,6 @@ void dlog (int sink, int prio, const char * fmt, ...)
}
else
log_safe(prio + 3, fmt, ap);
-#else
- vfprintf(stdout, fmt, ap);
-#endif
}
va_end(ap);
}
diff --git a/libmultipath/debug.h b/libmultipath/debug.h
index 082fff1..c6120c1 100644
--- a/libmultipath/debug.h
+++ b/libmultipath/debug.h
@@ -1,21 +1,13 @@
void dlog (int sink, int prio, const char * fmt, ...)
__attribute__((format(printf, 3, 4)));
-#if DAEMON
#include <pthread.h>
#include <stdarg.h>
#include "log_pthread.h"
-int logsink;
+extern int logsink;
#define condlog(prio, fmt, args...) \
dlog(logsink, prio, fmt "\n", ##args)
-
-#else /* DAEMON */
-
-#define condlog(prio, fmt, args...) \
- dlog(0, prio, fmt "\n", ##args)
-
-#endif /* DAEMON */
diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index f21d3ab..cc01486 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -22,11 +22,9 @@
#include "devmapper.h"
#include "config.h"
-#if DAEMON
#include "log_pthread.h"
#include <sys/types.h>
#include <time.h>
-#endif
#define MAX_WAIT 5
#define LOOPS_PER_SEC 5
@@ -47,8 +45,7 @@ dm_write_log (int level, const char *file, int line, const char *f, ...)
if (thres <= 3 || level > thres)
return;
- va_start(ap, f);
-#if DAEMON
+ va_start(ap, f);
if (!logsink) {
time_t t = time(NULL);
struct tm *tb = localtime(&t);
@@ -65,12 +62,7 @@ dm_write_log (int level, const char *file, int line, const char *f, ...)
condlog(level, "libdevmapper: %s(%i): ", file, line);
log_safe(level + 3, f, ap);
}
-#else
- fprintf(stdout, "libdevmapper: %s(%i): ", file, line);
- vfprintf(stdout, f, ap);
- fprintf(stdout, "\n");
-#endif
- va_end(ap);
+ va_end(ap);
return;
}
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 8cfb53f..7baa9e7 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -716,10 +716,6 @@ pathinfo (struct path *pp, vector hwtable, int mask)
if (mask & DI_WWID && !strlen(pp->wwid))
get_uid(pp);
-#ifndef DAEMON
- close(pp->fd);
- pp->fd = -1;
-#endif
return 0;
blank:
@@ -728,11 +724,6 @@ blank:
*/
memset(pp->wwid, 0, WWID_SIZE);
pp->state = PATH_DOWN;
-#ifndef DAEMON
- if (pp->fd > 0){
- close(pp->fd);
- pp->fd = -1;
- }
-#endif
+
return 0;
}
diff --git a/libmultipath/dmparser.c b/libmultipath/dmparser.c
index fe7d986..1ef22fb 100644
--- a/libmultipath/dmparser.c
+++ b/libmultipath/dmparser.c
@@ -277,10 +277,8 @@ disassemble_map (vector pathvec, char * params, struct multipath * mpp)
strncpy(pp->dev_t, word, BLK_DEV_SIZE);
-#ifndef DAEMON
- if (store_path(pathvec, pp))
+ if (mpp->waiter && store_path(pathvec, pp))
goto out;
-#endif
}
FREE(word);
diff --git a/libmultipath/prio.c b/libmultipath/prio.c
index 617fc19..4d6d840 100644
--- a/libmultipath/prio.c
+++ b/libmultipath/prio.c
@@ -28,18 +28,18 @@ void free_prio (struct prio * p)
void cleanup_prio(void)
{
- struct prio * prio_loop;
- struct prio * prio_temp;
+ struct prio * prio_loop;
+ struct prio * prio_temp;
- list_for_each_entry_safe(prio_loop, prio_temp, &prioritizers, node) {
- list_del(&prio_loop->node);
- free(prio_loop);
- }
+ list_for_each_entry_safe(prio_loop, prio_temp, &prioritizers, node) {
+ list_del(&prio_loop->node);
+ free(prio_loop);
+ }
}
struct prio * prio_lookup (char * name)
{
- struct prio * p;
+ struct prio * p;
list_for_each_entry(p, &prioritizers, node) {
if (!strncmp(name, p->name, PRIO_NAME_LEN))
@@ -61,7 +61,8 @@ struct prio * add_prio (char * name)
p = alloc_prio();
if (!p)
return NULL;
- snprintf(libname, LIB_PRIO_NAMELEN, "libprio%s.so", name);
+ snprintf(libname, LIB_PRIO_NAMELEN, "%s/libprio%s.so",
+ LIBMULTIPATH, name);
condlog(3, "loading %s prioritizer", libname);
handle = dlopen(libname, RTLD_NOW);
errstr = dlerror();
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index 11f3061..082d53f 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -170,14 +170,12 @@ free_multipath (struct multipath * mpp, int free_paths)
if (mpp->dmi)
FREE(mpp->dmi);
-
-#if DAEMON
+
/*
* better own vecs->lock here
*/
if (mpp->waiter)
((struct event_thread *)mpp->waiter)->mpp = NULL;
-#endif
free_pathvec(mpp->paths, free_paths);
free_pgvec(mpp->pg, free_paths);
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index f4d69bb..6757eb9 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -62,7 +62,7 @@ adopt_paths (vector pathvec, struct multipath * mpp)
condlog(3, "%s: ownership set to %s",
pp->dev, mpp->alias);
pp->mpp = mpp;
-
+
if (!mpp->paths && !(mpp->paths = vector_alloc()))
return 1;
@@ -294,18 +294,17 @@ retry:
char new_alias[WWID_SIZE];
/*
- * detect an external rename of the multipath device
+ * detect an external rename of the multipath device
*/
if (dm_get_name(mpp->wwid, DEFAULT_TARGET, new_alias)) {
condlog(3, "%s multipath mapped device name has "
"changed from %s to %s", mpp->wwid,
mpp->alias, new_alias);
strcpy(mpp->alias, new_alias);
-#if DAEMON
- if (mpp->waiter)
+
+ if (mpp->waiter)
strncpy(((struct event_thread *)mpp->waiter)->mapname,
new_alias, WWID_SIZE);
-#endif
goto retry;
}
condlog(0, "%s: failed to setup multipath", mpp->alias);
@@ -341,7 +340,7 @@ add_map_without_path (struct vectors * vecs,
if (adopt_paths(vecs->pathvec, mpp))
goto out;
-
+
if (!vector_alloc_slot(vecs->mpvec))
goto out;
diff --git a/libmultipath/structs_vec.h b/libmultipath/structs_vec.h
index b8a416f..19a2387 100644
--- a/libmultipath/structs_vec.h
+++ b/libmultipath/structs_vec.h
@@ -2,9 +2,7 @@
#define _STRUCTS_VEC_H
struct vectors {
-#if DAEMON
pthread_mutex_t *lock;
-#endif
vector pathvec;
vector mpvec;
};
diff --git a/libmultipath/uxsock.c b/libmultipath/uxsock.c
index cdc3dbc..a070943 100644
--- a/libmultipath/uxsock.c
+++ b/libmultipath/uxsock.c
@@ -129,23 +129,21 @@ size_t read_all(int fd, void *buf, size_t len)
int send_packet(int fd, const char *buf, size_t len)
{
int ret = 0;
-#ifdef DAEMON
sigset_t set, old;
/* Block SIGPIPE */
sigemptyset(&set);
sigaddset(&set, SIGPIPE);
pthread_sigmask(SIG_BLOCK, &set, &old);
-#endif
- if (write_all(fd, &len, sizeof(len)) != sizeof(len))
+
+ if (write_all(fd, &len, sizeof(len)) != sizeof(len))
ret = -1;
if (!ret && write_all(fd, buf, len) != len)
- ret = -1;
+ ret = -1;
-#ifdef DAEMON
/* And unblock it again */
pthread_sigmask(SIG_SETMASK, &old, NULL);
-#endif
+
return ret;
}
diff --git a/libmultipath/waiter.h b/libmultipath/waiter.h
index 0223924..468ce5f 100644
--- a/libmultipath/waiter.h
+++ b/libmultipath/waiter.h
@@ -1,8 +1,6 @@
#ifndef _WAITER_H
#define _WAITER_H
-#if DAEMON
-
struct event_thread {
struct dm_task *dmt;
pthread_t thread;
@@ -19,5 +17,4 @@ int start_waiter_thread (struct multipath *mpp, struct vectors *vecs);
int waiteventloop (struct event_thread *waiter);
void *waitevent (void *et);
-#endif /* DAEMON */
#endif /* _WAITER_H */
diff --git a/multipath/Makefile b/multipath/Makefile
index 71df431..bb44e3e 100644
--- a/multipath/Makefile
+++ b/multipath/Makefile
@@ -7,7 +7,7 @@ include ../Makefile.inc
OBJS = main.o
CFLAGS += -I$(multipathdir) -Wl,-rpath,$(libdir)
-LDFLAGS += -laio -ldevmapper -lpthread \
+LDFLAGS += -laio -ldevmapper -lpthread -ldl \
-lmultipath -L$(multipathdir)
EXEC = multipath
diff --git a/multipath/main.c b/multipath/main.c
index b6ea6fd..c071cac 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -49,6 +49,8 @@
#include <pgpolicies.h>
#include <version.h>
+int logsink;
+
static int
filter_pathvec (vector pathvec, char * refwwid)
{
diff --git a/multipathd/Makefile b/multipathd/Makefile
index 6beb993..dd223c4 100644
--- a/multipathd/Makefile
+++ b/multipathd/Makefile
@@ -5,7 +5,7 @@ include ../Makefile.inc
#
# basic flags setting
#
-CFLAGS += -DDAEMON -I$(multipathdir) -Wl,-rpath,$(libdir)
+CFLAGS += -I$(multipathdir) -Wl,-rpath,$(libdir)
LDFLAGS += -lpthread -ldevmapper -lreadline -lncurses -laio \
-lmultipath -L$(multipathdir)
diff --git a/multipathd/main.c b/multipathd/main.c
index 385521c..2b1fd86 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -65,6 +65,8 @@
pthread_cond_t exit_cond = PTHREAD_COND_INITIALIZER;
pthread_mutex_t exit_mutex = PTHREAD_MUTEX_INITIALIZER;
+int logsink;
+
/*
* global copy of vecs for use in sig handlers
*/
--
1.5.2.4

View File

@ -1,115 +0,0 @@
From 5403925a5b8f8fd582d137cb2a54d742508dca75 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 29 Apr 2008 13:56:08 +0200
Subject: [PATCH] Improve sense code scanning in sg_read() and tur checker
sg_read and tur should be able to correctly parse sense data,
as we might need to retry any UNIT ATTENTION sense codes.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/checkers/libsg.c | 13 ++++++++-
libmultipath/checkers/tur.c | 58 ++++++++++++++++++++++++++++------------
2 files changed, 52 insertions(+), 19 deletions(-)
diff --git a/libmultipath/checkers/libsg.c b/libmultipath/checkers/libsg.c
index 9171b10..4cb7ecc 100644
--- a/libmultipath/checkers/libsg.c
+++ b/libmultipath/checkers/libsg.c
@@ -72,10 +72,21 @@ retry:
(0 == io_hdr.driver_status)) {
return PATH_UP;
} else {
+ int key = 0;
+
+ if (io_hdr.sb_len_wr > 3) {
+ if (sbb[0] == 0x72 || sbb[0] == 0x73)
+ key = sbb[1] & 0x0f;
+ else if (io_hdr.sb_len_wr > 13 &&
+ ((sbb[0] & 0x7f) == 0x70 ||
+ (sbb[0] & 0x7f) == 0x71))
+ key = sbb[2] & 0x0f;
+ }
+
/*
* Retry if UNIT_ATTENTION check condition.
*/
- if ((sbb[2]&0xf) == 6) {
+ if (key == 0x6) {
if (--retry_count)
goto retry;
}
diff --git a/libmultipath/checkers/tur.c b/libmultipath/checkers/tur.c
index e84435e..43b846d 100644
--- a/libmultipath/checkers/tur.c
+++ b/libmultipath/checkers/tur.c
@@ -41,26 +41,48 @@ extern int
libcheck_check (struct checker * c)
{
struct sg_io_hdr io_hdr;
- unsigned char turCmdBlk[TUR_CMD_LEN] = { 0x00, 0, 0, 0, 0, 0 };
- unsigned char sense_buffer[32];
+ unsigned char turCmdBlk[TUR_CMD_LEN] = { 0x00, 0, 0, 0, 0, 0 };
+ unsigned char sense_buffer[32];
+ int retry_tur = 5;
- memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
- io_hdr.interface_id = 'S';
- io_hdr.cmd_len = sizeof (turCmdBlk);
- io_hdr.mx_sb_len = sizeof (sense_buffer);
- io_hdr.dxfer_direction = SG_DXFER_NONE;
- io_hdr.cmdp = turCmdBlk;
- io_hdr.sbp = sense_buffer;
- io_hdr.timeout = DEF_TIMEOUT;
- io_hdr.pack_id = 0;
- if (ioctl(c->fd, SG_IO, &io_hdr) < 0) {
+ retry:
+ memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
+ io_hdr.interface_id = 'S';
+ io_hdr.cmd_len = sizeof (turCmdBlk);
+ io_hdr.mx_sb_len = sizeof (sense_buffer);
+ io_hdr.dxfer_direction = SG_DXFER_NONE;
+ io_hdr.cmdp = turCmdBlk;
+ io_hdr.sbp = sense_buffer;
+ io_hdr.timeout = DEF_TIMEOUT;
+ io_hdr.pack_id = 0;
+ if (ioctl(c->fd, SG_IO, &io_hdr) < 0) {
MSG(c, MSG_TUR_DOWN);
- return PATH_DOWN;
- }
- if (io_hdr.info & SG_INFO_OK_MASK) {
+ return PATH_DOWN;
+ }
+ if (io_hdr.info & SG_INFO_OK_MASK) {
+ int key = 0, asc, ascq;
+
+ if (io_hdr.sb_len_wr > 3) {
+ if (io_hdr.sbp[0] == 0x72 || io_hdr.sbp[0] == 0x73) {
+ key = io_hdr.sbp[1] & 0x0f;
+ asc = io_hdr.sbp[2];
+ ascq = io_hdr.sbp[3];
+ } else if (io_hdr.sb_len_wr > 13 &&
+ ((io_hdr.sbp[0] & 0x7f) == 0x70 ||
+ (io_hdr.sbp[0] & 0x7f) == 0x71)) {
+ key = io_hdr.sbp[2] & 0x0f;
+ asc = io_hdr.sbp[12];
+ ascq = io_hdr.sbp[13];
+ }
+ }
+ if (key == 0x6) {
+ /* Unit Attention, retry */
+ if (--retry_tur)
+ goto retry;
+ }
MSG(c, MSG_TUR_DOWN);
- return PATH_DOWN;
- }
+ return PATH_DOWN;
+ }
MSG(c, MSG_TUR_UP);
- return PATH_UP;
+ return PATH_UP;
}
--
1.5.2.4

File diff suppressed because it is too large Load Diff

View File

@ -1,183 +0,0 @@
diff --git a/Makefile b/Makefile
index a099daf..54be0a5 100644
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,6 @@ BUILDDIRS = \
libmultipath/checkers \
multipath \
multipathd \
- devmap_name \
kpartx
ifeq ($(MULTIPATH_VERSION),)
diff --git a/Makefile.inc b/Makefile.inc
index 622f557..0d00303 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -13,7 +13,7 @@ ifeq ($(TOPDIR),)
TOPDIR = ..
endif
-prefix =
+prefix =
exec_prefix = $(prefix)
bindir = $(exec_prefix)/sbin
libudevdir = ${prefix}/lib/udev
@@ -26,8 +26,8 @@ libdir = $(prefix)/lib/multipath
GZIP = /bin/gzip -9 -c
INSTALL_PROGRAM = install
-OPTFLAGS = -pipe -g -Wall -Wunused -Wstrict-prototypes -fPIC
-CFLAGS = $(OPTFLAGS)
+OPTFLAGS = -pipe -g -Wall -Wunused -Wstrict-prototypes
+CFLAGS = $(OPTFLAGS) -fPIC
SHARED_FLAGS = -shared
%.o: %.c
diff --git a/kpartx/Makefile b/kpartx/Makefile
index 21e4ad4..ef08d37 100644
--- a/kpartx/Makefile
+++ b/kpartx/Makefile
@@ -15,21 +15,19 @@ all: $(EXEC)
$(EXEC): $(OBJS)
$(CC) $(OBJS) -o $(EXEC) $(LDFLAGS)
- $(GZIP) $(EXEC).8 > $(EXEC).8.gz
-
+
install: $(EXEC) $(EXEC).8
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) -d $(DESTDIR)$(libudevdir)
$(INSTALL_PROGRAM) -m 755 kpartx_id $(DESTDIR)$(libudevdir)
$(INSTALL_PROGRAM) -d $(DESTDIR)/etc/udev/rules.d
- $(INSTALL_PROGRAM) -m 644 kpartx.rules $(DESTDIR)/etc/udev/rules.d/
+ $(INSTALL_PROGRAM) -m 644 kpartx.rules $(DESTDIR)/etc/udev/rules.d/70-kpartx.rules
$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)
- $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)
+ $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)
uninstall:
rm -f $(DESTDIR)$(bindir)/$(EXEC)
- rm -f $(DESTDIR)$(mandir)/$(EXEC).8.gz
clean:
- rm -f core *.o $(EXEC) *.gz
+ rm -f core *.o $(EXEC)
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index 55721e8..d4bcbef 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -28,9 +28,8 @@ all: $(LIBS)
$(LIBS): $(OBJS)
$(CC) $(SHARED_FLAGS) $(CFLAGS) -o $@ $(OBJS)
-install:
- $(INSTALL_PROGRAM) -o root -g root -m 755 -d $(libdir)
- $(INSTALL_PROGRAM) -o root -g root -m 755 $(LIBS) $(libdir)/$(LIBS)
+install: $(LIBS)
+ $(INSTALL_PROGRAM) -D $(LIBS) $(DESTDIR)$(libdir)/$(LIBS)
uninstall:
rm -f $(libdir)/$(LIBS)
diff --git a/libmultipath/checkers/Makefile b/libmultipath/checkers/Makefile
index 9b517f2..dbc09ba 100644
--- a/libmultipath/checkers/Makefile
+++ b/libmultipath/checkers/Makefile
@@ -21,7 +21,7 @@ libcheck%.so: libsg.o %.o
$(CC) $(SHARED_FLAGS) -o $@ $^
install:
- $(INSTALL_PROGRAM) -o root -g root -m 755 $(LIBS) $(libdir)
+ $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(libdir)
uninstall:
rm -f $(libdir)/$(LIBS)
diff --git a/libmultipath/prioritizers/Makefile b/libmultipath/prioritizers/Makefile
index c05d457..46bb936 100644
--- a/libmultipath/prioritizers/Makefile
+++ b/libmultipath/prioritizers/Makefile
@@ -25,7 +25,7 @@ libprio%.so: %.o
$(CC) $(SHARED_FLAGS) -o $@ $^
install: $(LIBS)
- install -m 755 libprio*.so $(libdir)
+ install -m 755 libprio*.so $(DESTDIR)$(libdir)
uninstall:
rm -f $(libdir)/libprio*.so
diff --git a/libmultipath/prioritizers/hds.c b/libmultipath/prioritizers/hds.c
index 6ebe4d8..f3d4cb3 100644
--- a/libmultipath/prioritizers/hds.c
+++ b/libmultipath/prioritizers/hds.c
@@ -86,7 +86,7 @@
int hds_modular_prio (const char *dev, int fd)
{
int k;
- char vendor[8];
+ char vendor[9];
char product[32];
char serial[32];
char ldev[32];
diff --git a/multipath/Makefile b/multipath/Makefile
index bb44e3e..ed7ede1 100644
--- a/multipath/Makefile
+++ b/multipath/Makefile
@@ -16,24 +16,20 @@ all: $(EXEC)
$(EXEC): $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -o $(EXEC) $(LDFLAGS)
- $(GZIP) $(EXEC).8 > $(EXEC).8.gz
- $(GZIP) $(EXEC).conf.5 > $(EXEC).conf.5.gz
install:
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
$(INSTALL_PROGRAM) -d $(DESTDIR)/etc/udev/rules.d
- $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/etc/udev/rules.d/
+ $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/etc/udev/rules.d/71-multipath.rules
$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)
- $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)
+ $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)
$(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir)
- $(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5.gz $(DESTDIR)$(man5dir)
+ $(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5 $(DESTDIR)$(man5dir)
uninstall:
rm $(DESTDIR)/etc/udev/rules.d/multipath.rules
rm $(DESTDIR)$(bindir)/$(EXEC)
- rm $(DESTDIR)$(mandir)/$(EXEC).8.gz
- rm $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz
clean:
- rm -f core *.o $(EXEC) *.gz
+ rm -f core *.o $(EXEC)
diff --git a/multipath/multipath.rules b/multipath/multipath.rules
diff --git a/multipathd/Makefile b/multipathd/Makefile
index dd223c4..5143b6b 100644
--- a/multipathd/Makefile
+++ b/multipathd/Makefile
@@ -29,20 +29,18 @@ all : $(EXEC)
$(EXEC): $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $(EXEC) $(OBJS)
- $(GZIP) $(EXEC).8 > $(EXEC).8.gz
install:
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) -d $(DESTDIR)$(rcdir)
$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)
- $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)
+ $(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)
uninstall:
rm -f $(DESTDIR)$(bindir)/$(EXEC)
rm -f $(DESTDIR)$(rcdir)/$(EXEC)
- rm -f $(DESTDIR)$(mandir)/$(EXEC).8.gz
clean:
- rm -f core *.o $(EXEC) *.gz
+ rm -f core *.o $(EXEC)
diff --git a/multipathd/multipathd.init.suse b/multipathd/multipathd.init.suse

View File

@ -1,297 +0,0 @@
From 15805c2a7b107bdbc61880c9c3224a06ae04cc70 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 29 Apr 2008 14:12:57 +0200
Subject: [PATCH] Update hardware table
Update the built-in hardware table with definitions for various
new machines.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/hwtable.c | 135 ++++++++++++++++++++++++++++++++++++++----------
1 files changed, 107 insertions(+), 28 deletions(-)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index d938379..5ed7090 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -84,7 +84,7 @@ static struct hwentry default_hw[] = {
.pgpolicy = MULTIBUS,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
- .no_path_retry = NO_PATH_RETRY_UNDEF,
+ .no_path_retry = 12,
.minio = DEFAULT_MINIO,
.checker_name = DIRECTIO,
.prio_name = DEFAULT_PRIO,
@@ -100,7 +100,7 @@ static struct hwentry default_hw[] = {
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
- .no_path_retry = NO_PATH_RETRY_UNDEF,
+ .no_path_retry = 12,
.minio = DEFAULT_MINIO,
.checker_name = HP_SW,
.prio_name = PRIO_HP_SW,
@@ -116,7 +116,7 @@ static struct hwentry default_hw[] = {
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
- .no_path_retry = NO_PATH_RETRY_UNDEF,
+ .no_path_retry = 12,
.minio = DEFAULT_MINIO,
.checker_name = TUR,
.prio_name = PRIO_ALUA,
@@ -128,8 +128,8 @@ static struct hwentry default_hw[] = {
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
.selector = DEFAULT_SELECTOR,
- .pgpolicy = MULTIBUS,
- .pgfailback = FAILBACK_UNDEF,
+ .pgpolicy = GROUP_BY_PRIO,
+ .pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
.no_path_retry = 12,
.minio = DEFAULT_MINIO,
@@ -137,9 +137,9 @@ static struct hwentry default_hw[] = {
.prio_name = DEFAULT_PRIO,
},
{
- /* EVA 3000/5000 with new firmware */
+ /* EVA 3000/5000 with new firmware, EVA 4000/6000/8000 */
.vendor = "(COMPAQ|HP)",
- .product = "(MSA|HSV)1.1.*",
+ .product = "HSV1[01]1|HSV2[01]0|HSV300",
.getuid = DEFAULT_GETUID,
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
@@ -147,26 +147,26 @@ static struct hwentry default_hw[] = {
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
- .no_path_retry = NO_PATH_RETRY_UNDEF,
+ .no_path_retry = 12,
.minio = DEFAULT_MINIO,
.checker_name = TUR,
.prio_name = PRIO_ALUA,
},
{
- /* EVA 4000/6000/8000 */
+ /* HP MSA2000 product family */
.vendor = "HP",
- .product = "HSV2.*",
+ .product = "MSA2[02]12*",
.getuid = DEFAULT_GETUID,
.features = DEFAULT_FEATURES,
.hwhandler = DEFAULT_HWHANDLER,
.selector = DEFAULT_SELECTOR,
- .pgpolicy = GROUP_BY_PRIO,
+ .pgpolicy = MULTIBUS,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
- .no_path_retry = NO_PATH_RETRY_UNDEF,
+ .no_path_retry = 12,
.minio = DEFAULT_MINIO,
.checker_name = TUR,
- .prio_name = PRIO_ALUA,
+ .prio_name = DEFAULT_PRIO,
},
{
/* HP Smart Array */
@@ -179,9 +179,9 @@ static struct hwentry default_hw[] = {
.pgpolicy = MULTIBUS,
.pgfailback = FAILBACK_UNDEF,
.rr_weight = RR_WEIGHT_NONE,
- .no_path_retry = NO_PATH_RETRY_UNDEF,
+ .no_path_retry = 12,
.minio = DEFAULT_MINIO,
- .checker_name = TUR,
+ .checker_name = CCISS_TUR,
.prio_name = DEFAULT_PRIO,
},
/*
@@ -321,19 +321,67 @@ static struct hwentry default_hw[] = {
.prio_name = DEFAULT_PRIO,
},
{
- /* IBM DS4100 / FAStT100 */
+ /* IBM FAStT 1722-600 */
+ .vendor = "IBM",
+ .product = "1722-600",
+ .getuid = DEFAULT_GETUID,
+ .features = "1 queue_if_no_path",
+ .hwhandler = "1 rdac",
+ .selector = DEFAULT_SELECTOR,
+ .pgpolicy = GROUP_BY_PRIO,
+ .pgfailback = -FAILBACK_IMMEDIATE,
+ .rr_weight = RR_WEIGHT_NONE,
+ .no_path_retry = 300,
+ .minio = DEFAULT_MINIO,
+ .checker_name = RDAC,
+ .prio_name = PRIO_RDAC,
+ },
+ {
+ /* IBM DS4400 / FAStT700 */
.vendor = "IBM",
.product = "1742",
.getuid = DEFAULT_GETUID,
.features = DEFAULT_FEATURES,
- .hwhandler = DEFAULT_HWHANDLER,
+ .hwhandler = "1 rdac",
.selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
- .no_path_retry = NO_PATH_RETRY_UNDEF,
+ .no_path_retry = NO_PATH_RETRY_QUEUE,
.minio = DEFAULT_MINIO,
- .checker_name = TUR,
+ .checker_name = RDAC,
+ .prio_name = PRIO_RDAC,
+ },
+ {
+ /* IBM DS4700 */
+ .vendor = "IBM",
+ .product = "1814",
+ .getuid = DEFAULT_GETUID,
+ .features = DEFAULT_FEATURES,
+ .hwhandler = "1 rdac",
+ .selector = DEFAULT_SELECTOR,
+ .pgpolicy = GROUP_BY_PRIO,
+ .pgfailback = -FAILBACK_IMMEDIATE,
+ .rr_weight = RR_WEIGHT_NONE,
+ .no_path_retry = NO_PATH_RETRY_QUEUE,
+ .minio = DEFAULT_MINIO,
+ .checker_name = RDAC,
+ .prio_name = PRIO_RDAC,
+ },
+ {
+ /* IBM DS4800 */
+ .vendor = "IBM",
+ .product = "1815",
+ .getuid = DEFAULT_GETUID,
+ .features = DEFAULT_FEATURES,
+ .hwhandler = "1 rdac",
+ .selector = DEFAULT_SELECTOR,
+ .pgpolicy = GROUP_BY_PRIO,
+ .pgfailback = -FAILBACK_IMMEDIATE,
+ .rr_weight = RR_WEIGHT_NONE,
+ .no_path_retry = NO_PATH_RETRY_QUEUE,
+ .minio = DEFAULT_MINIO,
+ .checker_name = RDAC,
.prio_name = PRIO_RDAC,
},
{
@@ -342,14 +390,14 @@ static struct hwentry default_hw[] = {
.product = "3526",
.getuid = DEFAULT_GETUID,
.features = DEFAULT_FEATURES,
- .hwhandler = DEFAULT_HWHANDLER,
+ .hwhandler = "1 rdac",
.selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
.rr_weight = RR_WEIGHT_NONE,
- .no_path_retry = NO_PATH_RETRY_UNDEF,
+ .no_path_retry = NO_PATH_RETRY_QUEUE,
.minio = DEFAULT_MINIO,
- .checker_name = TUR,
+ .checker_name = RDAC,
.prio_name = PRIO_RDAC,
},
{
@@ -449,7 +497,7 @@ static struct hwentry default_hw[] = {
.checker_name = DIRECTIO,
.prio_name = DEFAULT_PRIO,
},
- /*
+ /*
* NETAPP controller family
*
* Maintainer : Dave Wysochanski
@@ -470,7 +518,7 @@ static struct hwentry default_hw[] = {
.checker_name = DIRECTIO,
.prio_name = PRIO_NETAPP,
},
- /*
+ /*
* IBM NSeries (NETAPP) controller family
*
* Maintainer : Dave Wysochanski
@@ -538,7 +586,7 @@ static struct hwentry default_hw[] = {
.product = "TP9[45]00",
.getuid = DEFAULT_GETUID,
.features = DEFAULT_FEATURES,
- .hwhandler = DEFAULT_HWHANDLER,
+ .hwhandler = "1 rdac",
.selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
@@ -553,7 +601,7 @@ static struct hwentry default_hw[] = {
.product = "IS.*",
.getuid = DEFAULT_GETUID,
.features = DEFAULT_FEATURES,
- .hwhandler = DEFAULT_HWHANDLER,
+ .hwhandler = "1 rdac",
.selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
@@ -574,7 +622,7 @@ static struct hwentry default_hw[] = {
.product = "OPENstorage D280",
.getuid = DEFAULT_GETUID,
.features = DEFAULT_FEATURES,
- .hwhandler = DEFAULT_HWHANDLER,
+ .hwhandler = "1 rdac",
.selector = DEFAULT_SELECTOR,
.pgpolicy = GROUP_BY_PRIO,
.pgfailback = -FAILBACK_IMMEDIATE,
@@ -605,7 +653,7 @@ static struct hwentry default_hw[] = {
.checker_name = DIRECTIO,
.prio_name = DEFAULT_PRIO,
},
- /*
+ /*
* Pivot3 RAIGE
*
* Maintainer : Bart Brooks, Pivot3
@@ -626,6 +674,37 @@ static struct hwentry default_hw[] = {
.checker_name = TUR,
.prio_name = DEFAULT_PRIO,
},
+ {
+ .vendor = "SUN",
+ .product = "CSM200_R",
+ .getuid = DEFAULT_GETUID,
+ .features = DEFAULT_FEATURES,
+ .hwhandler = "1 rdac",
+ .selector = DEFAULT_SELECTOR,
+ .pgpolicy = GROUP_BY_PRIO,
+ .pgfailback = -FAILBACK_IMMEDIATE,
+ .rr_weight = RR_WEIGHT_NONE,
+ .no_path_retry = NO_PATH_RETRY_QUEUE,
+ .minio = DEFAULT_MINIO,
+ .checker_name = RDAC,
+ .prio_name = PRIO_RDAC,
+ },
+ /* SUN/LSI 2540 */
+ {
+ .vendor = "SUN",
+ .product = "LCSM100_F",
+ .getuid = DEFAULT_GETUID,
+ .features = DEFAULT_FEATURES,
+ .hwhandler = "1 rdac",
+ .selector = DEFAULT_SELECTOR,
+ .pgpolicy = GROUP_BY_PRIO,
+ .pgfailback = -FAILBACK_IMMEDIATE,
+ .rr_weight = RR_WEIGHT_NONE,
+ .no_path_retry = NO_PATH_RETRY_QUEUE,
+ .minio = DEFAULT_MINIO,
+ .checker_name = RDAC,
+ .prio_name = PRIO_RDAC,
+ },
/*
* EOL
*/
--
1.5.2.4

View File

@ -1,135 +0,0 @@
From 33ade231f9ce022b0d8eb7c56caf23b60b6a8a5c Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 29 Apr 2008 13:43:42 +0200
Subject: [PATCH] Use 'mpatha' for user_friendly_names option
We really should use 'mpatha' instead of 'mpath0' for the
generated names with the user_friendly_names option.
Otherwise we can't distinguish them from EVMS names.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/alias.c | 61 +++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 53 insertions(+), 8 deletions(-)
diff --git a/libmultipath/alias.c b/libmultipath/alias.c
index ca434fe..517b055 100644
--- a/libmultipath/alias.c
+++ b/libmultipath/alias.c
@@ -179,6 +179,46 @@ fail:
return -1;
}
+static int
+format_devname(char *name, int id, int len)
+{
+ int pos;
+
+ memset(name,0, len);
+ strcpy(name,"mpath");
+ for (pos = len - 1; pos >= 5; pos--) {
+ name[pos] = 'a' + id % 26;
+ if (id < 26)
+ break;
+ id /= 26;
+ id--;
+ }
+ memmove(name + 5, name + pos, len - pos);
+ name[5 + len - pos] = '\0';
+ return (5 + len - pos);
+}
+
+static int
+scan_devname(char *alias)
+{
+ char *c;
+ int i, n = 0;
+
+ if (strncmp(alias, "mpath", 5))
+ return -1;
+
+ c = alias + 5;
+ while (*c != '\0' && *c != ' ' && *c != '\t') {
+ i = *c - 'a';
+ n = ( n * 26 ) + i;
+ c++;
+ if (*c < 'a' || *c > 'z')
+ break;
+ n++;
+ }
+
+ return n;
+}
static int
lookup_binding(FILE *f, char *map_wwid, char **map_alias)
@@ -200,7 +240,8 @@ lookup_binding(FILE *f, char *map_wwid, char **map_alias)
alias = strtok(buf, " \t");
if (!alias) /* blank line */
continue;
- if (sscanf(alias, "mpath%d", &curr_id) == 1 && curr_id >= id)
+ curr_id = scan_devname(alias);
+ if (curr_id >= id)
id = curr_id + 1;
wwid = strtok(NULL, " \t");
if (!wwid){
@@ -221,7 +262,7 @@ lookup_binding(FILE *f, char *map_wwid, char **map_alias)
}
condlog(3, "No matching wwid [%s] in bindings file.", map_wwid);
return id;
-}
+}
static int
rlookup_binding(FILE *f, char **map_wwid, char *map_alias)
@@ -243,7 +284,8 @@ rlookup_binding(FILE *f, char **map_wwid, char *map_alias)
alias = strtok(buf, " \t");
if (!alias) /* blank line */
continue;
- if (sscanf(alias, "mpath%d", &curr_id) == 1 && curr_id >= id)
+ curr_id = scan_devname(alias);
+ if (curr_id >= id)
id = curr_id + 1;
wwid = strtok(NULL, " \t");
if (!wwid){
@@ -264,7 +306,7 @@ rlookup_binding(FILE *f, char **map_wwid, char *map_alias)
}
condlog(3, "No matching alias [%s] in bindings file.", map_alias);
return id;
-}
+}
static char *
allocate_binding(int fd, char *wwid, int id)
@@ -272,13 +314,16 @@ allocate_binding(int fd, char *wwid, int id)
char buf[LINE_MAX];
off_t offset;
char *alias, *c;
-
+ int i;
+
if (id < 0) {
condlog(0, "Bindings file full. Cannot allocate new binding");
return NULL;
}
-
- snprintf(buf, LINE_MAX, "mpath%d %s\n", id, wwid);
+
+ i = format_devname(buf, id, LINE_MAX);
+ c = buf + i;
+ snprintf(c,LINE_MAX - i, " %s\n", wwid);
buf[LINE_MAX - 1] = '\0';
offset = lseek(fd, 0, SEEK_END);
@@ -304,7 +349,7 @@ allocate_binding(int fd, char *wwid, int id)
condlog(3, "Created new binding [%s] for WWID [%s]", alias,
wwid);
return alias;
-}
+}
char *
get_user_friendly_alias(char *wwid, char *file)
--
1.5.2.4

View File

@ -1,40 +0,0 @@
diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules
index f32c718..2746eff 100644
--- a/kpartx/kpartx.rules
+++ b/kpartx/kpartx.rules
@@ -9,7 +9,7 @@ ACTION=="remove", GOTO="kpartx_end"
ENV{DM_TABLE_STATE}!="LIVE", GOTO="kpartx_end"
-ENV{DM_UUID}=="?*", IMPORT{program}=="/lib/udev/kpartx_id %M %m $env{DM_UUID}"
+ENV{DM_UUID}=="?*", IMPORT{program}=="kpartx_id %M %m $env{DM_UUID}"
OPTIONS="link_priority=50"
@@ -18,7 +18,11 @@ ENV{DM_UUID}=="mpath-*", \
SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}"
# Create persistent links for dmraid tables
-ENV{DM_UUID}=="mpath-*", \
+ENV{DM_UUID}=="dmraid-*", \
+ SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}"
+
+# Create persistent links for linear tables
+ENV{DM_UUID}=="linear-*", \
SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}"
# Create persistent links for partitions
@@ -27,11 +31,11 @@ ENV{DM_PART}=="?*", \
# Create dm tables for partitions
ENV{DM_STATE}=="ACTIVE", ENV{DM_UUID}=="mpath-*", \
- RUN+="/sbin/kpartx -a -p -part /dev/$kernel"
+ RUN+="/sbin/kpartx -a -p _part /dev/$kernel"
ENV{DM_STATE}=="ACTIVE", ENV{DM_UUID}=="dmraid-*", \
- RUN+="/sbin/kpartx -a -p -part /dev/$kernel"
+ RUN+="/sbin/kpartx -a -p _part /dev/$kernel"
ENV{DM_STATE}=="ACTIVE", ENV{DM_UUID}=="linear-*", \
RUN+="/sbin/kpartx -a -p _part /dev/$kernel"
LABEL="kpartx_end"

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Jul 23 14:45:18 CEST 2008 - hare@suse.de
- Update to version 0.4.8
- Include changes from SLES10
- Include mkinitrd scriptlets
-------------------------------------------------------------------
Wed May 28 09:50:28 CEST 2008 - hare@suse.de

View File

@ -1,5 +1,5 @@
#
# spec file for package multipath-tools (Version 0.4.7)
# spec file for package multipath-tools (Version 0.4.8)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@ -19,27 +19,13 @@ Group: System/Base
Requires: device-mapper kpartx
PreReq: %insserv_prereq %fillup_prereq coreutils grep diffutils
AutoReqProv: on
Version: 0.4.7
Release: 125
Version: 0.4.8
Release: 1
Summary: Tools to Manage Multipathed Devices with the device-mapper
Source: multipath-tools-%{version}.tar.bz2
Source1: multipath.init.suse
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Patch0: %{name}-git-update.patch
Patch1: %{name}-block-SIGPIPE
Patch2: %{name}-crash-on-shutdown
Patch3: %{name}-use-mpatha-user_friendly_names
Patch4: %{name}-fixup-varargs-usage
Patch5: %{name}-libdevmapper-garbage-on-shutdown
Patch6: %{name}-retry-sg_read
Patch7: %{name}-quieten-callouts
Patch8: %{name}-update-hwtable
Patch9: %{name}-add-cciss-tur
Patch10: %{name}-remove-DAEMON-defines
Patch11: %{name}-suse-build-fixes
Patch12: %{name}-add-dm_linear
Patch13: %{name}-use-underscore-for-partnames
Patch14: %{name}-kpartx-wrong-partition-offset
Patch0: %{name}-git-update
Patch1: %{name}-sles11-alpha1-update
%description
This package provides the tools to manage multipathed devices by
@ -82,31 +68,12 @@ Authors:
%setup -n multipath-tools-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
cp %{S:1} multipath/multipath.init.suse
%build
make OPTFLAGS="$RPM_OPT_FLAGS" BUILD=glibc
make OPTFLAGS="$RPM_OPT_FLAGS"
%install
mkdir -p $RPM_BUILD_ROOT/sbin
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8
make DESTDIR=$RPM_BUILD_ROOT install
mkdir -p $RPM_BUILD_ROOT/etc/init.d
install -m 744 multipath/multipath.init.suse $RPM_BUILD_ROOT/etc/init.d/boot.multipath
install -m 744 multipathd/multipathd.init.suse $RPM_BUILD_ROOT/etc/init.d/multipathd
mkdir -p $RPM_BUILD_ROOT/var/cache/multipath/
%clean
@ -135,6 +102,10 @@ mkdir -p $RPM_BUILD_ROOT/var/cache/multipath/
/sbin/multipath
/sbin/multipathd
%attr (0700, root, root) /var/cache/multipath
%dir /lib/mkinitrd
%dir /lib/mkinitrd/scripts
/lib/mkinitrd/scripts/boot-multipath.sh
/lib/mkinitrd/scripts/setup-multipath.sh
%{_mandir}/man8/multipath.8*
%{_mandir}/man5/multipath.conf.5*
%{_mandir}/man8/multipathd.8*
@ -143,15 +114,22 @@ mkdir -p $RPM_BUILD_ROOT/var/cache/multipath/
%defattr(-,root,root)
%dir /etc/udev
%dir /etc/udev/rules.d
%dir /lib/udev
%config /etc/udev/rules.d/70-kpartx.rules
/sbin/kpartx
/sbin/activate_dm_linear
%dir /lib/udev
/lib/udev/kpartx_id
/lib/udev/dm_linear
%dir /lib/mkinitrd
%dir /lib/mkinitrd/scripts
/lib/mkinitrd/scripts/boot-kpartx.sh
/lib/mkinitrd/scripts/setup-kpartx.sh
%{_mandir}/man8/kpartx.8*
%changelog
* Wed Jul 23 2008 hare@suse.de
- Update to version 0.4.8
- Include changes from SLES10
- Include mkinitrd scriptlets
* Wed May 28 2008 hare@suse.de
- Calculate correct partition offset in kpartx (bnc#394658)
* Fri May 09 2008 hare@suse.de

View File

@ -1,127 +0,0 @@
#! /bin/sh
# Copyright (c) 2005 SuSE GmbH Nuernberg, Germany.
#
# Author: Hannes Reinecke <feedback@suse.de>
#
# init.d/boot.multipath
#
### BEGIN INIT INFO
# Provides: boot.multipath
# Required-Start: boot.device-mapper boot.udev
# Required-Stop:
# Default-Start: B
# Default-Stop:
# Description: Create multipath device targets
### END INIT INFO
PATH=/bin:/usr/bin:/sbin:/usr/sbin
PROGRAM=/sbin/multipath
# Set the maximum number of open files
MAX_OPEN_FDS=4096
test -x $PROGRAM || exit 5
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
. /etc/rc.status
# First reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - misc error
# 2 - invalid or excess args
# 3 - unimplemented feature (e.g. reload)
# 4 - insufficient privilege
# 5 - program not installed
# 6 - program not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
case "$1" in
start)
echo -n "Creating multipath targets"
# Check whether multipath daemon is already running
if /sbin/multipathd -k"list paths" > /dev/null 2>&1 ; then
echo -n " (multipathd running)"
rc_status -v
rc_exit
fi
# Load prerequisite module
modprobe dm-multipath
# Be a chicken and flush all existing maps
$PROGRAM -F
# Clear /dev/disk/by-name/ prior to start-up; multipath will
# recreate them.
rm -f /dev/disk/by-name/* 2>&1 >/dev/null
# Set the maximum number of open files
if [ -n "$MAX_OPEN_FDS" ] ; then
ulimit -n $MAX_OPEN_FDS
fi
# Start the program directly as checkproc doesn't work here
$PROGRAM -v 0
# Create all partitions which might have been missing
for map in $(/sbin/dmsetup ls --target multipath | sed '/No devices/d' | sort -n +2 | sed -n 's/.*, \(.*\))/\1/p' ) ; do
wait=5
while [ $wait -gt 0 ] ; do
[ -e /dev/dm-$map ] && break
wait=$((wait - 1))
sleep 1;
done
if [ $wait -le 0 ] ; then
echo -n "timeout waiting for devices"
rc_failed 1
break;
fi
/sbin/kpartx -a -p _part /dev/dm-$map
done
# Remember status and be verbose
rc_status -v
sleep 1
;;
stop)
echo -n "Removing multipath targets:"
# Flush all existing maps
$PROGRAM -F
rc_failed 0
rc_status -v
;;
status)
echo -n "Checking multipath targets: "
# Display active multipath tables
tblnum=$(/sbin/dmsetup ls --target multipath | sed '/No devices/d' | wc --lines)
if [ "$tblnum" ] && [ $tblnum -gt 0 ] ; then
echo -n "($tblnum multipath devices) "
rc_failed 0
else
rc_failed 3
fi
rc_status -v
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac
rc_exit