Compare commits
117 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6f2be9e59 | ||
|
|
3c9f48504b | ||
|
|
9f48ebd2e2 | ||
|
|
30306052cc | ||
|
|
f2377371e3 | ||
|
|
3c2eb3f84e | ||
|
|
05ecb26e7c | ||
|
|
61847c90be | ||
|
|
4ec4661dee | ||
|
|
75d5c0c70a | ||
|
|
94144d9276 | ||
|
|
0c6649fa32 | ||
|
|
354f1e7cfb | ||
|
|
519bd15b4d | ||
|
|
3cde646ade | ||
|
|
4e4233829d | ||
|
|
59945a7f7e | ||
|
|
588b3f63e9 | ||
|
|
6496193f3f | ||
|
|
6956fa4aa7 | ||
|
|
c9568c86e6 | ||
|
|
835a8a43de | ||
|
|
b0b20d4f7b | ||
|
|
0f3122f75f | ||
|
|
f52f69af95 | ||
|
|
748e0a08b6 | ||
|
|
e5eddaae1a | ||
|
|
d88fe4b956 | ||
|
|
0761930b9e | ||
|
|
bbfe9b1229 | ||
|
|
8e8d008d17 | ||
|
|
bf5e5e4891 | ||
|
|
c5432960d9 | ||
|
|
ef9089f4e8 | ||
|
|
ca605574d1 | ||
|
|
652daa1a21 | ||
|
|
dad5d3a235 | ||
|
|
05385b92f8 | ||
|
|
3121417f06 | ||
|
|
06885ec9cc | ||
|
|
81ff4f74fa | ||
|
|
18d73f2333 | ||
|
|
ce5b96a800 | ||
|
|
be2d12e9d4 | ||
|
|
a4b79a10d4 | ||
|
|
2d373b6820 | ||
|
|
51c88e7181 | ||
|
|
a5c63c957b |
||
|
|
c64a48b95f | ||
|
|
db52ccc87f | ||
|
|
ac4e55e1c0 | ||
|
|
b05147c356 | ||
|
|
7812c0e396 | ||
|
|
9fdf79cddf | ||
|
|
13dea6f50c | ||
|
|
26a2cd7a3e | ||
|
|
1dad67a5af | ||
|
|
d5b202726f | ||
|
|
2cf40b2f98 | ||
|
|
c8438866fb | ||
|
|
3140cfbb24 | ||
|
|
9abdc502cf | ||
|
|
f478b960f2 | ||
|
|
2b0cd7cceb | ||
|
|
c80b4a3ee2 | ||
|
|
2a2c997c52 | ||
|
|
9aa42b3e73 | ||
|
|
24cb0ee9c4 |
||
|
|
286eaf8ec0 |
||
|
|
6b2237f96e | ||
|
|
89934ae046 | ||
|
|
942c9b6ed8 | ||
|
|
78ea7f5afb | ||
|
|
5df1fd8b21 | ||
|
|
35f5570500 | ||
|
|
a4dbf985b2 |
||
|
|
0ab0849587 | ||
|
|
f97259d84a | ||
|
|
719f475042 | ||
|
|
f4ef615f25 | ||
|
|
80a194d926 |
||
|
|
134254a5b4 | ||
|
|
170e923cae | ||
|
|
e1b782c112 | ||
|
|
996407fc5f | ||
|
|
3ec0ebefcd | ||
|
|
57b6cee02c | ||
|
|
c79ce3480d | ||
|
|
0455310b07 | ||
|
|
00124a54fb | ||
|
|
64b1cb0e21 | ||
|
|
b8e90c4bbc | ||
|
|
938e745304 | ||
|
|
47d132054e | ||
|
|
e5cbd1f107 | ||
|
|
5dbff48724 |
||
|
|
c50e7dffa1 | ||
|
|
b6bec45d60 | ||
|
|
5bea53fe7e | ||
|
|
7e8f34e181 |
||
|
|
c06e36c691 | ||
|
|
5ec70185d3 | ||
|
|
e95acc1fdb |
||
|
|
542c8d8bff | ||
|
|
5e7fb0583a | ||
|
|
21aef9ba0a | ||
|
|
f0da3f91e8 | ||
|
|
5b6530e44c | ||
|
|
df3507c52f | ||
|
|
09b9b17566 | ||
|
|
7327f260a8 | ||
|
|
c9012ec5b7 | ||
|
|
a4bb435b33 | ||
|
|
3591e72a60 | ||
|
|
f9dfbb37ac | ||
|
|
8e9e3b7467 | ||
|
|
405f285a99 |
227 changed files with 12304 additions and 20233 deletions
1
.fmf/version
Normal file
1
.fmf/version
Normal file
|
|
@ -0,0 +1 @@
|
|||
1
|
||||
32
.gitignore
vendored
32
.gitignore
vendored
|
|
@ -3,3 +3,35 @@ multipath-tools-091027.tar.gz
|
|||
/multipath-tools-120613.tgz
|
||||
/multipath-tools-120821.tgz
|
||||
/multipath-tools-130222.tgz
|
||||
/multipath-tools-f21166a.tgz
|
||||
/multipath.conf
|
||||
/multipath-tools-git847cc43.tgz
|
||||
/multipath-tools-0.7.3.tgz
|
||||
/multipath-tools-07e7bd5.tgz
|
||||
/multipath-tools-1cb704b.tgz
|
||||
/multipath-tools-0.7.7.tgz
|
||||
/multipath-tools-ef6d98b.tgz
|
||||
/multipath-tools-1a8625a.tgz
|
||||
/multipath-tools-b80318b.tgz
|
||||
/multipath-tools-0.7.8.tgz
|
||||
/multipath-tools-0.7.9.tgz
|
||||
/multipath-tools-17a6101.tgz
|
||||
/multipath-tools-2df6110.tgz
|
||||
/multipath-tools-0.8.0.tgz
|
||||
/multipath-tools-0.8.2.tgz
|
||||
/multipath-tools-0.8.4.tgz
|
||||
/multipath-tools-0.8.5.tgz
|
||||
/multipath-tools-0.8.6.tgz
|
||||
/multipath-tools-0.8.7.tgz
|
||||
/multipath-tools-0.8.9.tgz
|
||||
/multipath-tools-0.9.0.tgz
|
||||
/multipath-tools-0.9.3.tgz
|
||||
/multipath-tools-0.9.4.tgz
|
||||
/multipath-tools-0.9.5.tgz
|
||||
/multipath-tools-0.9.6.tgz
|
||||
/multipath-tools-0.9.7.tgz
|
||||
/multipath-tools-0.9.8.tgz
|
||||
/multipath-tools-0.9.9.tgz
|
||||
/multipath-tools-0.10.0.tgz
|
||||
/multipath-tools-0.11.1.tgz
|
||||
/multipath-tools-0.13.0.tgz
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
---
|
||||
multipathd/multipathd.service | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
Index: multipath-tools-130222/multipathd/multipathd.service
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/multipathd.service
|
||||
+++ multipath-tools-130222/multipathd/multipathd.service
|
||||
@@ -2,6 +2,7 @@
|
||||
Description=Device-Mapper Multipath Device Controller
|
||||
Before=iscsi.service iscsid.service lvm2-activation-early.service
|
||||
After=syslog.target
|
||||
+ConditionPathExists=/etc/multipath.conf
|
||||
DefaultDependencies=no
|
||||
Conflicts=shutdown.target
|
||||
|
||||
63
0001-RH-fixup-udev-rules-for-redhat.patch
Normal file
63
0001-RH-fixup-udev-rules-for-redhat.patch
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
From 64a07df23affd21842fdc604887276e62e5b41de Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Thu, 13 Apr 2017 07:22:23 -0500
|
||||
Subject: [PATCH] RH: fixup udev rules for redhat
|
||||
|
||||
The multipath rules need to run after scsi_id is run. This means moving
|
||||
them after 60-persistent-storage.rules for redhat. Redhat also uses a
|
||||
different naming scheme for partitions than SuSE.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
Makefile.inc | 2 +-
|
||||
kpartx/kpartx.rules.in | 2 +-
|
||||
multipath/Makefile | 4 ++--
|
||||
3 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/Makefile.inc b/Makefile.inc
|
||||
index 9e3dc466..ead89030 100644
|
||||
--- a/Makefile.inc
|
||||
+++ b/Makefile.inc
|
||||
@@ -34,7 +34,7 @@ endif
|
||||
# Paths. All these can be overridden on the "make" command line.
|
||||
prefix :=
|
||||
# Prefix for binaries
|
||||
-exec_prefix := $(prefix)
|
||||
+exec_prefix := $(prefix)/usr
|
||||
# Prefix for non-essential libraries (libdmmp)
|
||||
usr_prefix := $(if $(prefix),$(prefix),/usr)
|
||||
# Prefix for configuration files (multipath.conf)
|
||||
diff --git a/kpartx/kpartx.rules.in b/kpartx/kpartx.rules.in
|
||||
index 9d879609..2049eb8f 100644
|
||||
--- a/kpartx/kpartx.rules.in
|
||||
+++ b/kpartx/kpartx.rules.in
|
||||
@@ -39,6 +39,6 @@ LABEL="mpath_kpartx_end"
|
||||
GOTO="kpartx_end"
|
||||
|
||||
LABEL="run_kpartx"
|
||||
-RUN+="@BINDIR@/kpartx -un -p -part /dev/$name"
|
||||
+RUN+="@BINDIR@/kpartx -un /dev/$name"
|
||||
|
||||
LABEL="kpartx_end"
|
||||
diff --git a/multipath/Makefile b/multipath/Makefile
|
||||
index 67fb5e62..2ea9e528 100644
|
||||
--- a/multipath/Makefile
|
||||
+++ b/multipath/Makefile
|
||||
@@ -27,7 +27,7 @@ install:
|
||||
$(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(udevrulesdir)
|
||||
$(Q)$(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir)
|
||||
$(Q)$(INSTALL_PROGRAM) -m 644 99-z-dm-mpath-late.rules $(DESTDIR)$(udevrulesdir)
|
||||
- $(Q)$(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)$(udevrulesdir)/56-multipath.rules
|
||||
+ $(Q)$(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)$(udevrulesdir)/62-multipath.rules
|
||||
$(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(tmpfilesdir)
|
||||
$(Q)$(INSTALL_PROGRAM) -m 644 tmpfiles.conf $(DESTDIR)$(tmpfilesdir)/multipath.conf
|
||||
$(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
|
||||
@@ -50,7 +50,7 @@ uninstall:
|
||||
$(Q)$(RM) $(DESTDIR)$(udevrulesdir)/99-z-dm-mpath-late.rules
|
||||
$(Q)$(RM) $(DESTDIR)$(modulesloaddir)/multipath.conf
|
||||
$(Q)$(RM) $(DESTDIR)$(modulesloaddir)/scsi_dh.conf
|
||||
- $(Q)$(RM) $(DESTDIR)$(libudevdir)/rules.d/56-multipath.rules
|
||||
+ $(Q)$(RM) $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules
|
||||
$(Q)$(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
|
||||
$(Q)$(RM) $(DESTDIR)$(mandir)/man5/$(EXEC).conf.5
|
||||
$(Q)$(RM) $(DESTDIR)$(tmpfilesdir)/multipath.conf
|
||||
100
0002-RH-Remove-the-property-blacklist-exception-builtin.patch
Normal file
100
0002-RH-Remove-the-property-blacklist-exception-builtin.patch
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
From f7be16ac9fce97585a4552d49f3d3c54a93c9c17 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Wed, 2 Jul 2014 12:49:53 -0500
|
||||
Subject: [PATCH] RH: Remove the property blacklist exception builtin
|
||||
|
||||
Multipath set the default property blacklist exceptions to
|
||||
(ID_SCSI_VPD|ID_WWN). This has the effect of blacklisting some internal
|
||||
devices. These devices may never have multiple paths, but it is nice
|
||||
to be able to set multipath up on them all the same. This patch simply
|
||||
removes the default, and makes it so that if no property
|
||||
blacklist_exception is given, then devices aren't failed for not matching
|
||||
it.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/blacklist.c | 5 ++---
|
||||
multipath/multipath.conf.5.in | 11 ++++++-----
|
||||
tests/blacklist.c | 7 ++-----
|
||||
3 files changed, 10 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/libmultipath/blacklist.c b/libmultipath/blacklist.c
|
||||
index 17e1b54a..10d13e98 100644
|
||||
--- a/libmultipath/blacklist.c
|
||||
+++ b/libmultipath/blacklist.c
|
||||
@@ -230,8 +230,6 @@ setup_default_blist (struct config * conf)
|
||||
ORIGIN_DEFAULT))
|
||||
return 1;
|
||||
}
|
||||
- if (store_ble(conf->elist_property, "(SCSI_IDENT_|ID_WWN)", ORIGIN_DEFAULT))
|
||||
- return 1;
|
||||
|
||||
vector_foreach_slot (conf->hwtable, hwe, i) {
|
||||
if (hwe->bl_product) {
|
||||
@@ -438,7 +436,8 @@ filter_property(const struct config *conf, struct udev_device *udev,
|
||||
*uid_attribute != '\0';
|
||||
bool uid_attr_seen = false;
|
||||
|
||||
- r = MATCH_PROPERTY_BLIST_MISSING;
|
||||
+ if (VECTOR_SIZE(conf->elist_property))
|
||||
+ r = MATCH_PROPERTY_BLIST_MISSING;
|
||||
udev_list_entry_foreach(list_entry,
|
||||
udev_device_get_properties_list_entry(udev)) {
|
||||
|
||||
diff --git a/multipath/multipath.conf.5.in b/multipath/multipath.conf.5.in
|
||||
index 3c9ae097..ba291e11 100644
|
||||
--- a/multipath/multipath.conf.5.in
|
||||
+++ b/multipath/multipath.conf.5.in
|
||||
@@ -1470,9 +1470,14 @@ keywords. Both are regular expressions. For a full description of these keywords
|
||||
Regular expression for an udev property. All
|
||||
devices that have matching udev properties will be excluded/included.
|
||||
The handling of the \fIproperty\fR keyword is special,
|
||||
-because devices \fBmust\fR have at least one whitelisted udev property;
|
||||
+because if a property blacklist_exception is set, devices \fBmust\fR have at
|
||||
+least one whitelisted udev property;
|
||||
otherwise they're treated as blacklisted, and the message
|
||||
"\fIblacklisted, udev property missing\fR" is displayed in the logs.
|
||||
+For example, setting the property blacklist_exception to
|
||||
+\fB(SCSI_IDENT_|ID_WWN)\fR, will cause well-behaved SCSI devices and devices
|
||||
+that provide a WWN (World Wide Number) to be included, and all others to be
|
||||
+excluded. This works to exclude most non-multipathable devices.
|
||||
.
|
||||
.RS
|
||||
.PP
|
||||
@@ -1483,10 +1488,6 @@ Blacklisting by missing properties is only applied to devices which do have the
|
||||
property specified by \fIuid_attribute\fR (e.g. \fIID_SERIAL\fR)
|
||||
set. Previously, it was applied to every device, possibly causing devices to be
|
||||
blacklisted because of temporary I/O error conditions.
|
||||
-.PP
|
||||
-The default \fIblacklist exception\fR is: \fB(SCSI_IDENT_|ID_WWN)\fR, causing
|
||||
-well-behaved SCSI devices and devices that provide a WWN (World Wide Number)
|
||||
-to be included, and all others to be excluded.
|
||||
.RE
|
||||
.TP
|
||||
.B protocol
|
||||
diff --git a/tests/blacklist.c b/tests/blacklist.c
|
||||
index ab3da619..52ae03e0 100644
|
||||
--- a/tests/blacklist.c
|
||||
+++ b/tests/blacklist.c
|
||||
@@ -371,9 +371,8 @@ static void test_property_missing(void **state)
|
||||
{
|
||||
static struct udev_device udev = { "sdb", { "ID_FOO", "ID_BAZ", "ID_BAR", "ID_SERIAL", NULL } };
|
||||
conf.blist_property = blist_property_wwn;
|
||||
- expect_condlog(3, "sdb: blacklisted, udev property missing\n");
|
||||
assert_int_equal(filter_property(&conf, &udev, 3, "ID_SERIAL"),
|
||||
- MATCH_PROPERTY_BLIST_MISSING);
|
||||
+ MATCH_NOTHING);
|
||||
assert_int_equal(filter_property(&conf, &udev, 3, "ID_BLAH"),
|
||||
MATCH_NOTHING);
|
||||
assert_int_equal(filter_property(&conf, &udev, 3, ""),
|
||||
@@ -465,9 +464,7 @@ static void test_filter_path_missing1(void **state)
|
||||
conf.blist_device = blist_device_foo_bar;
|
||||
conf.blist_protocol = blist_protocol_fcp;
|
||||
conf.blist_wwid = blist_wwid_xyzzy;
|
||||
- expect_condlog(3, "sdb: blacklisted, udev property missing\n");
|
||||
- assert_int_equal(filter_path(&conf, &miss1_pp),
|
||||
- MATCH_PROPERTY_BLIST_MISSING);
|
||||
+ assert_int_equal(filter_path(&conf, &miss1_pp), MATCH_NOTHING);
|
||||
}
|
||||
|
||||
/* This one matches the property whitelist, to test the other missing
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
---
|
||||
multipath/Makefile | 3 +++
|
||||
multipath/multipath.rules | 24 ++++++++++++++++++++++++
|
||||
2 files changed, 27 insertions(+)
|
||||
|
||||
Index: multipath-tools-130222/multipath/multipath.rules
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ multipath-tools-130222/multipath/multipath.rules
|
||||
@@ -0,0 +1,24 @@
|
||||
+# multipath wants the devmaps presented as meaninglful device names
|
||||
+# so name them after their devmap name
|
||||
+SUBSYSTEM!="block", GOTO="end_mpath"
|
||||
+
|
||||
+ENV{MPATH_SBIN_PATH}="/sbin"
|
||||
+TEST!="$env{MPATH_SBIN_PATH}/multipath", ENV{MPATH_SBIN_PATH}="/usr/sbin"
|
||||
+
|
||||
+ACTION=="add", ENV{DEVTYPE}!="partition", \
|
||||
+ ENV{DM_MULTIPATH_DEVICE_PATH}!="1", \
|
||||
+ TEST=="/etc/multipath.conf", \
|
||||
+ PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -c $tempnode", \
|
||||
+ ENV{DM_MULTIPATH_DEVICE_PATH}="1"
|
||||
+
|
||||
+ENV{DM_MULTIPATH_DEVICE_PATH}=="1", ENV{DEVTYPE}!="partition", \
|
||||
+ RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
|
||||
+
|
||||
+KERNEL!="dm-*", GOTO="end_mpath"
|
||||
+ENV{DM_UUID}=="mpath-?*|part[0-9]*-mpath-?*", OPTIONS+="link_priority=10"
|
||||
+ACTION!="change", GOTO="end_mpath"
|
||||
+ENV{DM_UUID}!="mpath-?*", GOTO="end_mpath"
|
||||
+ENV{DM_SUSPENDED}=="1", GOTO="end_mpath"
|
||||
+ENV{DM_ACTION}=="PATH_FAILED", GOTO="end_mpath"
|
||||
+RUN+="$env{MPATH_SBIN_PATH}/kpartx -a $tempnode"
|
||||
+LABEL="end_mpath"
|
||||
Index: multipath-tools-130222/multipath/Makefile
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/Makefile
|
||||
+++ multipath-tools-130222/multipath/Makefile
|
||||
@@ -21,12 +21,15 @@ $(EXEC): $(OBJS)
|
||||
install:
|
||||
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
|
||||
$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
|
||||
+ $(INSTALL_PROGRAM) -d $(DESTDIR)/lib/udev/rules.d
|
||||
+ $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/lib/udev/rules.d/62-multipath.rules
|
||||
$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)
|
||||
$(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)
|
||||
$(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir)
|
||||
$(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5.gz $(DESTDIR)$(man5dir)
|
||||
|
||||
uninstall:
|
||||
+ rm $(DESTDIR)/lib/udev/rules.d/62-multipath.rules
|
||||
rm $(DESTDIR)$(bindir)/$(EXEC)
|
||||
rm $(DESTDIR)$(mandir)/$(EXEC).8.gz
|
||||
rm $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
From f5e11246063b07d6dce6d37d3b74662475baa981 Mon Sep 17 00:00:00 2001
|
||||
From: Fabio M. Di Nitto <fdinitto@redhat.com>
|
||||
Date: Thu, 15 Oct 2009 04:39:27 +0200
|
||||
Subject: [PATCH 08/12] RH: Make build system RH/Fedora friendly
|
||||
|
||||
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
|
||||
---
|
||||
:100644 100644 7ec25d5... 06fb625... M Makefile.inc
|
||||
:100644 100644 21e4ad4... 06d79c0... M kpartx/Makefile
|
||||
:100644 100644 32d9ef5... 25e1483... M multipathd/Makefile
|
||||
Makefile.inc | 2 +-
|
||||
kpartx/Makefile | 10 +++++-----
|
||||
libmpathpersist/Makefile | 7 ++-----
|
||||
libmultipath/Makefile | 2 ++
|
||||
multipathd/Makefile | 1 +
|
||||
5 files changed, 11 insertions(+), 11 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/Makefile.inc
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/Makefile.inc
|
||||
+++ multipath-tools-130222/Makefile.inc
|
||||
@@ -29,7 +29,7 @@ multipathdir = $(TOPDIR)/libmultipath
|
||||
mandir = $(prefix)/usr/share/man/man8
|
||||
man5dir = $(prefix)/usr/share/man/man5
|
||||
man3dir = $(prefix)/usr/share/man/man3
|
||||
-rcdir = $(prefix)/etc/init.d
|
||||
+rcdir = $(prefix)/etc/rc.d/init.d
|
||||
syslibdir = $(prefix)/$(LIB)
|
||||
libdir = $(prefix)/$(LIB)/multipath
|
||||
unitdir = $(prefix)/lib/systemd/system
|
||||
Index: multipath-tools-130222/kpartx/Makefile
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/kpartx/Makefile
|
||||
+++ multipath-tools-130222/kpartx/Makefile
|
||||
@@ -26,17 +26,17 @@ $(EXEC): $(OBJS)
|
||||
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) -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) -d $(DESTDIR)$(mandir)
|
||||
$(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(bindir)/$(EXEC)
|
||||
rm -f $(DESTDIR)$(mandir)/$(EXEC).8.gz
|
||||
- rm -f $(DESTDIR)$(libudevdir)/kpartx_id
|
||||
+# rm -f $(DESTDIR)$(libudevdir)/kpartx_id
|
||||
|
||||
clean:
|
||||
rm -f core *.o $(EXEC) *.gz
|
||||
Index: multipath-tools-130222/multipathd/Makefile
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/Makefile
|
||||
+++ multipath-tools-130222/multipathd/Makefile
|
||||
@@ -35,6 +35,7 @@ install:
|
||||
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
|
||||
$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)
|
||||
$(INSTALL_PROGRAM) -d $(DESTDIR)$(rcdir)
|
||||
+ $(INSTALL_PROGRAM) -m 755 multipathd.init.redhat $(DESTDIR)$(rcdir)/$(EXEC)
|
||||
$(INSTALL_PROGRAM) -d $(DESTDIR)$(unitdir)
|
||||
$(INSTALL_PROGRAM) -m 644 $(EXEC).service $(DESTDIR)$(unitdir)
|
||||
$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)
|
||||
Index: multipath-tools-130222/libmultipath/Makefile
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/Makefile
|
||||
+++ multipath-tools-130222/libmultipath/Makefile
|
||||
@@ -46,9 +46,11 @@ install:
|
||||
$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
|
||||
$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
|
||||
$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(libdir)
|
||||
+ ln -sf $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(syslibdir)/$(LIBS)
|
||||
+ rm -f $(DESTDIR)$(syslibdir)/$(DEVLIB)
|
||||
|
||||
clean:
|
||||
rm -f core *.a *.o *.gz *.so *.so.*
|
||||
Index: multipath-tools-130222/libmpathpersist/Makefile
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmpathpersist/Makefile
|
||||
+++ multipath-tools-130222/libmpathpersist/Makefile
|
||||
@@ -28,17 +28,14 @@ $(LIBS):
|
||||
install: $(LIBS)
|
||||
$(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
|
||||
$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
|
||||
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(syslibdir)
|
||||
$(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(man3dir)
|
||||
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)/usr/include/
|
||||
- $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)/usr/share/doc/mpathpersist/
|
||||
- ln -sf $(DESTDIR)$(syslibdir)/$(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
|
||||
+ ln -sf $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
|
||||
install -m 644 mpath_persistent_reserve_in.3.gz $(DESTDIR)$(man3dir)
|
||||
install -m 644 mpath_persistent_reserve_out.3.gz $(DESTDIR)$(man3dir)
|
||||
- install -m 644 mpath_persist.h $(DESTDIR)/usr/include/
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(syslibdir)/$(LIBS)
|
||||
+ rm -f $(DESTDIR)$(syslibdir)/$(DEVLIB)
|
||||
rm $(DESTDIR)$(mandir)/mpath_persistent_reserve_in.3.gz
|
||||
rm $(DESTDIR)$(mandir)/mpath_persistent_reserve_out.3.gz
|
||||
|
||||
137
0003-RH-don-t-start-without-a-config-file.patch
Normal file
137
0003-RH-don-t-start-without-a-config-file.patch
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
From 5613e07ce9cabf2fdc402f6f102cc54bd1059800 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Wed, 15 Oct 2014 10:39:30 -0500
|
||||
Subject: [PATCH] RH: don't start without a config file
|
||||
|
||||
If /etc/multipath.conf doesn't exist, don't start multipathd and blacklist
|
||||
all devices when running multipath. A completely blank configuration file
|
||||
is almost never what users want. Also, people may have the multipath
|
||||
packages installed but don't want to use them. This patch provides a
|
||||
simple way to disable multipath. Simply removing or renaming
|
||||
/etc/multipath.conf will keep multipath from doing anything.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/config.c | 13 +++++++++++++
|
||||
libmultipath/config.h | 1 +
|
||||
multipath/main.c | 6 ++++++
|
||||
multipath/multipath.rules.in | 1 +
|
||||
multipathd/multipathd.8.in | 2 ++
|
||||
multipathd/multipathd.service.in | 1 +
|
||||
multipathd/multipathd.socket.in | 1 +
|
||||
7 files changed, 25 insertions(+)
|
||||
|
||||
diff --git a/libmultipath/config.c b/libmultipath/config.c
|
||||
index 8b424d18..b8317f4d 100644
|
||||
--- a/libmultipath/config.c
|
||||
+++ b/libmultipath/config.c
|
||||
@@ -937,6 +937,19 @@ int init_config__ (const char *file, struct config *conf)
|
||||
}
|
||||
factorize_hwtable(conf->hwtable, builtin_hwtable_size, file);
|
||||
validate_pctable(conf->overrides, 0, file);
|
||||
+ } else {
|
||||
+ condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices.");
|
||||
+ if (conf->blist_devnode == NULL) {
|
||||
+ conf->blist_devnode = vector_alloc();
|
||||
+ if (!conf->blist_devnode) {
|
||||
+ condlog(0, "cannot allocate blacklist\n");
|
||||
+ goto out;
|
||||
+ }
|
||||
+ }
|
||||
+ if (store_ble(conf->blist_devnode, ".*", ORIGIN_NO_CONFIG)) {
|
||||
+ condlog(0, "cannot store default no-config blacklist\n");
|
||||
+ goto out;
|
||||
+ }
|
||||
}
|
||||
|
||||
conf->processed_main_config = 1;
|
||||
diff --git a/libmultipath/config.h b/libmultipath/config.h
|
||||
index 5b4ebf8c..2302eacc 100644
|
||||
--- a/libmultipath/config.h
|
||||
+++ b/libmultipath/config.h
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#define ORIGIN_DEFAULT 0
|
||||
#define ORIGIN_CONFIG 1
|
||||
+#define ORIGIN_NO_CONFIG 2
|
||||
|
||||
enum devtypes {
|
||||
DEV_NONE,
|
||||
diff --git a/multipath/main.c b/multipath/main.c
|
||||
index f2adcdeb..31012874 100644
|
||||
--- a/multipath/main.c
|
||||
+++ b/multipath/main.c
|
||||
@@ -834,11 +834,14 @@ main (int argc, char *argv[])
|
||||
char *dev = NULL;
|
||||
struct config *conf;
|
||||
bool enable_foreign = false;
|
||||
+ bool have_config;
|
||||
+ struct stat buf;
|
||||
|
||||
libmultipath_init();
|
||||
if (atexit(dm_lib_exit) || atexit(libmultipath_exit))
|
||||
condlog(1, "failed to register cleanup handler for libmultipath: %m");
|
||||
logsink = LOGSINK_STDERR_WITH_TIME;
|
||||
+ have_config = (stat(DEFAULT_CONFIGFILE, &buf) == 0);
|
||||
if (init_config(DEFAULT_CONFIGFILE))
|
||||
exit(RTVL_FAIL);
|
||||
if (atexit(uninit_config))
|
||||
@@ -1092,6 +1095,9 @@ main (int argc, char *argv[])
|
||||
while ((r = configure(conf, cmd, dev_type, dev)) == RTVL_RETRY)
|
||||
condlog(3, "restart multipath configuration process");
|
||||
|
||||
+ if (!have_config && r == RTVL_OK &&
|
||||
+ (cmd == CMD_LIST_SHORT || cmd == CMD_LIST_LONG))
|
||||
+ r = RTVL_FAIL;
|
||||
out:
|
||||
put_multipath_config(conf);
|
||||
if (dev)
|
||||
diff --git a/multipath/multipath.rules.in b/multipath/multipath.rules.in
|
||||
index 2ac1972f..cc248231 100644
|
||||
--- a/multipath/multipath.rules.in
|
||||
+++ b/multipath/multipath.rules.in
|
||||
@@ -9,6 +9,7 @@ IMPORT{cmdline}="nompath"
|
||||
ENV{nompath}=="?*", GOTO="end_mpath"
|
||||
IMPORT{cmdline}="multipath"
|
||||
ENV{multipath}=="off", GOTO="end_mpath"
|
||||
+TEST!="/etc/multipath.conf", GOTO="end_mpath"
|
||||
|
||||
ENV{DEVTYPE}!="partition", GOTO="test_dev"
|
||||
IMPORT{parent}="DM_MULTIPATH_DEVICE_PATH"
|
||||
diff --git a/multipathd/multipathd.8.in b/multipathd/multipathd.8.in
|
||||
index 8815e099..342e363e 100644
|
||||
--- a/multipathd/multipathd.8.in
|
||||
+++ b/multipathd/multipathd.8.in
|
||||
@@ -49,6 +49,8 @@ map regains its maximum performance and redundancy.
|
||||
With the \fB-k\fR option, \fBmultipathd\fR acts as a client utility that
|
||||
sends commands to a running instance of the multipathd daemon (see
|
||||
\fBCOMMANDS\fR below).
|
||||
+
|
||||
+In this Linux distribution, multipathd does not run unless a /etc/multipath.conf file exists.
|
||||
.
|
||||
.
|
||||
.\" ----------------------------------------------------------------------------
|
||||
diff --git a/multipathd/multipathd.service.in b/multipathd/multipathd.service.in
|
||||
index eb58943c..ab166435 100644
|
||||
--- a/multipathd/multipathd.service.in
|
||||
+++ b/multipathd/multipathd.service.in
|
||||
@@ -6,6 +6,7 @@ Wants=systemd-udevd-kernel.socket multipathd-queueing.service @MODPROBE_UNIT@
|
||||
After=systemd-udevd-kernel.socket @MODPROBE_UNIT@
|
||||
After=multipathd.socket systemd-remount-fs.service
|
||||
Before=initrd-cleanup.service
|
||||
+ConditionPathExists=/etc/multipath.conf
|
||||
DefaultDependencies=no
|
||||
Conflicts=shutdown.target
|
||||
Conflicts=initrd-cleanup.service
|
||||
diff --git a/multipathd/multipathd.socket.in b/multipathd/multipathd.socket.in
|
||||
index 11002fce..5ed24757 100644
|
||||
--- a/multipathd/multipathd.socket.in
|
||||
+++ b/multipathd/multipathd.socket.in
|
||||
@@ -1,6 +1,7 @@
|
||||
[Unit]
|
||||
Description=multipathd control socket
|
||||
DefaultDependencies=no
|
||||
+ConditionPathExists=/etc/multipath.conf
|
||||
ConditionKernelCommandLine=!nompath
|
||||
ConditionKernelCommandLine=!multipath=off
|
||||
ConditionVirtualization=!container
|
||||
26
0004-RH-Fix-nvme-function-missing-argument.patch
Normal file
26
0004-RH-Fix-nvme-function-missing-argument.patch
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
From 283b5dd645663a2cf16f2813581772d7a84db6ad Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Fri, 25 Jan 2019 14:54:56 -0600
|
||||
Subject: [PATCH] RH: Fix nvme function missing argument
|
||||
|
||||
A future patch will change the compilation options to error when
|
||||
function declarations have unspecified arguments.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/nvme/argconfig.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libmultipath/nvme/argconfig.h b/libmultipath/nvme/argconfig.h
|
||||
index b3caa7be..f91504c9 100644
|
||||
--- a/libmultipath/nvme/argconfig.h
|
||||
+++ b/libmultipath/nvme/argconfig.h
|
||||
@@ -63,7 +63,7 @@ struct argconfig_commandline_options {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
-typedef void argconfig_help_func();
|
||||
+typedef void argconfig_help_func(void);
|
||||
void argconfig_append_usage(const char *str);
|
||||
void argconfig_print_help(const char *program_desc,
|
||||
const struct argconfig_commandline_options *options);
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
From 61b2002c6b2752c15b431e400cd614edc8c5b039 Mon Sep 17 00:00:00 2001
|
||||
From: Fabio M. Di Nitto <fdinitto@redhat.com>
|
||||
Date: Mon, 19 Oct 2009 07:05:45 +0200
|
||||
Subject: [PATCH 09/12] RH: multipathd blacklist all by default
|
||||
|
||||
If there is no configuration installed on the system, blacklist
|
||||
everything by default.
|
||||
|
||||
BZ#528059
|
||||
|
||||
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
|
||||
---
|
||||
:100644 100644 e7e962e... 5aa1ab0... M libmultipath/config.c
|
||||
:100644 100644 86b1320... 7e90e75... M libmultipath/config.h
|
||||
libmultipath/config.c | 16 ++++++++++++++++
|
||||
libmultipath/config.h | 1 +
|
||||
2 files changed, 17 insertions(+)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/config.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/config.c
|
||||
+++ multipath-tools-130222/libmultipath/config.c
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "defaults.h"
|
||||
#include "prio.h"
|
||||
#include "devmapper.h"
|
||||
+#include "version.h"
|
||||
|
||||
static int
|
||||
hwe_strmatch (struct hwentry *hwe1, struct hwentry *hwe2)
|
||||
@@ -585,6 +586,21 @@ load_config (char * file)
|
||||
|
||||
} else {
|
||||
init_keywords();
|
||||
+ condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices.");
|
||||
+ condlog(0, "A default multipath.conf file is located at");
|
||||
+ condlog(0, "/usr/share/doc/device-mapper-multipath-%d.%d.%d/multipath.conf", MULTIPATH_VERSION(VERSION_CODE));
|
||||
+ if (conf->blist_devnode == NULL) {
|
||||
+ conf->blist_devnode = vector_alloc();
|
||||
+ if (!conf->blist_devnode) {
|
||||
+ condlog(0, "cannot allocate blacklist\n");
|
||||
+ goto out;
|
||||
+ }
|
||||
+ }
|
||||
+ if (store_ble(conf->blist_devnode, strdup(".*"),
|
||||
+ ORIGIN_NO_CONFIG)) {
|
||||
+ condlog(0, "cannot store default no-config blacklist\n");
|
||||
+ goto out;
|
||||
+ }
|
||||
}
|
||||
|
||||
/*
|
||||
Index: multipath-tools-130222/libmultipath/config.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/config.h
|
||||
+++ multipath-tools-130222/libmultipath/config.h
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#define ORIGIN_DEFAULT 0
|
||||
#define ORIGIN_CONFIG 1
|
||||
+#define ORIGIN_NO_CONFIG 2
|
||||
|
||||
/*
|
||||
* In kernel, fast_io_fail == 0 means immediate failure on rport delete.
|
||||
|
|
@ -1,496 +0,0 @@
|
|||
---
|
||||
libmultipath/config.c | 3
|
||||
multipath/Makefile | 5
|
||||
multipath/main.c | 4
|
||||
multipath/mpathconf | 312 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
multipath/mpathconf.8 | 103 ++++++++++++++++
|
||||
5 files changed, 423 insertions(+), 4 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/config.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/config.c
|
||||
+++ multipath-tools-130222/libmultipath/config.c
|
||||
@@ -587,8 +587,7 @@ load_config (char * file)
|
||||
} else {
|
||||
init_keywords();
|
||||
condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices.");
|
||||
- condlog(0, "A default multipath.conf file is located at");
|
||||
- condlog(0, "/usr/share/doc/device-mapper-multipath-%d.%d.%d/multipath.conf", MULTIPATH_VERSION(VERSION_CODE));
|
||||
+ condlog(0, "run \"/sbin/mpathconf --enable\" to create a default /etc/multipath.conf");
|
||||
if (conf->blist_devnode == NULL) {
|
||||
conf->blist_devnode = vector_alloc();
|
||||
if (!conf->blist_devnode) {
|
||||
Index: multipath-tools-130222/multipath/Makefile
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/Makefile
|
||||
+++ multipath-tools-130222/multipath/Makefile
|
||||
@@ -17,22 +17,27 @@ $(EXEC): $(OBJS)
|
||||
$(CC) $(CFLAGS) $(OBJS) -o $(EXEC) $(LDFLAGS)
|
||||
$(GZIP) $(EXEC).8 > $(EXEC).8.gz
|
||||
$(GZIP) $(EXEC).conf.5 > $(EXEC).conf.5.gz
|
||||
+ $(GZIP) mpathconf.8 > mpathconf.8.gz
|
||||
|
||||
install:
|
||||
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
|
||||
$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
|
||||
+ $(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/
|
||||
$(INSTALL_PROGRAM) -d $(DESTDIR)/lib/udev/rules.d
|
||||
$(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/lib/udev/rules.d/62-multipath.rules
|
||||
$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)
|
||||
$(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)
|
||||
$(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir)
|
||||
$(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5.gz $(DESTDIR)$(man5dir)
|
||||
+ $(INSTALL_PROGRAM) -m 644 mpathconf.8.gz $(DESTDIR)$(mandir)
|
||||
|
||||
uninstall:
|
||||
rm $(DESTDIR)/lib/udev/rules.d/62-multipath.rules
|
||||
rm $(DESTDIR)$(bindir)/$(EXEC)
|
||||
+ rm $(DESTDIR)$(bindir)/mpathconf
|
||||
rm $(DESTDIR)$(mandir)/$(EXEC).8.gz
|
||||
rm $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz
|
||||
+ rm $(DESTDIR)$(mandir)/mpathconf.8.gz
|
||||
|
||||
clean:
|
||||
rm -f core *.o $(EXEC) *.gz
|
||||
Index: multipath-tools-130222/multipath/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/main.c
|
||||
+++ multipath-tools-130222/multipath/main.c
|
||||
@@ -433,10 +433,10 @@ main (int argc, char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
- if (dm_prereq())
|
||||
+ if (load_config(DEFAULT_CONFIGFILE))
|
||||
exit(1);
|
||||
|
||||
- if (load_config(DEFAULT_CONFIGFILE))
|
||||
+ if (dm_prereq())
|
||||
exit(1);
|
||||
|
||||
while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:Brtq")) != EOF ) {
|
||||
Index: multipath-tools-130222/multipath/mpathconf
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ multipath-tools-130222/multipath/mpathconf
|
||||
@@ -0,0 +1,312 @@
|
||||
+#!/bin/sh
|
||||
+#
|
||||
+# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
|
||||
+#
|
||||
+# This file is part of the device-mapper-multipath package.
|
||||
+#
|
||||
+# This copyrighted material is made available to anyone wishing to use,
|
||||
+# modify, copy, or redistribute it subject to the terms and conditions
|
||||
+# of the GNU General Public License v.2.
|
||||
+#
|
||||
+# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
+
|
||||
+#
|
||||
+# Simple editting of /etc/multipath.conf
|
||||
+# This program was largely ripped off from lvmconf
|
||||
+#
|
||||
+
|
||||
+unset ENABLE FIND FRIENDLY MODULE MULTIPATHD HAVE_DISABLE HAVE_FIND HAVE_BLACKLIST HAVE_DEFAULTS HAVE_FRIENDLY HAVE_MULTIPATHD HAVE_MODULE SHOW_STATUS CHANGED_CONFIG
|
||||
+
|
||||
+DEFAULT_CONFIGFILE="/usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf"
|
||||
+CONFIGFILE="/etc/multipath.conf"
|
||||
+MULTIPATHDIR="/etc/multipath"
|
||||
+TMPFILE=/etc/multipath/.multipath.conf.tmp
|
||||
+
|
||||
+function usage
|
||||
+{
|
||||
+ echo "usage: $0 <command>"
|
||||
+ echo ""
|
||||
+ echo "Commands:"
|
||||
+ echo "Enable: --enable "
|
||||
+ echo "Disable: --disable"
|
||||
+ echo "Set user_friendly_names (Default n): --user_friendly_names <y|n>"
|
||||
+ echo "Set find_multipaths (Default n): --find_multipaths <y|n>"
|
||||
+ echo "Load the dm-multipath modules on enable (Default y): --with_module <y|n>"
|
||||
+ echo "start/stop/reload multipathd (Default n): --with_multipathd <y|n>"
|
||||
+ echo ""
|
||||
+}
|
||||
+
|
||||
+function parse_args
|
||||
+{
|
||||
+ while [ -n "$1" ]; do
|
||||
+ case $1 in
|
||||
+ --enable)
|
||||
+ ENABLE=1
|
||||
+ shift
|
||||
+ ;;
|
||||
+ --disable)
|
||||
+ ENABLE=0
|
||||
+ shift
|
||||
+ ;;
|
||||
+ --user_friendly_names)
|
||||
+ if [ -n "$2" ]; then
|
||||
+ FRIENDLY=$2
|
||||
+ shift 2
|
||||
+ else
|
||||
+ usage
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ ;;
|
||||
+ --find_multipaths)
|
||||
+ if [ -n "$2" ]; then
|
||||
+ FIND=$2
|
||||
+ shift 2
|
||||
+ else
|
||||
+ usage
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ ;;
|
||||
+ --with_module)
|
||||
+ if [ -n "$2" ]; then
|
||||
+ MODULE=$2
|
||||
+ shift 2
|
||||
+ else
|
||||
+ usage
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ ;;
|
||||
+ --with_multipathd)
|
||||
+ if [ -n "$2" ]; then
|
||||
+ MULTIPATHD=$2
|
||||
+ shift 2
|
||||
+ else
|
||||
+ usage
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ ;;
|
||||
+ *)
|
||||
+ usage
|
||||
+ exit
|
||||
+ esac
|
||||
+ done
|
||||
+}
|
||||
+
|
||||
+function validate_args
|
||||
+{
|
||||
+ if [ "$ENABLE" = "0" ] && [ -n "$FRIENDLY" -o -n "$FIND" -o -n "$MODULE" ]; then
|
||||
+ echo "ignoring extra parameters on disable"
|
||||
+ FRIENDLY=""
|
||||
+ FIND=""
|
||||
+ MODULE=""
|
||||
+ fi
|
||||
+ if [ -n "$FRIENDLY" ] && [ "$FRIENDLY" != "y" -a "$FRIENDLY" != "n" ]; then
|
||||
+ echo "--user_friendly_names must be either 'y' or 'n'"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ if [ -n "$FIND" ] && [ "$FIND" != "y" -a "$FIND" != "n" ]; then
|
||||
+ echo "--find_multipaths must be either 'y' or 'n'"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ if [ -z "$ENABLE" -a -z "$FIND" -a -z "$FRIENDLY" ]; then
|
||||
+ SHOW_STATUS=1
|
||||
+ fi
|
||||
+ if [ -n "$MODULE" ] && [ "$MODULE" != "y" -a "$MODULE" != "n" ]; then
|
||||
+ echo "--with_module must be either 'y' or 'n'"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ if [ -n "$MULTIPATHD" ] && [ "$MULTIPATHD" != "y" -a "$MULTIPATHD" != "n" ]; then
|
||||
+ echo "--with_multipathd must be either 'y' or 'n'"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+umask 0077
|
||||
+
|
||||
+parse_args "$@"
|
||||
+
|
||||
+validate_args
|
||||
+
|
||||
+if [ ! -d "$MULTIPATHDIR" ]; then
|
||||
+ echo "/etc/multipath/ does not exist. failing"
|
||||
+ exit 1
|
||||
+fi
|
||||
+
|
||||
+rm $TMPFILE 2> /dev/null
|
||||
+if [ -f "$CONFIGFILE" ]; then
|
||||
+ cp $CONFIGFILE $TMPFILE
|
||||
+elif [ -f "$DEFAULT_CONFIGFILE" ]; then
|
||||
+ cp $DEFAULT_CONFIGFILE $TMPFILE
|
||||
+else
|
||||
+ touch $TMPFILE
|
||||
+fi
|
||||
+
|
||||
+if grep -q "^blacklist[[:space:]]*{" $TMPFILE ; then
|
||||
+ HAVE_BLACKLIST=1
|
||||
+fi
|
||||
+
|
||||
+if grep -q "^defaults[[:space:]]*{" $TMPFILE ; then
|
||||
+ HAVE_DEFAULTS=1
|
||||
+fi
|
||||
+
|
||||
+if [ -z "$MODULE" -o "$MODULE" = "y" ]; then
|
||||
+ if lsmod | grep -q "dm_multipath" ; then
|
||||
+ HAVE_MODULE=1
|
||||
+ else
|
||||
+ HAVE_MODULE=0
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+if [ "$MULTIPATHD" = "y" ]; then
|
||||
+ if service multipathd status > /dev/null ; then
|
||||
+ HAVE_MULTIPATHD=1
|
||||
+ else
|
||||
+ HAVE_MULTIPATHD=0
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+if [ "$HAVE_BLACKLIST" = "1" ]; then
|
||||
+ if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*devnode \"\.\?\*\"" ; then
|
||||
+ HAVE_DISABLE=1
|
||||
+ elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[#[:space:]]*devnode \"\.\?\*\"" ; then
|
||||
+ HAVE_DISABLE=0
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+if [ "$HAVE_DEFAULTS" = "1" ]; then
|
||||
+ if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*find_multipaths[[:space:]]*\(yes\|1\)" ; then
|
||||
+ HAVE_FIND=1
|
||||
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*find_multipaths[[:space:]]*\(no\|0\)" ; then
|
||||
+ HAVE_FIND=0
|
||||
+ fi
|
||||
+ if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]]*\(yes\|1\)" ; then
|
||||
+ HAVE_FRIENDLY=1
|
||||
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]]*\(no\|0\)" ; then
|
||||
+ HAVE_FRIENDLY=0
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+if [ -n "$SHOW_STATUS" ]; then
|
||||
+ if [ -z "$HAVE_DISABLE" -o "$HAVE_DISABLE" = 0 ]; then
|
||||
+ echo "multipath is enabled"
|
||||
+ else
|
||||
+ echo "multipath is disabled"
|
||||
+ fi
|
||||
+ if [ -z "$HAVE_FIND" -o "$HAVE_FIND" = 0 ]; then
|
||||
+ echo "find_multipaths is disabled"
|
||||
+ else
|
||||
+ echo "find_multipaths is enabled"
|
||||
+ fi
|
||||
+ if [ -z "$HAVE_FRIENDLY" -o "$HAVE_FRIENDLY" = 0 ]; then
|
||||
+ echo "user_friendly_names is disabled"
|
||||
+ else
|
||||
+ echo "user_friendly_names is enabled"
|
||||
+ fi
|
||||
+ if [ -n "$HAVE_MODULE" ]; then
|
||||
+ if [ "$HAVE_MODULE" = 1 ]; then
|
||||
+ echo "dm_multipath module is loaded"
|
||||
+ else
|
||||
+ echo "dm_multipath module is not loaded"
|
||||
+ fi
|
||||
+ fi
|
||||
+ if [ -n "$HAVE_MULTIPATHD" ]; then
|
||||
+ service multipathd status
|
||||
+ fi
|
||||
+ exit 0
|
||||
+fi
|
||||
+
|
||||
+if [ -z "$HAVE_BLACKLIST" ]; then
|
||||
+ cat >> $TMPFILE <<- _EOF_
|
||||
+
|
||||
+blacklist {
|
||||
+}
|
||||
+_EOF_
|
||||
+fi
|
||||
+
|
||||
+if [ -z "$HAVE_DEFAULTS" ]; then
|
||||
+ cat >> $TMPFILE <<- _EOF_
|
||||
+
|
||||
+defaults {
|
||||
+}
|
||||
+_EOF_
|
||||
+fi
|
||||
+
|
||||
+if [ "$ENABLE" = 1 ]; then
|
||||
+ if [ "$HAVE_DISABLE" = 1 ]; then
|
||||
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*devnode \"\.\?\*\"/# devnode ".*"/' $TMPFILE
|
||||
+ fi
|
||||
+elif [ "$ENABLE" = 0 ]; then
|
||||
+ if [ -z "$HAVE_DISABLE" ]; then
|
||||
+ sed -i '/^blacklist[[:space:]]*{/ a\
|
||||
+ devnode "*"
|
||||
+' $TMPFILE
|
||||
+ elif [ "$HAVE_DISABLE" = 0 ]; then
|
||||
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[#[:space:]]*devnode \"\.\?\*\"/ devnode ".*"/' $TMPFILE
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+if [ "$FIND" = "n" ]; then
|
||||
+ if [ "$HAVE_FIND" = 1 ]; then
|
||||
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*find_multipaths[[:space:]]*\(yes\|1\)/ find_multipaths no/' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+ fi
|
||||
+elif [ "$FIND" = "y" ]; then
|
||||
+ if [ -z "$HAVE_FIND" ]; then
|
||||
+ sed -i '/^defaults[[:space:]]*{/ a\
|
||||
+ find_multipaths yes
|
||||
+' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+ elif [ "$HAVE_FIND" = 0 ]; then
|
||||
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*find_multipaths[[:space:]]*\(no\|0\)/ find_multipaths yes/' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+if [ "$FRIENDLY" = "n" ]; then
|
||||
+ if [ "$HAVE_FRIENDLY" = 1 ]; then
|
||||
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]]*\(yes\|1\)/ user_friendly_names no/' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+ fi
|
||||
+elif [ "$FRIENDLY" = "y" ]; then
|
||||
+ if [ -z "$HAVE_FRIENDLY" ]; then
|
||||
+ sed -i '/^defaults[[:space:]]*{/ a\
|
||||
+ user_friendly_names yes
|
||||
+' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+ elif [ "$HAVE_FRIENDLY" = 0 ]; then
|
||||
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]]*\(no\|0\)/ user_friendly_names yes/' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+if [ -f "$CONFIGFILE" ]; then
|
||||
+ cp $CONFIGFILE $CONFIGFILE.old
|
||||
+ if [ $? != 0 ]; then
|
||||
+ echo "failed to backup old config file, $CONFIGFILE not updated"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+cp $TMPFILE $CONFIGFILE
|
||||
+if [ $? != 0 ]; then
|
||||
+ echo "failed to copy new config file into place, check $CONFIGFILE is still OK"
|
||||
+ exit 1
|
||||
+fi
|
||||
+
|
||||
+rm -f $TMPFILE
|
||||
+
|
||||
+if [ "$ENABLE" = 1 ]; then
|
||||
+ if [ "$HAVE_MODULE" = 0 ]; then
|
||||
+ modprobe dm_multipath
|
||||
+ fi
|
||||
+ if [ "$HAVE_MULTIPATHD" = 0 ]; then
|
||||
+ service multipathd start
|
||||
+ fi
|
||||
+elif [ "$ENABLE" = 0 ]; then
|
||||
+ if [ "$HAVE_MULTIPATHD" = 1 ]; then
|
||||
+ service multipathd stop
|
||||
+ fi
|
||||
+elif [ -n "$CHANGED_CONFIG" -a "$HAVE_MULTIPATHD" = 1 ]; then
|
||||
+ service multipathd reload
|
||||
+fi
|
||||
Index: multipath-tools-130222/multipath/mpathconf.8
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ multipath-tools-130222/multipath/mpathconf.8
|
||||
@@ -0,0 +1,103 @@
|
||||
+.TH MPATHCONF 8 "June 2010" "" "Linux Administrator's Manual"
|
||||
+.SH NAME
|
||||
+mpathconf - A tool for configuring device-mapper-multipath
|
||||
+.SH SYNOPSIS
|
||||
+.B mpathconf
|
||||
+.RB [\| commands \|]
|
||||
+.RB [\| options \|]
|
||||
+.SH DESCRIPTION
|
||||
+.B mpathconf
|
||||
+is a utility that creates or modifies
|
||||
+.B /etc/multipath.conf.
|
||||
+It can enable or disable multipathing and configure some common options.
|
||||
+.B mpathconf
|
||||
+can also load the
|
||||
+.B dm_multipath
|
||||
+module, start and stop the
|
||||
+.B multipathd
|
||||
+daemon, and configure the
|
||||
+.B multipathd
|
||||
+service to start automatically or not. If
|
||||
+.B mpathconf
|
||||
+is called with no commands, it will display the current configuration.
|
||||
+
|
||||
+The default options for mpathconf are
|
||||
+.B --with_module
|
||||
+The
|
||||
+.B --with_multipathd
|
||||
+option is not set by default. Enabling multipathing will load the
|
||||
+.B dm_multipath
|
||||
+module but it will not immediately start it. This is so
|
||||
+that users can manually edit their config file if necessary, before starting
|
||||
+.B multipathd.
|
||||
+
|
||||
+If
|
||||
+.B /etc/multipath.conf
|
||||
+already exists, mpathconf will edit it. If it does not exist, mpathconf will
|
||||
+use
|
||||
+.B /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf
|
||||
+as the starting file. This file has
|
||||
+.B user_friendly_names
|
||||
+set. If this file does not exist, mpathconf will create
|
||||
+.B /etc/multipath.conf
|
||||
+from scratch. For most users, this means that
|
||||
+.B user_friendly_names
|
||||
+will be set by default, unless they use the
|
||||
+.B --user_friendly_names n
|
||||
+command.
|
||||
+.SH COMMANDS
|
||||
+.TP
|
||||
+.B --enable
|
||||
+Removes any line that blacklists all device nodes from the
|
||||
+.B /etc/multipath.conf
|
||||
+blacklist section.
|
||||
+.TP
|
||||
+.B --disable
|
||||
+Adds a line that blacklists all device nodes to the
|
||||
+.B /etc/multipath.conf
|
||||
+blacklist section. If no blacklist section exists, it will create one.
|
||||
+.TP
|
||||
+.B --user_friendly_name \fP { \fBy\fP | \fBn\fP }
|
||||
+If set to \fBy\fP, this adds the line
|
||||
+.B user_friendly_names yes
|
||||
+to the
|
||||
+.B /etc/multipath.conf
|
||||
+defaults section. If set to \fBn\fP, this removes the line, if present. This
|
||||
+command can be used along with any other command.
|
||||
+.TP
|
||||
+.B --find_multipaths\fP { \fBy\fP | \fBn\fP }
|
||||
+If set to \fBy\fP, this adds the line
|
||||
+.B find_multipaths yes
|
||||
+to the
|
||||
+.B /etc/multipath.conf
|
||||
+defaults section. If set to \fBn\fP, this removes the line, if present. This
|
||||
+command can be used aldong with any other command.
|
||||
+.SH OPTIONS
|
||||
+.TP
|
||||
+.B --with_module\fP { \fBy\fP | \fBn\fP }
|
||||
+If set to \fBy\fP, this runs
|
||||
+.B modprobe dm_multipath
|
||||
+to install the multipath modules. This option only works with the
|
||||
+.B --enable
|
||||
+command. This option is set to \fBy\fP by default.
|
||||
+.TP
|
||||
+.B --with_multipathd { \fBy\fP | \fBn\fP }
|
||||
+If set to \fBy\fP, this runs
|
||||
+.B service multipathd start
|
||||
+to start the multipathd daemon on \fB--enable\fP,
|
||||
+.B service multipathd stop
|
||||
+to start the multipathd daemon on \fB--disable\fP, and
|
||||
+.B service multipathd reload
|
||||
+to reconfigure multipathd on \fB--user_frindly_names\fP and
|
||||
+\fB--find_multipaths\fP.
|
||||
+This option is set to \fBn\fP by default.
|
||||
+.SH FILES
|
||||
+.BR /etc/multipath.conf
|
||||
+.SH "SEE ALSO"
|
||||
+.BR multipath.conf (5),
|
||||
+.BR modprobe (8),
|
||||
+.BR multipath (8),
|
||||
+.BR multipathd (8),
|
||||
+.BR service (8),
|
||||
+.SH AUTHOR
|
||||
+Benjamin Marzinski <bmarzins@redhat.com>
|
||||
67
0005-RH-use-rpm-optflags-if-present.patch
Normal file
67
0005-RH-use-rpm-optflags-if-present.patch
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
From bf46f8029998498045bb055415ba3ff515c79eaa Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Wed, 19 Apr 2017 06:10:01 -0500
|
||||
Subject: [PATCH] RH: use rpm optflags if present
|
||||
|
||||
Use the passed in optflags when compiling as an RPM, and keep the
|
||||
default flags as close as possible to the current fedora flags, while
|
||||
still being generic.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
Makefile.inc | 25 ++++++++++++++++++-------
|
||||
1 file changed, 18 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/Makefile.inc b/Makefile.inc
|
||||
index ead89030..03aee175 100644
|
||||
--- a/Makefile.inc
|
||||
+++ b/Makefile.inc
|
||||
@@ -102,17 +102,29 @@ SYSTEMD_LIBDEPS := $(if $(SYSTEMD),$(if $(shell test $(SYSTEMD) -gt 209 && echo
|
||||
MODPROBE_UNIT := $(shell test "0$(SYSTEMD)" -lt 245 2>/dev/null || \
|
||||
echo "modprobe@dm_multipath.service")
|
||||
|
||||
-OPTFLAGS := -O2 -g $(STACKPROT) --param=ssp-buffer-size=4
|
||||
+ifndef RPM_OPT_FLAGS
|
||||
+ OPTFLAGS := -O2 -g $(STACKPROT) --param=ssp-buffer-size=4 \
|
||||
+ -Wall $(FORTIFY_OPT) -fexceptions -grecord-gcc-switches \
|
||||
+ -fasynchronous-unwind-tables
|
||||
+ ifeq ($(shell test -f /usr/lib/rpm/redhat/redhat-hardened-cc1 && echo 1),1)
|
||||
+ OPTFLAGS += -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
|
||||
+ endif
|
||||
+ ifeq ($(shell test -f /usr/lib/rpm/redhat/redhat-annobin-cc1 && echo 1),1)
|
||||
+ OPTFLAGS += -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
|
||||
+ endif
|
||||
+else
|
||||
+ OPTFLAGS := $(RPM_OPT_FLAGS) --param=ssp-buffer-size=4
|
||||
+endif
|
||||
|
||||
# Set WARN_ONLY=1 to avoid compilation erroring out due to warnings. Useful during development.
|
||||
WARN_ONLY :=
|
||||
ERROR := $(if $(WARN_ONLY),,error=)
|
||||
WERROR := $(if $(WARN_ONLY),,-Werror)
|
||||
-WARNFLAGS := $(WERROR) -Wall -Wextra -Wformat=2 $(WFORMATOVERFLOW) -W$(ERROR)implicit-int \
|
||||
+WARNFLAGS := $(WERROR) -Wextra -Wformat=2 $(WFORMATOVERFLOW) -W$(ERROR)implicit-int \
|
||||
-W$(ERROR)implicit-function-declaration -W$(ERROR)format-security \
|
||||
- $(WNOCLOBBERED) -W$(ERROR)cast-qual $(ERROR_DISCARDED_QUALIFIERS) $(W_URCU_TYPE_LIMITS)
|
||||
+ $(WNOCLOBBERED) -W$(ERROR)cast-qual $(ERROR_DISCARDED_QUALIFIERS) $(W_URCU_TYPE_LIMITS) -Wstrict-prototypes
|
||||
|
||||
-CPPFLAGS := $(FORTIFY_OPT) $(CPPFLAGS) $(D_URCU_VERSION) \
|
||||
+CPPFLAGS := $(CPPFLAGS) $(D_URCU_VERSION) \
|
||||
-D_FILE_OFFSET_BITS=64 \
|
||||
-DBIN_DIR=\"$(bindir)\" -DMULTIPATH_DIR=\"$(TGTDIR)$(plugindir)\" \
|
||||
-DRUNTIME_DIR=\"$(runtimedir)\" -DCONFIG_DIR=\"$(TGTDIR)$(configdir)\" \
|
||||
@@ -121,12 +133,11 @@ CPPFLAGS := $(FORTIFY_OPT) $(CPPFLAGS) $(D_URCU_VERSION) \
|
||||
-DABSTRACT_SOCKET=\"$(abstract_socket)\" -DPATHNAME_SOCKET=\"$(pathname_socket)\" \
|
||||
-DWSTRINGOP_TRUNCATION=$(if $(WSTRINGOP_TRUNCATION),1,0) \
|
||||
-MMD -MP
|
||||
-CFLAGS := -std=$(C_STD) $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe \
|
||||
- -fexceptions
|
||||
+CFLAGS := -std=$(C_STD) $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe
|
||||
BIN_CFLAGS := -fPIE -DPIE
|
||||
LIB_CFLAGS := -fPIC
|
||||
SHARED_FLAGS := -shared
|
||||
-LDFLAGS := $(LDFLAGS) -Wl,-z,relro -Wl,-z,now -Wl,-z,defs
|
||||
+LDFLAGS := $(LDFLAGS) $(RPM_LD_FLAGS) -Wl,-z,relro -Wl,-z,now -Wl,-z,defs
|
||||
BIN_LDFLAGS := -pie
|
||||
|
||||
# Source code directories. Don't modify.
|
||||
|
|
@ -1,222 +0,0 @@
|
|||
---
|
||||
libmultipath/config.c | 1 +
|
||||
libmultipath/config.h | 1 +
|
||||
libmultipath/configure.c | 11 +++++++++++
|
||||
libmultipath/defaults.h | 1 +
|
||||
libmultipath/dict.c | 34 ++++++++++++++++++++++++++++++++++
|
||||
libmultipath/wwids.c | 26 ++++++++++++++++++++++++++
|
||||
libmultipath/wwids.h | 1 +
|
||||
multipath/main.c | 2 +-
|
||||
multipathd/main.c | 6 ++++++
|
||||
9 files changed, 82 insertions(+), 1 deletion(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/config.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/config.c
|
||||
+++ multipath-tools-130222/libmultipath/config.c
|
||||
@@ -547,6 +547,7 @@ load_config (char * file)
|
||||
conf->reassign_maps = DEFAULT_REASSIGN_MAPS;
|
||||
conf->checkint = DEFAULT_CHECKINT;
|
||||
conf->max_checkint = MAX_CHECKINT(conf->checkint);
|
||||
+ conf->find_multipaths = DEFAULT_FIND_MULTIPATHS;
|
||||
conf->fast_io_fail = DEFAULT_FAST_IO_FAIL;
|
||||
conf->retain_hwhandler = DEFAULT_RETAIN_HWHANDLER;
|
||||
conf->detect_prio = DEFAULT_DETECT_PRIO;
|
||||
Index: multipath-tools-130222/libmultipath/configure.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/configure.c
|
||||
+++ multipath-tools-130222/libmultipath/configure.c
|
||||
@@ -508,6 +508,10 @@ coalesce_paths (struct vectors * vecs, v
|
||||
|
||||
memset(empty_buff, 0, WWID_SIZE);
|
||||
|
||||
+ /* ignore refwwid if it's empty */
|
||||
+ if (refwwid && !strlen(refwwid))
|
||||
+ refwwid = NULL;
|
||||
+
|
||||
if (force_reload) {
|
||||
vector_foreach_slot (pathvec, pp1, k) {
|
||||
pp1->mpp = NULL;
|
||||
@@ -537,6 +541,13 @@ coalesce_paths (struct vectors * vecs, v
|
||||
if (refwwid && strncmp(pp1->wwid, refwwid, WWID_SIZE))
|
||||
continue;
|
||||
|
||||
+ /* If find_multipaths was selected check if the path is valid */
|
||||
+ if (conf->find_multipaths && !refwwid &&
|
||||
+ !should_multipath(pp1, pathvec)) {
|
||||
+ orphan_path(pp1);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* at this point, we know we really got a new mp
|
||||
*/
|
||||
Index: multipath-tools-130222/libmultipath/defaults.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/defaults.h
|
||||
+++ multipath-tools-130222/libmultipath/defaults.h
|
||||
@@ -15,6 +15,7 @@
|
||||
#define DEFAULT_USER_FRIENDLY_NAMES 0
|
||||
#define DEFAULT_VERBOSITY 2
|
||||
#define DEFAULT_REASSIGN_MAPS 1
|
||||
+#define DEFAULT_FIND_MULTIPATHS 0
|
||||
#define DEFAULT_FAST_IO_FAIL 5
|
||||
#define DEFAULT_RETAIN_HWHANDLER RETAIN_HWHANDLER_OFF
|
||||
#define DEFAULT_DETECT_PRIO DETECT_PRIO_OFF
|
||||
Index: multipath-tools-130222/libmultipath/dict.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/dict.c
|
||||
+++ multipath-tools-130222/libmultipath/dict.c
|
||||
@@ -585,6 +585,27 @@ def_reservation_key_handler(vector strve
|
||||
}
|
||||
|
||||
static int
|
||||
+def_find_multipaths_handler(vector strvec)
|
||||
+{
|
||||
+ char * buff;
|
||||
+
|
||||
+ buff = set_value(strvec);
|
||||
+
|
||||
+ if (!buff)
|
||||
+ return 1;
|
||||
+
|
||||
+ if ((strlen(buff) == 2 && !strcmp(buff, "no")) ||
|
||||
+ (strlen(buff) == 1 && !strcmp(buff, "0")))
|
||||
+ conf->find_multipaths = 0;
|
||||
+ else if ((strlen(buff) == 3 && !strcmp(buff, "yes")) ||
|
||||
+ (strlen(buff) == 1 && !strcmp(buff, "1")))
|
||||
+ conf->find_multipaths = 1;
|
||||
+
|
||||
+ FREE(buff);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
def_names_handler(vector strvec)
|
||||
{
|
||||
char * buff;
|
||||
@@ -2700,6 +2721,18 @@ snprint_def_log_checker_err (char * buff
|
||||
}
|
||||
|
||||
static int
|
||||
+snprint_def_find_multipaths (char * buff, int len, void * data)
|
||||
+{
|
||||
+ if (conf->find_multipaths == DEFAULT_FIND_MULTIPATHS)
|
||||
+ return 0;
|
||||
+ if (!conf->find_multipaths)
|
||||
+ return snprintf(buff, len, "no");
|
||||
+
|
||||
+ return snprintf(buff, len, "yes");
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int
|
||||
snprint_def_user_friendly_names (char * buff, int len, void * data)
|
||||
{
|
||||
if (conf->user_friendly_names == USER_FRIENDLY_NAMES_ON)
|
||||
@@ -2833,6 +2866,7 @@ init_keywords(void)
|
||||
install_keyword("wwids_file", &wwids_file_handler, &snprint_def_wwids_file);
|
||||
install_keyword("log_checker_err", &def_log_checker_err_handler, &snprint_def_log_checker_err);
|
||||
install_keyword("reservation_key", &def_reservation_key_handler, &snprint_def_reservation_key);
|
||||
+ install_keyword("find_multipaths", &def_find_multipaths_handler, &snprint_def_find_multipaths);
|
||||
install_keyword("retain_attached_hw_handler", &def_retain_hwhandler_handler, &snprint_def_retain_hwhandler_handler);
|
||||
install_keyword("detect_prio", &def_detect_prio_handler, &snprint_def_detect_prio);
|
||||
__deprecated install_keyword("default_selector", &def_selector_handler, NULL);
|
||||
Index: multipath-tools-130222/libmultipath/wwids.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/wwids.c
|
||||
+++ multipath-tools-130222/libmultipath/wwids.c
|
||||
@@ -125,6 +125,32 @@ out:
|
||||
}
|
||||
|
||||
int
|
||||
+should_multipath(struct path *pp1, vector pathvec)
|
||||
+{
|
||||
+ int i;
|
||||
+ struct path *pp2;
|
||||
+
|
||||
+ condlog(4, "checking if %s should be multipathed", pp1->dev);
|
||||
+ vector_foreach_slot(pathvec, pp2, i) {
|
||||
+ if (pp1->dev == pp2->dev)
|
||||
+ continue;
|
||||
+ if (strncmp(pp1->wwid, pp2->wwid, WWID_SIZE) == 0) {
|
||||
+ condlog(3, "found multiple paths with wwid %s, "
|
||||
+ "multipathing %s", pp1->wwid, pp1->dev);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ }
|
||||
+ if (check_wwids_file(pp1->wwid, 0) < 0) {
|
||||
+ condlog(3, "wwid %s not in wwids file, skipping %s",
|
||||
+ pp1->wwid, pp1->dev);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ condlog(3, "found wwid %s in wwids file, multipathing %s", pp1->wwid,
|
||||
+ pp1->dev);
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
remember_wwid(char *wwid)
|
||||
{
|
||||
int ret = check_wwids_file(wwid, 1);
|
||||
Index: multipath-tools-130222/libmultipath/wwids.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/wwids.h
|
||||
+++ multipath-tools-130222/libmultipath/wwids.h
|
||||
@@ -12,6 +12,7 @@
|
||||
"#\n" \
|
||||
"# Valid WWIDs:\n"
|
||||
|
||||
+int should_multipath(struct path *pp, vector pathvec);
|
||||
int remember_wwid(char *wwid);
|
||||
int check_wwids_file(char *wwid, int write_wwid);
|
||||
|
||||
Index: multipath-tools-130222/multipath/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/main.c
|
||||
+++ multipath-tools-130222/multipath/main.c
|
||||
@@ -333,7 +333,7 @@ configure (void)
|
||||
/*
|
||||
* core logic entry point
|
||||
*/
|
||||
- r = coalesce_paths(&vecs, NULL, NULL, conf->force_reload);
|
||||
+ r = coalesce_paths(&vecs, NULL, refwwid, conf->force_reload);
|
||||
|
||||
out:
|
||||
if (refwwid)
|
||||
Index: multipath-tools-130222/multipathd/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/main.c
|
||||
+++ multipath-tools-130222/multipathd/main.c
|
||||
@@ -49,6 +49,7 @@
|
||||
#include <print.h>
|
||||
#include <configure.h>
|
||||
#include <prio.h>
|
||||
+#include <wwids.h>
|
||||
#include <pgpolicies.h>
|
||||
#include <uevent.h>
|
||||
|
||||
@@ -471,6 +472,11 @@ rescan:
|
||||
return 1;
|
||||
}
|
||||
|
||||
+ if (conf->find_multipaths &&
|
||||
+ !should_multipath(pp, vecs->pathvec)) {
|
||||
+ orphan_path(pp);
|
||||
+ return 0;
|
||||
+ }
|
||||
condlog(4,"%s: creating new map", pp->dev);
|
||||
if ((mpp = add_map_with_path(vecs, pp, 1))) {
|
||||
mpp->action = ACT_CREATE;
|
||||
Index: multipath-tools-130222/libmultipath/config.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/config.h
|
||||
+++ multipath-tools-130222/libmultipath/config.h
|
||||
@@ -106,6 +106,7 @@ struct config {
|
||||
unsigned int dev_loss;
|
||||
int log_checker_err;
|
||||
int allow_queueing;
|
||||
+ int find_multipaths;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
mode_t mode;
|
||||
917
0006-RH-add-mpathconf.patch
Normal file
917
0006-RH-add-mpathconf.patch
Normal file
|
|
@ -0,0 +1,917 @@
|
|||
From 29e5c6d6e2177e73d1be2ed2af66c1007487bf60 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Thu, 16 Oct 2014 15:49:01 -0500
|
||||
Subject: [PATCH] RH: add mpathconf
|
||||
|
||||
mpathconf is a program (largely based on lvmcomf) to help users
|
||||
configure /etc/multipath.conf and enable or disable multipathing. It
|
||||
has a couple of built-in options that can be set directly from the
|
||||
command line. But, mostly it is used to get a multipath.conf file
|
||||
with the OS defaults, and to enable and disable multipathing via
|
||||
a single command.
|
||||
|
||||
Co-authored-by: Paul Donohue <git@PaulSD.com>
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
.github/actions/spelling/expect.txt | 3 +
|
||||
libmultipath/config.c | 2 +
|
||||
multipath/Makefile | 4 +
|
||||
multipath/mpathconf | 658 ++++++++++++++++++++++++++++
|
||||
multipath/mpathconf.8 | 151 +++++++
|
||||
5 files changed, 818 insertions(+)
|
||||
create mode 100644 multipath/mpathconf
|
||||
create mode 100644 multipath/mpathconf.8
|
||||
|
||||
diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt
|
||||
index a5856bcc..5c9113ba 100644
|
||||
--- a/.github/actions/spelling/expect.txt
|
||||
+++ b/.github/actions/spelling/expect.txt
|
||||
@@ -131,9 +131,11 @@ Marzinski
|
||||
misdetection
|
||||
mpath
|
||||
mpathb
|
||||
+mpathconf
|
||||
mpathpersist
|
||||
mpathvalid
|
||||
msecs
|
||||
+multipathable
|
||||
multipathc
|
||||
multipathd
|
||||
multipathed
|
||||
@@ -154,6 +156,7 @@ ontap
|
||||
OOM
|
||||
opensvc
|
||||
OPTFLAGS
|
||||
+outfile
|
||||
paramp
|
||||
partx
|
||||
pathgroup
|
||||
diff --git a/libmultipath/config.c b/libmultipath/config.c
|
||||
index b8317f4d..0bbaa981 100644
|
||||
--- a/libmultipath/config.c
|
||||
+++ b/libmultipath/config.c
|
||||
@@ -939,6 +939,8 @@ int init_config__ (const char *file, struct config *conf)
|
||||
validate_pctable(conf->overrides, 0, file);
|
||||
} else {
|
||||
condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices.");
|
||||
+ condlog(0, "You can run \"/sbin/mpathconf --enable\" to create");
|
||||
+ condlog(0, "/etc/multipath.conf. See man mpathconf(8) for more details");
|
||||
if (conf->blist_devnode == NULL) {
|
||||
conf->blist_devnode = vector_alloc();
|
||||
if (!conf->blist_devnode) {
|
||||
diff --git a/multipath/Makefile b/multipath/Makefile
|
||||
index 2ea9e528..3dc241cc 100644
|
||||
--- a/multipath/Makefile
|
||||
+++ b/multipath/Makefile
|
||||
@@ -24,6 +24,7 @@ $(EXEC): $(OBJS) $(multipathdir)/libmultipath.so $(mpathcmddir)/libmpathcmd.so
|
||||
install:
|
||||
$(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
|
||||
$(Q)$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
|
||||
+ $(Q)$(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/
|
||||
$(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(udevrulesdir)
|
||||
$(Q)$(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir)
|
||||
$(Q)$(INSTALL_PROGRAM) -m 644 99-z-dm-mpath-late.rules $(DESTDIR)$(udevrulesdir)
|
||||
@@ -32,6 +33,7 @@ install:
|
||||
$(Q)$(INSTALL_PROGRAM) -m 644 tmpfiles.conf $(DESTDIR)$(tmpfilesdir)/multipath.conf
|
||||
$(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man8
|
||||
$(Q)$(INSTALL_PROGRAM) -m 644 $(EXEC).8 $(DESTDIR)$(mandir)/man8
|
||||
+ $(Q)$(INSTALL_PROGRAM) -m 644 mpathconf.8 $(DESTDIR)$(mandir)/man8
|
||||
$(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)/man5
|
||||
$(Q)$(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5 $(DESTDIR)$(mandir)/man5
|
||||
$(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(modulesloaddir)
|
||||
@@ -46,12 +48,14 @@ endif
|
||||
|
||||
uninstall:
|
||||
$(Q)$(RM) $(DESTDIR)$(bindir)/$(EXEC)
|
||||
+ $(Q)$(RM) $(DESTDIR)$(bindir)/mpathconf
|
||||
$(Q)$(RM) $(DESTDIR)$(udevrulesdir)/11-dm-mpath.rules
|
||||
$(Q)$(RM) $(DESTDIR)$(udevrulesdir)/99-z-dm-mpath-late.rules
|
||||
$(Q)$(RM) $(DESTDIR)$(modulesloaddir)/multipath.conf
|
||||
$(Q)$(RM) $(DESTDIR)$(modulesloaddir)/scsi_dh.conf
|
||||
$(Q)$(RM) $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules
|
||||
$(Q)$(RM) $(DESTDIR)$(mandir)/man8/$(EXEC).8
|
||||
+ $(Q)$(RM) $(DESTDIR)$(mandir)/man8/mpathconf.8
|
||||
$(Q)$(RM) $(DESTDIR)$(mandir)/man5/$(EXEC).conf.5
|
||||
$(Q)$(RM) $(DESTDIR)$(tmpfilesdir)/multipath.conf
|
||||
|
||||
diff --git a/multipath/mpathconf b/multipath/mpathconf
|
||||
new file mode 100644
|
||||
index 00000000..ce430075
|
||||
--- /dev/null
|
||||
+++ b/multipath/mpathconf
|
||||
@@ -0,0 +1,658 @@
|
||||
+#!/bin/bash
|
||||
+#
|
||||
+# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
|
||||
+#
|
||||
+# This file is part of the device-mapper-multipath package.
|
||||
+#
|
||||
+# This copyrighted material is made available to anyone wishing to use,
|
||||
+# modify, copy, or redistribute it subject to the terms and conditions
|
||||
+# of the GNU General Public License v.2.
|
||||
+#
|
||||
+# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
+
|
||||
+#
|
||||
+# Simple editting of /etc/multipath.conf
|
||||
+# This program was largely ripped off from lvmconf
|
||||
+#
|
||||
+
|
||||
+unset ENABLE FIND FRIENDLY PROPERTY FOREIGN MODULE MULTIPATHD HAVE_DISABLE HAVE_WWID_DISABLE HAVE_FIND HAVE_BLACKLIST HAVE_EXCEPTIONS HAVE_DEFAULTS HAVE_FRIENDLY HAVE_PROPERTY HAVE_FOREIGN HAVE_MULTIPATHD HAVE_MODULE HAVE_OUTFILE SHOW_STATUS CHANGED_CONFIG WWID_LIST HAVE_OPTION OPTION_NAME OPTION_VALUE HAVE_RECHECK_WWID RECHECK_WWID
|
||||
+
|
||||
+DEFAULT_CONFIG="# device-mapper-multipath configuration file
|
||||
+
|
||||
+# For a complete list of the default configuration values, run either:
|
||||
+# # multipath -t
|
||||
+# or
|
||||
+# # multipathd show config
|
||||
+
|
||||
+# For a list of configuration options with descriptions, see the
|
||||
+# multipath.conf man page.
|
||||
+
|
||||
+defaults {
|
||||
+ user_friendly_names yes
|
||||
+ find_multipaths on
|
||||
+}"
|
||||
+
|
||||
+CONFIGFILE="/etc/multipath.conf"
|
||||
+OUTPUTFILE="/etc/multipath.conf"
|
||||
+MULTIPATHDIR="/etc/multipath"
|
||||
+TMPFILE="/etc/multipath/.multipath.conf.tmp"
|
||||
+WWIDS=0
|
||||
+
|
||||
+function usage
|
||||
+{
|
||||
+ echo "usage: $0 <command>"
|
||||
+ echo ""
|
||||
+ echo "Commands:"
|
||||
+ echo "Enable: --enable "
|
||||
+ echo "Disable: --disable"
|
||||
+ echo "Only allow certain wwids (instead of enable): --allow <WWID>"
|
||||
+ echo "Set user_friendly_names (Default y): --user_friendly_names <y|n>"
|
||||
+ echo "Set find_multipaths (Default on): --find_multipaths <on|yes|y|off|no|n|strict|greedy|smart>"
|
||||
+ echo "Set default property blacklist (Default n): --property_blacklist <y|n>"
|
||||
+ echo "Set enable_foreign to show foreign devices (Default n): --enable_foreign <y|n>"
|
||||
+ echo "Set recheck_wwid (Defaut n): --recheck_wwid <y|n>"
|
||||
+ echo "Add/Change/Remove option in defaults section: --option <option_name>:<value>"
|
||||
+ echo "Load the dm-multipath modules on enable (Default y): --with_module <y|n>"
|
||||
+ echo "start/stop/reload multipathd (Default n): --with_multipathd <y|n>"
|
||||
+ echo "select output file (Default /etc/multipath.conf): --outfile <FILE>"
|
||||
+ echo ""
|
||||
+}
|
||||
+
|
||||
+function add_wwid
|
||||
+{
|
||||
+ INDEX=0
|
||||
+ while [ "$INDEX" -lt "$WWIDS" ] ; do
|
||||
+ if [ "$1" = "${WWID_LIST[$INDEX]}" ] ; then
|
||||
+ return
|
||||
+ fi
|
||||
+ ((INDEX++))
|
||||
+ done
|
||||
+ WWID_LIST[$WWIDS]="$1"
|
||||
+ ((WWIDS++))
|
||||
+}
|
||||
+
|
||||
+function get_dm_deps
|
||||
+{
|
||||
+ shift 3
|
||||
+ while [ -n "$1" -a -n "$2" ]; do
|
||||
+ MAJOR=$(echo $1 | tr -d '(,')
|
||||
+ MINOR=$(echo $2 | tr -d ')')
|
||||
+ UUID=`dmsetup info -c --noheadings -o uuid -j $MAJOR -m $MINOR 2> /dev/null`
|
||||
+ if [ -n "$UUID" ] ; then
|
||||
+ set_dm_wwid $UUID
|
||||
+ fi
|
||||
+ shift 2
|
||||
+ done
|
||||
+}
|
||||
+
|
||||
+function set_dm_wwid
|
||||
+{
|
||||
+ if [[ "$1" =~ ^part[[:digit:]]+-mpath- ]] ; then
|
||||
+ add_wwid "${1##part*-mpath-}"
|
||||
+ elif [[ "$1" =~ ^mpath- ]] ; then
|
||||
+ add_wwid "${1##mpath-}"
|
||||
+ else
|
||||
+ get_dm_deps `dmsetup deps -u $1`
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+function set_wwid
|
||||
+{
|
||||
+ UUID=""
|
||||
+ if [[ "$1" =~ ^[[:digit:]]+:[[:digit:]]+$ ]] ; then
|
||||
+ MAJOR=${1%%:*}
|
||||
+ MINOR=${1##*:}
|
||||
+ UUID=`dmsetup info -c --noheadings -o uuid -j $MAJOR -m $MINOR 2> /dev/null`
|
||||
+ else
|
||||
+ UUID=`dmsetup info -c --noheadings -o uuid $1 2> /dev/null`
|
||||
+ fi
|
||||
+ if [ -n "$UUID" ] ; then
|
||||
+ set_dm_wwid $UUID
|
||||
+ else
|
||||
+ add_wwid "$1"
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+function parse_args
|
||||
+{
|
||||
+ while [ -n "$1" ]; do
|
||||
+ case $1 in
|
||||
+ --enable)
|
||||
+ ENABLE=1
|
||||
+ shift
|
||||
+ ;;
|
||||
+ --disable)
|
||||
+ ENABLE=0
|
||||
+ shift
|
||||
+ ;;
|
||||
+ --allow)
|
||||
+ ENABLE=2
|
||||
+ if [ -n "$2" ]; then
|
||||
+ set_wwid $2
|
||||
+ shift 2
|
||||
+ else
|
||||
+ usage
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ ;;
|
||||
+ --user_friendly_names)
|
||||
+ if [ -n "$2" ]; then
|
||||
+ FRIENDLY=$2
|
||||
+ shift 2
|
||||
+ else
|
||||
+ usage
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ ;;
|
||||
+ --recheck_wwid)
|
||||
+ if [ -n "$2" ]; then
|
||||
+ RECHECK_WWID=$2
|
||||
+ shift 2
|
||||
+ else
|
||||
+ usage
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ ;;
|
||||
+ --find_multipaths)
|
||||
+ if [ -n "$2" ]; then
|
||||
+ FIND=$2
|
||||
+ shift 2
|
||||
+ else
|
||||
+ usage
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ ;;
|
||||
+ --property_blacklist)
|
||||
+ if [ -n "$2" ]; then
|
||||
+ PROPERTY=$2
|
||||
+ shift 2
|
||||
+ else
|
||||
+ usage
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ ;;
|
||||
+ --option)
|
||||
+ if [ -n "$2" ]; then
|
||||
+ OPTION_NAME=$(echo $2 | cut -s -f1 -d:)
|
||||
+ OPTION_VALUE=$(echo $2 | cut -s -f2 -d:)
|
||||
+ if [ -z "$OPTION_NAME" ]; then
|
||||
+ usage
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ shift 2
|
||||
+ else
|
||||
+ usage
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ ;;
|
||||
+ --enable_foreign)
|
||||
+ if [ -n "$2" ]; then
|
||||
+ FOREIGN=$2
|
||||
+ shift 2
|
||||
+ else
|
||||
+ usage
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ ;;
|
||||
+ --with_module)
|
||||
+ if [ -n "$2" ]; then
|
||||
+ MODULE=$2
|
||||
+ shift 2
|
||||
+ else
|
||||
+ usage
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ ;;
|
||||
+ --with_multipathd)
|
||||
+ if [ -n "$2" ]; then
|
||||
+ MULTIPATHD=$2
|
||||
+ shift 2
|
||||
+ else
|
||||
+ usage
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ ;;
|
||||
+ --outfile)
|
||||
+ if [ -n "$2" ]; then
|
||||
+ OUTPUTFILE=$2
|
||||
+ HAVE_OUTFILE=1
|
||||
+ shift 2
|
||||
+ else
|
||||
+ usage
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ ;;
|
||||
+ *)
|
||||
+ usage
|
||||
+ exit
|
||||
+ esac
|
||||
+ done
|
||||
+}
|
||||
+
|
||||
+function validate_args
|
||||
+{
|
||||
+ if [ "$ENABLE" = "0" ] && [ -n "$FRIENDLY" -o -n "$FIND" -o -n "$PROPERTY" -o -n "$MODULE" -o -n "$FOREIGN" -o -n "$OPTION_NAME" -o -n "$RECHECK_WWID" ]; then
|
||||
+ echo "ignoring extra parameters on disable"
|
||||
+ FRIENDLY=""
|
||||
+ FIND=""
|
||||
+ PROPERTY=""
|
||||
+ MODULE=""
|
||||
+ FOREIGN=""
|
||||
+ OPTION_NAME=""
|
||||
+ OPTION_VALUE=""
|
||||
+ RECHECK_WWID=""
|
||||
+ fi
|
||||
+ if [ -n "$FRIENDLY" ] && [ "$FRIENDLY" != "y" -a "$FRIENDLY" != "n" ]; then
|
||||
+ echo "--user_friendly_names must be either 'y' or 'n'"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ if [ -n "$RECHECK_WWID" ] && [ "$RECHECK_WWID" != "y" -a "$RECHECK_WWID" != "n" ]; then
|
||||
+ echo "--recheck_wwid must be either 'y' or 'n'"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ if [ "$FIND" = "y" ]; then
|
||||
+ FIND="on"
|
||||
+ elif [ "$FIND" = "n" ]; then
|
||||
+ FIND="off"
|
||||
+ elif [ -n "$FIND" ] && [ "$FIND" != "on" -a "$FIND" != "yes" -a "$FIND" != "off" -a "$FIND" != "no" -a "$FIND" != "strict" -a "$FIND" != "greedy" -a "$FIND" != "smart" ]; then
|
||||
+ echo "--find_multipaths must be one of 'on' 'yes' 'y' 'off' 'no' 'n' 'strict' 'greedy' or 'smart'"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ if [ -n "$PROPERTY" ] && [ "$PROPERTY" != "y" -a "$PROPERTY" != "n" ]; then
|
||||
+ echo "--property_blacklist must be either 'y' or 'n'"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ if [ -n "$FOREIGN" ] && [ "$FOREIGN" != "y" -a "$FOREIGN" != "n" ]; then
|
||||
+ echo "--enable_foreign must be either 'y' or 'n'"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ if [ -n "$OPTION_NAME" ]; then
|
||||
+ if [[ $OPTION_NAME =~ [[:space:]]|#|\"|!|\{|\} ]]; then
|
||||
+ echo "--option name \"$OPTION_NAME\" is invalid"
|
||||
+ exit 1
|
||||
+ elif [[ $OPTION_VALUE =~ \"|#|!|\{|\} ]]; then
|
||||
+ echo "--option value \"$OPTION_VALUE\" is invalid"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ if [[ $OPTION_VALUE =~ [[:space:]] ]]; then
|
||||
+ OPTION_VALUE=\"$OPTION_VALUE\"
|
||||
+ fi
|
||||
+ fi
|
||||
+ if [ -z "$ENABLE" -a -z "$FIND" -a -z "$FRIENDLY" -a -z "$PROPERTY" -a -z "$FOREIGN" -a -z "$OPTION_NAME" -a -z "$RECHECK_WWID" ]; then
|
||||
+ SHOW_STATUS=1
|
||||
+ fi
|
||||
+ if [ -n "$MODULE" ] && [ "$MODULE" != "y" -a "$MODULE" != "n" ]; then
|
||||
+ echo "--with_module must be either 'y' or 'n'"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ if [ -n "$MULTIPATHD" ] && [ "$MULTIPATHD" != "y" -a "$MULTIPATHD" != "n" ]; then
|
||||
+ echo "--with_multipathd must be either 'y' or 'n'"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ if [ "$ENABLE" = 2 -a -z "$HAVE_OUTFILE" ]; then
|
||||
+ echo "Because --allow makes changes that cannot be automatically reversed,"
|
||||
+ echo "you must set --outfile when you set --allow"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+function add_blacklist_exceptions
|
||||
+{
|
||||
+ INDEX=0
|
||||
+ while [ "$INDEX" -lt "$WWIDS" ] ; do
|
||||
+ sed -i '/^blacklist_exceptions[[:space:]]*{/ a\
|
||||
+ wwid '"\"${WWID_LIST[$INDEX]}\""'
|
||||
+' $TMPFILE
|
||||
+ ((INDEX++))
|
||||
+ done
|
||||
+}
|
||||
+
|
||||
+umask 0077
|
||||
+
|
||||
+parse_args "$@"
|
||||
+
|
||||
+validate_args
|
||||
+
|
||||
+if [ ! -d "$MULTIPATHDIR" ]; then
|
||||
+ echo "/etc/multipath/ does not exist. failing"
|
||||
+ exit 1
|
||||
+fi
|
||||
+
|
||||
+rm $TMPFILE 2> /dev/null
|
||||
+echo "$DEFAULT_CONFIG" > $TMPFILE
|
||||
+if [ -f "$CONFIGFILE" ]; then
|
||||
+ cp $CONFIGFILE $TMPFILE
|
||||
+fi
|
||||
+
|
||||
+if grep -q "^blacklist[[:space:]]*{" $TMPFILE ; then
|
||||
+ HAVE_BLACKLIST=1
|
||||
+fi
|
||||
+
|
||||
+if grep -q "^blacklist_exceptions[[:space:]]*{" $TMPFILE ; then
|
||||
+ HAVE_EXCEPTIONS=1
|
||||
+fi
|
||||
+
|
||||
+if grep -q "^defaults[[:space:]]*{" $TMPFILE ; then
|
||||
+ HAVE_DEFAULTS=1
|
||||
+fi
|
||||
+
|
||||
+if [ -z "$MODULE" -o "$MODULE" = "y" ]; then
|
||||
+ if lsmod | grep -q "dm_multipath" ; then
|
||||
+ HAVE_MODULE=1
|
||||
+ else
|
||||
+ HAVE_MODULE=0
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+if [ "$MULTIPATHD" = "y" ]; then
|
||||
+ if /bin/systemctl status multipathd.service > /dev/null 2>&1 ; then
|
||||
+ HAVE_MULTIPATHD=1
|
||||
+ else
|
||||
+ HAVE_MULTIPATHD=0
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+if [ "$HAVE_BLACKLIST" = "1" ]; then
|
||||
+ if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*devnode[[:space:]][[:space:]]*\"\.\?\*\"" ; then
|
||||
+ HAVE_DISABLE=1
|
||||
+ elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*devnode[[:space:]][[:space:]]*\"\.\?\*\"" ; then
|
||||
+ HAVE_DISABLE=0
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+if [ "$HAVE_BLACKLIST" = "1" ]; then
|
||||
+ if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*wwid[[:space:]][[:space:]]*\"\.\?\*\"" ; then
|
||||
+ HAVE_WWID_DISABLE=1
|
||||
+ elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*wwid[[:space:]][[:space:]]*\"\.\?\*\"" ; then
|
||||
+ HAVE_WWID_DISABLE=0
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+if [ "$HAVE_DEFAULTS" = "1" ]; then
|
||||
+ HAVE_FIND=`sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | sed -n 's/^[[:blank:]]*find_multipaths[[:blank:]][[:blank:]]*\([^[:blank:]]*\).*$/\1/p' | sed -n 1p`
|
||||
+ if [ "$HAVE_FIND" = "1" ]; then
|
||||
+ HAVE_FIND="yes"
|
||||
+ elif [ "$HAVE_FIND" = "0" ]; then
|
||||
+ HAVE_FIND="no"
|
||||
+ fi
|
||||
+ if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]][[:space:]]*\(yes\|1\)" ; then
|
||||
+ HAVE_FRIENDLY=1
|
||||
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]][[:space:]]*\(no\|0\)" ; then
|
||||
+ HAVE_FRIENDLY=0
|
||||
+ fi
|
||||
+ if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*recheck_wwid[[:space:]][[:space:]]*\(yes\|1\)" ; then
|
||||
+ HAVE_RECHECK_WWID=1
|
||||
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*recheck_wwid[[:space:]][[:space:]]*\(no\|0\)" ; then
|
||||
+ HAVE_RECHECK_WWID=0
|
||||
+ fi
|
||||
+ if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*enable_foreign" ; then
|
||||
+ HAVE_FOREIGN=0
|
||||
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*enable_foreign[[:space:]][[:space:]]*\"\.\*\"" ; then
|
||||
+ HAVE_FOREIGN=1
|
||||
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*enable_foreign[[:space:]][[:space:]]*\"\^\$\"" ; then
|
||||
+ HAVE_FOREIGN=2
|
||||
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*enable_foreign[[:space:]][[:space:]]*\"NONE\"" ; then
|
||||
+ HAVE_FOREIGN=2
|
||||
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*enable_foreign" ; then
|
||||
+ HAVE_FOREIGN=3
|
||||
+ fi
|
||||
+ if [ -n "$OPTION_NAME" ]; then
|
||||
+ if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q '^[[:space:]]*'"$OPTION_NAME"'[[:space:]][[:space:]]*'"$OPTION_VALUE" ; then
|
||||
+ HAVE_OPTION=1
|
||||
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q '^[[:space:]]*'"$OPTION_NAME"'\([[:space:]].*\)\?$' ; then
|
||||
+ HAVE_OPTION=0
|
||||
+ fi
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+if [ "$HAVE_EXCEPTIONS" = "1" ]; then
|
||||
+ if sed -n '/^blacklist_exceptions[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*property[[:space:]][[:space:]]*\"(SCSI_IDENT_|ID_WWN)\"" ; then
|
||||
+ HAVE_PROPERTY=1
|
||||
+ elif sed -n '/^blacklist_exceptions[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*property[[:space:]][[:space:]]*\"(SCSI_IDENT_|ID_WWN)\"" ; then
|
||||
+ HAVE_PROPERTY=0
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+if [ -n "$SHOW_STATUS" ]; then
|
||||
+ if [ -z "$HAVE_DISABLE" -o "$HAVE_DISABLE" = 0 ]; then
|
||||
+ echo "multipath is enabled"
|
||||
+ else
|
||||
+ echo "multipath is disabled"
|
||||
+ fi
|
||||
+ if [ -z "$HAVE_FIND" ]; then
|
||||
+ echo "find_multipaths is off"
|
||||
+ else
|
||||
+ echo "find_multipaths is $HAVE_FIND"
|
||||
+ fi
|
||||
+ if [ -z "$HAVE_FRIENDLY" -o "$HAVE_FRIENDLY" = 0 ]; then
|
||||
+ echo "user_friendly_names is disabled"
|
||||
+ else
|
||||
+ echo "user_friendly_names is enabled"
|
||||
+ fi
|
||||
+ if [ -z "$HAVE_RECHECK_WWID" -o "$HAVE_RECHECK_WWID" = 0 ]; then
|
||||
+ echo "recheck_wwid is disabled"
|
||||
+ else
|
||||
+ echo "recheck_wwid is enabled"
|
||||
+ fi
|
||||
+ if [ -z "$HAVE_PROPERTY" -o "$HAVE_PROPERTY" = 0 ]; then
|
||||
+ echo "default property blacklist is disabled"
|
||||
+ else
|
||||
+ echo "default property blacklist is enabled"
|
||||
+ fi
|
||||
+ if [ -z "$HAVE_FOREIGN" -o "$HAVE_FOREIGN" = 0 ]; then
|
||||
+ echo "enable_foreign is not set (no foreign multipath devices will be shown)"
|
||||
+ elif [ "$HAVE_FOREIGN" = 1 ]; then
|
||||
+ echo "enable_foreign is set (all foreign multipath devices will be shown)"
|
||||
+ elif [ "$HAVE_FOREIGN" = 2 ]; then
|
||||
+ echo "enable_foreign is set (no foreign multipath devices will be shown)"
|
||||
+ else
|
||||
+ echo "enable_foreign is set (foreign multipath devices may not be shown)"
|
||||
+ fi
|
||||
+ if [ -n "$HAVE_MODULE" ]; then
|
||||
+ if [ "$HAVE_MODULE" = 1 ]; then
|
||||
+ echo "dm_multipath module is loaded"
|
||||
+ else
|
||||
+ echo "dm_multipath module is not loaded"
|
||||
+ fi
|
||||
+ fi
|
||||
+ if [ -z "$HAVE_MULTIPATHD" ]; then
|
||||
+ if /bin/systemctl status multipathd.service > /dev/null 2>&1 ; then
|
||||
+ HAVE_MULTIPATHD=1
|
||||
+ else
|
||||
+ HAVE_MULTIPATHD=0
|
||||
+ fi
|
||||
+ fi
|
||||
+ if [ "$HAVE_MULTIPATHD" = 1 ]; then
|
||||
+ echo "multipathd is running"
|
||||
+ else
|
||||
+ echo "multipathd is not running"
|
||||
+ fi
|
||||
+ exit 0
|
||||
+fi
|
||||
+
|
||||
+if [ -z "$HAVE_BLACKLIST" ]; then
|
||||
+ cat >> $TMPFILE <<- _EOF_
|
||||
+
|
||||
+blacklist {
|
||||
+}
|
||||
+_EOF_
|
||||
+fi
|
||||
+
|
||||
+if [ -z "$HAVE_DEFAULTS" ]; then
|
||||
+ cat >> $TMPFILE <<- _EOF_
|
||||
+
|
||||
+defaults {
|
||||
+}
|
||||
+_EOF_
|
||||
+fi
|
||||
+
|
||||
+if [ "$ENABLE" = 2 ]; then
|
||||
+ if [ "$HAVE_DISABLE" = 1 ]; then
|
||||
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*devnode[[:space:]][[:space:]]*\"\.\?\*\"/# devnode ".*"/' $TMPFILE
|
||||
+ fi
|
||||
+ if [ -z "$HAVE_WWID_DISABLE" ]; then
|
||||
+ sed -i '/^blacklist[[:space:]]*{/ a\
|
||||
+ wwid ".*"
|
||||
+' $TMPFILE
|
||||
+ elif [ "$HAVE_WWID_DISABLE" = 0 ]; then
|
||||
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*wwid[[:space:]][[:space:]]*\"\.\?\*\"/ wwid ".*"/' $TMPFILE
|
||||
+ fi
|
||||
+ if [ "$HAVE_EXCEPTIONS" = 1 ]; then
|
||||
+ sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/ {/^[[:space:]]*wwid/ d}' $TMPFILE
|
||||
+ else
|
||||
+ cat >> $TMPFILE <<- _EOF_
|
||||
+
|
||||
+blacklist_exceptions {
|
||||
+}
|
||||
+_EOF_
|
||||
+ fi
|
||||
+ add_blacklist_exceptions
|
||||
+elif [ "$ENABLE" = 1 ]; then
|
||||
+ if [ "$HAVE_DISABLE" = 1 ]; then
|
||||
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*devnode[[:space:]][[:space:]]*\"\.\?\*\"/# devnode ".*"/' $TMPFILE
|
||||
+ fi
|
||||
+elif [ "$ENABLE" = 0 ]; then
|
||||
+ if [ -z "$HAVE_DISABLE" ]; then
|
||||
+ sed -i '/^blacklist[[:space:]]*{/ a\
|
||||
+ devnode ".*"
|
||||
+' $TMPFILE
|
||||
+ elif [ "$HAVE_DISABLE" = 0 ]; then
|
||||
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*devnode[[:space:]][[:space:]]*\"\.\?\*\"/ devnode ".*"/' $TMPFILE
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+if [ -n "$FIND" ]; then
|
||||
+ if [ -z "$HAVE_FIND" ]; then
|
||||
+ sed -i '/^defaults[[:space:]]*{/ a\
|
||||
+ find_multipaths '"$FIND"'
|
||||
+' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+ elif [ "$FIND" != "$HAVE_FIND" ]; then
|
||||
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:blank:]]*find_multipaths[[:blank:]][[:blank:]]*[^[:blank:]]*/ find_multipaths '"$FIND"'/' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+if [ "$FRIENDLY" = "n" ]; then
|
||||
+ if [ "$HAVE_FRIENDLY" = 1 ]; then
|
||||
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]][[:space:]]*\(yes\|1\)/ user_friendly_names no/' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+ fi
|
||||
+elif [ "$FRIENDLY" = "y" ]; then
|
||||
+ if [ -z "$HAVE_FRIENDLY" ]; then
|
||||
+ sed -i '/^defaults[[:space:]]*{/ a\
|
||||
+ user_friendly_names yes
|
||||
+' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+ elif [ "$HAVE_FRIENDLY" = 0 ]; then
|
||||
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]][[:space:]]*\(no\|0\)/ user_friendly_names yes/' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+if [ "$RECHECK_WWID" = "n" ]; then
|
||||
+ if [ "$HAVE_RECHECK_WWID" = 1 ]; then
|
||||
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*recheck_wwid[[:space:]][[:space:]]*\(yes\|1\)/ recheck_wwid no/' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+ fi
|
||||
+elif [ "$RECHECK_WWID" = "y" ]; then
|
||||
+ if [ -z "$HAVE_RECHECK_WWID" ]; then
|
||||
+ sed -i '/^defaults[[:space:]]*{/ a\
|
||||
+ recheck_wwid yes
|
||||
+' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+ elif [ "$HAVE_RECHECK_WWID" = 0 ]; then
|
||||
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*recheck_wwid[[:space:]][[:space:]]*\(no\|0\)/ recheck_wwid yes/' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+if [ "$PROPERTY" = "n" ]; then
|
||||
+ if [ "$HAVE_PROPERTY" = 1 ]; then
|
||||
+ sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/ s/^[[:space:]]*property[[:space:]][[:space:]]*\"(SCSI_IDENT_|ID_WWN)\"/# property \"(SCSI_IDENT_|ID_WWN)\"/' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+ fi
|
||||
+elif [ "$PROPERTY" = "y" ]; then
|
||||
+ if [ -z "$HAVE_PROPERTY" -a -z "$HAVE_EXCEPTIONS" ]; then
|
||||
+ cat >> $TMPFILE << _EOF_
|
||||
+
|
||||
+blacklist_exceptions {
|
||||
+ property "(SCSI_IDENT_|ID_WWN)"
|
||||
+}
|
||||
+_EOF_
|
||||
+ CHANGED_CONFIG=1
|
||||
+ elif [ -z "$HAVE_PROPERTY" ]; then
|
||||
+ sed -i '/^blacklist_exceptions[[:space:]]*{/ a\
|
||||
+ property "(SCSI_IDENT_|ID_WWN)"
|
||||
+' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+ elif [ "$HAVE_PROPERTY" = 0 ]; then
|
||||
+ sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*property[[:space:]][[:space:]]*\"(SCSI_IDENT_|ID_WWN)\"/ property \"(SCSI_IDENT_|ID_WWN)\"/' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+if [ "$FOREIGN" = "n" ]; then
|
||||
+ if [ "$HAVE_FOREIGN" = 1 -o "$HAVE_FOREIGN" = 3 ]; then
|
||||
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*enable_foreign/# enable_foreign/' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+ fi
|
||||
+elif [ "$FOREIGN" = "y" ]; then
|
||||
+ if [ -z "$HAVE_FOREIGN" ]; then
|
||||
+ sed -i '/^defaults[[:space:]]*{/ a\
|
||||
+ enable_foreign ".*"
|
||||
+' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+ elif [ "$HAVE_FOREIGN" = 0 -o "$HAVE_FOREIGN" = 2 -o "$HAVE_FOREIGN" = 3 ]; then
|
||||
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*#\?[[:space:]]*enable_foreign.*$/ enable_foreign ".*"/' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+if [ -n "$OPTION_NAME" -a -n "$OPTION_VALUE" ]; then
|
||||
+ if [ -z "$HAVE_OPTION" ]; then
|
||||
+ sed -i '/^defaults[[:space:]]*{/ a\
|
||||
+ '"$OPTION_NAME"' '"$OPTION_VALUE"'
|
||||
+' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+ elif [ "$HAVE_OPTION" = 0 ]; then
|
||||
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*'"$OPTION_NAME"'\([[:space:]].*\)\?$/ '"$OPTION_NAME"' '"$OPTION_VALUE"'/' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+ fi
|
||||
+elif [ -n "$OPTION_NAME" -a -n "$HAVE_OPTION" ]; then
|
||||
+ sed -i '/^defaults[[:space:]]*{/,/^}/{/^[[:space:]]*'"$OPTION_NAME"'\([[:space:]].*\)\?$/d}' $TMPFILE
|
||||
+ CHANGED_CONFIG=1
|
||||
+fi
|
||||
+
|
||||
+if [ -f "$OUTPUTFILE" ]; then
|
||||
+ cp $OUTPUTFILE $OUTPUTFILE.old
|
||||
+ if [ $? != 0 ]; then
|
||||
+ echo "failed to backup old config file, $OUTPUTFILE not updated"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
+cp $TMPFILE $OUTPUTFILE
|
||||
+if [ $? != 0 ]; then
|
||||
+ echo "failed to copy new config file into place, check $OUTPUTFILE is still OK"
|
||||
+ exit 1
|
||||
+fi
|
||||
+
|
||||
+rm -f $TMPFILE
|
||||
+
|
||||
+if [ "$ENABLE" = 1 ]; then
|
||||
+ if [ "$HAVE_MODULE" = 0 ]; then
|
||||
+ modprobe dm_multipath
|
||||
+ fi
|
||||
+ if [ "$HAVE_MULTIPATHD" = 0 ]; then
|
||||
+ systemctl start multipathd.service
|
||||
+ fi
|
||||
+elif [ "$ENABLE" = 0 ]; then
|
||||
+ if [ "$HAVE_MULTIPATHD" = 1 ]; then
|
||||
+ systemctl stop multipathd.service
|
||||
+ fi
|
||||
+elif [ -n "$CHANGED_CONFIG" -a "$HAVE_MULTIPATHD" = 1 ]; then
|
||||
+ systemctl reload multipathd.service
|
||||
+fi
|
||||
diff --git a/multipath/mpathconf.8 b/multipath/mpathconf.8
|
||||
new file mode 100644
|
||||
index 00000000..ec4e5c56
|
||||
--- /dev/null
|
||||
+++ b/multipath/mpathconf.8
|
||||
@@ -0,0 +1,151 @@
|
||||
+.TH MPATHCONF 8 "June 2010" "" "Linux Administrator's Manual"
|
||||
+.SH NAME
|
||||
+mpathconf - A tool for configuring device-mapper-multipath
|
||||
+.SH SYNOPSIS
|
||||
+.B mpathconf
|
||||
+.RB [\| commands \|]
|
||||
+.RB [\| options \|]
|
||||
+.SH DESCRIPTION
|
||||
+.B mpathconf
|
||||
+is a utility that creates or modifies
|
||||
+.B /etc/multipath.conf.
|
||||
+It can enable or disable multipathing and configure some common options.
|
||||
+.B mpathconf
|
||||
+can also load the
|
||||
+.B dm_multipath
|
||||
+module, start and stop the
|
||||
+.B multipathd
|
||||
+daemon, and configure the
|
||||
+.B multipathd
|
||||
+service to start automatically or not. If
|
||||
+.B mpathconf
|
||||
+is called with no commands, it will display the current configuration, but
|
||||
+will not create of modify
|
||||
+.B /etc/multipath.conf
|
||||
+
|
||||
+The default options for mpathconf are
|
||||
+.B --with_module
|
||||
+The
|
||||
+.B --with_multipathd
|
||||
+option is not set by default. Enabling multipathing will load the
|
||||
+.B dm_multipath
|
||||
+module but it will not immediately start it. This is so
|
||||
+that users can manually edit their config file if necessary, before starting
|
||||
+.B multipathd.
|
||||
+
|
||||
+If
|
||||
+.B /etc/multipath.conf
|
||||
+already exists, mpathconf will edit it. If it does not exist, mpathconf will
|
||||
+create a default file with
|
||||
+.B user_friendly_names
|
||||
+set and
|
||||
+.B find_multipaths
|
||||
+set to \fBon\fP. To disable these, use the
|
||||
+.B --user_friendly_names n
|
||||
+and
|
||||
+.B --find_multipaths off
|
||||
+options
|
||||
+.SH COMMANDS
|
||||
+.TP
|
||||
+.B --enable
|
||||
+Removes any line that blacklists all device nodes from the
|
||||
+.B /etc/multipath.conf
|
||||
+blacklist section. Also, creates
|
||||
+.B /etc/multipath.conf
|
||||
+if it doesn't exist.
|
||||
+.TP
|
||||
+.B --disable
|
||||
+Adds a line that blacklists all device nodes to the
|
||||
+.B /etc/multipath.conf
|
||||
+blacklist section. If no blacklist section exists, it will create one.
|
||||
+.TP
|
||||
+.B --allow \fB<device>\fP
|
||||
+Modifies the \fB/etc/multipath/conf\fP blacklist to blacklist all
|
||||
+wwids and the blacklist_exceptions to whitelist \fB<device>\fP. \fB<device>\fP
|
||||
+can be in the form of MAJOR:MINOR, a wwid, or the name of a device-mapper
|
||||
+device, either a multipath device, or any device on stacked on top of one or
|
||||
+more multipath devices. This command can be used multiple times to allow
|
||||
+multiple devices. \fBNOTE:\fP This action will create a configuration file that
|
||||
+mpathconf will not be able to revert back to its previous state. Because
|
||||
+of this, \fB--outfile\fP is required when using \fB--allow\fP.
|
||||
+.TP
|
||||
+.B --user_friendly_names \fP { \fBy\fP | \fBn\fP }
|
||||
+If set to \fBy\fP, this adds the line
|
||||
+.B user_friendly_names yes
|
||||
+to the
|
||||
+.B /etc/multipath.conf
|
||||
+defaults section. If set to \fBn\fP, this removes the line, if present. This
|
||||
+command can be used along with any other command.
|
||||
+.TP
|
||||
+.B --recheck_wwid \fP { \fBy\fP | \fBn\fP }
|
||||
+If set to \fBy\fP, this adds the line
|
||||
+.B recheck_wwid yes
|
||||
+to the
|
||||
+.B /etc/multipath.conf
|
||||
+defaults section, or sets an existing line to \fByes\fP. If set to \fBn\fP, this
|
||||
+sets an existing \fBrecheck_wwid\fP line to \fBno\fP. This command can be used
|
||||
+along with any other command.
|
||||
+.TP
|
||||
+.B --find_multipaths\fP { \fBon\fP | \fByes\fP | \fBy\fP | \fBoff\fP | \fBno\fP | \fBn\fP | \fBstrict\fP | \fBgreedy\fP | \fBsmart\fP }
|
||||
+If set to \fB<value>\fP, this adds the line
|
||||
+.B find_multipaths <value>
|
||||
+to the
|
||||
+.B /etc/multipath.conf
|
||||
+defaults section. This command can be used along with any other command.
|
||||
+\fBy\fP and \fBn\fP can be used instead of \fByes\fP and \fBno\fP.
|
||||
+.TP
|
||||
+.B --property_blacklist \fP { \fBy\fP | \fBn\fP }
|
||||
+If set to \fBy\fP, this adds the line
|
||||
+.B property "(SCSI_IDENT_|ID_WWN)"
|
||||
+to the
|
||||
+.B /etc/multipath.conf
|
||||
+blacklist_exceptions section. If set to \fBn\fP, this removes the line, if
|
||||
+present. This command can be used along with any other command.
|
||||
+.TP
|
||||
+.B --enable_foreign\fP { \fBy\fP | \fBn\fP }
|
||||
+If set to \fBy\fP, this adds the line
|
||||
+.B enable_foreign ".*"
|
||||
+to the
|
||||
+.B /etc/multipath.conf
|
||||
+defaults section. if set to \fBn\fP, this removes the line, if present. This
|
||||
+command can be used along with any other command.
|
||||
+.TP
|
||||
+.B --option \fB<option_name>:[<value>]\fP
|
||||
+Sets the defaults section option \fB<option_name>\fP to \fB<value>\fP. If the
|
||||
+option was not previously set in the defaults section, it is added. If it was
|
||||
+set, its value is changed to \fB<value>\fP. If \fB<value>\fP is left blank,
|
||||
+then the option is removed from the defaults section, if was set there. This
|
||||
+command can be used along with any other command.
|
||||
+.TP
|
||||
+.B --outfile \fB<filename>\fP
|
||||
+Write the resulting multipath configuration to \fB<filename>\fP instead of
|
||||
+\fB/etc/multipath.conf\fP.
|
||||
+.SH OPTIONS
|
||||
+.TP
|
||||
+.B --with_module\fP { \fBy\fP | \fBn\fP }
|
||||
+If set to \fBy\fP, this runs
|
||||
+.B modprobe dm_multipath
|
||||
+to install the multipath modules. This option only works with the
|
||||
+.B --enable
|
||||
+command. This option is set to \fBy\fP by default.
|
||||
+.TP
|
||||
+.B --with_multipathd { \fBy\fP | \fBn\fP }
|
||||
+If set to \fBy\fP, this runs
|
||||
+.B service multipathd start
|
||||
+to start the multipathd daemon on \fB--enable\fP,
|
||||
+.B service multipathd stop
|
||||
+to stop the multipathd daemon on \fB--disable\fP, and
|
||||
+.B service multipathd reload
|
||||
+to reconfigure multipathd on \fB--user_friendly_names\fP and
|
||||
+\fB--find_multipaths\fP.
|
||||
+This option is set to \fBn\fP by default.
|
||||
+.SH FILES
|
||||
+.BR /etc/multipath.conf
|
||||
+.SH "SEE ALSO"
|
||||
+.BR multipath.conf (5),
|
||||
+.BR modprobe (8),
|
||||
+.BR multipath (8),
|
||||
+.BR multipathd (8),
|
||||
+.BR service (8),
|
||||
+.SH AUTHOR
|
||||
+Benjamin Marzinski <bmarzins@redhat.com>
|
||||
|
|
@ -1,274 +0,0 @@
|
|||
---
|
||||
libmultipath/checkers.h | 3 +
|
||||
libmultipath/checkers/Makefile | 4 +
|
||||
libmultipath/checkers/tur.c | 123 +++++++++++++++++++++++++++++++++++++++--
|
||||
multipath.conf.annotated | 5 +
|
||||
4 files changed, 128 insertions(+), 7 deletions(-)
|
||||
|
||||
Index: multipath-tools-120613/libmultipath/checkers.h
|
||||
===================================================================
|
||||
--- multipath-tools-120613.orig/libmultipath/checkers.h
|
||||
+++ multipath-tools-120613/libmultipath/checkers.h
|
||||
@@ -60,6 +60,7 @@ enum path_check_state {
|
||||
|
||||
#define DIRECTIO "directio"
|
||||
#define TUR "tur"
|
||||
+#define HP_TUR "hp_tur"
|
||||
#define HP_SW "hp_sw"
|
||||
#define RDAC "rdac"
|
||||
#define EMC_CLARIION "emc_clariion"
|
||||
@@ -77,6 +78,7 @@ enum path_check_state {
|
||||
#define CHECKER_MSG_LEN 256
|
||||
#define CHECKER_DEV_LEN 256
|
||||
#define LIB_CHECKER_NAMELEN 256
|
||||
+#define WWID_SIZE 128
|
||||
|
||||
struct checker {
|
||||
struct list_head node;
|
||||
@@ -88,6 +90,7 @@ struct checker {
|
||||
int disable;
|
||||
char name[CHECKER_NAME_LEN];
|
||||
char message[CHECKER_MSG_LEN]; /* comm with callers */
|
||||
+ char wwid[WWID_SIZE]; /* LUN wwid */
|
||||
void * context; /* store for persistent data */
|
||||
void ** mpcontext; /* store for persistent data shared
|
||||
multipath-wide. Use MALLOC if
|
||||
Index: multipath-tools-120613/libmultipath/checkers/Makefile
|
||||
===================================================================
|
||||
--- multipath-tools-120613.orig/libmultipath/checkers/Makefile
|
||||
+++ multipath-tools-120613/libmultipath/checkers/Makefile
|
||||
@@ -8,6 +8,7 @@ LIBS= \
|
||||
libcheckcciss_tur.so \
|
||||
libcheckreadsector0.so \
|
||||
libchecktur.so \
|
||||
+ libcheckhp_tur.so \
|
||||
libcheckdirectio.so \
|
||||
libcheckemc_clariion.so \
|
||||
libcheckhp_sw.so \
|
||||
@@ -23,6 +24,9 @@ libcheckdirectio.so: libsg.o directio.o
|
||||
libcheck%.so: libsg.o %.o
|
||||
$(CC) $(LDFLAGS) $(SHARED_FLAGS) -o $@ $^
|
||||
|
||||
+hp_tur.o: tur.c
|
||||
+ $(CC) $(CFLAGS) -DCHECK_WWID -c -o $@ $<
|
||||
+
|
||||
install:
|
||||
$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(libdir)
|
||||
|
||||
Index: multipath-tools-120613/libmultipath/checkers/tur.c
|
||||
===================================================================
|
||||
--- multipath-tools-120613.orig/libmultipath/checkers/tur.c
|
||||
+++ multipath-tools-120613/libmultipath/checkers/tur.c
|
||||
@@ -24,12 +24,101 @@
|
||||
#define TUR_CMD_LEN 6
|
||||
#define HEAVY_CHECK_COUNT 10
|
||||
|
||||
+#ifdef CHECK_WWID
|
||||
+#define MSG_TUR_UP "HP tur checker reports path is up"
|
||||
+#define MSG_TUR_DOWN "HP tur checker reports path is down"
|
||||
+#define MSG_TUR_GHOST "HP tur checker reports path is in standby state"
|
||||
+#define MSG_TUR_RUNNING "HP tur checker still running"
|
||||
+#define MSG_TUR_TIMEOUT "HP tur checker timed out"
|
||||
+#define MSG_TUR_FAILED "HP tur checker failed to initialize"
|
||||
+#define EVPD 0x01
|
||||
+#define PAGE_83 0x83
|
||||
+#define INQUIRY_CMD 0x12
|
||||
+#define INQUIRY_CMDLEN 6
|
||||
+#define SCSI_INQ_BUFF_LEN 96
|
||||
+#else
|
||||
#define MSG_TUR_UP "tur checker reports path is up"
|
||||
#define MSG_TUR_DOWN "tur checker reports path is down"
|
||||
#define MSG_TUR_GHOST "tur checker reports path is in standby state"
|
||||
#define MSG_TUR_RUNNING "tur checker still running"
|
||||
#define MSG_TUR_TIMEOUT "tur checker timed out"
|
||||
#define MSG_TUR_FAILED "tur checker failed to initialize"
|
||||
+#endif
|
||||
+
|
||||
+#ifdef CHECK_WWID
|
||||
+static int
|
||||
+do_inq(int fd, unsigned int timeout, char * wwid)
|
||||
+{
|
||||
+ int ret = -1;
|
||||
+ unsigned char inq_cmd[INQUIRY_CMDLEN] =
|
||||
+ {INQUIRY_CMD, EVPD, PAGE_83, 0, SCSI_INQ_BUFF_LEN, 0 };
|
||||
+ unsigned char sense_buffer[32];
|
||||
+ unsigned char resp_buffer[SCSI_INQ_BUFF_LEN];
|
||||
+ char *pbuff;
|
||||
+
|
||||
+ int m,k;
|
||||
+ int retry_tur = 5;
|
||||
+ struct sg_io_hdr io_hdr;
|
||||
+
|
||||
+retry:
|
||||
+ memset(resp_buffer, 0, sizeof(resp_buffer));
|
||||
+ memset(&io_hdr, 0, sizeof(struct sg_io_hdr));
|
||||
+
|
||||
+ io_hdr.interface_id = 'S';
|
||||
+ io_hdr.cmd_len = sizeof(inq_cmd);
|
||||
+ io_hdr.mx_sb_len = sizeof(sense_buffer);
|
||||
+ io_hdr.dxfer_direction = -3; // Data transfer from the device.
|
||||
+ io_hdr.dxfer_len = sizeof(resp_buffer);
|
||||
+ io_hdr.dxferp = (unsigned char *)resp_buffer;
|
||||
+ io_hdr.cmdp = inq_cmd;
|
||||
+ io_hdr.sbp = sense_buffer;
|
||||
+ io_hdr.timeout = timeout; // IOCTL timeout value.
|
||||
+
|
||||
+ if (ioctl(fd, SG_IO, &io_hdr) < 0) {
|
||||
+ condlog(0, "SG_IO ioctl failed: %s", strerror(errno));
|
||||
+ return ret;
|
||||
+ }
|
||||
+ if (io_hdr.info & SG_INFO_OK_MASK){
|
||||
+ int key = 0, asc, ascq;
|
||||
+
|
||||
+ if (io_hdr.host_status == DID_BUS_BUSY ||
|
||||
+ io_hdr.host_status == DID_ERROR ||
|
||||
+ io_hdr.host_status == DID_TRANSPORT_DISRUPTED) {
|
||||
+ if (--retry_tur)
|
||||
+ goto retry;
|
||||
+ }
|
||||
+ 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;
|
||||
+ }
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ pbuff = (char *) resp_buffer;
|
||||
+
|
||||
+ wwid[0] = '3';
|
||||
+ for (m = 8, k = 1; m < 11; ++m, k+=2)
|
||||
+ sprintf(&wwid[k], "%02x", (unsigned int)pbuff[m] & 0xff);
|
||||
+ for (m = 11; m < 24; ++m, k+=2)
|
||||
+ sprintf(&wwid[k], "%02x", (unsigned int)pbuff[m] & 0xff);
|
||||
+
|
||||
+ return (ret = 0);
|
||||
+}
|
||||
+#endif
|
||||
|
||||
struct tur_checker_context {
|
||||
dev_t devt;
|
||||
@@ -43,6 +132,7 @@ struct tur_checker_context {
|
||||
pthread_cond_t active;
|
||||
pthread_spinlock_t hldr_lock;
|
||||
int holders;
|
||||
+ char wwid[WWID_SIZE];
|
||||
char message[CHECKER_MSG_LEN];
|
||||
};
|
||||
|
||||
@@ -100,12 +190,15 @@ void libcheck_free (struct checker * c)
|
||||
#define TUR_MSG(msg, fmt, args...) snprintf(msg, CHECKER_MSG_LEN, fmt, ##args);
|
||||
|
||||
int
|
||||
-tur_check(int fd, unsigned int timeout, char *msg)
|
||||
+tur_check (int fd, unsigned int timeout, char *msg, char *wwid)
|
||||
{
|
||||
struct sg_io_hdr io_hdr;
|
||||
unsigned char turCmdBlk[TUR_CMD_LEN] = { 0x00, 0, 0, 0, 0, 0 };
|
||||
unsigned char sense_buffer[32];
|
||||
int retry_tur = 5;
|
||||
+#ifdef CHECK_WWID
|
||||
+ char new_wwid[WWID_SIZE];
|
||||
+#endif
|
||||
|
||||
retry:
|
||||
memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
|
||||
@@ -179,6 +272,24 @@ tur_check(int fd, unsigned int timeout,
|
||||
TUR_MSG(msg, MSG_TUR_DOWN);
|
||||
return PATH_DOWN;
|
||||
}
|
||||
+#ifdef CHECK_WWID
|
||||
+ if (!do_inq(fd, timeout, new_wwid)) {
|
||||
+
|
||||
+ if(!strcmp(wwid, "\0")) {
|
||||
+ strcpy(wwid, new_wwid);
|
||||
+ goto up;
|
||||
+ }
|
||||
+
|
||||
+ if (strcmp(wwid , new_wwid)) {
|
||||
+ condlog(0,
|
||||
+ "hp_tur: Lun collided. new_wwid %s old_wwid %s",
|
||||
+ new_wwid, wwid);
|
||||
+ TUR_MSG(msg, MSG_TUR_DOWN);
|
||||
+ return PATH_DOWN;
|
||||
+ }
|
||||
+ }
|
||||
+up:
|
||||
+#endif
|
||||
TUR_MSG(msg, MSG_TUR_UP);
|
||||
return PATH_UP;
|
||||
}
|
||||
@@ -215,7 +326,7 @@ void *tur_thread(void *ctx)
|
||||
ct->state = PATH_PENDING;
|
||||
pthread_mutex_unlock(&ct->lock);
|
||||
|
||||
- state = tur_check(ct->fd, ct->timeout, ct->message);
|
||||
+ state = tur_check(ct->fd, ct->timeout, ct->message, ct->wwid);
|
||||
|
||||
/* TUR checker done */
|
||||
pthread_mutex_lock(&ct->lock);
|
||||
@@ -275,7 +386,7 @@ libcheck_check (struct checker * c)
|
||||
ct->devt = sb.st_rdev;
|
||||
|
||||
if (c->sync)
|
||||
- return tur_check(c->fd, c->timeout, c->message);
|
||||
+ return tur_check(c->fd, c->timeout, c->message, ct->wwid);
|
||||
|
||||
/*
|
||||
* Async mode
|
||||
@@ -319,7 +430,8 @@ libcheck_check (struct checker * c)
|
||||
pthread_mutex_unlock(&ct->lock);
|
||||
condlog(3, "%d:%d: tur thread not responding, "
|
||||
"using sync mode", TUR_DEVT(ct));
|
||||
- return tur_check(c->fd, c->timeout, c->message);
|
||||
+ return tur_check(c->fd, c->timeout, c->message,
|
||||
+ ct->wwid);
|
||||
}
|
||||
/* Start new TUR checker */
|
||||
ct->state = PATH_UNCHECKED;
|
||||
@@ -337,7 +449,8 @@ libcheck_check (struct checker * c)
|
||||
ct->holders--;
|
||||
condlog(3, "%d:%d: failed to start tur thread, using"
|
||||
" sync mode", TUR_DEVT(ct));
|
||||
- return tur_check(c->fd, c->timeout, c->message);
|
||||
+ return tur_check(c->fd, c->timeout, c->message,
|
||||
+ ct->wwid);
|
||||
}
|
||||
pthread_attr_destroy(&attr);
|
||||
tur_timeout(&tsp);
|
||||
Index: multipath-tools-120613/multipath.conf.annotated
|
||||
===================================================================
|
||||
--- multipath-tools-120613.orig/multipath.conf.annotated
|
||||
+++ multipath-tools-120613/multipath.conf.annotated
|
||||
@@ -96,7 +96,8 @@
|
||||
# # name : path_checker, checker
|
||||
# # scope : multipath & multipathd
|
||||
# # desc : the default method used to determine the paths' state
|
||||
-# # values : readsector0|tur|emc_clariion|hp_sw|directio|rdac|cciss_tur
|
||||
+# # values : readsector0|tur|emc_clariion|hp_sw|directio|rdac|
|
||||
+# cciss_tur|hp_tur
|
||||
# # default : directio
|
||||
# #
|
||||
# path_checker directio
|
||||
@@ -493,7 +494,7 @@
|
||||
# # scope : multipathd & multipathd
|
||||
# # desc : path checking algorithm to use to check path state
|
||||
# # values : readsector0|tur|emc_clariion|hp_sw|directio|rdac|
|
||||
-# # cciss_tur
|
||||
+# # cciss_tur|hp_tur
|
||||
# #
|
||||
# path_checker directio
|
||||
#
|
||||
151
0007-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch
Normal file
151
0007-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
From d6ad888bad3850bb0a342ebcdc9fd78773eb3b2a Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Fri, 17 Oct 2014 11:20:34 -0500
|
||||
Subject: [PATCH] RH: add wwids from kernel cmdline mpath.wwids with -A
|
||||
|
||||
This patch adds another option to multipath, "-A", which reads
|
||||
/proc/cmdline for mpath.wwid=<WWID> options, and adds any wwids it finds
|
||||
to /etc/multipath/wwids. While this isn't usually important during
|
||||
normal operation, since these wwids should already be added, it can be
|
||||
helpful during installation, to make sure that multipath can claim
|
||||
devices as its own, before LVM or something else makes use of them. The
|
||||
patch also execs "/sbin/multipath -A" before running multipathd in
|
||||
multipathd.service
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
multipath/main.c | 54 ++++++++++++++++++++++++++++++--
|
||||
multipath/multipath.8.in | 7 ++++-
|
||||
multipathd/multipathd.service.in | 1 +
|
||||
3 files changed, 59 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/multipath/main.c b/multipath/main.c
|
||||
index 31012874..a667c2ee 100644
|
||||
--- a/multipath/main.c
|
||||
+++ b/multipath/main.c
|
||||
@@ -111,7 +111,7 @@ usage (char * progname)
|
||||
fprintf (stderr, " %s [-v level] [-R retries] -F\n", progname);
|
||||
fprintf (stderr, " %s [-v level] [-l|-ll] [device]\n", progname);
|
||||
fprintf (stderr, " %s [-v level] [-a|-w] device\n", progname);
|
||||
- fprintf (stderr, " %s [-v level] -W\n", progname);
|
||||
+ fprintf (stderr, " %s [-v level] [-A|-W]\n", progname);
|
||||
fprintf (stderr, " %s [-v level] [-i] [-c|-C] device\n", progname);
|
||||
fprintf (stderr, " %s [-v level] [-i] [-u|-U]\n", progname);
|
||||
fprintf (stderr, " %s [-h|-t|-T]\n", progname);
|
||||
@@ -125,6 +125,8 @@ usage (char * progname)
|
||||
" -f flush a multipath device map\n"
|
||||
" -F flush all multipath device maps\n"
|
||||
" -a add a device wwid to the wwids file\n"
|
||||
+ " -A add devices from kernel command line mpath.wwids\n"
|
||||
+ " parameters to wwids file\n"
|
||||
" -c check if a device should be a path in a multipath device\n"
|
||||
" -C check if a multipath device has usable paths\n"
|
||||
" -q allow queue_if_no_path when multipathd is not running\n"
|
||||
@@ -440,6 +442,50 @@ static void cleanup_vecs(void)
|
||||
free_pathvec(vecs.pathvec, FREE_PATHS);
|
||||
}
|
||||
|
||||
+static int remember_cmdline_wwid(void)
|
||||
+{
|
||||
+ FILE *f = NULL;
|
||||
+ char buf[LINE_MAX], *next, *ptr;
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ f = fopen("/proc/cmdline", "re");
|
||||
+ if (!f) {
|
||||
+ condlog(0, "can't open /proc/cmdline : %s", strerror(errno));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (!fgets(buf, sizeof(buf), f)) {
|
||||
+ if (ferror(f))
|
||||
+ condlog(0, "read of /proc/cmdline failed : %s",
|
||||
+ strerror(errno));
|
||||
+ else
|
||||
+ condlog(0, "couldn't read /proc/cmdline");
|
||||
+ fclose(f);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ fclose(f);
|
||||
+ next = buf;
|
||||
+ while((ptr = strstr(next, "mpath.wwid="))) {
|
||||
+ ptr += 11;
|
||||
+ next = strpbrk(ptr, " \t\n");
|
||||
+ if (next) {
|
||||
+ *next = '\0';
|
||||
+ next++;
|
||||
+ }
|
||||
+ if (strlen(ptr)) {
|
||||
+ if (remember_wwid(ptr) != 0)
|
||||
+ ret = -1;
|
||||
+ }
|
||||
+ else {
|
||||
+ condlog(0, "empty mpath.wwid kernel command line option");
|
||||
+ ret = -1;
|
||||
+ }
|
||||
+ if (!next)
|
||||
+ break;
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
static int
|
||||
configure (struct config *conf, enum mpath_cmds cmd,
|
||||
enum devtypes dev_type, char *devpath)
|
||||
@@ -851,7 +897,7 @@ main (int argc, char *argv[])
|
||||
condlog(1, "failed to register cleanup handler for vecs: %m");
|
||||
if (atexit(cleanup_bindings))
|
||||
condlog(1, "failed to register cleanup handler for bindings: %m");
|
||||
- while ((arg = getopt(argc, argv, ":adDcChl::eFfM:v:p:b:BrR:itTquUwW")) != EOF ) {
|
||||
+ while ((arg = getopt(argc, argv, ":aAdDcChl::eFfM:v:p:b:BrR:itTquUwW")) != EOF ) {
|
||||
switch(arg) {
|
||||
case 'v':
|
||||
if (!isdigit(optarg[0])) {
|
||||
@@ -922,6 +968,10 @@ main (int argc, char *argv[])
|
||||
case 'T':
|
||||
cmd = CMD_DUMP_CONFIG;
|
||||
break;
|
||||
+ case 'A':
|
||||
+ if (remember_cmdline_wwid() != 0)
|
||||
+ exit(RTVL_FAIL);
|
||||
+ exit(RTVL_OK);
|
||||
case 'h':
|
||||
usage(argv[0]);
|
||||
exit(RTVL_OK);
|
||||
diff --git a/multipath/multipath.8.in b/multipath/multipath.8.in
|
||||
index b88e9a4c..edd742aa 100644
|
||||
--- a/multipath/multipath.8.in
|
||||
+++ b/multipath/multipath.8.in
|
||||
@@ -64,7 +64,7 @@ multipath \- Device mapper target autoconfig.
|
||||
.B multipath
|
||||
.RB [\| \-v\ \c
|
||||
.IR level \|]
|
||||
-.B -W
|
||||
+.RB [\| \-A | \-W \|]
|
||||
.
|
||||
.LP
|
||||
.B multipath
|
||||
@@ -146,6 +146,11 @@ device mapper, path checkers ...).
|
||||
Add the WWID for the specified device to the WWIDs file.
|
||||
.
|
||||
.TP
|
||||
+.B \-A
|
||||
+Add the WWIDs from any kernel command line \fImpath.wwid\fR parameters to the
|
||||
+WWIDs file.
|
||||
+.
|
||||
+.TP
|
||||
.B \-w
|
||||
Remove the WWID for the specified device from the WWIDs file.
|
||||
.
|
||||
diff --git a/multipathd/multipathd.service.in b/multipathd/multipathd.service.in
|
||||
index ab166435..1ec08c6e 100644
|
||||
--- a/multipathd/multipathd.service.in
|
||||
+++ b/multipathd/multipathd.service.in
|
||||
@@ -19,6 +19,7 @@ StartLimitBurst=3
|
||||
[Service]
|
||||
Type=notify
|
||||
NotifyAccess=main
|
||||
+ExecStartPre=-@BINDIR@/multipath -A
|
||||
ExecStart=@BINDIR@/multipathd -d -s
|
||||
ExecReload=@BINDIR@/multipathd reconfigure
|
||||
Restart=on-failure
|
||||
41
0008-RH-reset-default-find_mutipaths-value-to-off.patch
Normal file
41
0008-RH-reset-default-find_mutipaths-value-to-off.patch
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
From 064d761121e7e2c7b63ab280e341d8010a413119 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Thu, 7 Jun 2018 17:43:52 -0500
|
||||
Subject: [PATCH] RH: reset default find_mutipaths value to off
|
||||
|
||||
Upstream has changed to default find_multipaths to "strict". For now
|
||||
Redhat will retain the previous default of "off".
|
||||
|
||||
Co-authored-by: Paul Donohue <git@PaulSD.com>
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/defaults.h | 2 +-
|
||||
multipath/multipath.conf.5.in | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h
|
||||
index 134b690a..e2fe7ac4 100644
|
||||
--- a/libmultipath/defaults.h
|
||||
+++ b/libmultipath/defaults.h
|
||||
@@ -24,7 +24,7 @@
|
||||
#define DEFAULT_NO_PATH_RETRY NO_PATH_RETRY_UNDEF
|
||||
#define DEFAULT_VERBOSITY 2
|
||||
#define DEFAULT_REASSIGN_MAPS 0
|
||||
-#define DEFAULT_FIND_MULTIPATHS FIND_MULTIPATHS_STRICT
|
||||
+#define DEFAULT_FIND_MULTIPATHS FIND_MULTIPATHS_OFF
|
||||
#define DEFAULT_FAST_IO_FAIL 5
|
||||
#define DEFAULT_DEV_LOSS_TMO 600
|
||||
#define DEFAULT_RETAIN_HWHANDLER RETAIN_HWHANDLER_ON
|
||||
diff --git a/multipath/multipath.conf.5.in b/multipath/multipath.conf.5.in
|
||||
index ba291e11..b8389db3 100644
|
||||
--- a/multipath/multipath.conf.5.in
|
||||
+++ b/multipath/multipath.conf.5.in
|
||||
@@ -1227,7 +1227,7 @@ as non-multipath and passed on to upper layers.
|
||||
\fBNote:\fR this may cause delays during device detection if
|
||||
there are single-path devices which aren\'t blacklisted.
|
||||
.TP
|
||||
-The default is: \fBstrict\fR
|
||||
+The default is: \fBoff\fR
|
||||
.RE
|
||||
.
|
||||
.
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
---
|
||||
kpartx/dos.c | 2 --
|
||||
kpartx/kpartx.c | 9 ++++++---
|
||||
2 files changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/kpartx/dos.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/kpartx/dos.c
|
||||
+++ multipath-tools-130222/kpartx/dos.c
|
||||
@@ -98,8 +98,6 @@ read_dos_pt(int fd, struct slice all, st
|
||||
break;
|
||||
}
|
||||
if (is_extended(p.sys_type)) {
|
||||
- sp[i].size = 2; /* extended partitions only get two
|
||||
- sectors mapped for LILO to install */
|
||||
n += read_extended_partition(fd, &p, i, sp+n, ns-n);
|
||||
}
|
||||
}
|
||||
Index: multipath-tools-130222/kpartx/kpartx.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/kpartx/kpartx.c
|
||||
+++ multipath-tools-130222/kpartx/kpartx.c
|
||||
@@ -516,6 +516,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)
|
||||
@@ -541,9 +542,11 @@ main(int argc, char **argv){
|
||||
}
|
||||
strip_slash(partname);
|
||||
|
||||
- if (safe_sprintf(params, "%s %" PRIu64,
|
||||
- device,
|
||||
- slices[j].start)) {
|
||||
+ start = slices[j].start - slices[k].start;
|
||||
+ if (safe_sprintf(params, "%d:%d %" PRIu64,
|
||||
+ slices[k].major,
|
||||
+ slices[k].minor,
|
||||
+ start)) {
|
||||
fprintf(stderr, "params too small\n");
|
||||
exit(1);
|
||||
}
|
||||
|
|
@ -1,327 +0,0 @@
|
|||
---
|
||||
kpartx/bsd.c | 35 ---------------
|
||||
kpartx/dos.c | 7 +--
|
||||
kpartx/kpartx.c | 123 +++++++-------------------------------------------------
|
||||
kpartx/kpartx.h | 1
|
||||
kpartx/sun.c | 35 ---------------
|
||||
5 files changed, 24 insertions(+), 177 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/kpartx/bsd.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/kpartx/bsd.c
|
||||
+++ multipath-tools-130222/kpartx/bsd.c
|
||||
@@ -50,10 +50,10 @@ int
|
||||
read_bsd_pt(int fd, struct slice all, struct slice *sp, int ns) {
|
||||
struct bsd_disklabel *l;
|
||||
struct bsd_partition *p;
|
||||
- unsigned int offset = all.start, end;
|
||||
+ unsigned int offset = all.start;
|
||||
int max_partitions;
|
||||
char *bp;
|
||||
- int n = 0, i, j;
|
||||
+ int n = 0;
|
||||
|
||||
bp = getblock(fd, offset+1); /* 1 sector suffices */
|
||||
if (bp == NULL)
|
||||
@@ -79,36 +79,5 @@ read_bsd_pt(int fd, struct slice all, st
|
||||
break;
|
||||
}
|
||||
}
|
||||
- /*
|
||||
- * Convention has it that the bsd disklabel will always have
|
||||
- * the 'c' partition spanning the entire disk.
|
||||
- * So we have to check for contained slices.
|
||||
- */
|
||||
- for(i = 0; i < n; i++) {
|
||||
- if (sp[i].size == 0)
|
||||
- continue;
|
||||
-
|
||||
- end = sp[i].start + sp[i].size;
|
||||
- for(j = 0; j < n; j ++) {
|
||||
- if ( i == j )
|
||||
- continue;
|
||||
- if (sp[j].size == 0)
|
||||
- continue;
|
||||
-
|
||||
- if (sp[i].start < sp[j].start) {
|
||||
- if (end > sp[j].start &&
|
||||
- end < sp[j].start + sp[j].size) {
|
||||
- /* Invalid slice */
|
||||
- fprintf(stderr,
|
||||
- "bsd_disklabel: slice %d overlaps with %d\n", i , j);
|
||||
- sp[i].size = 0;
|
||||
- }
|
||||
- } else {
|
||||
- if (end <= sp[j].start + sp[j].size) {
|
||||
- sp[i].container = j + 1;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
return n;
|
||||
}
|
||||
Index: multipath-tools-130222/kpartx/dos.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/kpartx/dos.c
|
||||
+++ multipath-tools-130222/kpartx/dos.c
|
||||
@@ -16,7 +16,7 @@ is_extended(int type) {
|
||||
}
|
||||
|
||||
static int
|
||||
-read_extended_partition(int fd, struct partition *ep, int en,
|
||||
+read_extended_partition(int fd, struct partition *ep,
|
||||
struct slice *sp, int ns)
|
||||
{
|
||||
struct partition p;
|
||||
@@ -53,7 +53,6 @@ read_extended_partition(int fd, struct p
|
||||
if (n < ns) {
|
||||
sp[n].start = here + le32_to_cpu(p.start_sect);
|
||||
sp[n].size = le32_to_cpu(p.nr_sects);
|
||||
- sp[n].container = en + 1;
|
||||
n++;
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
@@ -98,7 +97,9 @@ read_dos_pt(int fd, struct slice all, st
|
||||
break;
|
||||
}
|
||||
if (is_extended(p.sys_type)) {
|
||||
- n += read_extended_partition(fd, &p, i, sp+n, ns-n);
|
||||
+ n += read_extended_partition(fd, &p, sp+n, ns-n);
|
||||
+ /* hide the extended partition itself */
|
||||
+ sp[i].size = 2;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
Index: multipath-tools-130222/kpartx/kpartx.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/kpartx/kpartx.c
|
||||
+++ multipath-tools-130222/kpartx/kpartx.c
|
||||
@@ -192,7 +192,7 @@ get_hotplug_device(void)
|
||||
|
||||
int
|
||||
main(int argc, char **argv){
|
||||
- int i, j, m, n, op, off, arg, c, d, ro=0;
|
||||
+ int i, j, m, n, op, off, arg, ro=0;
|
||||
int fd = -1;
|
||||
struct slice all;
|
||||
struct pt *ptp;
|
||||
@@ -381,49 +381,30 @@ main(int argc, char **argv){
|
||||
else
|
||||
continue;
|
||||
|
||||
+ /*
|
||||
+ * test for overlap, as in the case of an extended partition
|
||||
+ * zero their size to avoid mapping
|
||||
+ */
|
||||
+ for (j = 0; j < n; j++) {
|
||||
+ for (m = j + 1; m < n; m++) {
|
||||
+ if (slices[m].start > slices[j].start &&
|
||||
+ slices[m].start < slices[j].start +
|
||||
+ slices[j].size)
|
||||
+ slices[j].size = 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
switch(what) {
|
||||
case LIST:
|
||||
- for (j = 0, c = 0, m = 0; j < n; j++) {
|
||||
+ for (j = 0; j < n; j++) {
|
||||
if (slices[j].size == 0)
|
||||
continue;
|
||||
- if (slices[j].container > 0) {
|
||||
- c++;
|
||||
- continue;
|
||||
- }
|
||||
-
|
||||
- slices[j].minor = m++;
|
||||
|
||||
printf("%s%s%d : 0 %" PRIu64 " %s %" PRIu64"\n",
|
||||
mapname, delim, j+1,
|
||||
slices[j].size, device,
|
||||
slices[j].start);
|
||||
}
|
||||
- /* Loop to resolve contained slices */
|
||||
- d = c;
|
||||
- while (c) {
|
||||
- for (j = 0; j < n; j++) {
|
||||
- uint64_t start;
|
||||
- int k = slices[j].container - 1;
|
||||
-
|
||||
- if (slices[j].size == 0)
|
||||
- continue;
|
||||
- if (slices[j].minor > 0)
|
||||
- continue;
|
||||
- if (slices[j].container == 0)
|
||||
- continue;
|
||||
- slices[j].minor = m++;
|
||||
-
|
||||
- start = slices[j].start - slices[k].start;
|
||||
- printf("%s%s%d : 0 %" PRIu64 " /dev/dm-%d %" PRIu64 "\n",
|
||||
- mapname, delim, j+1,
|
||||
- slices[j].size,
|
||||
- slices[k].minor, start);
|
||||
- c--;
|
||||
- }
|
||||
- /* Terminate loop if nothing more to resolve */
|
||||
- if (d == c)
|
||||
- break;
|
||||
- }
|
||||
|
||||
break;
|
||||
|
||||
@@ -462,16 +443,10 @@ main(int argc, char **argv){
|
||||
case ADD:
|
||||
case UPDATE:
|
||||
/* ADD and UPDATE share the same code that adds new partitions. */
|
||||
- for (j = 0, c = 0; j < n; j++) {
|
||||
+ for (j = 0; j < n; j++) {
|
||||
if (slices[j].size == 0)
|
||||
continue;
|
||||
|
||||
- /* Skip all contained slices */
|
||||
- if (slices[j].container > 0) {
|
||||
- c++;
|
||||
- continue;
|
||||
- }
|
||||
-
|
||||
if (safe_sprintf(partname, "%s%s%d",
|
||||
mapname, delim, j+1)) {
|
||||
fprintf(stderr, "partname too small\n");
|
||||
@@ -512,72 +487,6 @@ main(int argc, char **argv){
|
||||
slices[j].minor, slices[j].size,
|
||||
DM_TARGET, params);
|
||||
}
|
||||
- /* Loop to resolve contained slices */
|
||||
- d = c;
|
||||
- while (c) {
|
||||
- for (j = 0; j < n; j++) {
|
||||
- uint64_t start;
|
||||
- int k = slices[j].container - 1;
|
||||
-
|
||||
- if (slices[j].size == 0)
|
||||
- continue;
|
||||
-
|
||||
- /* Skip all existing slices */
|
||||
- if (slices[j].minor > 0)
|
||||
- continue;
|
||||
-
|
||||
- /* Skip all simple slices */
|
||||
- if (slices[j].container == 0)
|
||||
- continue;
|
||||
-
|
||||
- /* Check container slice */
|
||||
- if (slices[k].size == 0)
|
||||
- fprintf(stderr, "Invalid slice %d\n",
|
||||
- k);
|
||||
-
|
||||
- if (safe_sprintf(partname, "%s%s%d",
|
||||
- mapname, delim, j+1)) {
|
||||
- fprintf(stderr, "partname too small\n");
|
||||
- exit(1);
|
||||
- }
|
||||
- strip_slash(partname);
|
||||
-
|
||||
- start = slices[j].start - slices[k].start;
|
||||
- if (safe_sprintf(params, "%d:%d %" PRIu64,
|
||||
- slices[k].major,
|
||||
- slices[k].minor,
|
||||
- start)) {
|
||||
- fprintf(stderr, "params too small\n");
|
||||
- exit(1);
|
||||
- }
|
||||
-
|
||||
- op = (dm_map_present(partname) ?
|
||||
- DM_DEVICE_RELOAD : DM_DEVICE_CREATE);
|
||||
-
|
||||
- dm_addmap(op, partname, DM_TARGET, params,
|
||||
- slices[j].size, ro, uuid, j+1,
|
||||
- buf.st_mode & 0777,
|
||||
- buf.st_uid, buf.st_gid,
|
||||
- &cookie);
|
||||
-
|
||||
- if (op == DM_DEVICE_RELOAD)
|
||||
- dm_simplecmd(DM_DEVICE_RESUME,
|
||||
- partname, 1,
|
||||
- &cookie);
|
||||
-
|
||||
- dm_devn(partname, &slices[j].major,
|
||||
- &slices[j].minor);
|
||||
-
|
||||
- if (verbose)
|
||||
- printf("add map %s : 0 %" PRIu64 " %s %s\n",
|
||||
- partname, slices[j].size,
|
||||
- DM_TARGET, params);
|
||||
- c--;
|
||||
- }
|
||||
- /* Terminate loop */
|
||||
- if (d == c)
|
||||
- break;
|
||||
- }
|
||||
|
||||
if (what == ADD) {
|
||||
/* Skip code that removes devmappings for deleted partitions */
|
||||
Index: multipath-tools-130222/kpartx/kpartx.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/kpartx/kpartx.h
|
||||
+++ multipath-tools-130222/kpartx/kpartx.h
|
||||
@@ -24,7 +24,6 @@
|
||||
struct slice {
|
||||
uint64_t start;
|
||||
uint64_t size;
|
||||
- int container;
|
||||
int major;
|
||||
int minor;
|
||||
};
|
||||
Index: multipath-tools-130222/kpartx/sun.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/kpartx/sun.c
|
||||
+++ multipath-tools-130222/kpartx/sun.c
|
||||
@@ -62,8 +62,8 @@ int
|
||||
read_sun_pt(int fd, struct slice all, struct slice *sp, int ns) {
|
||||
struct sun_disk_label *l;
|
||||
struct sun_raw_part *s;
|
||||
- unsigned int offset = all.start, end;
|
||||
- int i, j, n;
|
||||
+ unsigned int offset = all.start;
|
||||
+ int i, n;
|
||||
char *bp;
|
||||
|
||||
bp = getblock(fd, offset);
|
||||
@@ -95,37 +95,6 @@ read_sun_pt(int fd, struct slice all, st
|
||||
break;
|
||||
}
|
||||
}
|
||||
- /*
|
||||
- * Convention has it that the SUN disklabel will always have
|
||||
- * the 'c' partition spanning the entire disk.
|
||||
- * So we have to check for contained slices.
|
||||
- */
|
||||
- for(i = 0; i < SUN_DISK_MAXPARTITIONS; i++) {
|
||||
- if (sp[i].size == 0)
|
||||
- continue;
|
||||
-
|
||||
- end = sp[i].start + sp[i].size;
|
||||
- for(j = 0; j < SUN_DISK_MAXPARTITIONS; j ++) {
|
||||
- if ( i == j )
|
||||
- continue;
|
||||
- if (sp[j].size == 0)
|
||||
- continue;
|
||||
-
|
||||
- if (sp[i].start < sp[j].start) {
|
||||
- if (end > sp[j].start &&
|
||||
- end < sp[j].start + sp[j].size) {
|
||||
- /* Invalid slice */
|
||||
- fprintf(stderr,
|
||||
- "sun_disklabel: slice %d overlaps with %d\n", i , j);
|
||||
- sp[i].size = 0;
|
||||
- }
|
||||
- } else {
|
||||
- if (end <= sp[j].start + sp[j].size) {
|
||||
- sp[i].container = j + 1;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
return n;
|
||||
}
|
||||
|
||||
84
0009-RH-attempt-to-get-ANA-info-via-sysfs-first.patch
Normal file
84
0009-RH-attempt-to-get-ANA-info-via-sysfs-first.patch
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
From 335b8eb2773b07a602e84e14c1f3e289a9b25b5a Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Thu, 11 Apr 2019 13:25:42 -0500
|
||||
Subject: [PATCH] RH: attempt to get ANA info via sysfs first
|
||||
|
||||
When the ANA prioritizer is run, first see if the "ana_state" sysfs file
|
||||
exists, and if it does, try to read the state from there. If that fails,
|
||||
fallback to using an ioctl.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/prioritizers/ana.c | 31 +++++++++++++++++++++++++++++--
|
||||
1 file changed, 29 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libmultipath/prioritizers/ana.c b/libmultipath/prioritizers/ana.c
|
||||
index 34527b22..4eaa3cc3 100644
|
||||
--- a/libmultipath/prioritizers/ana.c
|
||||
+++ b/libmultipath/prioritizers/ana.c
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "prio.h"
|
||||
#include "util.h"
|
||||
#include "structs.h"
|
||||
+#include "sysfs.h"
|
||||
|
||||
enum {
|
||||
ANA_ERR_GETCTRL_FAILED = 1,
|
||||
@@ -35,6 +36,7 @@ enum {
|
||||
ANA_ERR_GETNS_FAILED,
|
||||
ANA_ERR_NO_MEMORY,
|
||||
ANA_ERR_NO_INFORMATION,
|
||||
+ ANA_ERR_INVALID_STATE,
|
||||
};
|
||||
|
||||
static const char *ana_errmsg[] = {
|
||||
@@ -48,6 +50,7 @@ static const char *ana_errmsg[] = {
|
||||
[ANA_ERR_GETNS_FAILED] = "couldn't get namespace info",
|
||||
[ANA_ERR_NO_MEMORY] = "out of memory",
|
||||
[ANA_ERR_NO_INFORMATION] = "invalid fd",
|
||||
+ [ANA_ERR_INVALID_STATE] = "invalid state",
|
||||
};
|
||||
|
||||
static const char *anas_string[] = {
|
||||
@@ -106,6 +109,27 @@ static int get_ana_state(__u32 nsid, __u32 anagrpid, void *ana_log,
|
||||
return -ANA_ERR_GETANAS_NOTFOUND;
|
||||
}
|
||||
|
||||
+static int get_ana_info_sysfs(struct path *pp)
|
||||
+{
|
||||
+ char state[32];
|
||||
+
|
||||
+ if (!pp->udev || sysfs_attr_get_value(pp->udev, "ana_state", state,
|
||||
+ sizeof(state)) <= 0)
|
||||
+ return -ANA_ERR_NO_INFORMATION;
|
||||
+
|
||||
+ if (strcmp(state, "optimized") == 0)
|
||||
+ return NVME_ANA_OPTIMIZED;
|
||||
+ if (strcmp(state, "non-optimized") == 0)
|
||||
+ return NVME_ANA_NONOPTIMIZED;
|
||||
+ if (strcmp(state, "inaccessible") == 0)
|
||||
+ return NVME_ANA_INACCESSIBLE;
|
||||
+ if (strcmp(state, "persistent-loss") == 0)
|
||||
+ return NVME_ANA_PERSISTENT_LOSS;
|
||||
+ if (strcmp(state, "change") == 0)
|
||||
+ return NVME_ANA_CHANGE;
|
||||
+ return -ANA_ERR_INVALID_STATE;
|
||||
+}
|
||||
+
|
||||
static int get_ana_info(struct path * pp)
|
||||
{
|
||||
int rc;
|
||||
@@ -208,8 +232,11 @@ int getprio(struct path *pp, __attribute__((unused)) char *args)
|
||||
|
||||
if (pp->fd < 0)
|
||||
rc = -ANA_ERR_NO_INFORMATION;
|
||||
- else
|
||||
- rc = get_ana_info(pp);
|
||||
+ else {
|
||||
+ rc = get_ana_info_sysfs(pp);
|
||||
+ if (rc < 0)
|
||||
+ rc = get_ana_info(pp);
|
||||
+ }
|
||||
|
||||
switch (rc) {
|
||||
case NVME_ANA_OPTIMIZED:
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
---
|
||||
multipathd/main.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
Index: multipath-tools-130222/multipathd/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/main.c
|
||||
+++ multipath-tools-130222/multipathd/main.c
|
||||
@@ -990,7 +990,8 @@ mpvec_garbage_collector (struct vectors
|
||||
return;
|
||||
|
||||
vector_foreach_slot (vecs->mpvec, mpp, i) {
|
||||
- if (mpp && mpp->alias && !dm_map_present(mpp->alias)) {
|
||||
+ if (mpp && mpp->alias && !dm_map_present(mpp->alias) &&
|
||||
+ errno != ENOMEM) {
|
||||
condlog(2, "%s: remove dead map", mpp->alias);
|
||||
remove_map_and_stop_waiter(mpp, vecs, 1);
|
||||
i--;
|
||||
96
0010-RH-make-parse_vpd_pg83-match-scsi_id-output.patch
Normal file
96
0010-RH-make-parse_vpd_pg83-match-scsi_id-output.patch
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
From 137c96d16b6bb03d8a52854e152db4ee36b7d9e4 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Thu, 25 Mar 2021 13:05:10 -0500
|
||||
Subject: [PATCH] RH: make parse_vpd_pg83 match scsi_id output
|
||||
|
||||
Red Hat sets ID_SERIAL based on the result of scsi_id, instead of using
|
||||
the result of sg_inq and 55-scsi-sg3_id.rules. Make parse_vpd_pg83 match
|
||||
that.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/discovery.c | 12 ++----------
|
||||
tests/vpd.c | 6 ++++++
|
||||
2 files changed, 8 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
|
||||
index 31db8758..21cfcc73 100644
|
||||
--- a/libmultipath/discovery.c
|
||||
+++ b/libmultipath/discovery.c
|
||||
@@ -1225,13 +1225,9 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
|
||||
good_len = 8;
|
||||
break;
|
||||
case 2:
|
||||
- /* IEEE Extended: Prio 6 */
|
||||
- new_prio = 6;
|
||||
- good_len = 8;
|
||||
- break;
|
||||
case 3:
|
||||
- /* IEEE Locally assigned: Prio 1 */
|
||||
- new_prio = 1;
|
||||
+ /* IEEE Extended or Locally assigned: Prio 6 */
|
||||
+ new_prio = 6;
|
||||
good_len = 8;
|
||||
break;
|
||||
default:
|
||||
@@ -1249,10 +1245,6 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
|
||||
break;
|
||||
case 0x8:
|
||||
/* SCSI Name: Prio 3 */
|
||||
- invalid = (d[3] < 4 || (memcmp(d + 4, "eui.", 4) &&
|
||||
- memcmp(d + 4, "naa.", 4) &&
|
||||
- memcmp(d + 4, "iqn.", 4)));
|
||||
- new_prio = 3;
|
||||
break;
|
||||
case 0x1:
|
||||
/* T-10 Vendor ID: Prio 2 */
|
||||
diff --git a/tests/vpd.c b/tests/vpd.c
|
||||
index e3212e61..cdb111bb 100644
|
||||
--- a/tests/vpd.c
|
||||
+++ b/tests/vpd.c
|
||||
@@ -232,11 +232,13 @@ static const char * const str_prefix[] = {
|
||||
[STR_IQN] = "iqn.",
|
||||
};
|
||||
|
||||
+#if 0
|
||||
static const char byte0[] = {
|
||||
[STR_EUI] = '2',
|
||||
[STR_NAA] = '3',
|
||||
[STR_IQN] = '8',
|
||||
};
|
||||
+#endif
|
||||
|
||||
/**
|
||||
* create_scsi_string_desc() - create a SCSI name string descriptor.
|
||||
@@ -767,6 +769,7 @@ make_test_vpd_naa(2, 18);
|
||||
make_test_vpd_naa(2, 17);
|
||||
make_test_vpd_naa(2, 16);
|
||||
|
||||
+#if 0
|
||||
/* SCSI Name string: EUI64, WWID size: 17 */
|
||||
make_test_vpd_str(0, 20, 18)
|
||||
make_test_vpd_str(0, 20, 17)
|
||||
@@ -802,6 +805,7 @@ make_test_vpd_str(18, 20, 18)
|
||||
make_test_vpd_str(18, 20, 17)
|
||||
make_test_vpd_str(18, 20, 16)
|
||||
make_test_vpd_str(18, 20, 15)
|
||||
+#endif
|
||||
|
||||
static int test_vpd(void)
|
||||
{
|
||||
@@ -910,6 +914,7 @@ static int test_vpd(void)
|
||||
cmocka_unit_test(test_vpd_naa_2_18),
|
||||
cmocka_unit_test(test_vpd_naa_2_17),
|
||||
cmocka_unit_test(test_vpd_naa_2_16),
|
||||
+/*
|
||||
cmocka_unit_test(test_vpd_str_0_20_18),
|
||||
cmocka_unit_test(test_vpd_str_0_20_17),
|
||||
cmocka_unit_test(test_vpd_str_0_20_16),
|
||||
@@ -934,6 +939,7 @@ static int test_vpd(void)
|
||||
cmocka_unit_test(test_vpd_str_18_20_17),
|
||||
cmocka_unit_test(test_vpd_str_18_20_16),
|
||||
cmocka_unit_test(test_vpd_str_18_20_15),
|
||||
+*/
|
||||
};
|
||||
return cmocka_run_group_tests(tests, setup, teardown);
|
||||
}
|
||||
25
0011-RH-add-scsi-device-handlers-to-modules-load.d.patch
Normal file
25
0011-RH-add-scsi-device-handlers-to-modules-load.d.patch
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
From 374755791536be4870ab2e93ae36549cbaaeb800 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Fri, 25 Mar 2022 18:12:06 -0500
|
||||
Subject: [PATCH] RH: add scsi device handlers to modules-load.d
|
||||
|
||||
Make scsi_dh_alua scsi_dh_emc and scsi_dh_rdac get loaded in early boot.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
Makefile.inc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile.inc b/Makefile.inc
|
||||
index 03aee175..936a622f 100644
|
||||
--- a/Makefile.inc
|
||||
+++ b/Makefile.inc
|
||||
@@ -16,7 +16,7 @@ READLINE :=
|
||||
|
||||
# List of scsi device handler modules to load on boot, e.g.
|
||||
# SCSI_DH_MODULES_PRELOAD := scsi_dh_alua scsi_dh_rdac
|
||||
-SCSI_DH_MODULES_PRELOAD :=
|
||||
+SCSI_DH_MODULES_PRELOAD := scsi_dh_alua scsi_dh_emc scsi_dh_rdac
|
||||
|
||||
EXTRAVERSION := $(shell rev=$$(git rev-parse --short=7 HEAD 2>/dev/null); echo $${rev:+-g$$rev})
|
||||
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
---
|
||||
multipath.conf.annotated | 53 -----------------------------------------------
|
||||
multipath.conf.synthetic | 3 --
|
||||
2 files changed, 56 deletions(-)
|
||||
|
||||
Index: multipath-tools-120123/multipath.conf.annotated
|
||||
===================================================================
|
||||
--- multipath-tools-120123.orig/multipath.conf.annotated
|
||||
+++ multipath-tools-120123/multipath.conf.annotated
|
||||
@@ -186,32 +186,6 @@
|
||||
# user_friendly_names no
|
||||
#
|
||||
# #
|
||||
-# # name : mode
|
||||
-# # scope : multipath & multipathd
|
||||
-# # desc : The mode to use for the multipath device nodes, in octal.
|
||||
-# # values : 0000 - 0777
|
||||
-# # default : determined by the process
|
||||
-# mode 0644
|
||||
-#
|
||||
-# #
|
||||
-# # name : uid
|
||||
-# # scope : multipath & multipathd
|
||||
-# # desc : The user id to use for the multipath device nodes. You
|
||||
-# # may use either the numeric or symbolic uid
|
||||
-# # values : <user_id>
|
||||
-# # default : determined by the process
|
||||
-# uid 0
|
||||
-#
|
||||
-# #
|
||||
-# # name : gid
|
||||
-# # scope : multipath & multipathd
|
||||
-# # desc : The group id to user for the multipath device nodes. You
|
||||
-# # may use either the numeric or symbolic gid
|
||||
-# # values : <group_id>
|
||||
-# # default : determined by the process
|
||||
-# gid disk
|
||||
-#
|
||||
-# #
|
||||
# # name : checker_timeout
|
||||
# # scope : multipath & multipathd
|
||||
# # desc : The timeout to use for path checkers that issue scsi
|
||||
@@ -388,33 +362,6 @@
|
||||
# #
|
||||
# flush_on_last_del yes
|
||||
#
|
||||
-# #
|
||||
-# # name : mode
|
||||
-# # scope : multipath & multipathd
|
||||
-# # desc : The mode to use for the multipath device nodes, in
|
||||
-# # octal.
|
||||
-# # values : 0000 - 0777
|
||||
-# # default : determined by the process
|
||||
-# mode 0644
|
||||
-#
|
||||
-# #
|
||||
-# # name : uid
|
||||
-# # scope : multipath & multipathd
|
||||
-# # desc : The user id to use for the multipath device nodes.
|
||||
-# # You may use either the numeric or symbolic uid
|
||||
-# # values : <user_id>
|
||||
-# # default : determined by the process
|
||||
-# uid 0
|
||||
-#
|
||||
-# #
|
||||
-# # name : gid
|
||||
-# # scope : multipath & multipathd
|
||||
-# # desc : The group id to user for the multipath device nodes.
|
||||
-# # You may use either the numeric or symbolic gid
|
||||
-# # values : <group_id>
|
||||
-# # default : determined by the process
|
||||
-# gid 0
|
||||
-#
|
||||
# }
|
||||
# multipath {
|
||||
# wwid 1DEC_____321816758474
|
||||
Index: multipath-tools-120123/multipath.conf.synthetic
|
||||
===================================================================
|
||||
--- multipath-tools-120123.orig/multipath.conf.synthetic
|
||||
+++ multipath-tools-120123/multipath.conf.synthetic
|
||||
@@ -18,9 +18,6 @@
|
||||
# no_path_retry fail
|
||||
# queue_without_daemon no
|
||||
# user_friendly_names no
|
||||
-# mode 644
|
||||
-# uid 0
|
||||
-# gid disk
|
||||
#}
|
||||
#blacklist {
|
||||
# wwid 26353900f02796769
|
||||
26
0012-RH-compile-with-libreadline-support.patch
Normal file
26
0012-RH-compile-with-libreadline-support.patch
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
From cc15379130e8aa068e97c64afd46be212b456d4f Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Tue, 15 Nov 2022 18:03:33 -0600
|
||||
Subject: [PATCH] RH: compile with libreadline support
|
||||
|
||||
Since the license issue has been resolved, and there are problems with
|
||||
the command completion with libedit, use libreadline.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
Makefile.inc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile.inc b/Makefile.inc
|
||||
index 936a622f..f475f70f 100644
|
||||
--- a/Makefile.inc
|
||||
+++ b/Makefile.inc
|
||||
@@ -12,7 +12,7 @@
|
||||
# Readline library to use, libedit, libreadline, or empty
|
||||
# Caution: Using libreadline may make the multipathd binary undistributable,
|
||||
# see https://github.com/opensvc/multipath-tools/issues/36
|
||||
-READLINE :=
|
||||
+READLINE := libreadline
|
||||
|
||||
# List of scsi device handler modules to load on boot, e.g.
|
||||
# SCSI_DH_MODULES_PRELOAD := scsi_dh_alua scsi_dh_rdac
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
---
|
||||
kpartx/lopart.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/kpartx/lopart.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/kpartx/lopart.c
|
||||
+++ multipath-tools-130222/kpartx/lopart.c
|
||||
@@ -205,13 +205,13 @@ find_unused_loop_device (void)
|
||||
fprintf(stderr,
|
||||
"mount: Could not find any loop device, and, according to %s,\n"
|
||||
" this kernel does not know about the loop device.\n"
|
||||
- " (If so, then recompile or `insmod loop.o'.)",
|
||||
+ " (If so, then recompile or `modprobe loop'.)",
|
||||
PROC_DEVICES);
|
||||
|
||||
else
|
||||
fprintf(stderr,
|
||||
"mount: Could not find any loop device. Maybe this kernel does not know\n"
|
||||
- " about the loop device (then recompile or `insmod loop.o'), or\n"
|
||||
+ " about the loop device (then recompile or `modprobe loop'), or\n"
|
||||
" maybe /dev/loop# has the wrong major number?");
|
||||
|
||||
} else
|
||||
186
0013-RH-Add-mpathcleanup.patch
Normal file
186
0013-RH-Add-mpathcleanup.patch
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
From 2ef5bd86052ba0b22f4d3a16e69cdf268d90a53a Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Fri, 7 Jul 2023 15:25:59 -0500
|
||||
Subject: [PATCH] RH: Add mpathcleanup
|
||||
|
||||
mpathcleanup is a program that will remove a multipath device as well as
|
||||
all of the scsi path devices that make it up.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
multipath/Makefile | 2 +
|
||||
multipath/mpathcleanup | 145 +++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 147 insertions(+)
|
||||
create mode 100755 multipath/mpathcleanup
|
||||
|
||||
diff --git a/multipath/Makefile b/multipath/Makefile
|
||||
index 3dc241cc..47e82234 100644
|
||||
--- a/multipath/Makefile
|
||||
+++ b/multipath/Makefile
|
||||
@@ -25,6 +25,7 @@ install:
|
||||
$(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
|
||||
$(Q)$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
|
||||
$(Q)$(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/
|
||||
+ $(Q)$(INSTALL_PROGRAM) -m 755 mpathcleanup $(DESTDIR)$(bindir)/
|
||||
$(Q)$(INSTALL_PROGRAM) -d $(DESTDIR)$(udevrulesdir)
|
||||
$(Q)$(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir)
|
||||
$(Q)$(INSTALL_PROGRAM) -m 644 99-z-dm-mpath-late.rules $(DESTDIR)$(udevrulesdir)
|
||||
@@ -49,6 +50,7 @@ endif
|
||||
uninstall:
|
||||
$(Q)$(RM) $(DESTDIR)$(bindir)/$(EXEC)
|
||||
$(Q)$(RM) $(DESTDIR)$(bindir)/mpathconf
|
||||
+ $(Q)$(RM) $(DESTDIR)$(bindir)/mpathcleanup
|
||||
$(Q)$(RM) $(DESTDIR)$(udevrulesdir)/11-dm-mpath.rules
|
||||
$(Q)$(RM) $(DESTDIR)$(udevrulesdir)/99-z-dm-mpath-late.rules
|
||||
$(Q)$(RM) $(DESTDIR)$(modulesloaddir)/multipath.conf
|
||||
diff --git a/multipath/mpathcleanup b/multipath/mpathcleanup
|
||||
new file mode 100755
|
||||
index 00000000..6fd921e4
|
||||
--- /dev/null
|
||||
+++ b/multipath/mpathcleanup
|
||||
@@ -0,0 +1,145 @@
|
||||
+#!/bin/bash
|
||||
+#
|
||||
+# Copyright (C) 2023 Red Hat, Inc. All rights reserved.
|
||||
+#
|
||||
+# This file is part of the device-mapper-multipath package.
|
||||
+#
|
||||
+# This copyrighted material is made available to anyone wishing to use,
|
||||
+# modify, copy, or redistribute it subject to the terms and conditions
|
||||
+# of the GNU General Public License v.2.
|
||||
+#
|
||||
+# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
+
|
||||
+unset PROGRAM FLUSH DEVICE DEVNAME MAJOR MINOR PATHDEVS PATHDEV HAVE_MULTIPATHD QUEUEING
|
||||
+
|
||||
+function usage
|
||||
+{
|
||||
+ echo "usage: $PROGRAM [-h] [--flush] <device>"
|
||||
+ echo ""
|
||||
+ echo "remove a multipath device and its scsi path devices"
|
||||
+ echo ""
|
||||
+ echo "options:"
|
||||
+ echo " -h, --help show this help message and exit"
|
||||
+ echo " --flush disable queuing on the multipath device and"
|
||||
+ echo " flush the path devices before removing"
|
||||
+}
|
||||
+
|
||||
+function parse_args
|
||||
+{
|
||||
+ while [ -n "$1" ]; do
|
||||
+ case $1 in
|
||||
+ --flush)
|
||||
+ FLUSH=1
|
||||
+ shift
|
||||
+ ;;
|
||||
+ --help | -h)
|
||||
+ usage
|
||||
+ exit 1
|
||||
+ ;;
|
||||
+ *)
|
||||
+ if [ -n "$DEVICE" ]; then
|
||||
+ usage
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ DEVICE=$1
|
||||
+ shift
|
||||
+ ;;
|
||||
+ esac
|
||||
+ done
|
||||
+}
|
||||
+
|
||||
+function validate_device
|
||||
+{
|
||||
+ if [ -z "$DEVICE" ]; then
|
||||
+ usage
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ if [[ "$DEVICE" =~ ^[[:digit:]]+:[[:digit:]]+$ ]]; then
|
||||
+ MAJOR=${DEVICE%%:*}
|
||||
+ MINOR=${DEVICE##*:}
|
||||
+ DEVNAME=`dmsetup ls --target multipath | grep "($MAJOR, $MINOR)$" | awk '{print $1}'`
|
||||
+ else
|
||||
+ DEVNAME=`dmsetup ls --target multipath | awk '{print $1}' | grep "^$DEVICE$"`
|
||||
+ fi
|
||||
+ if [ -z "$DEVNAME" ]; then
|
||||
+ DEVNAME=`multipath -v 1 -l $DEVICE 2>/dev/null`
|
||||
+ if [ -z "$DEVNAME" ]; then
|
||||
+ echo "$DEVICE is not a multipath device"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ # verify that this is not a native nvme multipath device
|
||||
+ dmsetup ls --target multipath | awk '{print $1}' | grep -q "^$DEVNAME$"
|
||||
+ if test $? -eq 1; then
|
||||
+ echo "$DEVICE is not a device-mapper multipath device"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ fi
|
||||
+ if [ -z "$MINOR" ]; then
|
||||
+ MINOR=`dmsetup info -c --noheadings -o minor $DEVNAME`
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+function get_paths
|
||||
+{
|
||||
+ PATHDEVS=`ls /sys/block/dm-$MINOR/slaves`
|
||||
+ for PATHDEV in $PATHDEVS; do
|
||||
+ if [[ ! "$PATHDEV" =~ ^sd[a-z]+$ ]]; then
|
||||
+ echo "$PATHDEV is not a scsi device. $PROGRAM only works with scsi devices"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ done
|
||||
+}
|
||||
+
|
||||
+function remove_devs
|
||||
+{
|
||||
+ pidof multipathd > /dev/null
|
||||
+ HAVE_MULTIPATHD=$?
|
||||
+ multipath -v2 -l "$DEVNAME" | grep features | grep -q queue_if_no_path
|
||||
+ QUEUEING=$?
|
||||
+ if [ -n "$FLUSH" ] && [ "$QUEUEING" -eq 0 ]; then
|
||||
+ if test $HAVE_MULTIPATHD -eq 0; then
|
||||
+ multipathd disablequeueing map "$DEVNAME" > /dev/null
|
||||
+ else
|
||||
+ dmsetup message "$DEVNAME" 0 fail_if_no_path
|
||||
+ fi
|
||||
+ sleep 1
|
||||
+ fi
|
||||
+ if test $HAVE_MULTIPATHD -eq 0; then
|
||||
+ multipath -f "$DEVNAME"
|
||||
+ else
|
||||
+ multipathd -Df "$DEVNAME"
|
||||
+ fi
|
||||
+ if test $? -eq 1; then
|
||||
+ echo "$DEVICE cannot be removed"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ for PATHDEV in $PATHDEVS; do
|
||||
+ if [ -n "$FLUSH" ]; then
|
||||
+ blockdev --flushbufs /dev/"$PATHDEV"
|
||||
+ fi
|
||||
+ echo 1 > /sys/block/"$PATHDEV"/device/delete
|
||||
+ done
|
||||
+}
|
||||
+
|
||||
+function verify_removal
|
||||
+{
|
||||
+ multipath -v 1 -d $DEVNAME | grep -q "^$DEVNAME$"
|
||||
+ if test $? -eq 0; then
|
||||
+ echo "$DEVICE removed but path devices still exist"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ multipath -v 1 -l $DEVNAME | grep -q "^$DEVNAME$"
|
||||
+ if test $? -eq 0; then
|
||||
+ echo "$DEVICE removal succeeded, but device still exists"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+PROGRAM="$0"
|
||||
+parse_args "$@"
|
||||
+validate_device
|
||||
+get_paths
|
||||
+remove_devs
|
||||
+verify_removal
|
||||
|
|
@ -1,148 +0,0 @@
|
|||
---
|
||||
Makefile.inc | 9 +++++----
|
||||
kpartx/Makefile | 2 +-
|
||||
libmpathpersist/Makefile | 4 ++--
|
||||
libmultipath/Makefile | 1 +
|
||||
libmultipath/checkers/Makefile | 2 +-
|
||||
libmultipath/prioritizers/Makefile | 2 +-
|
||||
multipath/Makefile | 2 +-
|
||||
multipathd/Makefile | 5 +++--
|
||||
8 files changed, 15 insertions(+), 12 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/Makefile.inc
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/Makefile.inc
|
||||
+++ multipath-tools-130222/Makefile.inc
|
||||
@@ -23,15 +23,15 @@ endif
|
||||
|
||||
prefix =
|
||||
exec_prefix = $(prefix)
|
||||
-bindir = $(exec_prefix)/sbin
|
||||
+bindir = $(exec_prefix)/usr/sbin
|
||||
libudevdir = ${prefix}/lib/udev
|
||||
multipathdir = $(TOPDIR)/libmultipath
|
||||
mandir = $(prefix)/usr/share/man/man8
|
||||
man5dir = $(prefix)/usr/share/man/man5
|
||||
man3dir = $(prefix)/usr/share/man/man3
|
||||
rcdir = $(prefix)/etc/rc.d/init.d
|
||||
-syslibdir = $(prefix)/$(LIB)
|
||||
-libdir = $(prefix)/$(LIB)/multipath
|
||||
+syslibdir = $(prefix)/usr/$(LIB)
|
||||
+libdir = $(prefix)/usr/$(LIB)/multipath
|
||||
unitdir = $(prefix)/lib/systemd/system
|
||||
mpathpersistdir = $(TOPDIR)/libmpathpersist
|
||||
|
||||
@@ -42,8 +42,9 @@ ifndef RPM_OPT_FLAGS
|
||||
RPM_OPT_FLAGS = -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4
|
||||
endif
|
||||
|
||||
+LDFLAGS += -Wl,-z,relro
|
||||
OPTFLAGS = $(RPM_OPT_FLAGS) -Wunused -Wstrict-prototypes
|
||||
-CFLAGS = $(OPTFLAGS) -fPIC -DLIB_STRING=\"${LIB}\"
|
||||
+CFLAGS = $(OPTFLAGS) -DLIB_STRING=\"${LIB}\"
|
||||
SHARED_FLAGS = -shared
|
||||
|
||||
%.o: %.c
|
||||
Index: multipath-tools-130222/multipathd/Makefile
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/Makefile
|
||||
+++ multipath-tools-130222/multipathd/Makefile
|
||||
@@ -5,9 +5,10 @@ include ../Makefile.inc
|
||||
#
|
||||
# basic flags setting
|
||||
#
|
||||
-CFLAGS += -I$(multipathdir) -I$(mpathpersistdir)
|
||||
+CFLAGS += -fPIE -DPIE -I$(multipathdir) -I$(mpathpersistdir)
|
||||
LDFLAGS += -lpthread -ldevmapper -lreadline -ludev -ldl \
|
||||
- -L$(multipathdir) -lmultipath -L$(mpathpersistdir) -lmpathpersist
|
||||
+ -L$(multipathdir) -lmultipath -L$(mpathpersistdir) -lmpathpersist \
|
||||
+ -Wl,-z,now -pie
|
||||
|
||||
#
|
||||
# debuging stuff
|
||||
Index: multipath-tools-130222/kpartx/Makefile
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/kpartx/Makefile
|
||||
+++ multipath-tools-130222/kpartx/Makefile
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
include ../Makefile.inc
|
||||
|
||||
-CFLAGS += -I. -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
|
||||
+CFLAGS += -fPIC -I. -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
|
||||
|
||||
LIBDM_API_COOKIE = $(shell grep -Ecs '^[a-z]*[[:space:]]+dm_task_set_cookie' /usr/include/libdevmapper.h)
|
||||
|
||||
Index: multipath-tools-130222/libmpathpersist/Makefile
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmpathpersist/Makefile
|
||||
+++ multipath-tools-130222/libmpathpersist/Makefile
|
||||
@@ -10,7 +10,7 @@ DEVLIB = libmpathpersist.so
|
||||
LIBS = $(DEVLIB).$(SONAME)
|
||||
|
||||
|
||||
-CFLAGS += -I$(multipathdir) -I$(mpathpersistdir)
|
||||
+CFLAGS += -fPIC -I$(multipathdir) -I$(mpathpersistdir)
|
||||
LIBDEPS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath
|
||||
|
||||
OBJS = mpath_persist.o mpath_updatepr.o mpath_pr_ioctl.o
|
||||
@@ -19,7 +19,7 @@ all: $(LIBS)
|
||||
|
||||
|
||||
$(LIBS):
|
||||
- $(CC) -Wall -fPIC -c $(CFLAGS) *.c
|
||||
+ $(CC) -Wall -c $(CFLAGS) *.c
|
||||
$(CC) -shared $(LIBDEPS) -Wl,-soname=$@ $(CFLAGS) -o $@ $(OBJS)
|
||||
ln -s $(LIBS) $(DEVLIB)
|
||||
$(GZIP) mpath_persistent_reserve_in.3 > mpath_persistent_reserve_in.3.gz
|
||||
Index: multipath-tools-130222/libmultipath/Makefile
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/Makefile
|
||||
+++ multipath-tools-130222/libmultipath/Makefile
|
||||
@@ -8,6 +8,7 @@ SONAME=0
|
||||
DEVLIB = libmultipath.so
|
||||
LIBS = $(DEVLIB).$(SONAME)
|
||||
LIBDEPS = -lpthread -ldl -ldevmapper -ludev
|
||||
+CFLAGS += -fPIC
|
||||
|
||||
OBJS = memory.o parser.o vector.o devmapper.o \
|
||||
hwtable.o blacklist.o util.o dmparser.o config.o \
|
||||
Index: multipath-tools-130222/libmultipath/checkers/Makefile
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/checkers/Makefile
|
||||
+++ multipath-tools-130222/libmultipath/checkers/Makefile
|
||||
@@ -14,7 +14,7 @@ LIBS= \
|
||||
libcheckhp_sw.so \
|
||||
libcheckrdac.so
|
||||
|
||||
-CFLAGS += -I..
|
||||
+CFLAGS += -fPIC -I..
|
||||
|
||||
all: $(LIBS)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/prioritizers/Makefile
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/prioritizers/Makefile
|
||||
+++ multipath-tools-130222/libmultipath/prioritizers/Makefile
|
||||
@@ -17,7 +17,7 @@ LIBS = \
|
||||
libprioweightedpath.so \
|
||||
libprioiet.so
|
||||
|
||||
-CFLAGS += -I..
|
||||
+CFLAGS += -fPIC -I..
|
||||
|
||||
all: $(LIBS)
|
||||
|
||||
Index: multipath-tools-130222/multipath/Makefile
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/Makefile
|
||||
+++ multipath-tools-130222/multipath/Makefile
|
||||
@@ -6,7 +6,7 @@ include ../Makefile.inc
|
||||
|
||||
OBJS = main.o
|
||||
|
||||
-CFLAGS += -I$(multipathdir)
|
||||
+CFLAGS += -fPIC -I$(multipathdir)
|
||||
LDFLAGS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath
|
||||
|
||||
EXEC = multipath
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
---
|
||||
kpartx/gpt.c | 9 ++++++---
|
||||
1 file changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
Index: multipath-tools-120821/kpartx/gpt.c
|
||||
===================================================================
|
||||
--- multipath-tools-120821.orig/kpartx/gpt.c
|
||||
+++ multipath-tools-120821/kpartx/gpt.c
|
||||
@@ -637,6 +637,7 @@ read_gpt_pt (int fd, struct slice all, s
|
||||
uint32_t i;
|
||||
int n = 0;
|
||||
int last_used_index=-1;
|
||||
+ int sector_size_mul = get_sector_size(fd)/512;
|
||||
|
||||
if (!find_valid_gpt (fd, &gpt, &ptes) || !gpt || !ptes) {
|
||||
if (gpt)
|
||||
@@ -652,9 +653,11 @@ read_gpt_pt (int fd, struct slice all, s
|
||||
sp[n].size = 0;
|
||||
n++;
|
||||
} else {
|
||||
- sp[n].start = __le64_to_cpu(ptes[i].starting_lba);
|
||||
- sp[n].size = __le64_to_cpu(ptes[i].ending_lba) -
|
||||
- __le64_to_cpu(ptes[i].starting_lba) + 1;
|
||||
+ sp[n].start = sector_size_mul *
|
||||
+ __le64_to_cpu(ptes[i].starting_lba);
|
||||
+ sp[n].size = sector_size_mul *
|
||||
+ (__le64_to_cpu(ptes[i].ending_lba) -
|
||||
+ __le64_to_cpu(ptes[i].starting_lba) + 1);
|
||||
last_used_index=n;
|
||||
n++;
|
||||
}
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
---
|
||||
libmultipath/print.c | 31 +++++++++++++++++++++++++++----
|
||||
1 file changed, 27 insertions(+), 4 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/print.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/print.c
|
||||
+++ multipath-tools-130222/libmultipath/print.c
|
||||
@@ -8,6 +8,8 @@
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
+#include <string.h>
|
||||
+#include <errno.h>
|
||||
|
||||
#include "checkers.h"
|
||||
#include "vector.h"
|
||||
@@ -24,6 +26,7 @@
|
||||
#include "switchgroup.h"
|
||||
#include "devmapper.h"
|
||||
#include "uevent.h"
|
||||
+#include "debug.h"
|
||||
|
||||
#define MAX(x,y) (x > y) ? x : y
|
||||
#define TAIL (line + len - 1 - c)
|
||||
@@ -754,12 +757,32 @@ snprint_pathgroup (char * line, int len,
|
||||
extern void
|
||||
print_multipath_topology (struct multipath * mpp, int verbosity)
|
||||
{
|
||||
- char buff[MAX_LINE_LEN * MAX_LINES] = {};
|
||||
+ int resize;
|
||||
+ char *buff = NULL;
|
||||
+ char *old = NULL;
|
||||
+ int len, maxlen = MAX_LINE_LEN * MAX_LINES;
|
||||
|
||||
- memset(&buff[0], 0, MAX_LINE_LEN * MAX_LINES);
|
||||
- snprint_multipath_topology(&buff[0], MAX_LINE_LEN * MAX_LINES,
|
||||
- mpp, verbosity);
|
||||
+ buff = MALLOC(maxlen);
|
||||
+ do {
|
||||
+ if (!buff) {
|
||||
+ if (old)
|
||||
+ FREE(old);
|
||||
+ condlog(0, "couldn't allocate memory for list: %s\n",
|
||||
+ strerror(errno));
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ len = snprint_multipath_topology(buff, maxlen, mpp, verbosity);
|
||||
+ resize = (len == maxlen - 1);
|
||||
+
|
||||
+ if (resize) {
|
||||
+ maxlen *= 2;
|
||||
+ old = buff;
|
||||
+ buff = REALLOC(buff, maxlen);
|
||||
+ }
|
||||
+ } while (resize);
|
||||
printf("%s", buff);
|
||||
+ FREE(buff);
|
||||
}
|
||||
|
||||
extern int
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
---
|
||||
libmultipath/discovery.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/discovery.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/discovery.c
|
||||
+++ multipath-tools-130222/libmultipath/discovery.c
|
||||
@@ -898,7 +898,8 @@ get_state (struct path * pp, int daemon)
|
||||
c->timeout = DEF_TIMEOUT;
|
||||
state = checker_check(c);
|
||||
condlog(3, "%s: state = %s", pp->dev, checker_state_name(state));
|
||||
- if (state != PATH_UP && strlen(checker_message(c)))
|
||||
+ if (state != PATH_UP && state != PATH_GHOST &&
|
||||
+ strlen(checker_message(c)))
|
||||
condlog(3, "%s: checker msg is \"%s\"",
|
||||
pp->dev, checker_message(c));
|
||||
return state;
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
---
|
||||
libmultipath/config.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/config.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/config.c
|
||||
+++ multipath-tools-130222/libmultipath/config.c
|
||||
@@ -437,6 +437,8 @@ restart:
|
||||
merge_hwe(hwe2, hwe1);
|
||||
if (hwe_strmatch(hwe2, hwe1) == 0) {
|
||||
vector_del_slot(hw, i);
|
||||
+ free_hwe(hwe1);
|
||||
+ n -= 1;
|
||||
/*
|
||||
* Play safe here; we have modified
|
||||
* the original vector so the outer
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
---
|
||||
libmpathpersist/mpath_updatepr.c | 3 ++-
|
||||
libmultipath/uxsock.c | 4 ++--
|
||||
2 files changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmpathpersist/mpath_updatepr.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmpathpersist/mpath_updatepr.c
|
||||
+++ multipath-tools-130222/libmpathpersist/mpath_updatepr.c
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <debug.h>
|
||||
#include "memory.h"
|
||||
#include "../libmultipath/uxsock.h"
|
||||
+#include "../libmultipath/defaults.h"
|
||||
|
||||
unsigned long mem_allocated; /* Total memory used in Bytes */
|
||||
|
||||
@@ -25,7 +26,7 @@ int update_prflag(char * arg1, char * ar
|
||||
size_t len;
|
||||
int ret = 0;
|
||||
|
||||
- fd = ux_socket_connect("/var/run/multipathd.sock");
|
||||
+ fd = ux_socket_connect(DEFAULT_SOCKET);
|
||||
if (fd == -1) {
|
||||
condlog (0, "ux socket connect error");
|
||||
return 1 ;
|
||||
Index: multipath-tools-130222/libmultipath/uxsock.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/uxsock.c
|
||||
+++ multipath-tools-130222/libmultipath/uxsock.c
|
||||
@@ -31,7 +31,7 @@ int ux_socket_connect(const char *name)
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sun_family = AF_LOCAL;
|
||||
addr.sun_path[0] = '\0';
|
||||
- len = strlen(name) + 1;
|
||||
+ len = strlen(name) + 1 + sizeof(sa_family_t);
|
||||
strncpy(&addr.sun_path[1], name, len);
|
||||
|
||||
fd = socket(AF_LOCAL, SOCK_STREAM, 0);
|
||||
@@ -62,7 +62,7 @@ int ux_socket_listen(const char *name)
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sun_family = AF_LOCAL;
|
||||
addr.sun_path[0] = '\0';
|
||||
- len = strlen(name) + 1;
|
||||
+ len = strlen(name) + 1 + sizeof(sa_family_t);
|
||||
strncpy(&addr.sun_path[1], name, len);
|
||||
|
||||
if (bind(fd, (struct sockaddr *)&addr, len) == -1) {
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
---
|
||||
libmultipath/uevent.c | 12 ++++--------
|
||||
1 file changed, 4 insertions(+), 8 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/uevent.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/uevent.c
|
||||
+++ multipath-tools-130222/libmultipath/uevent.c
|
||||
@@ -53,8 +53,10 @@ typedef int (uev_trigger)(struct uevent
|
||||
|
||||
pthread_t uevq_thr;
|
||||
LIST_HEAD(uevq);
|
||||
-pthread_mutex_t uevq_lock, *uevq_lockp = &uevq_lock;
|
||||
-pthread_cond_t uev_cond, *uev_condp = &uev_cond;
|
||||
+pthread_mutex_t uevq_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
+pthread_mutex_t *uevq_lockp = &uevq_lock;
|
||||
+pthread_cond_t uev_cond = PTHREAD_COND_INITIALIZER;
|
||||
+pthread_cond_t *uev_condp = &uev_cond;
|
||||
uev_trigger *my_uev_trigger;
|
||||
void * my_trigger_data;
|
||||
int servicing_uev;
|
||||
@@ -409,10 +411,6 @@ int uevent_listen(void)
|
||||
* thereby not getting to empty the socket's receive buffer queue
|
||||
* often enough.
|
||||
*/
|
||||
- INIT_LIST_HEAD(&uevq);
|
||||
-
|
||||
- pthread_mutex_init(uevq_lockp, NULL);
|
||||
- pthread_cond_init(uev_condp, NULL);
|
||||
pthread_cleanup_push(uevq_stop, NULL);
|
||||
|
||||
monitor = udev_monitor_new_from_netlink(conf->udev, "udev");
|
||||
@@ -525,8 +523,6 @@ out:
|
||||
if (need_failback)
|
||||
err = failback_listen();
|
||||
pthread_cleanup_pop(1);
|
||||
- pthread_mutex_destroy(uevq_lockp);
|
||||
- pthread_cond_destroy(uev_condp);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
---
|
||||
multipath/multipath.rules | 2 ++
|
||||
multipathd/multipathd.service | 1 +
|
||||
2 files changed, 3 insertions(+)
|
||||
|
||||
Index: multipath-tools-130222/multipath/multipath.rules
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/multipath.rules
|
||||
+++ multipath-tools-130222/multipath/multipath.rules
|
||||
@@ -2,6 +2,8 @@
|
||||
# so name them after their devmap name
|
||||
SUBSYSTEM!="block", GOTO="end_mpath"
|
||||
|
||||
+IMPORT{cmdline}="nompath"
|
||||
+ENV{nompath}=="?*", GOTO="end_mpath"
|
||||
ENV{MPATH_SBIN_PATH}="/sbin"
|
||||
TEST!="$env{MPATH_SBIN_PATH}/multipath", ENV{MPATH_SBIN_PATH}="/usr/sbin"
|
||||
|
||||
Index: multipath-tools-130222/multipathd/multipathd.service
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/multipathd.service
|
||||
+++ multipath-tools-130222/multipathd/multipathd.service
|
||||
@@ -3,6 +3,7 @@ Description=Device-Mapper Multipath Devi
|
||||
Before=iscsi.service iscsid.service lvm2-activation-early.service
|
||||
After=syslog.target
|
||||
ConditionPathExists=/etc/multipath.conf
|
||||
+ConditionKernelCommandLine=!nompath
|
||||
DefaultDependencies=no
|
||||
Conflicts=shutdown.target
|
||||
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
---
|
||||
multipathd/main.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
Index: multipath-tools-130222/multipathd/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/main.c
|
||||
+++ multipath-tools-130222/multipathd/main.c
|
||||
@@ -1363,6 +1363,7 @@ configure (struct vectors * vecs, int st
|
||||
|
||||
sync_maps_state(mpvec);
|
||||
vector_foreach_slot(mpvec, mpp, i){
|
||||
+ remember_wwid(mpp->wwid);
|
||||
update_map_pr(mpp);
|
||||
}
|
||||
|
||||
|
|
@ -1,239 +0,0 @@
|
|||
---
|
||||
libmultipath/discovery.c | 3 +
|
||||
libmultipath/wwids.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++
|
||||
libmultipath/wwids.h | 1
|
||||
multipath/main.c | 26 ++++++++++++--
|
||||
multipath/multipath.8 | 5 ++
|
||||
5 files changed, 115 insertions(+), 6 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/discovery.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/discovery.c
|
||||
+++ multipath-tools-130222/libmultipath/discovery.c
|
||||
@@ -53,7 +53,8 @@ store_pathinfo (vector pathvec, vector h
|
||||
goto out;
|
||||
}
|
||||
pp->udev = udev_device_ref(udevice);
|
||||
- err = pathinfo(pp, hwtable, flag | DI_BLACKLIST);
|
||||
+ err = pathinfo(pp, hwtable,
|
||||
+ (conf->dry_run == 3)? flag : (flag | DI_BLACKLIST));
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/wwids.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/wwids.c
|
||||
+++ multipath-tools-130222/libmultipath/wwids.c
|
||||
@@ -82,6 +82,92 @@ write_out_wwid(int fd, char *wwid) {
|
||||
}
|
||||
|
||||
int
|
||||
+do_remove_wwid(int fd, char *str) {
|
||||
+ char buf[4097];
|
||||
+ char *ptr;
|
||||
+ off_t start = 0;
|
||||
+ int bytes;
|
||||
+
|
||||
+ while (1) {
|
||||
+ if (lseek(fd, start, SEEK_SET) < 0) {
|
||||
+ condlog(0, "wwid file read lseek failed : %s",
|
||||
+ strerror(errno));
|
||||
+ return -1;
|
||||
+ }
|
||||
+ bytes = read(fd, buf, 4096);
|
||||
+ if (bytes < 0) {
|
||||
+ if (errno == EINTR || errno == EAGAIN)
|
||||
+ continue;
|
||||
+ condlog(0, "failed to read from wwids file : %s",
|
||||
+ strerror(errno));
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (!bytes) /* didn't find wwid to remove */
|
||||
+ return 1;
|
||||
+ buf[bytes] = '\0';
|
||||
+ ptr = strstr(buf, str);
|
||||
+ if (ptr != NULL) {
|
||||
+ condlog(3, "found '%s'", str);
|
||||
+ if (lseek(fd, start + (ptr - buf), SEEK_SET) < 0) {
|
||||
+ condlog(0, "write lseek failed : %s",
|
||||
+ strerror(errno));
|
||||
+ return -1;
|
||||
+ }
|
||||
+ while (1) {
|
||||
+ if (write(fd, "#", 1) < 0) {
|
||||
+ if (errno == EINTR || errno == EAGAIN)
|
||||
+ continue;
|
||||
+ condlog(0, "failed to write to wwids file : %s", strerror(errno));
|
||||
+ return -1;
|
||||
+ }
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ ptr = strrchr(buf, '\n');
|
||||
+ if (ptr == NULL) { /* shouldn't happen, assume it is EOF */
|
||||
+ condlog(4, "couldn't find newline, assuming end of file");
|
||||
+ return 1;
|
||||
+ }
|
||||
+ start = start + (ptr - buf) + 1;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
+int
|
||||
+remove_wwid(char *wwid) {
|
||||
+ int fd, len, can_write;
|
||||
+ char *str;
|
||||
+ int ret = -1;
|
||||
+
|
||||
+ len = strlen(wwid) + 4; /* two slashes the newline and a zero byte */
|
||||
+ str = malloc(len);
|
||||
+ if (str == NULL) {
|
||||
+ condlog(0, "can't allocate memory to remove wwid : %s",
|
||||
+ strerror(errno));
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (snprintf(str, len, "/%s/\n", wwid) >= len) {
|
||||
+ condlog(0, "string overflow trying to remove wwid");
|
||||
+ goto out;
|
||||
+ }
|
||||
+ condlog(3, "removing line '%s' from wwids file", str);
|
||||
+ fd = open_file(conf->wwids_file, &can_write, WWIDS_FILE_HEADER);
|
||||
+ if (fd < 0)
|
||||
+ goto out;
|
||||
+ if (!can_write) {
|
||||
+ condlog(0, "cannot remove wwid. wwids file is read-only");
|
||||
+ goto out_file;
|
||||
+ }
|
||||
+ ret = do_remove_wwid(fd, str);
|
||||
+
|
||||
+out_file:
|
||||
+ close(fd);
|
||||
+out:
|
||||
+ free(str);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
check_wwids_file(char *wwid, int write_wwid)
|
||||
{
|
||||
int fd, can_write, found, ret;
|
||||
Index: multipath-tools-130222/libmultipath/wwids.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/wwids.h
|
||||
+++ multipath-tools-130222/libmultipath/wwids.h
|
||||
@@ -15,5 +15,6 @@
|
||||
int should_multipath(struct path *pp, vector pathvec);
|
||||
int remember_wwid(char *wwid);
|
||||
int check_wwids_file(char *wwid, int write_wwid);
|
||||
+int remove_wwid(char *wwid);
|
||||
|
||||
#endif /* _WWIDS_H */
|
||||
Index: multipath-tools-130222/multipath/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/main.c
|
||||
+++ multipath-tools-130222/multipath/main.c
|
||||
@@ -83,7 +83,7 @@ usage (char * progname)
|
||||
{
|
||||
fprintf (stderr, VERSION_STRING);
|
||||
fprintf (stderr, "Usage:\n");
|
||||
- fprintf (stderr, " %s [-c] [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
|
||||
+ fprintf (stderr, " %s [-c|-w] [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
|
||||
fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname);
|
||||
fprintf (stderr, " %s -F [-v lvl]\n", progname);
|
||||
fprintf (stderr, " %s -t\n", progname);
|
||||
@@ -104,6 +104,7 @@ usage (char * progname)
|
||||
" -B treat the bindings file as read only\n" \
|
||||
" -p policy failover|multibus|group_by_serial|group_by_prio\n" \
|
||||
" -b fil bindings file location\n" \
|
||||
+ " -w remove a device from the wwids file\n" \
|
||||
" -p pol force all maps to specified path grouping policy :\n" \
|
||||
" . failover one path per priority group\n" \
|
||||
" . multibus all paths in one priority group\n" \
|
||||
@@ -212,7 +213,6 @@ get_dm_mpvec (vector curmp, vector pathv
|
||||
|
||||
if (!conf->dry_run)
|
||||
reinstate_paths(mpp);
|
||||
- remember_wwid(mpp->wwid);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -262,7 +262,7 @@ configure (void)
|
||||
/*
|
||||
* if we have a blacklisted device parameter, exit early
|
||||
*/
|
||||
- if (dev && conf->dev_type == DEV_DEVNODE &&
|
||||
+ if (dev && conf->dev_type == DEV_DEVNODE && conf->dry_run != 3 &&
|
||||
(filter_devnode(conf->blist_devnode,
|
||||
conf->elist_devnode, dev) > 0)) {
|
||||
if (conf->dry_run == 2)
|
||||
@@ -284,6 +284,17 @@ configure (void)
|
||||
condlog(3, "scope is nul");
|
||||
goto out;
|
||||
}
|
||||
+ if (conf->dry_run == 3) {
|
||||
+ r = remove_wwid(refwwid);
|
||||
+ if (r == 0)
|
||||
+ printf("wwid '%s' removed\n", refwwid);
|
||||
+ else if (r == 1) {
|
||||
+ printf("wwid '%s' not in wwids file\n",
|
||||
+ refwwid);
|
||||
+ r = 0;
|
||||
+ }
|
||||
+ goto out;
|
||||
+ }
|
||||
condlog(3, "scope limited to %s", refwwid);
|
||||
if (conf->dry_run == 2) {
|
||||
if (check_wwids_file(refwwid, 0) == 0){
|
||||
@@ -439,7 +450,7 @@ main (int argc, char *argv[])
|
||||
if (dm_prereq())
|
||||
exit(1);
|
||||
|
||||
- while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:Brtq")) != EOF ) {
|
||||
+ while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:Brtqw")) != EOF ) {
|
||||
switch(arg) {
|
||||
case 1: printf("optarg : %s\n",optarg);
|
||||
break;
|
||||
@@ -504,6 +515,9 @@ main (int argc, char *argv[])
|
||||
case 'h':
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
+ case 'w':
|
||||
+ conf->dry_run = 3;
|
||||
+ break;
|
||||
case ':':
|
||||
fprintf(stderr, "Missing option argument\n");
|
||||
usage(argv[0]);
|
||||
@@ -555,6 +569,10 @@ main (int argc, char *argv[])
|
||||
condlog(0, "the -c option requires a path to check");
|
||||
goto out;
|
||||
}
|
||||
+ if (conf->dry_run == 3 && !conf->dev) {
|
||||
+ condlog(0, "the -w option requires a device");
|
||||
+ goto out;
|
||||
+ }
|
||||
if (conf->remove == FLUSH_ONE) {
|
||||
if (conf->dev_type == DEV_DEVMAP) {
|
||||
r = dm_suspend_and_flush_map(conf->dev);
|
||||
Index: multipath-tools-130222/multipath/multipath.8
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/multipath.8
|
||||
+++ multipath-tools-130222/multipath/multipath.8
|
||||
@@ -8,7 +8,7 @@ multipath \- Device mapper target autoco
|
||||
.RB [\| \-b\ \c
|
||||
.IR bindings_file \|]
|
||||
.RB [\| \-d \|]
|
||||
-.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r \|]
|
||||
+.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-w \|]
|
||||
.RB [\| \-p\ \c
|
||||
.BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|]
|
||||
.RB [\| device \|]
|
||||
@@ -68,6 +68,9 @@ check if a block device should be a path
|
||||
.B \-q
|
||||
allow device tables with queue_if_no_path when multipathd is not running
|
||||
.TP
|
||||
+.B \-w
|
||||
+remove the wwid for the specified device from the wwids file
|
||||
+.TP
|
||||
.BI \-p " policy"
|
||||
force new maps to use the specified policy:
|
||||
.RS 1.2i
|
||||
|
|
@ -1,164 +0,0 @@
|
|||
---
|
||||
libmultipath/wwids.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
|
||||
libmultipath/wwids.h | 1 +
|
||||
multipath/main.c | 29 +++++++++++++++++++++++++++--
|
||||
multipath/multipath.8 | 5 ++++-
|
||||
4 files changed, 76 insertions(+), 3 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/wwids.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/wwids.c
|
||||
+++ multipath-tools-130222/libmultipath/wwids.c
|
||||
@@ -82,6 +82,50 @@ write_out_wwid(int fd, char *wwid) {
|
||||
}
|
||||
|
||||
int
|
||||
+replace_wwids(vector mp)
|
||||
+{
|
||||
+ int i, fd, can_write;
|
||||
+ struct multipath * mpp;
|
||||
+ size_t len;
|
||||
+ int ret = -1;
|
||||
+
|
||||
+ fd = open_file(conf->wwids_file, &can_write, WWIDS_FILE_HEADER);
|
||||
+ if (fd < 0)
|
||||
+ goto out;
|
||||
+ if (!can_write) {
|
||||
+ condlog(0, "cannot replace wwids. wwids file is read-only");
|
||||
+ goto out_file;
|
||||
+ }
|
||||
+ if (ftruncate(fd, 0) < 0) {
|
||||
+ condlog(0, "cannot truncate wwids file : %s", strerror(errno));
|
||||
+ goto out_file;
|
||||
+ }
|
||||
+ len = strlen(WWIDS_FILE_HEADER);
|
||||
+ if (write_all(fd, WWIDS_FILE_HEADER, len) != len) {
|
||||
+ condlog(0, "Can't write wwid file header : %s",
|
||||
+ strerror(errno));
|
||||
+ /* cleanup partially written header */
|
||||
+ if (ftruncate(fd, 0) < 0)
|
||||
+ condlog(0, "Cannot truncate header : %s",
|
||||
+ strerror(errno));
|
||||
+ goto out_file;
|
||||
+ }
|
||||
+ if (!mp || !mp->allocated) {
|
||||
+ ret = 0;
|
||||
+ goto out_file;
|
||||
+ }
|
||||
+ vector_foreach_slot(mp, mpp, i) {
|
||||
+ if (write_out_wwid(fd, mpp->wwid) < 0)
|
||||
+ goto out_file;
|
||||
+ }
|
||||
+ ret = 0;
|
||||
+out_file:
|
||||
+ close(fd);
|
||||
+out:
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
do_remove_wwid(int fd, char *str) {
|
||||
char buf[4097];
|
||||
char *ptr;
|
||||
Index: multipath-tools-130222/libmultipath/wwids.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/wwids.h
|
||||
+++ multipath-tools-130222/libmultipath/wwids.h
|
||||
@@ -16,5 +16,6 @@ int should_multipath(struct path *pp, ve
|
||||
int remember_wwid(char *wwid);
|
||||
int check_wwids_file(char *wwid, int write_wwid);
|
||||
int remove_wwid(char *wwid);
|
||||
+int replace_wwids(vector mp);
|
||||
|
||||
#endif /* _WWIDS_H */
|
||||
Index: multipath-tools-130222/multipath/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/main.c
|
||||
+++ multipath-tools-130222/multipath/main.c
|
||||
@@ -83,7 +83,7 @@ usage (char * progname)
|
||||
{
|
||||
fprintf (stderr, VERSION_STRING);
|
||||
fprintf (stderr, "Usage:\n");
|
||||
- fprintf (stderr, " %s [-c|-w] [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
|
||||
+ fprintf (stderr, " %s [-c|-w|-W] [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
|
||||
fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname);
|
||||
fprintf (stderr, " %s -F [-v lvl]\n", progname);
|
||||
fprintf (stderr, " %s -t\n", progname);
|
||||
@@ -105,6 +105,7 @@ usage (char * progname)
|
||||
" -p policy failover|multibus|group_by_serial|group_by_prio\n" \
|
||||
" -b fil bindings file location\n" \
|
||||
" -w remove a device from the wwids file\n" \
|
||||
+ " -W reset the wwids file include only the current devices\n" \
|
||||
" -p pol force all maps to specified path grouping policy :\n" \
|
||||
" . failover one path per priority group\n" \
|
||||
" . multibus all paths in one priority group\n" \
|
||||
@@ -450,7 +451,7 @@ main (int argc, char *argv[])
|
||||
if (dm_prereq())
|
||||
exit(1);
|
||||
|
||||
- while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:Brtqw")) != EOF ) {
|
||||
+ while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:BrtqwW")) != EOF ) {
|
||||
switch(arg) {
|
||||
case 1: printf("optarg : %s\n",optarg);
|
||||
break;
|
||||
@@ -518,6 +519,9 @@ main (int argc, char *argv[])
|
||||
case 'w':
|
||||
conf->dry_run = 3;
|
||||
break;
|
||||
+ case 'W':
|
||||
+ conf->dry_run = 4;
|
||||
+ break;
|
||||
case ':':
|
||||
fprintf(stderr, "Missing option argument\n");
|
||||
usage(argv[0]);
|
||||
@@ -573,6 +577,27 @@ main (int argc, char *argv[])
|
||||
condlog(0, "the -w option requires a device");
|
||||
goto out;
|
||||
}
|
||||
+ if (conf->dry_run == 4) {
|
||||
+ struct multipath * mpp;
|
||||
+ int i;
|
||||
+ vector curmp;
|
||||
+
|
||||
+ curmp = vector_alloc();
|
||||
+ if (!curmp) {
|
||||
+ condlog(0, "can't allocate memory for mp list");
|
||||
+ goto out;
|
||||
+ }
|
||||
+ if (dm_get_maps(curmp) == 0)
|
||||
+ r = replace_wwids(curmp);
|
||||
+ if (r == 0)
|
||||
+ printf("successfully reset wwids\n");
|
||||
+ vector_foreach_slot_backwards(curmp, mpp, i) {
|
||||
+ vector_del_slot(curmp, i);
|
||||
+ free_multipath(mpp, KEEP_PATHS);
|
||||
+ }
|
||||
+ vector_free(curmp);
|
||||
+ goto out;
|
||||
+ }
|
||||
if (conf->remove == FLUSH_ONE) {
|
||||
if (conf->dev_type == DEV_DEVMAP) {
|
||||
r = dm_suspend_and_flush_map(conf->dev);
|
||||
Index: multipath-tools-130222/multipath/multipath.8
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/multipath.8
|
||||
+++ multipath-tools-130222/multipath/multipath.8
|
||||
@@ -8,7 +8,7 @@ multipath \- Device mapper target autoco
|
||||
.RB [\| \-b\ \c
|
||||
.IR bindings_file \|]
|
||||
.RB [\| \-d \|]
|
||||
-.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-w \|]
|
||||
+.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-w | \-W \|]
|
||||
.RB [\| \-p\ \c
|
||||
.BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|]
|
||||
.RB [\| device \|]
|
||||
@@ -71,6 +71,9 @@ allow device tables with queue_if_no_pat
|
||||
.B \-w
|
||||
remove the wwid for the specified device from the wwids file
|
||||
.TP
|
||||
+.B \-W
|
||||
+reset the wwids file to only include the current multipath devices
|
||||
+.TP
|
||||
.BI \-p " policy"
|
||||
force new maps to use the specified policy:
|
||||
.RS 1.2i
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
---
|
||||
multipathd/main.c | 7 ++++---
|
||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/multipathd/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/main.c
|
||||
+++ multipath-tools-130222/multipathd/main.c
|
||||
@@ -537,7 +537,8 @@ rescan:
|
||||
goto fail_map;
|
||||
|
||||
if (retries >= 0) {
|
||||
- condlog(2, "%s path added to devmap %s", pp->dev, mpp->alias);
|
||||
+ condlog(2, "%s [%s]: path added to devmap %s",
|
||||
+ pp->dev, pp->dev_t, mpp->alias);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
@@ -642,8 +643,8 @@ ev_remove_path (struct path *pp, struct
|
||||
}
|
||||
sync_map_state(mpp);
|
||||
|
||||
- condlog(2, "%s: path removed from map %s",
|
||||
- pp->dev, mpp->alias);
|
||||
+ condlog(2, "%s [%s]: path removed from map %s",
|
||||
+ pp->dev, pp->dev_t, mpp->alias);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
---
|
||||
multipathd/main.c | 7 +++----
|
||||
1 file changed, 3 insertions(+), 4 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/multipathd/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/main.c
|
||||
+++ multipath-tools-130222/multipathd/main.c
|
||||
@@ -1226,11 +1226,10 @@ check_path (struct vectors * vecs, struc
|
||||
pp->checkint = 2 * pp->checkint;
|
||||
else
|
||||
pp->checkint = conf->max_checkint;
|
||||
-
|
||||
- pp->tick = pp->checkint;
|
||||
- condlog(4, "%s: delay next check %is",
|
||||
- pp->dev_t, pp->tick);
|
||||
}
|
||||
+ pp->tick = pp->checkint;
|
||||
+ condlog(4, "%s: delay next check %is",
|
||||
+ pp->dev_t, pp->tick);
|
||||
}
|
||||
}
|
||||
else if (newstate == PATH_DOWN) {
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
---
|
||||
libmultipath/structs_vec.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/structs_vec.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/structs_vec.c
|
||||
+++ multipath-tools-130222/libmultipath/structs_vec.c
|
||||
@@ -106,7 +106,7 @@ orphan_paths (vector pathvec, struct mul
|
||||
static void
|
||||
set_multipath_wwid (struct multipath * mpp)
|
||||
{
|
||||
- if (mpp->wwid)
|
||||
+ if (strlen(mpp->wwid))
|
||||
return;
|
||||
|
||||
dm_get_uuid(mpp->alias, mpp->wwid);
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
---
|
||||
libmultipath/discovery.c | 2 +-
|
||||
multipathd/main.c | 19 ++++++++++++++++++-
|
||||
2 files changed, 19 insertions(+), 2 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/discovery.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/discovery.c
|
||||
+++ multipath-tools-130222/libmultipath/discovery.c
|
||||
@@ -1034,7 +1034,7 @@ pathinfo (struct path *pp, vector hwtabl
|
||||
}
|
||||
}
|
||||
|
||||
- if (path_state == PATH_UP && (mask & DI_WWID) && !strlen(pp->wwid))
|
||||
+ if ((mask & DI_WWID) && !strlen(pp->wwid))
|
||||
get_uid(pp);
|
||||
if (mask & DI_BLACKLIST && mask & DI_WWID) {
|
||||
if (filter_wwid(conf->blist_wwid, conf->elist_wwid,
|
||||
Index: multipath-tools-130222/multipathd/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/main.c
|
||||
+++ multipath-tools-130222/multipathd/main.c
|
||||
@@ -376,7 +376,7 @@ static int
|
||||
uev_add_path (struct uevent *uev, struct vectors * vecs)
|
||||
{
|
||||
struct path *pp;
|
||||
- int ret;
|
||||
+ int ret, i;
|
||||
|
||||
condlog(2, "%s: add path (uevent)", uev->kernel);
|
||||
if (strstr(uev->kernel, "..") != NULL) {
|
||||
@@ -393,6 +393,23 @@ uev_add_path (struct uevent *uev, struct
|
||||
uev->kernel);
|
||||
if (pp->mpp)
|
||||
return 0;
|
||||
+ if (!strlen(pp->wwid)) {
|
||||
+ udev_device_unref(pp->udev);
|
||||
+ pp->udev = udev_device_ref(uev->udev);
|
||||
+ ret = pathinfo(pp, conf->hwtable,
|
||||
+ DI_ALL | DI_BLACKLIST);
|
||||
+ if (ret == 2) {
|
||||
+ i = find_slot(vecs->pathvec, (void *)pp);
|
||||
+ if (i != -1)
|
||||
+ vector_del_slot(vecs->pathvec, i);
|
||||
+ free_path(pp);
|
||||
+ return 0;
|
||||
+ } else if (ret == 1) {
|
||||
+ condlog(0, "%s: failed to reinitialize path",
|
||||
+ uev->kernel);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ }
|
||||
} else {
|
||||
/*
|
||||
* get path vital state
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
---
|
||||
libmultipath/prio.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/prio.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/prio.c
|
||||
+++ multipath-tools-130222/libmultipath/prio.c
|
||||
@@ -162,7 +162,10 @@ void prio_put (struct prio * dst)
|
||||
if (!dst)
|
||||
return;
|
||||
|
||||
- src = prio_lookup(dst->name);
|
||||
+ if (!strlen(dst->name))
|
||||
+ src = NULL;
|
||||
+ else
|
||||
+ src = prio_lookup(dst->name);
|
||||
memset(dst, 0x0, sizeof(struct prio));
|
||||
free_prio(src);
|
||||
}
|
||||
|
|
@ -1,200 +0,0 @@
|
|||
---
|
||||
libmultipath/dict.c | 10 ++++------
|
||||
libmultipath/structs.h | 2 +-
|
||||
multipathd/cli.c | 3 +++
|
||||
multipathd/cli.h | 2 ++
|
||||
multipathd/cli_handlers.c | 18 ++++++++++++++++++
|
||||
multipathd/cli_handlers.h | 2 ++
|
||||
multipathd/main.c | 2 ++
|
||||
multipathd/multipathd.init.redhat | 14 ++++++++++----
|
||||
8 files changed, 42 insertions(+), 11 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/dict.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/dict.c
|
||||
+++ multipath-tools-130222/libmultipath/dict.c
|
||||
@@ -438,14 +438,11 @@ def_queue_without_daemon(vector strvec)
|
||||
if (!buff)
|
||||
return 1;
|
||||
|
||||
- if (!strncmp(buff, "off", 3) || !strncmp(buff, "no", 2) ||
|
||||
- !strncmp(buff, "0", 1))
|
||||
- conf->queue_without_daemon = QUE_NO_DAEMON_OFF;
|
||||
- else if (!strncmp(buff, "on", 2) || !strncmp(buff, "yes", 3) ||
|
||||
+ if (!strncmp(buff, "on", 2) || !strncmp(buff, "yes", 3) ||
|
||||
!strncmp(buff, "1", 1))
|
||||
conf->queue_without_daemon = QUE_NO_DAEMON_ON;
|
||||
else
|
||||
- conf->queue_without_daemon = QUE_NO_DAEMON_UNDEF;
|
||||
+ conf->queue_without_daemon = QUE_NO_DAEMON_OFF;
|
||||
|
||||
free(buff);
|
||||
return 0;
|
||||
@@ -2670,8 +2667,9 @@ snprint_def_queue_without_daemon (char *
|
||||
case QUE_NO_DAEMON_OFF:
|
||||
return snprintf(buff, len, "\"no\"");
|
||||
case QUE_NO_DAEMON_ON:
|
||||
- case QUE_NO_DAEMON_UNDEF:
|
||||
return snprintf(buff, len, "\"yes\"");
|
||||
+ case QUE_NO_DAEMON_FORCE:
|
||||
+ return snprintf(buff, len, "\"forced\"");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Index: multipath-tools-130222/libmultipath/structs.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/structs.h
|
||||
+++ multipath-tools-130222/libmultipath/structs.h
|
||||
@@ -67,9 +67,9 @@ enum pgstates {
|
||||
};
|
||||
|
||||
enum queue_without_daemon_states {
|
||||
- QUE_NO_DAEMON_UNDEF,
|
||||
QUE_NO_DAEMON_OFF,
|
||||
QUE_NO_DAEMON_ON,
|
||||
+ QUE_NO_DAEMON_FORCE,
|
||||
};
|
||||
|
||||
enum pgtimeouts {
|
||||
Index: multipath-tools-130222/multipathd/cli.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/cli.c
|
||||
+++ multipath-tools-130222/multipathd/cli.c
|
||||
@@ -162,6 +162,7 @@ load_keys (void)
|
||||
r += add_key(keys, "resize", RESIZE, 0);
|
||||
r += add_key(keys, "reset", RESET, 0);
|
||||
r += add_key(keys, "reload", RELOAD, 0);
|
||||
+ r += add_key(keys, "forcequeueing", FORCEQ, 0);
|
||||
r += add_key(keys, "disablequeueing", DISABLEQ, 0);
|
||||
r += add_key(keys, "restorequeueing", RESTOREQ, 0);
|
||||
r += add_key(keys, "paths", PATHS, 0);
|
||||
@@ -459,6 +460,8 @@ cli_init (void) {
|
||||
add_handler(GETPRSTATUS+MAP, NULL);
|
||||
add_handler(SETPRSTATUS+MAP, NULL);
|
||||
add_handler(UNSETPRSTATUS+MAP, NULL);
|
||||
+ add_handler(FORCEQ+DAEMON, NULL);
|
||||
+ add_handler(RESTOREQ+DAEMON, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Index: multipath-tools-130222/multipathd/cli.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/cli.h
|
||||
+++ multipath-tools-130222/multipathd/cli.h
|
||||
@@ -10,6 +10,7 @@ enum {
|
||||
__RESIZE,
|
||||
__RESET,
|
||||
__RELOAD,
|
||||
+ __FORCEQ,
|
||||
__DISABLEQ,
|
||||
__RESTOREQ,
|
||||
__PATHS,
|
||||
@@ -45,6 +46,7 @@ enum {
|
||||
#define RESIZE (1 << __RESIZE)
|
||||
#define RESET (1 << __RESET)
|
||||
#define RELOAD (1 << __RELOAD)
|
||||
+#define FORCEQ (1 << __FORCEQ)
|
||||
#define DISABLEQ (1 << __DISABLEQ)
|
||||
#define RESTOREQ (1 << __RESTOREQ)
|
||||
#define PATHS (1 << __PATHS)
|
||||
Index: multipath-tools-130222/multipathd/cli_handlers.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/cli_handlers.c
|
||||
+++ multipath-tools-130222/multipathd/cli_handlers.c
|
||||
@@ -628,6 +628,24 @@ cli_resize(void *v, char **reply, int *l
|
||||
}
|
||||
|
||||
int
|
||||
+cli_force_no_daemon_q(void * v, char ** reply, int * len, void * data)
|
||||
+{
|
||||
+ condlog(2, "force queue_without_daemon (operator)");
|
||||
+ if (conf->queue_without_daemon == QUE_NO_DAEMON_OFF)
|
||||
+ conf->queue_without_daemon = QUE_NO_DAEMON_FORCE;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+cli_restore_no_daemon_q(void * v, char ** reply, int * len, void * data)
|
||||
+{
|
||||
+ condlog(2, "restore queue_without_daemon (operator)");
|
||||
+ if (conf->queue_without_daemon == QUE_NO_DAEMON_FORCE)
|
||||
+ conf->queue_without_daemon = QUE_NO_DAEMON_OFF;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
cli_restore_queueing(void *v, char **reply, int *len, void *data)
|
||||
{
|
||||
struct vectors * vecs = (struct vectors *)data;
|
||||
Index: multipath-tools-130222/multipathd/cli_handlers.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/cli_handlers.h
|
||||
+++ multipath-tools-130222/multipathd/cli_handlers.h
|
||||
@@ -28,6 +28,8 @@ int cli_suspend(void * v, char ** reply,
|
||||
int cli_resume(void * v, char ** reply, int * len, void * data);
|
||||
int cli_reinstate(void * v, char ** reply, int * len, void * data);
|
||||
int cli_fail(void * v, char ** reply, int * len, void * data);
|
||||
+int cli_force_no_daemon_q(void * v, char ** reply, int * len, void * data);
|
||||
+int cli_restore_no_daemon_q(void * v, char ** reply, int * len, void * data);
|
||||
int cli_quit(void * v, char ** reply, int * len, void * data);
|
||||
int cli_shutdown(void * v, char ** reply, int * len, void * data);
|
||||
int cli_reassign (void * v, char ** reply, int * len, void * data);
|
||||
Index: multipath-tools-130222/multipathd/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/main.c
|
||||
+++ multipath-tools-130222/multipathd/main.c
|
||||
@@ -904,6 +904,8 @@ uxlsnrloop (void * ap)
|
||||
set_handler_callback(GETPRSTATUS+MAP, cli_getprstatus);
|
||||
set_handler_callback(SETPRSTATUS+MAP, cli_setprstatus);
|
||||
set_handler_callback(UNSETPRSTATUS+MAP, cli_unsetprstatus);
|
||||
+ set_handler_callback(FORCEQ+DAEMON, cli_force_no_daemon_q);
|
||||
+ set_handler_callback(RESTOREQ+DAEMON, cli_restore_no_daemon_q);
|
||||
|
||||
umask(077);
|
||||
uxsock_listen(&uxsock_trigger, ap);
|
||||
Index: multipath-tools-130222/multipathd/multipathd.init.redhat
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/multipathd.init.redhat
|
||||
+++ multipath-tools-130222/multipathd/multipathd.init.redhat
|
||||
@@ -81,23 +81,28 @@ force_stop() {
|
||||
echo
|
||||
}
|
||||
|
||||
-stop() {
|
||||
+check_root() {
|
||||
root_dev=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/mtab)
|
||||
dm_num=`dmsetup info -c --noheadings -o minor $root_dev 2> /dev/null`
|
||||
if [ $? -eq 0 ]; then
|
||||
root_dm_device="dm-$dm_num"
|
||||
[ -d $syspath/$root_dm_device ] && teardown_slaves $syspath/$root_dm_device
|
||||
fi
|
||||
+}
|
||||
|
||||
- force_stop
|
||||
+force_queue_without_daemon() {
|
||||
+ $DAEMON forcequeueing daemon
|
||||
}
|
||||
|
||||
restart() {
|
||||
- stop
|
||||
+ force_queue_without_daemon
|
||||
+ check_root
|
||||
+ force_stop
|
||||
start
|
||||
}
|
||||
|
||||
force_restart() {
|
||||
+ force_queue_without_daemon
|
||||
force_stop
|
||||
start
|
||||
}
|
||||
@@ -115,7 +120,8 @@ start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
- stop
|
||||
+ check_root
|
||||
+ force_stop
|
||||
;;
|
||||
force-stop)
|
||||
force_stop
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
---
|
||||
kpartx/kpartx.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
Index: multipath-tools-130222/kpartx/kpartx.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/kpartx/kpartx.c
|
||||
+++ multipath-tools-130222/kpartx/kpartx.c
|
||||
@@ -348,7 +348,7 @@ main(int argc, char **argv){
|
||||
if (delim == NULL) {
|
||||
delim = malloc(DELIM_SIZE);
|
||||
memset(delim, 0, DELIM_SIZE);
|
||||
- set_delimiter(device, delim);
|
||||
+ set_delimiter(mapname, delim);
|
||||
}
|
||||
|
||||
fd = open(device, O_RDONLY);
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
---
|
||||
multipath/mpathconf | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/multipath/mpathconf
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/mpathconf
|
||||
+++ multipath-tools-130222/multipath/mpathconf
|
||||
@@ -31,8 +31,8 @@ function usage
|
||||
echo "Commands:"
|
||||
echo "Enable: --enable "
|
||||
echo "Disable: --disable"
|
||||
- echo "Set user_friendly_names (Default n): --user_friendly_names <y|n>"
|
||||
- echo "Set find_multipaths (Default n): --find_multipaths <y|n>"
|
||||
+ echo "Set user_friendly_names (Default y): --user_friendly_names <y|n>"
|
||||
+ echo "Set find_multipaths (Default y): --find_multipaths <y|n>"
|
||||
echo "Load the dm-multipath modules on enable (Default y): --with_module <y|n>"
|
||||
echo "start/stop/reload multipathd (Default n): --with_multipathd <y|n>"
|
||||
echo ""
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
This patch provides hwtable updates for NETAPP/LSI/ENGENIO E-Series arrays,
|
||||
utilizing new features to detect TPGS support, automatically.
|
||||
|
||||
Signed-off-by: Sean Stewart <Sean.Stewart@netapp.com>
|
||||
|
||||
---
|
||||
---
|
||||
libmultipath/hwtable.c | 12 +++++++++---
|
||||
1 file changed, 9 insertions(+), 3 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/hwtable.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/hwtable.c
|
||||
+++ multipath-tools-130222/libmultipath/hwtable.c
|
||||
@@ -1046,9 +1046,13 @@ static struct hwentry default_hw[] = {
|
||||
.checker_name = RDAC,
|
||||
.prio_name = PRIO_RDAC,
|
||||
},
|
||||
- /* LSI/Engenio/NetApp E-Series RDAC storage */
|
||||
+ /* LSI/Engenio/NetApp E-Series RDAC storage
|
||||
+ *
|
||||
+ * Maintainer : Sean Stewart
|
||||
+ * Mail : sean.stewart@netapp.com
|
||||
+ */
|
||||
{
|
||||
- .vendor = "(LSI|ENGENIO)",
|
||||
+ .vendor = "(NETAPP|LSI|ENGENIO)",
|
||||
.product = "INF-01-00",
|
||||
.bl_product = "Universal Xport",
|
||||
.features = "2 pg_init_retries 50",
|
||||
@@ -1056,10 +1060,12 @@ static struct hwentry default_hw[] = {
|
||||
.pgpolicy = GROUP_BY_PRIO,
|
||||
.pgfailback = -FAILBACK_IMMEDIATE,
|
||||
.rr_weight = RR_WEIGHT_NONE,
|
||||
- .no_path_retry = 15,
|
||||
+ .no_path_retry = 30,
|
||||
.checker_name = RDAC,
|
||||
.prio_name = PRIO_RDAC,
|
||||
.prio_args = NULL,
|
||||
+ .detect_prio = DETECT_PRIO_ON,
|
||||
+ .retain_hwhandler = RETAIN_HWHANDLER_ON,
|
||||
},
|
||||
{
|
||||
.vendor = "STK",
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
---
|
||||
multipath/mpathconf | 21 +++++++++++++++------
|
||||
1 file changed, 15 insertions(+), 6 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/multipath/mpathconf
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/mpathconf
|
||||
+++ multipath-tools-130222/multipath/mpathconf
|
||||
@@ -159,7 +159,7 @@ if [ -z "$MODULE" -o "$MODULE" = "y" ];
|
||||
fi
|
||||
|
||||
if [ "$MULTIPATHD" = "y" ]; then
|
||||
- if service multipathd status > /dev/null ; then
|
||||
+ if /bin/systemctl status multipathd.service > /dev/null 2>&1 ; then
|
||||
HAVE_MULTIPATHD=1
|
||||
else
|
||||
HAVE_MULTIPATHD=0
|
||||
@@ -210,8 +210,17 @@ if [ -n "$SHOW_STATUS" ]; then
|
||||
echo "dm_multipath module is not loaded"
|
||||
fi
|
||||
fi
|
||||
- if [ -n "$HAVE_MULTIPATHD" ]; then
|
||||
- service multipathd status
|
||||
+ if [ -z "$HAVE_MULTIPATHD" ]; then
|
||||
+ if /bin/systemctl status multipathd.service > /dev/null 2>&1 ; then
|
||||
+ HAVE_MULTIPATHD=1
|
||||
+ else
|
||||
+ HAVE_MULTIPATHD=0
|
||||
+ fi
|
||||
+ fi
|
||||
+ if [ "$HAVE_MULTIPATHD" = 1 ]; then
|
||||
+ echo "multipathd is running"
|
||||
+ else
|
||||
+ echo "multipathd is not running"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
@@ -301,12 +310,12 @@ if [ "$ENABLE" = 1 ]; then
|
||||
modprobe dm_multipath
|
||||
fi
|
||||
if [ "$HAVE_MULTIPATHD" = 0 ]; then
|
||||
- service multipathd start
|
||||
+ systemctl start multipathd.service
|
||||
fi
|
||||
elif [ "$ENABLE" = 0 ]; then
|
||||
if [ "$HAVE_MULTIPATHD" = 1 ]; then
|
||||
- service multipathd stop
|
||||
+ systemctl stop multipathd.service
|
||||
fi
|
||||
elif [ -n "$CHANGED_CONFIG" -a "$HAVE_MULTIPATHD" = 1 ]; then
|
||||
- service multipathd reload
|
||||
+ systemctl reload multipathd.service
|
||||
fi
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
---
|
||||
libmultipath/print.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/print.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/print.c
|
||||
+++ multipath-tools-130222/libmultipath/print.c
|
||||
@@ -422,6 +422,16 @@ snprint_path_serial (char * buff, size_t
|
||||
}
|
||||
|
||||
static int
|
||||
+snprint_path_mpp (char * buff, size_t len, struct path * pp)
|
||||
+{
|
||||
+ if (!pp->mpp)
|
||||
+ return snprintf(buff, len, "[orphan]");
|
||||
+ if (!pp->mpp->alias)
|
||||
+ return snprintf(buff, len, "[unknown]");
|
||||
+ return snprint_str(buff, len, pp->mpp->alias);
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
snprint_path_checker (char * buff, size_t len, struct path * pp)
|
||||
{
|
||||
struct checker * c = &pp->checker;
|
||||
@@ -464,6 +474,7 @@ struct path_data pd[] = {
|
||||
{'p', "pri", 0, snprint_pri},
|
||||
{'S', "size", 0, snprint_path_size},
|
||||
{'z', "serial", 0, snprint_path_serial},
|
||||
+ {'m', "multipath", 0, snprint_path_mpp},
|
||||
{0, NULL, 0 , NULL}
|
||||
};
|
||||
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
---
|
||||
multipathd/multipathd.service | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
Index: multipath-tools-130222/multipathd/multipathd.service
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/multipathd.service
|
||||
+++ multipath-tools-130222/multipathd/multipathd.service
|
||||
@@ -10,6 +10,7 @@ Conflicts=shutdown.target
|
||||
[Service]
|
||||
Type=forking
|
||||
PIDFile=/var/run/multipathd.pid
|
||||
+ExecStartPre=/sbin/modprobe dm-multipath
|
||||
ExecStart=/sbin/multipathd
|
||||
ExecReload=/sbin/multipathd reconfigure
|
||||
#ExecStop=/path/to/scrip delete-me if not necessary
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
---
|
||||
libmultipath/devmapper.c | 45 ---------------------------------------------
|
||||
libmultipath/devmapper.h | 1 -
|
||||
libmultipath/propsel.c | 2 --
|
||||
3 files changed, 48 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/devmapper.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/devmapper.c
|
||||
+++ multipath-tools-130222/libmultipath/devmapper.c
|
||||
@@ -917,51 +917,6 @@ out:
|
||||
return r;
|
||||
}
|
||||
|
||||
-extern char *
|
||||
-dm_get_name(char *uuid)
|
||||
-{
|
||||
- struct dm_task *dmt;
|
||||
- struct dm_info info;
|
||||
- char *prefixed_uuid, *name = NULL;
|
||||
- const char *nametmp;
|
||||
-
|
||||
- dmt = dm_task_create(DM_DEVICE_INFO);
|
||||
- if (!dmt)
|
||||
- return NULL;
|
||||
-
|
||||
- prefixed_uuid = MALLOC(UUID_PREFIX_LEN + strlen(uuid) + 1);
|
||||
- if (!prefixed_uuid) {
|
||||
- condlog(0, "cannot create prefixed uuid : %s",
|
||||
- strerror(errno));
|
||||
- goto freeout;
|
||||
- }
|
||||
- sprintf(prefixed_uuid, UUID_PREFIX "%s", uuid);
|
||||
- if (!dm_task_set_uuid(dmt, prefixed_uuid))
|
||||
- goto freeout;
|
||||
-
|
||||
- if (!dm_task_run(dmt))
|
||||
- goto freeout;
|
||||
-
|
||||
- if (!dm_task_get_info(dmt, &info) || !info.exists)
|
||||
- goto freeout;
|
||||
-
|
||||
- nametmp = dm_task_get_name(dmt);
|
||||
- if (nametmp && strlen(nametmp)) {
|
||||
- name = MALLOC(strlen(nametmp) + 1);
|
||||
- if (name)
|
||||
- strcpy(name, nametmp);
|
||||
- } else {
|
||||
- condlog(2, "%s: no device-mapper name found", uuid);
|
||||
- }
|
||||
-
|
||||
-freeout:
|
||||
- if (prefixed_uuid)
|
||||
- FREE(prefixed_uuid);
|
||||
- dm_task_destroy(dmt);
|
||||
-
|
||||
- return name;
|
||||
-}
|
||||
-
|
||||
int
|
||||
dm_geteventnr (char *name)
|
||||
{
|
||||
Index: multipath-tools-130222/libmultipath/devmapper.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/devmapper.h
|
||||
+++ multipath-tools-130222/libmultipath/devmapper.h
|
||||
@@ -40,7 +40,6 @@ int dm_remove_partmaps (const char * map
|
||||
int dm_get_uuid(char *name, char *uuid);
|
||||
int dm_get_info (char * mapname, struct dm_info ** dmi);
|
||||
int dm_rename (char * old, char * new);
|
||||
-char * dm_get_name(char * uuid);
|
||||
int dm_reassign(const char * mapname);
|
||||
int dm_reassign_table(const char *name, char *old, char *new);
|
||||
int dm_setgeometry(struct multipath *mpp);
|
||||
Index: multipath-tools-130222/libmultipath/propsel.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/propsel.c
|
||||
+++ multipath-tools-130222/libmultipath/propsel.c
|
||||
@@ -263,8 +263,6 @@ select_alias (struct multipath * mp)
|
||||
conf->bindings_file, mp->alias_prefix, conf->bindings_read_only);
|
||||
}
|
||||
if (mp->alias == NULL)
|
||||
- mp->alias = dm_get_name(mp->wwid);
|
||||
- if (mp->alias == NULL)
|
||||
mp->alias = STRDUP(mp->wwid);
|
||||
}
|
||||
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
---
|
||||
libmultipath/hwtable.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/hwtable.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/hwtable.c
|
||||
+++ multipath-tools-130222/libmultipath/hwtable.c
|
||||
@@ -794,6 +794,7 @@ static struct hwentry default_hw[] = {
|
||||
.prio_name = PRIO_ONTAP,
|
||||
.prio_args = NULL,
|
||||
.retain_hwhandler = RETAIN_HWHANDLER_ON,
|
||||
+ .user_friendly_names = USER_FRIENDLY_NAMES_OFF,
|
||||
.detect_prio = DETECT_PRIO_ON,
|
||||
},
|
||||
/*
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
---
|
||||
libmultipath/propsel.c | 11 +++++++++--
|
||||
1 file changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/propsel.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/propsel.c
|
||||
+++ multipath-tools-130222/libmultipath/propsel.c
|
||||
@@ -384,10 +384,17 @@ select_getuid (struct path * pp)
|
||||
void
|
||||
detect_prio(struct path * pp)
|
||||
{
|
||||
+ int ret;
|
||||
struct prio *p = &pp->prio;
|
||||
|
||||
- if (get_target_port_group_support(pp->fd) > 0)
|
||||
- prio_get(p, PRIO_ALUA, DEFAULT_PRIO_ARGS);
|
||||
+ if (get_target_port_group_support(pp->fd) <= 0)
|
||||
+ return;
|
||||
+ ret = get_target_port_group(pp->fd);
|
||||
+ if (ret < 0)
|
||||
+ return;
|
||||
+ if (get_asymmetric_access_state(pp->fd, ret) < 0)
|
||||
+ return;
|
||||
+ prio_get(p, PRIO_ALUA, DEFAULT_PRIO_ARGS);
|
||||
}
|
||||
|
||||
extern int
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
---
|
||||
libmultipath/alias.c | 39 ++++++++++++++++++++++++++++++---------
|
||||
1 file changed, 30 insertions(+), 9 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/alias.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/alias.c
|
||||
+++ multipath-tools-130222/libmultipath/alias.c
|
||||
@@ -46,11 +46,11 @@ format_devname(char *name, int id, int l
|
||||
memset(name,0, len);
|
||||
strcpy(name, prefix);
|
||||
for (pos = len - 1; pos >= prefix_len; pos--) {
|
||||
+ id--;
|
||||
name[pos] = 'a' + id % 26;
|
||||
if (id < 26)
|
||||
break;
|
||||
id /= 26;
|
||||
- id--;
|
||||
}
|
||||
memmove(name + prefix_len, name + pos, len - pos);
|
||||
name[prefix_len + len - pos] = '\0';
|
||||
@@ -66,13 +66,22 @@ scan_devname(char *alias, char *prefix)
|
||||
if (!prefix || strncmp(alias, prefix, strlen(prefix)))
|
||||
return -1;
|
||||
|
||||
+ if (strlen(alias) == strlen(prefix))
|
||||
+ return -1;
|
||||
+
|
||||
+ if (strlen(alias) > strlen(prefix) + 7)
|
||||
+ /* id of 'aaaaaaaa' overflows int */
|
||||
+ return -1;
|
||||
+
|
||||
c = alias + strlen(prefix);
|
||||
while (*c != '\0' && *c != ' ' && *c != '\t') {
|
||||
+ if (*c < 'a' || *c > 'z')
|
||||
+ return -1;
|
||||
i = *c - 'a';
|
||||
n = ( n * 26 ) + i;
|
||||
+ if (n < 0)
|
||||
+ return -1;
|
||||
c++;
|
||||
- if (*c < 'a' || *c > 'z')
|
||||
- break;
|
||||
n++;
|
||||
}
|
||||
|
||||
@@ -84,7 +93,9 @@ lookup_binding(FILE *f, char *map_wwid,
|
||||
{
|
||||
char buf[LINE_MAX];
|
||||
unsigned int line_nr = 0;
|
||||
- int id = 0;
|
||||
+ int id = 1;
|
||||
+ int biggest_id = 1;
|
||||
+ int smallest_bigger_id = INT_MAX;
|
||||
|
||||
*map_alias = NULL;
|
||||
|
||||
@@ -100,8 +111,12 @@ lookup_binding(FILE *f, char *map_wwid,
|
||||
if (!alias) /* blank line */
|
||||
continue;
|
||||
curr_id = scan_devname(alias, prefix);
|
||||
- if (curr_id >= id)
|
||||
- id = curr_id + 1;
|
||||
+ if (curr_id == id)
|
||||
+ id++;
|
||||
+ if (curr_id > biggest_id)
|
||||
+ biggest_id = curr_id;
|
||||
+ if (curr_id > id && curr_id < smallest_bigger_id)
|
||||
+ smallest_bigger_id = curr_id;
|
||||
wwid = strtok(NULL, " \t");
|
||||
if (!wwid){
|
||||
condlog(3,
|
||||
@@ -116,11 +131,17 @@ lookup_binding(FILE *f, char *map_wwid,
|
||||
if (*map_alias == NULL)
|
||||
condlog(0, "Cannot copy alias from bindings "
|
||||
"file : %s", strerror(errno));
|
||||
- return id;
|
||||
+ return 0;
|
||||
}
|
||||
}
|
||||
condlog(3, "No matching wwid [%s] in bindings file.", map_wwid);
|
||||
- return id;
|
||||
+ if (id < 0) {
|
||||
+ condlog(0, "no more available user_friendly_names");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if (id < smallest_bigger_id)
|
||||
+ return id;
|
||||
+ return biggest_id + 1;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -254,7 +275,7 @@ get_user_friendly_alias(char *wwid, char
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- if (!alias && can_write && !bindings_read_only)
|
||||
+ if (!alias && can_write && !bindings_read_only && id)
|
||||
alias = allocate_binding(fd, wwid, id, prefix);
|
||||
|
||||
fclose(f);
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
---
|
||||
libmultipath/configure.c | 7 ------
|
||||
libmultipath/devmapper.c | 53 ++++++++++++++++++++++-------------------------
|
||||
libmultipath/devmapper.h | 2 -
|
||||
3 files changed, 25 insertions(+), 37 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/configure.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/configure.c
|
||||
+++ multipath-tools-130222/libmultipath/configure.c
|
||||
@@ -384,24 +384,17 @@ domap (struct multipath * mpp, char * pa
|
||||
|
||||
r = dm_addmap_create(mpp, params);
|
||||
|
||||
- if (!r)
|
||||
- r = dm_addmap_create_ro(mpp, params);
|
||||
-
|
||||
lock_multipath(mpp, 0);
|
||||
break;
|
||||
|
||||
case ACT_RELOAD:
|
||||
r = dm_addmap_reload(mpp, params);
|
||||
- if (!r)
|
||||
- r = dm_addmap_reload_ro(mpp, params);
|
||||
if (r)
|
||||
r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias);
|
||||
break;
|
||||
|
||||
case ACT_RESIZE:
|
||||
r = dm_addmap_reload(mpp, params);
|
||||
- if (!r)
|
||||
- r = dm_addmap_reload_ro(mpp, params);
|
||||
if (r)
|
||||
r = dm_simplecmd_flush(DM_DEVICE_RESUME, mpp->alias, 1);
|
||||
break;
|
||||
Index: multipath-tools-130222/libmultipath/devmapper.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/devmapper.c
|
||||
+++ multipath-tools-130222/libmultipath/devmapper.c
|
||||
@@ -298,42 +298,39 @@ dm_addmap (int task, const char *target,
|
||||
return r;
|
||||
}
|
||||
|
||||
-static int
|
||||
-_dm_addmap_create (struct multipath *mpp, char * params, int ro) {
|
||||
- int r;
|
||||
- r = dm_addmap(DM_DEVICE_CREATE, TGT_MPATH, mpp, params, 1, ro);
|
||||
- /*
|
||||
- * DM_DEVICE_CREATE is actually DM_DEV_CREATE + DM_TABLE_LOAD.
|
||||
- * Failing the second part leaves an empty map. Clean it up.
|
||||
- */
|
||||
- if (!r && dm_map_present(mpp->alias)) {
|
||||
- condlog(3, "%s: failed to load map (a path might be in use)",
|
||||
- mpp->alias);
|
||||
- dm_flush_map_nosync(mpp->alias);
|
||||
+extern int
|
||||
+dm_addmap_create (struct multipath *mpp, char * params) {
|
||||
+ int ro;
|
||||
+
|
||||
+ for (ro = 0; ro <= 1; ro++) {
|
||||
+ int err;
|
||||
+
|
||||
+ if (dm_addmap(DM_DEVICE_CREATE, TGT_MPATH, mpp, params, 1, ro))
|
||||
+ return 1;
|
||||
+ /*
|
||||
+ * DM_DEVICE_CREATE is actually DM_DEV_CREATE + DM_TABLE_LOAD.
|
||||
+ * Failing the second part leaves an empty map. Clean it up.
|
||||
+ */
|
||||
+ err = errno;
|
||||
+ if (dm_map_present(mpp->alias)) {
|
||||
+ condlog(3, "%s: failed to load map (a path might be in use)", mpp->alias);
|
||||
+ dm_flush_map_nosync(mpp->alias);
|
||||
+ }
|
||||
+ if (err != EROFS)
|
||||
+ break;
|
||||
}
|
||||
- return r;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
#define ADDMAP_RW 0
|
||||
#define ADDMAP_RO 1
|
||||
|
||||
extern int
|
||||
-dm_addmap_create (struct multipath *mpp, char *params) {
|
||||
- return _dm_addmap_create(mpp, params, ADDMAP_RW);
|
||||
-}
|
||||
-
|
||||
-extern int
|
||||
-dm_addmap_create_ro (struct multipath *mpp, char *params) {
|
||||
- return _dm_addmap_create(mpp, params, ADDMAP_RO);
|
||||
-}
|
||||
-
|
||||
-extern int
|
||||
dm_addmap_reload (struct multipath *mpp, char *params) {
|
||||
- return dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RW);
|
||||
-}
|
||||
-
|
||||
-extern int
|
||||
-dm_addmap_reload_ro (struct multipath *mpp, char *params) {
|
||||
+ if (dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RW))
|
||||
+ return 1;
|
||||
+ if (errno != EROFS)
|
||||
+ return 0;
|
||||
return dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RO);
|
||||
}
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/devmapper.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/devmapper.h
|
||||
+++ multipath-tools-130222/libmultipath/devmapper.h
|
||||
@@ -12,9 +12,7 @@ int dm_drv_version (unsigned int * versi
|
||||
int dm_simplecmd_flush (int, const char *, int);
|
||||
int dm_simplecmd_noflush (int, const char *);
|
||||
int dm_addmap_create (struct multipath *mpp, char *params);
|
||||
-int dm_addmap_create_ro (struct multipath *mpp, char *params);
|
||||
int dm_addmap_reload (struct multipath *mpp, char *params);
|
||||
-int dm_addmap_reload_ro (struct multipath *mpp, char *params);
|
||||
int dm_map_present (const char *);
|
||||
int dm_get_map(char *, unsigned long long *, char *);
|
||||
int dm_get_status(char *, char *);
|
||||
|
|
@ -1,493 +0,0 @@
|
|||
---
|
||||
libmultipath/file.c | 4 +-
|
||||
libmultipath/lock.c | 9 ----
|
||||
libmultipath/lock.h | 1
|
||||
libmultipath/log_pthread.c | 22 -----------
|
||||
libmultipath/waiter.c | 2 -
|
||||
multipathd/cli_handlers.c | 4 +-
|
||||
multipathd/main.c | 90 ++++++++++++++++++++-------------------------
|
||||
multipathd/main.h | 3 +
|
||||
multipathd/uxlsnr.c | 21 +++++++---
|
||||
multipathd/uxlsnr.h | 3 +
|
||||
10 files changed, 65 insertions(+), 94 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/file.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/file.c
|
||||
+++ multipath-tools-130222/libmultipath/file.c
|
||||
@@ -98,7 +98,7 @@ lock_file(int fd, char *file_name)
|
||||
sigaddset(&set, SIGALRM);
|
||||
|
||||
sigaction(SIGALRM, &act, &oldact);
|
||||
- sigprocmask(SIG_UNBLOCK, &set, &oldset);
|
||||
+ pthread_sigmask(SIG_UNBLOCK, &set, &oldset);
|
||||
|
||||
alarm(FILE_TIMEOUT);
|
||||
err = fcntl(fd, F_SETLKW, &lock);
|
||||
@@ -112,7 +112,7 @@ lock_file(int fd, char *file_name)
|
||||
condlog(0, "%s is locked. Giving up.", file_name);
|
||||
}
|
||||
|
||||
- sigprocmask(SIG_SETMASK, &oldset, NULL);
|
||||
+ pthread_sigmask(SIG_SETMASK, &oldset, NULL);
|
||||
sigaction(SIGALRM, &oldact, NULL);
|
||||
return err;
|
||||
}
|
||||
Index: multipath-tools-130222/libmultipath/lock.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/lock.c
|
||||
+++ multipath-tools-130222/libmultipath/lock.c
|
||||
@@ -1,16 +1,7 @@
|
||||
#include <pthread.h>
|
||||
-#include <signal.h>
|
||||
#include "lock.h"
|
||||
#include <stdio.h>
|
||||
|
||||
-void block_signal (int signum, sigset_t *old)
|
||||
-{
|
||||
- sigset_t set;
|
||||
- sigemptyset(&set);
|
||||
- sigaddset(&set, signum);
|
||||
- pthread_sigmask(SIG_BLOCK, &set, old);
|
||||
-}
|
||||
-
|
||||
void cleanup_lock (void * data)
|
||||
{
|
||||
unlock ((*(struct mutex_lock *)data));
|
||||
Index: multipath-tools-130222/libmultipath/lock.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/lock.h
|
||||
+++ multipath-tools-130222/libmultipath/lock.h
|
||||
@@ -29,6 +29,5 @@ struct mutex_lock {
|
||||
#endif
|
||||
|
||||
void cleanup_lock (void * data);
|
||||
-void block_signal(int signum, sigset_t *old);
|
||||
|
||||
#endif /* _LOCK_H */
|
||||
Index: multipath-tools-130222/libmultipath/log_pthread.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/log_pthread.c
|
||||
+++ multipath-tools-130222/libmultipath/log_pthread.c
|
||||
@@ -22,26 +22,13 @@ pthread_cond_t logev_cond;
|
||||
|
||||
int logq_running;
|
||||
|
||||
-static void
|
||||
-sigusr1 (int sig)
|
||||
-{
|
||||
- pthread_mutex_lock(&logq_lock);
|
||||
- log_reset("multipathd");
|
||||
- pthread_mutex_unlock(&logq_lock);
|
||||
-}
|
||||
-
|
||||
void log_safe (int prio, const char * fmt, va_list ap)
|
||||
{
|
||||
- sigset_t old;
|
||||
-
|
||||
if (log_thr == (pthread_t)0) {
|
||||
syslog(prio, fmt, ap);
|
||||
return;
|
||||
}
|
||||
|
||||
- block_signal(SIGUSR1, &old);
|
||||
- block_signal(SIGHUP, NULL);
|
||||
-
|
||||
pthread_mutex_lock(&logq_lock);
|
||||
log_enqueue(prio, fmt, ap);
|
||||
pthread_mutex_unlock(&logq_lock);
|
||||
@@ -49,8 +36,6 @@ void log_safe (int prio, const char * fm
|
||||
pthread_mutex_lock(&logev_lock);
|
||||
pthread_cond_signal(&logev_cond);
|
||||
pthread_mutex_unlock(&logev_lock);
|
||||
-
|
||||
- pthread_sigmask(SIG_SETMASK, &old, NULL);
|
||||
}
|
||||
|
||||
void log_thread_flush (void)
|
||||
@@ -81,15 +66,8 @@ static void flush_logqueue (void)
|
||||
|
||||
static void * log_thread (void * et)
|
||||
{
|
||||
- struct sigaction sig;
|
||||
int running;
|
||||
|
||||
- sig.sa_handler = sigusr1;
|
||||
- sigemptyset(&sig.sa_mask);
|
||||
- sig.sa_flags = 0;
|
||||
- if (sigaction(SIGUSR1, &sig, NULL) < 0)
|
||||
- logdbg(stderr, "Cannot set signal handler");
|
||||
-
|
||||
pthread_mutex_lock(&logev_lock);
|
||||
logq_running = 1;
|
||||
pthread_mutex_unlock(&logev_lock);
|
||||
Index: multipath-tools-130222/libmultipath/waiter.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/waiter.c
|
||||
+++ multipath-tools-130222/libmultipath/waiter.c
|
||||
@@ -157,8 +157,6 @@ void *waitevent (void *et)
|
||||
waiter = (struct event_thread *)et;
|
||||
pthread_cleanup_push(free_waiter, et);
|
||||
|
||||
- block_signal(SIGUSR1, NULL);
|
||||
- block_signal(SIGHUP, NULL);
|
||||
while (1) {
|
||||
r = waiteventloop(waiter);
|
||||
|
||||
Index: multipath-tools-130222/multipathd/cli_handlers.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/cli_handlers.c
|
||||
+++ multipath-tools-130222/multipathd/cli_handlers.c
|
||||
@@ -939,8 +939,8 @@ int
|
||||
cli_shutdown (void * v, char ** reply, int * len, void * data)
|
||||
{
|
||||
condlog(3, "shutdown (operator)");
|
||||
-
|
||||
- return exit_daemon(0);
|
||||
+ exit_daemon();
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
int
|
||||
Index: multipath-tools-130222/multipathd/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/main.c
|
||||
+++ multipath-tools-130222/multipathd/main.c
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <limits.h>
|
||||
#include <linux/oom.h>
|
||||
#include <libudev.h>
|
||||
+#include <semaphore.h>
|
||||
#include <mpath_persist.h>
|
||||
|
||||
/*
|
||||
@@ -52,6 +53,7 @@
|
||||
#include <wwids.h>
|
||||
#include <pgpolicies.h>
|
||||
#include <uevent.h>
|
||||
+#include <log.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "pidfile.h"
|
||||
@@ -81,13 +83,11 @@ struct mpath_event_param
|
||||
|
||||
unsigned int mpath_mx_alloc_len;
|
||||
|
||||
-pthread_cond_t exit_cond = PTHREAD_COND_INITIALIZER;
|
||||
-pthread_mutex_t exit_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
-
|
||||
int logsink;
|
||||
enum daemon_status running_state;
|
||||
pid_t daemon_pid;
|
||||
|
||||
+static sem_t exit_sem;
|
||||
/*
|
||||
* global copy of vecs for use in sig handlers
|
||||
*/
|
||||
@@ -838,9 +838,6 @@ out:
|
||||
static void *
|
||||
ueventloop (void * ap)
|
||||
{
|
||||
- block_signal(SIGUSR1, NULL);
|
||||
- block_signal(SIGHUP, NULL);
|
||||
-
|
||||
if (uevent_listen())
|
||||
condlog(0, "error starting uevent listener");
|
||||
|
||||
@@ -850,9 +847,6 @@ ueventloop (void * ap)
|
||||
static void *
|
||||
uevqloop (void * ap)
|
||||
{
|
||||
- block_signal(SIGUSR1, NULL);
|
||||
- block_signal(SIGHUP, NULL);
|
||||
-
|
||||
if (uevent_dispatch(&uev_trigger, ap))
|
||||
condlog(0, "error starting uevent dispatcher");
|
||||
|
||||
@@ -861,9 +855,6 @@ uevqloop (void * ap)
|
||||
static void *
|
||||
uxlsnrloop (void * ap)
|
||||
{
|
||||
- block_signal(SIGUSR1, NULL);
|
||||
- block_signal(SIGHUP, NULL);
|
||||
-
|
||||
if (cli_init())
|
||||
return NULL;
|
||||
|
||||
@@ -913,18 +904,10 @@ uxlsnrloop (void * ap)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-int
|
||||
-exit_daemon (int status)
|
||||
+void
|
||||
+exit_daemon (void)
|
||||
{
|
||||
- if (status != 0)
|
||||
- fprintf(stderr, "bad exit status. see daemon.log\n");
|
||||
-
|
||||
- if (running_state != DAEMON_SHUTDOWN) {
|
||||
- pthread_mutex_lock(&exit_mutex);
|
||||
- pthread_cond_signal(&exit_cond);
|
||||
- pthread_mutex_unlock(&exit_mutex);
|
||||
- }
|
||||
- return status;
|
||||
+ sem_post(&exit_sem);
|
||||
}
|
||||
|
||||
const char *
|
||||
@@ -1287,7 +1270,6 @@ checkerloop (void *ap)
|
||||
struct path *pp;
|
||||
int count = 0;
|
||||
unsigned int i;
|
||||
- sigset_t old;
|
||||
|
||||
mlockall(MCL_CURRENT | MCL_FUTURE);
|
||||
vecs = (struct vectors *)ap;
|
||||
@@ -1301,7 +1283,6 @@ checkerloop (void *ap)
|
||||
}
|
||||
|
||||
while (1) {
|
||||
- block_signal(SIGHUP, &old);
|
||||
pthread_cleanup_push(cleanup_lock, &vecs->lock);
|
||||
lock(vecs->lock);
|
||||
pthread_testcancel();
|
||||
@@ -1325,7 +1306,6 @@ checkerloop (void *ap)
|
||||
}
|
||||
|
||||
lock_cleanup_pop(vecs->lock);
|
||||
- pthread_sigmask(SIG_SETMASK, &old, NULL);
|
||||
sleep(1);
|
||||
}
|
||||
return NULL;
|
||||
@@ -1485,36 +1465,56 @@ signal_set(int signo, void (*func) (int)
|
||||
return (osig.sa_handler);
|
||||
}
|
||||
|
||||
+void
|
||||
+handle_signals(void)
|
||||
+{
|
||||
+ if (reconfig_sig && running_state == DAEMON_RUNNING) {
|
||||
+ condlog(2, "reconfigure (signal)");
|
||||
+ pthread_cleanup_push(cleanup_lock,
|
||||
+ &gvecs->lock);
|
||||
+ lock(gvecs->lock);
|
||||
+ pthread_testcancel();
|
||||
+ reconfigure(gvecs);
|
||||
+ lock_cleanup_pop(gvecs->lock);
|
||||
+ }
|
||||
+ if (log_reset_sig) {
|
||||
+ condlog(2, "reset log (signal)");
|
||||
+ pthread_mutex_lock(&logq_lock);
|
||||
+ log_reset("multipathd");
|
||||
+ pthread_mutex_unlock(&logq_lock);
|
||||
+ }
|
||||
+ reconfig_sig = 0;
|
||||
+ log_reset_sig = 0;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
sighup (int sig)
|
||||
{
|
||||
- condlog(2, "reconfigure (SIGHUP)");
|
||||
-
|
||||
- if (running_state != DAEMON_RUNNING)
|
||||
- return;
|
||||
-
|
||||
- reconfigure(gvecs);
|
||||
-
|
||||
-#ifdef _DEBUG_
|
||||
- dbg_free_final(NULL);
|
||||
-#endif
|
||||
+ reconfig_sig = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
sigend (int sig)
|
||||
{
|
||||
- exit_daemon(0);
|
||||
+ exit_daemon();
|
||||
}
|
||||
|
||||
static void
|
||||
sigusr1 (int sig)
|
||||
{
|
||||
- condlog(3, "SIGUSR1 received");
|
||||
+ log_reset_sig = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
signal_init(void)
|
||||
{
|
||||
+ sigset_t set;
|
||||
+
|
||||
+ sigemptyset(&set);
|
||||
+ sigaddset(&set, SIGHUP);
|
||||
+ sigaddset(&set, SIGUSR1);
|
||||
+ pthread_sigmask(SIG_BLOCK, &set, NULL);
|
||||
+
|
||||
signal_set(SIGHUP, sighup);
|
||||
signal_set(SIGUSR1, sigusr1);
|
||||
signal_set(SIGINT, sigend);
|
||||
@@ -1587,10 +1587,11 @@ child (void * param)
|
||||
struct vectors * vecs;
|
||||
struct multipath * mpp;
|
||||
int i;
|
||||
- sigset_t set;
|
||||
int rc, pid_rc;
|
||||
|
||||
mlockall(MCL_CURRENT | MCL_FUTURE);
|
||||
+ sem_init(&exit_sem, 0, 0);
|
||||
+ signal_init();
|
||||
|
||||
setup_thread_attr(&misc_attr, 64 * 1024, 1);
|
||||
setup_thread_attr(&waiter_attr, 32 * 1024, 1);
|
||||
@@ -1650,7 +1651,6 @@ child (void * param)
|
||||
if (!vecs)
|
||||
exit(1);
|
||||
|
||||
- signal_init();
|
||||
setscheduler();
|
||||
set_oom_adj();
|
||||
|
||||
@@ -1693,25 +1693,17 @@ child (void * param)
|
||||
}
|
||||
pthread_attr_destroy(&misc_attr);
|
||||
|
||||
- pthread_mutex_lock(&exit_mutex);
|
||||
/* Startup complete, create logfile */
|
||||
pid_rc = pidfile_create(DEFAULT_PIDFILE, daemon_pid);
|
||||
/* Ignore errors, we can live without */
|
||||
|
||||
running_state = DAEMON_RUNNING;
|
||||
- pthread_cond_wait(&exit_cond, &exit_mutex);
|
||||
- /* Need to block these to avoid deadlocking */
|
||||
- sigemptyset(&set);
|
||||
- sigaddset(&set, SIGTERM);
|
||||
- sigaddset(&set, SIGINT);
|
||||
- pthread_sigmask(SIG_BLOCK, &set, NULL);
|
||||
|
||||
/*
|
||||
* exit path
|
||||
*/
|
||||
+ while(sem_wait(&exit_sem) != 0); /* Do nothing */
|
||||
running_state = DAEMON_SHUTDOWN;
|
||||
- pthread_sigmask(SIG_UNBLOCK, &set, NULL);
|
||||
- block_signal(SIGHUP, NULL);
|
||||
lock(vecs->lock);
|
||||
if (conf->queue_without_daemon == QUE_NO_DAEMON_OFF)
|
||||
vector_foreach_slot(vecs->mpvec, mpp, i)
|
||||
Index: multipath-tools-130222/multipathd/main.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/main.h
|
||||
+++ multipath-tools-130222/multipathd/main.h
|
||||
@@ -16,7 +16,7 @@ struct prin_resp;
|
||||
|
||||
extern pid_t daemon_pid;
|
||||
|
||||
-int exit_daemon(int);
|
||||
+void exit_daemon(void);
|
||||
const char * daemon_status(void);
|
||||
int reconfigure (struct vectors *);
|
||||
int ev_add_path (struct path *, struct vectors *);
|
||||
@@ -35,5 +35,6 @@ int mpath_pr_event_handle(struct path *p
|
||||
void * mpath_pr_event_handler_fn (void * );
|
||||
int update_map_pr(struct multipath *mpp);
|
||||
void * mpath_pr_event_handler_fn (void * pathp );
|
||||
+void handle_signals(void);
|
||||
|
||||
#endif /* MAIN_H */
|
||||
Index: multipath-tools-130222/multipathd/uxlsnr.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/uxlsnr.c
|
||||
+++ multipath-tools-130222/multipathd/uxlsnr.c
|
||||
@@ -8,6 +8,7 @@
|
||||
/*
|
||||
* A simple domain socket listener
|
||||
*/
|
||||
+#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@@ -19,20 +20,21 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <sys/poll.h>
|
||||
-
|
||||
+#include <signal.h>
|
||||
#include <checkers.h>
|
||||
-
|
||||
#include <memory.h>
|
||||
#include <debug.h>
|
||||
#include <vector.h>
|
||||
#include <structs.h>
|
||||
+#include <structs_vec.h>
|
||||
#include <uxsock.h>
|
||||
#include <defaults.h>
|
||||
|
||||
+#include "main.h"
|
||||
#include "cli.h"
|
||||
#include "uxlsnr.h"
|
||||
|
||||
-#define SLEEP_TIME 5000
|
||||
+struct timespec sleep_time = {5, 0};
|
||||
|
||||
struct client {
|
||||
int fd;
|
||||
@@ -42,6 +44,8 @@ struct client {
|
||||
static struct client *clients;
|
||||
static unsigned num_clients;
|
||||
struct pollfd *polls;
|
||||
+volatile sig_atomic_t reconfig_sig = 0;
|
||||
+volatile sig_atomic_t log_reset_sig = 0;
|
||||
|
||||
/*
|
||||
* handle a new client joining
|
||||
@@ -104,6 +108,7 @@ void * uxsock_listen(int (*uxsock_trigge
|
||||
int rlen;
|
||||
char *inbuf;
|
||||
char *reply;
|
||||
+ sigset_t mask;
|
||||
|
||||
ux_sock = ux_socket_listen(DEFAULT_SOCKET);
|
||||
|
||||
@@ -115,7 +120,9 @@ void * uxsock_listen(int (*uxsock_trigge
|
||||
pthread_cleanup_push(uxsock_cleanup, NULL);
|
||||
|
||||
polls = (struct pollfd *)MALLOC(0);
|
||||
-
|
||||
+ pthread_sigmask(SIG_SETMASK, NULL, &mask);
|
||||
+ sigdelset(&mask, SIGHUP);
|
||||
+ sigdelset(&mask, SIGUSR1);
|
||||
while (1) {
|
||||
struct client *c;
|
||||
int i, poll_count;
|
||||
@@ -132,11 +139,13 @@ void * uxsock_listen(int (*uxsock_trigge
|
||||
}
|
||||
|
||||
/* most of our life is spent in this call */
|
||||
- poll_count = poll(polls, i, SLEEP_TIME);
|
||||
+ poll_count = ppoll(polls, i, &sleep_time, &mask);
|
||||
|
||||
if (poll_count == -1) {
|
||||
- if (errno == EINTR)
|
||||
+ if (errno == EINTR) {
|
||||
+ handle_signals();
|
||||
continue;
|
||||
+ }
|
||||
|
||||
/* something went badly wrong! */
|
||||
condlog(0, "poll");
|
||||
Index: multipath-tools-130222/multipathd/uxlsnr.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/uxlsnr.h
|
||||
+++ multipath-tools-130222/multipathd/uxlsnr.h
|
||||
@@ -4,5 +4,8 @@
|
||||
void * uxsock_listen(int (*uxsock_trigger)
|
||||
(char *, char **, int *, void *),
|
||||
void * trigger_data);
|
||||
+
|
||||
+extern volatile sig_atomic_t reconfig_sig;
|
||||
+extern volatile sig_atomic_t log_reset_sig;
|
||||
#endif
|
||||
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
---
|
||||
libmultipath/waiter.c | 9 +++++++++
|
||||
multipathd/main.c | 8 ++++++++
|
||||
2 files changed, 17 insertions(+)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/waiter.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/waiter.c
|
||||
+++ multipath-tools-130222/libmultipath/waiter.c
|
||||
@@ -57,6 +57,7 @@ void stop_waiter_thread (struct multipat
|
||||
thread = mpp->waiter;
|
||||
mpp->waiter = (pthread_t)0;
|
||||
pthread_cancel(thread);
|
||||
+ pthread_kill(thread, SIGUSR2);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -65,6 +66,7 @@ void stop_waiter_thread (struct multipat
|
||||
*/
|
||||
int waiteventloop (struct event_thread *waiter)
|
||||
{
|
||||
+ sigset_t set, oldset;
|
||||
int event_nr;
|
||||
int r;
|
||||
|
||||
@@ -97,8 +99,15 @@ int waiteventloop (struct event_thread *
|
||||
dm_task_no_open_count(waiter->dmt);
|
||||
|
||||
/* wait */
|
||||
+ sigemptyset(&set);
|
||||
+ sigaddset(&set, SIGUSR2);
|
||||
+ pthread_sigmask(SIG_UNBLOCK, &set, &oldset);
|
||||
+
|
||||
+ pthread_testcancel();
|
||||
r = dm_task_run(waiter->dmt);
|
||||
+ pthread_testcancel();
|
||||
|
||||
+ pthread_sigmask(SIG_SETMASK, &oldset, NULL);
|
||||
dm_task_destroy(waiter->dmt);
|
||||
waiter->dmt = NULL;
|
||||
|
||||
Index: multipath-tools-130222/multipathd/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/main.c
|
||||
+++ multipath-tools-130222/multipathd/main.c
|
||||
@@ -1506,6 +1506,12 @@ sigusr1 (int sig)
|
||||
}
|
||||
|
||||
static void
|
||||
+sigusr2 (int sig)
|
||||
+{
|
||||
+ condlog(3, "SIGUSR2 received");
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
signal_init(void)
|
||||
{
|
||||
sigset_t set;
|
||||
@@ -1513,10 +1519,12 @@ signal_init(void)
|
||||
sigemptyset(&set);
|
||||
sigaddset(&set, SIGHUP);
|
||||
sigaddset(&set, SIGUSR1);
|
||||
+ sigaddset(&set, SIGUSR2);
|
||||
pthread_sigmask(SIG_BLOCK, &set, NULL);
|
||||
|
||||
signal_set(SIGHUP, sighup);
|
||||
signal_set(SIGUSR1, sigusr1);
|
||||
+ signal_set(SIGUSR2, sigusr2);
|
||||
signal_set(SIGINT, sigend);
|
||||
signal_set(SIGTERM, sigend);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
---
|
||||
libmultipath/wwids.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/wwids.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/wwids.c
|
||||
+++ multipath-tools-130222/libmultipath/wwids.c
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
+#include <sys/types.h>
|
||||
|
||||
#include "checkers.h"
|
||||
#include "vector.h"
|
||||
@@ -100,6 +101,11 @@ replace_wwids(vector mp)
|
||||
condlog(0, "cannot truncate wwids file : %s", strerror(errno));
|
||||
goto out_file;
|
||||
}
|
||||
+ if (lseek(fd, 0, SEEK_SET) < 0) {
|
||||
+ condlog(0, "cannot seek to the start of the file : %s",
|
||||
+ strerror(errno));
|
||||
+ goto out_file;
|
||||
+ }
|
||||
len = strlen(WWIDS_FILE_HEADER);
|
||||
if (write_all(fd, WWIDS_FILE_HEADER, len) != len) {
|
||||
condlog(0, "Can't write wwid file header : %s",
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
---
|
||||
multipath/multipath.conf.5 | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/multipath/multipath.conf.5
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/multipath.conf.5
|
||||
+++ multipath-tools-130222/multipath/multipath.conf.5
|
||||
@@ -136,7 +136,7 @@ per-multipath option in the configuratio
|
||||
1 priority group per target node name. Target node names are fetched
|
||||
in /sys/class/fc_transport/target*/node_name.
|
||||
.TP
|
||||
-Default value is \fImultibus\fR.
|
||||
+Default value is \fIfailover\fR.
|
||||
.RE
|
||||
.TP
|
||||
.B uid_attribute
|
||||
@@ -182,7 +182,7 @@ Generate a random priority between 1 and
|
||||
Generate the path priority based on the regular expression and the
|
||||
priority provided as argument. requires prio_args keyword.
|
||||
.TP
|
||||
-Default value is \fBnone\fR.
|
||||
+Default value is \fBconst\fR.
|
||||
.RE
|
||||
.TP
|
||||
.B prio_args
|
||||
@@ -270,7 +270,7 @@ The number of IO to route to a path befo
|
||||
the same path group. This is only for BIO based multipath. Default is
|
||||
.I 1000
|
||||
.TP
|
||||
-.B rr_min_io_q
|
||||
+.B rr_min_io_rq
|
||||
The number of IO requests to route to a path before switching to the
|
||||
next in the same path group. This is only for request based multipath.
|
||||
Default is
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
---
|
||||
multipath/Makefile | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/multipath/Makefile
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/Makefile
|
||||
+++ multipath-tools-130222/multipath/Makefile
|
||||
@@ -23,8 +23,8 @@ install:
|
||||
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
|
||||
$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
|
||||
$(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/
|
||||
- $(INSTALL_PROGRAM) -d $(DESTDIR)/lib/udev/rules.d
|
||||
- $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/lib/udev/rules.d/62-multipath.rules
|
||||
+ $(INSTALL_PROGRAM) -d $(DESTDIR)/usr/lib/udev/rules.d
|
||||
+ $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/usr/lib/udev/rules.d/62-multipath.rules
|
||||
$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)
|
||||
$(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)
|
||||
$(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir)
|
||||
@@ -32,7 +32,7 @@ install:
|
||||
$(INSTALL_PROGRAM) -m 644 mpathconf.8.gz $(DESTDIR)$(mandir)
|
||||
|
||||
uninstall:
|
||||
- rm $(DESTDIR)/lib/udev/rules.d/62-multipath.rules
|
||||
+ rm $(DESTDIR)/usr/lib/udev/rules.d/62-multipath.rules
|
||||
rm $(DESTDIR)$(bindir)/$(EXEC)
|
||||
rm $(DESTDIR)$(bindir)/mpathconf
|
||||
rm $(DESTDIR)$(mandir)/$(EXEC).8.gz
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
---
|
||||
kpartx/kpartx.c | 3 +--
|
||||
kpartx/lopart.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/kpartx/kpartx.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/kpartx/kpartx.c
|
||||
+++ multipath-tools-130222/kpartx/kpartx.c
|
||||
@@ -204,7 +204,6 @@ main(int argc, char **argv){
|
||||
char * delim = NULL;
|
||||
char *uuid = NULL;
|
||||
char *mapname = NULL;
|
||||
- int loopro = 0;
|
||||
int hotplug = 0;
|
||||
int loopcreated = 0;
|
||||
struct stat buf;
|
||||
@@ -315,7 +314,7 @@ main(int argc, char **argv){
|
||||
if (!loopdev) {
|
||||
loopdev = find_unused_loop_device();
|
||||
|
||||
- if (set_loop(loopdev, device, 0, &loopro)) {
|
||||
+ if (set_loop(loopdev, device, 0, &ro)) {
|
||||
fprintf(stderr, "can't set up loop\n");
|
||||
exit (1);
|
||||
}
|
||||
Index: multipath-tools-130222/kpartx/lopart.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/kpartx/lopart.c
|
||||
+++ multipath-tools-130222/kpartx/lopart.c
|
||||
@@ -230,7 +230,7 @@ set_loop (const char *device, const char
|
||||
|
||||
if ((ffd = open (file, mode)) < 0) {
|
||||
|
||||
- if (!*loopro && errno == EROFS)
|
||||
+ if (!*loopro && (errno == EROFS || errno == EACCES))
|
||||
ffd = open (file, mode = O_RDONLY);
|
||||
|
||||
if (ffd < 0) {
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
---
|
||||
libmultipath/dict.c | 4 ----
|
||||
1 file changed, 4 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/dict.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/dict.c
|
||||
+++ multipath-tools-130222/libmultipath/dict.c
|
||||
@@ -2468,16 +2468,12 @@ snprint_def_verbosity (char * buff, int
|
||||
static int
|
||||
snprint_def_max_polling_interval (char * buff, int len, void * data)
|
||||
{
|
||||
- if (conf->max_checkint == MAX_CHECKINT(conf->checkint))
|
||||
- return 0;
|
||||
return snprintf(buff, len, "%i", conf->max_checkint);
|
||||
}
|
||||
|
||||
static int
|
||||
snprint_reassign_maps (char * buff, int len, void * data)
|
||||
{
|
||||
- if (conf->reassign_maps == DEFAULT_REASSIGN_MAPS)
|
||||
- return 0;
|
||||
return snprintf(buff, len, "\"%s\"",
|
||||
conf->reassign_maps?"yes":"no");
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
---
|
||||
multipath/multipath.rules | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
Index: multipath-tools-130222/multipath/multipath.rules
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/multipath.rules
|
||||
+++ multipath-tools-130222/multipath/multipath.rules
|
||||
@@ -11,7 +11,7 @@ ACTION=="add", ENV{DEVTYPE}!="partition"
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}!="1", \
|
||||
TEST=="/etc/multipath.conf", \
|
||||
PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -c $tempnode", \
|
||||
- ENV{DM_MULTIPATH_DEVICE_PATH}="1"
|
||||
+ ENV{DM_MULTIPATH_DEVICE_PATH}="1" ENV{ID_FS_TYPE}="mpath_member"
|
||||
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", ENV{DEVTYPE}!="partition", \
|
||||
RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
---
|
||||
multipath/main.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
Index: multipath-tools-130222/multipath/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/main.c
|
||||
+++ multipath-tools-130222/multipath/main.c
|
||||
@@ -311,7 +311,7 @@ configure (void)
|
||||
/*
|
||||
* get a path list
|
||||
*/
|
||||
- if (conf->dev)
|
||||
+ if (conf->dev && !conf->list)
|
||||
di_flag = DI_WWID;
|
||||
|
||||
if (conf->list > 1)
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
|
||||
index 7b1cb62..4b860bb 100644
|
||||
--- a/multipathd/cli_handlers.c
|
||||
+++ b/multipathd/cli_handlers.c
|
||||
@@ -603,7 +603,18 @@ cli_resize(void *v, char **reply, int *len, void *data)
|
||||
}
|
||||
|
||||
pgp = VECTOR_SLOT(mpp->pg, 0);
|
||||
+
|
||||
+ if (!pgp){
|
||||
+ condlog(0, "%s: couldn't get path group. cannot resize",
|
||||
+ mapname);
|
||||
+ return 1;
|
||||
+ }
|
||||
pp = VECTOR_SLOT(pgp->paths, 0);
|
||||
+
|
||||
+ if (!pp){
|
||||
+ condlog(0, "%s: couldn't get path. cannot resize", mapname);
|
||||
+ return 1;
|
||||
+ }
|
||||
if (!pp->udev || sysfs_get_size(pp, &size)) {
|
||||
condlog(0, "%s: couldn't get size for sysfs. cannot resize",
|
||||
mapname);
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
---
|
||||
multipathd/cli_handlers.c | 3 ++-
|
||||
multipathd/main.c | 12 ++++++------
|
||||
2 files changed, 8 insertions(+), 7 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/multipathd/cli_handlers.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/cli_handlers.c
|
||||
+++ multipath-tools-130222/multipathd/cli_handlers.c
|
||||
@@ -632,7 +632,8 @@ cli_resize(void *v, char **reply, int *l
|
||||
return 1;
|
||||
|
||||
dm_lib_release();
|
||||
- setup_multipath(vecs, mpp);
|
||||
+ if (setup_multipath(vecs, mpp) != 0)
|
||||
+ return 1;
|
||||
sync_map_state(mpp);
|
||||
|
||||
return 0;
|
||||
Index: multipath-tools-130222/multipathd/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/main.c
|
||||
+++ multipath-tools-130222/multipathd/main.c
|
||||
@@ -134,7 +134,6 @@ coalesce_maps(struct vectors *vecs, vect
|
||||
struct multipath * ompp;
|
||||
vector ompv = vecs->mpvec;
|
||||
unsigned int i;
|
||||
- int j;
|
||||
|
||||
vector_foreach_slot (ompv, ompp, i) {
|
||||
if (!find_mp_by_wwid(nmpv, ompp->wwid)) {
|
||||
@@ -148,16 +147,17 @@ coalesce_maps(struct vectors *vecs, vect
|
||||
/*
|
||||
* may be just because the device is open
|
||||
*/
|
||||
+ if (setup_multipath(vecs, ompp) != 0) {
|
||||
+ i--;
|
||||
+ continue;
|
||||
+ }
|
||||
if (!vector_alloc_slot(nmpv))
|
||||
return 1;
|
||||
|
||||
vector_set_slot(nmpv, ompp);
|
||||
- setup_multipath(vecs, ompp);
|
||||
|
||||
- if ((j = find_slot(ompv, (void *)ompp)) != -1)
|
||||
- vector_del_slot(ompv, j);
|
||||
-
|
||||
- continue;
|
||||
+ vector_del_slot(ompv, i);
|
||||
+ i--;
|
||||
}
|
||||
else {
|
||||
dm_lib_release();
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
---
|
||||
libmultipath/dict.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/dict.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/dict.c
|
||||
+++ multipath-tools-130222/libmultipath/dict.c
|
||||
@@ -1126,11 +1126,11 @@ hw_failback_handler(vector strvec)
|
||||
|
||||
buff = set_value(strvec);
|
||||
|
||||
- if (strlen(buff) == 6 && !strcmp(buff, "\"manual\""))
|
||||
+ if (strlen(buff) == 6 && !strcmp(buff, "manual"))
|
||||
hwe->pgfailback = -FAILBACK_MANUAL;
|
||||
- else if (strlen(buff) == 9 && !strcmp(buff, "\"immediate\""))
|
||||
+ else if (strlen(buff) == 9 && !strcmp(buff, "immediate"))
|
||||
hwe->pgfailback = -FAILBACK_IMMEDIATE;
|
||||
- else if (strlen(buff) == 10 && !strcmp(buff, "\"followover\""))
|
||||
+ else if (strlen(buff) == 10 && !strcmp(buff, "followover"))
|
||||
hwe->pgfailback = -FAILBACK_FOLLOWOVER;
|
||||
else
|
||||
hwe->pgfailback = atoi(buff);
|
||||
|
|
@ -1,308 +0,0 @@
|
|||
---
|
||||
libmpathpersist/mpath_persist.c | 7 ++++---
|
||||
libmpathpersist/mpath_persist.h | 2 +-
|
||||
libmpathpersist/mpath_pr_ioctl.c | 5 +++--
|
||||
libmultipath/config.c | 9 +++------
|
||||
libmultipath/config.h | 2 +-
|
||||
mpathpersist/Makefile | 2 +-
|
||||
mpathpersist/main.c | 11 +++++++----
|
||||
multipath/Makefile | 2 +-
|
||||
multipath/main.c | 12 ++++++++----
|
||||
multipathd/main.c | 11 ++++++++---
|
||||
10 files changed, 37 insertions(+), 26 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmpathpersist/mpath_persist.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmpathpersist/mpath_persist.c
|
||||
+++ multipath-tools-130222/libmpathpersist/mpath_persist.c
|
||||
@@ -1,4 +1,3 @@
|
||||
-#include "mpath_persist.h"
|
||||
#include <libdevmapper.h>
|
||||
#include <defaults.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -8,6 +7,7 @@
|
||||
#include <checkers.h>
|
||||
#include <structs.h>
|
||||
#include <structs_vec.h>
|
||||
+#include <libudev.h>
|
||||
|
||||
#include <prio.h>
|
||||
#include <unistd.h>
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <ctype.h>
|
||||
#include <propsel.h>
|
||||
|
||||
+#include "mpath_persist.h"
|
||||
#include "mpathpr.h"
|
||||
#include "mpath_pr_ioctl.h"
|
||||
|
||||
@@ -32,9 +33,9 @@
|
||||
|
||||
|
||||
int
|
||||
-mpath_lib_init (void)
|
||||
+mpath_lib_init (struct udev *udev)
|
||||
{
|
||||
- if (load_config(DEFAULT_CONFIGFILE)){
|
||||
+ if (load_config(DEFAULT_CONFIGFILE, udev)){
|
||||
condlog(0, "Failed to initialize multipath config.");
|
||||
return 1;
|
||||
}
|
||||
Index: multipath-tools-130222/libmpathpersist/mpath_persist.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmpathpersist/mpath_persist.h
|
||||
+++ multipath-tools-130222/libmpathpersist/mpath_persist.h
|
||||
@@ -174,7 +174,7 @@ struct prout_param_descriptor { /* PROU
|
||||
*
|
||||
* RETURNS: 0->Success, 1->Failed.
|
||||
*/
|
||||
-extern int mpath_lib_init (void );
|
||||
+extern int mpath_lib_init (struct udev *udev);
|
||||
|
||||
|
||||
/*
|
||||
Index: multipath-tools-130222/libmpathpersist/mpath_pr_ioctl.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmpathpersist/mpath_pr_ioctl.c
|
||||
+++ multipath-tools-130222/libmpathpersist/mpath_pr_ioctl.c
|
||||
@@ -10,8 +10,9 @@
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
-#include "mpath_pr_ioctl.h"
|
||||
-#include <mpath_persist.h>
|
||||
+#include <libudev.h>
|
||||
+#include "mpath_pr_ioctl.h"
|
||||
+#include <mpath_persist.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/config.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/config.c
|
||||
+++ multipath-tools-130222/libmultipath/config.c
|
||||
@@ -467,9 +467,6 @@ free_config (struct config * conf)
|
||||
if (conf->dev)
|
||||
FREE(conf->dev);
|
||||
|
||||
- if (conf->udev)
|
||||
- udev_unref(conf->udev);
|
||||
-
|
||||
if (conf->multipath_dir)
|
||||
FREE(conf->multipath_dir);
|
||||
|
||||
@@ -519,12 +516,12 @@ free_config (struct config * conf)
|
||||
}
|
||||
|
||||
int
|
||||
-load_config (char * file)
|
||||
+load_config (char * file, struct udev *udev)
|
||||
{
|
||||
if (!conf)
|
||||
conf = alloc_config();
|
||||
|
||||
- if (!conf)
|
||||
+ if (!conf || !udev)
|
||||
return 1;
|
||||
|
||||
/*
|
||||
@@ -533,7 +530,7 @@ load_config (char * file)
|
||||
if (!conf->verbosity)
|
||||
conf->verbosity = DEFAULT_VERBOSITY;
|
||||
|
||||
- conf->udev = udev_new();
|
||||
+ conf->udev = udev;
|
||||
dm_drv_version(conf->version, TGT_MPATH);
|
||||
conf->dev_type = DEV_NONE;
|
||||
conf->minio = DEFAULT_MINIO;
|
||||
Index: multipath-tools-130222/libmultipath/config.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/config.h
|
||||
+++ multipath-tools-130222/libmultipath/config.h
|
||||
@@ -159,7 +159,7 @@ void free_mptable (vector mptable);
|
||||
|
||||
int store_hwe (vector hwtable, struct hwentry *);
|
||||
|
||||
-int load_config (char * file);
|
||||
+int load_config (char * file, struct udev * udev);
|
||||
struct config * alloc_config (void);
|
||||
void free_config (struct config * conf);
|
||||
|
||||
Index: multipath-tools-130222/mpathpersist/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/mpathpersist/main.c
|
||||
+++ multipath-tools-130222/mpathpersist/main.c
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <vector.h>
|
||||
#include <structs.h>
|
||||
#include <getopt.h>
|
||||
+#include <libudev.h>
|
||||
#include <mpath_persist.h>
|
||||
#include "main.h"
|
||||
#include <pthread.h>
|
||||
@@ -68,7 +69,8 @@ int main (int argc, char * argv[])
|
||||
int noisy = 0;
|
||||
int num_transport =0;
|
||||
void *resp = NULL;
|
||||
- struct transportid * tmp;
|
||||
+ struct transportid * tmp;
|
||||
+ struct udev *udev = NULL;
|
||||
|
||||
if (optind == argc)
|
||||
{
|
||||
@@ -84,8 +86,8 @@ int main (int argc, char * argv[])
|
||||
exit (1);
|
||||
}
|
||||
|
||||
-
|
||||
- mpath_lib_init();
|
||||
+ udev = udev_new();
|
||||
+ mpath_lib_init(udev);
|
||||
memset(transportids,0,MPATH_MX_TIDS);
|
||||
|
||||
while (1)
|
||||
@@ -461,12 +463,13 @@ int main (int argc, char * argv[])
|
||||
if (res < 0)
|
||||
{
|
||||
mpath_lib_exit();
|
||||
+ udev_unref(udev);
|
||||
return MPATH_PR_FILE_ERROR;
|
||||
}
|
||||
|
||||
out :
|
||||
mpath_lib_exit();
|
||||
-
|
||||
+ udev_unref(udev);
|
||||
return (ret >= 0) ? ret : MPATH_PR_OTHER;
|
||||
}
|
||||
|
||||
Index: multipath-tools-130222/multipath/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/main.c
|
||||
+++ multipath-tools-130222/multipath/main.c
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
+#include <libudev.h>
|
||||
|
||||
#include <checkers.h>
|
||||
#include <prio.h>
|
||||
@@ -435,6 +436,7 @@ convert_dev(char *dev)
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
+ struct udev *udev;
|
||||
int arg;
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
@@ -445,7 +447,9 @@ main (int argc, char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
- if (load_config(DEFAULT_CONFIGFILE))
|
||||
+ udev = udev_new();
|
||||
+
|
||||
+ if (load_config(DEFAULT_CONFIGFILE, udev))
|
||||
exit(1);
|
||||
|
||||
if (dm_prereq())
|
||||
@@ -560,11 +564,11 @@ main (int argc, char *argv[])
|
||||
|
||||
if (init_checkers()) {
|
||||
condlog(0, "failed to initialize checkers");
|
||||
- exit(1);
|
||||
+ goto out;
|
||||
}
|
||||
if (init_prio()) {
|
||||
condlog(0, "failed to initialize prioritizers");
|
||||
- exit(1);
|
||||
+ goto out;
|
||||
}
|
||||
dm_init();
|
||||
|
||||
@@ -628,7 +632,7 @@ out:
|
||||
*/
|
||||
free_config(conf);
|
||||
conf = NULL;
|
||||
-
|
||||
+ udev_unref(udev);
|
||||
#ifdef _DEBUG_
|
||||
dbg_free_final(NULL);
|
||||
#endif
|
||||
Index: multipath-tools-130222/multipathd/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/main.c
|
||||
+++ multipath-tools-130222/multipathd/main.c
|
||||
@@ -93,6 +93,8 @@ static sem_t exit_sem;
|
||||
*/
|
||||
struct vectors * gvecs;
|
||||
|
||||
+struct udev * udev;
|
||||
+
|
||||
static int
|
||||
need_switch_pathgroup (struct multipath * mpp, int refresh)
|
||||
{
|
||||
@@ -1408,7 +1410,7 @@ reconfigure (struct vectors * vecs)
|
||||
vecs->pathvec = NULL;
|
||||
conf = NULL;
|
||||
|
||||
- if (!load_config(DEFAULT_CONFIGFILE)) {
|
||||
+ if (!load_config(DEFAULT_CONFIGFILE, udev)) {
|
||||
conf->verbosity = old->verbosity;
|
||||
conf->daemon = 1;
|
||||
configure(vecs, 1);
|
||||
@@ -1601,6 +1603,8 @@ child (void * param)
|
||||
sem_init(&exit_sem, 0, 0);
|
||||
signal_init();
|
||||
|
||||
+ udev = udev_new();
|
||||
+
|
||||
setup_thread_attr(&misc_attr, 64 * 1024, 1);
|
||||
setup_thread_attr(&waiter_attr, 32 * 1024, 1);
|
||||
|
||||
@@ -1615,7 +1619,7 @@ child (void * param)
|
||||
condlog(2, "--------start up--------");
|
||||
condlog(2, "read " DEFAULT_CONFIGFILE);
|
||||
|
||||
- if (load_config(DEFAULT_CONFIGFILE))
|
||||
+ if (load_config(DEFAULT_CONFIGFILE, udev))
|
||||
exit(1);
|
||||
|
||||
if (init_checkers()) {
|
||||
@@ -1765,7 +1769,8 @@ child (void * param)
|
||||
*/
|
||||
free_config(conf);
|
||||
conf = NULL;
|
||||
-
|
||||
+ udev_unref(udev);
|
||||
+ udev = NULL;
|
||||
#ifdef _DEBUG_
|
||||
dbg_free_final(NULL);
|
||||
#endif
|
||||
Index: multipath-tools-130222/mpathpersist/Makefile
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/mpathpersist/Makefile
|
||||
+++ multipath-tools-130222/mpathpersist/Makefile
|
||||
@@ -5,7 +5,7 @@ include ../Makefile.inc
|
||||
OBJS = main.o
|
||||
|
||||
CFLAGS += -I$(multipathdir) -I$(mpathpersistdir)
|
||||
-LDFLAGS += -lpthread -ldevmapper -L$(mpathpersistdir) -lmpathpersist -L$(multipathdir) -lmultipath
|
||||
+LDFLAGS += -lpthread -ldevmapper -L$(mpathpersistdir) -lmpathpersist -L$(multipathdir) -lmultipath -ludev
|
||||
|
||||
EXEC = mpathpersist
|
||||
|
||||
Index: multipath-tools-130222/multipath/Makefile
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/Makefile
|
||||
+++ multipath-tools-130222/multipath/Makefile
|
||||
@@ -7,7 +7,7 @@ include ../Makefile.inc
|
||||
OBJS = main.o
|
||||
|
||||
CFLAGS += -fPIC -I$(multipathdir)
|
||||
-LDFLAGS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath
|
||||
+LDFLAGS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath -ludev
|
||||
|
||||
EXEC = multipath
|
||||
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
---
|
||||
libmultipath/discovery.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/discovery.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/discovery.c
|
||||
+++ multipath-tools-130222/libmultipath/discovery.c
|
||||
@@ -799,6 +799,7 @@ path_offline (struct path * pp)
|
||||
condlog(3, "%s: path state = %s", pp->dev, buff);
|
||||
|
||||
if (!strncmp(buff, "offline", 7) ||
|
||||
+ !strncmp(buff, "quiesce", 7) ||
|
||||
!strncmp(buff, "transport-offline", 17)) {
|
||||
pp->offline = 1;
|
||||
return PATH_DOWN;
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
---
|
||||
libmultipath/prioritizers/alua.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/prioritizers/alua.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/prioritizers/alua.c
|
||||
+++ multipath-tools-130222/libmultipath/prioritizers/alua.c
|
||||
@@ -108,7 +108,7 @@ int getprio (struct path * pp, char * ar
|
||||
default:
|
||||
rc = 0;
|
||||
}
|
||||
- if (priopath)
|
||||
+ if (priopath && aas != AAS_OPTIMIZED)
|
||||
rc += 80;
|
||||
} else {
|
||||
switch(-rc) {
|
||||
|
|
@ -1,329 +0,0 @@
|
|||
---
|
||||
libmultipath/discovery.c | 109 +++++++++++++++++++++++++++++++++++++----------
|
||||
libmultipath/sysfs.c | 86 +++++++++++++++++++++++++++++++------
|
||||
libmultipath/sysfs.h | 2
|
||||
3 files changed, 161 insertions(+), 36 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/discovery.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/discovery.c
|
||||
+++ multipath-tools-130222/libmultipath/discovery.c
|
||||
@@ -162,7 +162,6 @@ declare_sysfs_get_str(cutype);
|
||||
declare_sysfs_get_str(vendor);
|
||||
declare_sysfs_get_str(model);
|
||||
declare_sysfs_get_str(rev);
|
||||
-declare_sysfs_get_str(state);
|
||||
declare_sysfs_get_str(dev);
|
||||
|
||||
int
|
||||
@@ -315,9 +314,14 @@ static void
|
||||
sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
|
||||
{
|
||||
struct udev_device *rport_dev = NULL;
|
||||
- char value[11];
|
||||
+ char value[16];
|
||||
char rport_id[32];
|
||||
+ int delay_fast_io_fail = 0;
|
||||
+ int current_dev_loss = 0;
|
||||
+ int ret;
|
||||
|
||||
+ if (!mpp->dev_loss && mpp->fast_io_fail == MP_FAST_IO_FAIL_UNSET)
|
||||
+ return;
|
||||
sprintf(rport_id, "rport-%d:%d-%d",
|
||||
pp->sg_id.host_no, pp->sg_id.channel, pp->sg_id.transport_id);
|
||||
rport_dev = udev_device_new_from_subsystem_sysname(conf->udev,
|
||||
@@ -330,33 +334,85 @@ sysfs_set_rport_tmo(struct multipath *mp
|
||||
condlog(4, "target%d:%d:%d -> %s", pp->sg_id.host_no,
|
||||
pp->sg_id.channel, pp->sg_id.scsi_id, rport_id);
|
||||
|
||||
- snprintf(value, 11, "%u", mpp->dev_loss);
|
||||
- if (mpp->dev_loss &&
|
||||
- sysfs_attr_set_value(rport_dev, "dev_loss_tmo", value, 11) <= 0) {
|
||||
- if ((mpp->fast_io_fail == MP_FAST_IO_FAIL_UNSET ||
|
||||
- mpp->fast_io_fail == MP_FAST_IO_FAIL_OFF)
|
||||
- && mpp->dev_loss > 600) {
|
||||
- condlog(3, "%s: limiting dev_loss_tmo to 600, since "
|
||||
- "fast_io_fail is not set", mpp->alias);
|
||||
- snprintf(value, 11, "%u", 600);
|
||||
- if (sysfs_attr_set_value(rport_dev, "dev_loss_tmo",
|
||||
- value, 11) <= 0)
|
||||
- condlog(0, "%s failed to set dev_loss_tmo",
|
||||
- mpp->alias);
|
||||
+ memset(value, 0, 16);
|
||||
+ if (mpp->fast_io_fail != MP_FAST_IO_FAIL_UNSET) {
|
||||
+ ret = sysfs_attr_get_value(rport_dev, "dev_loss_tmo",
|
||||
+ value, 16);
|
||||
+ if (ret <= 0) {
|
||||
+ condlog(0, "%s: failed to read dev_loss_tmo value, "
|
||||
+ "error %d", rport_id, -ret);
|
||||
goto out;
|
||||
}
|
||||
+ if (sscanf(value, "%u\n", ¤t_dev_loss) != 1) {
|
||||
+ condlog(0, "%s: Cannot parse dev_loss_tmo "
|
||||
+ "attribute '%s'", rport_id, value);
|
||||
+ goto out;
|
||||
+ }
|
||||
+ if ((mpp->dev_loss &&
|
||||
+ mpp->fast_io_fail >= (int)mpp->dev_loss) ||
|
||||
+ (!mpp->dev_loss &&
|
||||
+ mpp->fast_io_fail >= (int)current_dev_loss)) {
|
||||
+ condlog(3, "%s: limiting fast_io_fail_tmo to %d, since "
|
||||
+ "it must be less than dev_loss_tmo",
|
||||
+ rport_id, mpp->dev_loss - 1);
|
||||
+ if (mpp->dev_loss)
|
||||
+ mpp->fast_io_fail = mpp->dev_loss - 1;
|
||||
+ else
|
||||
+ mpp->fast_io_fail = current_dev_loss - 1;
|
||||
+ }
|
||||
+ if (mpp->fast_io_fail >= (int)current_dev_loss)
|
||||
+ delay_fast_io_fail = 1;
|
||||
+ }
|
||||
+ if (mpp->dev_loss > 600 &&
|
||||
+ (mpp->fast_io_fail == MP_FAST_IO_FAIL_OFF ||
|
||||
+ mpp->fast_io_fail == MP_FAST_IO_FAIL_UNSET)) {
|
||||
+ condlog(3, "%s: limiting dev_loss_tmo to 600, since "
|
||||
+ "fast_io_fail is unset or off", rport_id);
|
||||
+ mpp->dev_loss = 600;
|
||||
}
|
||||
- if (mpp->fast_io_fail != MP_FAST_IO_FAIL_UNSET){
|
||||
+ if (mpp->fast_io_fail != MP_FAST_IO_FAIL_UNSET) {
|
||||
if (mpp->fast_io_fail == MP_FAST_IO_FAIL_OFF)
|
||||
sprintf(value, "off");
|
||||
else if (mpp->fast_io_fail == MP_FAST_IO_FAIL_ZERO)
|
||||
sprintf(value, "0");
|
||||
+ else if (delay_fast_io_fail)
|
||||
+ snprintf(value, 16, "%u", current_dev_loss - 1);
|
||||
else
|
||||
- snprintf(value, 11, "%u", mpp->fast_io_fail);
|
||||
- if (sysfs_attr_set_value(rport_dev, "fast_io_fail_tmo",
|
||||
- value, 11) <= 0) {
|
||||
- condlog(0, "%s failed to set fast_io_fail_tmo",
|
||||
- mpp->alias);
|
||||
+ snprintf(value, 16, "%u", mpp->fast_io_fail);
|
||||
+ ret = sysfs_attr_set_value(rport_dev, "fast_io_fail_tmo",
|
||||
+ value, strlen(value));
|
||||
+ if (ret <= 0) {
|
||||
+ if (ret == -EBUSY)
|
||||
+ condlog(3, "%s: rport blocked", rport_id);
|
||||
+ else
|
||||
+ condlog(0, "%s: failed to set fast_io_fail_tmo to %s, error %d",
|
||||
+ rport_id, value, -ret);
|
||||
+ goto out;
|
||||
+ }
|
||||
+ }
|
||||
+ if (mpp->dev_loss) {
|
||||
+ snprintf(value, 16, "%u", mpp->dev_loss);
|
||||
+ ret = sysfs_attr_set_value(rport_dev, "dev_loss_tmo",
|
||||
+ value, strlen(value));
|
||||
+ if (ret <= 0) {
|
||||
+ if (ret == -EBUSY)
|
||||
+ condlog(3, "%s: rport blocked", rport_id);
|
||||
+ else
|
||||
+ condlog(0, "%s: failed to set dev_loss_tmo to %s, error %d",
|
||||
+ rport_id, value, -ret);
|
||||
+ goto out;
|
||||
+ }
|
||||
+ }
|
||||
+ if (delay_fast_io_fail) {
|
||||
+ snprintf(value, 16, "%u", mpp->fast_io_fail);
|
||||
+ ret = sysfs_attr_set_value(rport_dev, "fast_io_fail_tmo",
|
||||
+ value, strlen(value));
|
||||
+ if (ret <= 0) {
|
||||
+ if (ret == -EBUSY)
|
||||
+ condlog(3, "%s: rport blocked", rport_id);
|
||||
+ else
|
||||
+ condlog(0, "%s: failed to set fast_io_fail_tmo to %s, error %d",
|
||||
+ rport_id, value, -ret);
|
||||
}
|
||||
}
|
||||
out:
|
||||
@@ -394,7 +450,7 @@ sysfs_set_session_tmo(struct multipath *
|
||||
} else {
|
||||
snprintf(value, 11, "%u", mpp->fast_io_fail);
|
||||
if (sysfs_attr_set_value(session_dev, "recovery_tmo",
|
||||
- value, 11)) {
|
||||
+ value, 11) <= 0) {
|
||||
condlog(3, "%s: Failed to set recovery_tmo, "
|
||||
" error %d", pp->dev, errno);
|
||||
}
|
||||
@@ -752,6 +808,9 @@ cciss_sysfs_pathinfo (struct path * pp)
|
||||
static int
|
||||
common_sysfs_pathinfo (struct path * pp)
|
||||
{
|
||||
+ if (!pp)
|
||||
+ return 1;
|
||||
+
|
||||
if (!pp->udev) {
|
||||
condlog(4, "%s: udev not initialised", pp->dev);
|
||||
return 1;
|
||||
@@ -793,7 +852,8 @@ path_offline (struct path * pp)
|
||||
return PATH_DOWN;
|
||||
}
|
||||
|
||||
- if (sysfs_get_state(parent, buff, SCSI_STATE_SIZE))
|
||||
+ memset(buff, 0x0, SCSI_STATE_SIZE);
|
||||
+ if (sysfs_attr_get_value(parent, "state", buff, SCSI_STATE_SIZE) <= 0)
|
||||
return PATH_DOWN;
|
||||
|
||||
condlog(3, "%s: path state = %s", pp->dev, buff);
|
||||
@@ -983,6 +1043,9 @@ pathinfo (struct path *pp, vector hwtabl
|
||||
{
|
||||
int path_state;
|
||||
|
||||
+ if (!pp)
|
||||
+ return 1;
|
||||
+
|
||||
condlog(3, "%s: mask = 0x%x", pp->dev, mask);
|
||||
|
||||
/*
|
||||
Index: multipath-tools-130222/libmultipath/sysfs.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/sysfs.c
|
||||
+++ multipath-tools-130222/libmultipath/sysfs.c
|
||||
@@ -38,7 +38,12 @@
|
||||
#include "debug.h"
|
||||
#include "devmapper.h"
|
||||
|
||||
-ssize_t sysfs_attr_set_value(struct udev_device *dev, const char *attr_name,
|
||||
+/*
|
||||
+ * When we modify an attribute value we cannot rely on libudev for now,
|
||||
+ * as libudev lacks the capability to update an attribute value.
|
||||
+ * So for modified attributes we need to implement our own function.
|
||||
+ */
|
||||
+ssize_t sysfs_attr_get_value(struct udev_device *dev, const char *attr_name,
|
||||
char * value, size_t value_len)
|
||||
{
|
||||
char devpath[PATH_SIZE];
|
||||
@@ -54,28 +59,83 @@ ssize_t sysfs_attr_set_value(struct udev
|
||||
condlog(4, "open '%s'", devpath);
|
||||
if (stat(devpath, &statbuf) != 0) {
|
||||
condlog(4, "stat '%s' failed: %s", devpath, strerror(errno));
|
||||
- return 0;
|
||||
+ return -errno;
|
||||
}
|
||||
|
||||
/* skip directories */
|
||||
- if (S_ISDIR(statbuf.st_mode))
|
||||
- return 0;
|
||||
+ if (S_ISDIR(statbuf.st_mode)) {
|
||||
+ condlog(4, "%s is a directory", devpath);
|
||||
+ return -EISDIR;
|
||||
+ }
|
||||
|
||||
/* skip non-writeable files */
|
||||
- if ((statbuf.st_mode & S_IWUSR) == 0)
|
||||
+ if ((statbuf.st_mode & S_IRUSR) == 0) {
|
||||
+ condlog(4, "%s is not readable", devpath);
|
||||
+ return -EPERM;
|
||||
+ }
|
||||
+
|
||||
+ /* read attribute value */
|
||||
+ fd = open(devpath, O_RDONLY);
|
||||
+ if (fd < 0) {
|
||||
+ condlog(4, "attribute '%s' can not be opened: %s",
|
||||
+ devpath, strerror(errno));
|
||||
+ return -errno;
|
||||
+ }
|
||||
+ size = read(fd, value, value_len);
|
||||
+ if (size < 0) {
|
||||
+ condlog(4, "read from %s failed: %s", devpath, strerror(errno));
|
||||
+ size = -errno;
|
||||
+ } else if (size == value_len) {
|
||||
+ condlog(4, "overflow while reading from %s", devpath);
|
||||
+ size = 0;
|
||||
+ }
|
||||
+
|
||||
+ close(fd);
|
||||
+ return size;
|
||||
+}
|
||||
+
|
||||
+ssize_t sysfs_attr_set_value(struct udev_device *dev, const char *attr_name,
|
||||
+ char * value, size_t value_len)
|
||||
+{
|
||||
+ char devpath[PATH_SIZE];
|
||||
+ struct stat statbuf;
|
||||
+ int fd;
|
||||
+ ssize_t size = -1;
|
||||
+
|
||||
+ if (!dev || !attr_name || !value || !value_len)
|
||||
return 0;
|
||||
|
||||
+ snprintf(devpath, PATH_SIZE, "%s/%s", udev_device_get_syspath(dev),
|
||||
+ attr_name);
|
||||
+ condlog(4, "open '%s'", devpath);
|
||||
+ if (stat(devpath, &statbuf) != 0) {
|
||||
+ condlog(4, "stat '%s' failed: %s", devpath, strerror(errno));
|
||||
+ return -errno;
|
||||
+ }
|
||||
+
|
||||
+ /* skip directories */
|
||||
+ if (S_ISDIR(statbuf.st_mode)) {
|
||||
+ condlog(4, "%s is a directory", devpath);
|
||||
+ return -EISDIR;
|
||||
+ }
|
||||
+
|
||||
+ /* skip non-writeable files */
|
||||
+ if ((statbuf.st_mode & S_IWUSR) == 0) {
|
||||
+ condlog(4, "%s is not writeable", devpath);
|
||||
+ return -EPERM;
|
||||
+ }
|
||||
+
|
||||
/* write attribute value */
|
||||
fd = open(devpath, O_WRONLY);
|
||||
if (fd < 0) {
|
||||
condlog(4, "attribute '%s' can not be opened: %s",
|
||||
devpath, strerror(errno));
|
||||
- return 0;
|
||||
+ return -errno;
|
||||
}
|
||||
size = write(fd, value, value_len);
|
||||
if (size < 0) {
|
||||
condlog(4, "write to %s failed: %s", devpath, strerror(errno));
|
||||
- size = 0;
|
||||
+ size = -errno;
|
||||
} else if (size < value_len) {
|
||||
condlog(4, "tried to write %ld to %s. Wrote %ld",
|
||||
(long)value_len, devpath, (long)size);
|
||||
@@ -89,14 +149,14 @@ ssize_t sysfs_attr_set_value(struct udev
|
||||
int
|
||||
sysfs_get_size (struct path *pp, unsigned long long * size)
|
||||
{
|
||||
- const char * attr;
|
||||
+ char attr[255];
|
||||
int r;
|
||||
|
||||
- if (!pp->udev)
|
||||
+ if (!pp->udev || !size)
|
||||
return 1;
|
||||
|
||||
- attr = udev_device_get_sysattr_value(pp->udev, "size");
|
||||
- if (!attr) {
|
||||
+ attr[0] = '\0';
|
||||
+ if (sysfs_attr_get_value(pp->udev, "size", attr, 255) == 0) {
|
||||
condlog(3, "%s: No size attribute in sysfs", pp->dev);
|
||||
return 1;
|
||||
}
|
||||
@@ -104,8 +164,8 @@ sysfs_get_size (struct path *pp, unsigne
|
||||
r = sscanf(attr, "%llu\n", size);
|
||||
|
||||
if (r != 1) {
|
||||
- condlog(3, "%s: Cannot parse size attribute '%s'",
|
||||
- pp->dev, attr);
|
||||
+ condlog(3, "%s: Cannot parse size attribute", pp->dev);
|
||||
+ *size = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/sysfs.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/sysfs.h
|
||||
+++ multipath-tools-130222/libmultipath/sysfs.h
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
ssize_t sysfs_attr_set_value(struct udev_device *dev, const char *attr_name,
|
||||
char * value, size_t value_len);
|
||||
+ssize_t sysfs_attr_get_value(struct udev_device *dev, const char *attr_name,
|
||||
+ char * value, size_t value_len);
|
||||
int sysfs_get_size (struct path *pp, unsigned long long * size);
|
||||
int sysfs_check_holders(char * check_devt, char * new_devt);
|
||||
#endif
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
---
|
||||
libmultipath/dict.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/dict.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/dict.c
|
||||
+++ multipath-tools-130222/libmultipath/dict.c
|
||||
@@ -2562,7 +2562,7 @@ snprint_def_failback (char * buff, int l
|
||||
if (!pgfailback)
|
||||
pgfailback = DEFAULT_FAILBACK;
|
||||
|
||||
- switch(conf->pgfailback) {
|
||||
+ switch(pgfailback) {
|
||||
case FAILBACK_UNDEF:
|
||||
break;
|
||||
case -FAILBACK_MANUAL:
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
---
|
||||
libmultipath/devmapper.c | 21 +++++++++++++++++----
|
||||
libmultipath/devmapper.h | 2 +-
|
||||
2 files changed, 18 insertions(+), 5 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/devmapper.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/devmapper.c
|
||||
+++ multipath-tools-130222/libmultipath/devmapper.c
|
||||
@@ -363,7 +363,7 @@ out:
|
||||
}
|
||||
|
||||
extern int
|
||||
-dm_get_map(char * name, unsigned long long * size, char * outparams)
|
||||
+dm_get_map(const char * name, unsigned long long * size, char * outparams)
|
||||
{
|
||||
int r = 1;
|
||||
struct dm_task *dmt;
|
||||
@@ -682,7 +682,9 @@ _dm_flush_map (const char * mapname, int
|
||||
extern int
|
||||
dm_suspend_and_flush_map (const char * mapname)
|
||||
{
|
||||
- int s;
|
||||
+ int s = 0, queue_if_no_path = 0;
|
||||
+ unsigned long long mapsize;
|
||||
+ char params[PARAMS_SIZE] = {0};
|
||||
|
||||
if (!dm_map_present(mapname))
|
||||
return 0;
|
||||
@@ -690,8 +692,17 @@ dm_suspend_and_flush_map (const char * m
|
||||
if (dm_type(mapname, TGT_MPATH) <= 0)
|
||||
return 0; /* nothing to do */
|
||||
|
||||
- s = dm_queue_if_no_path((char *)mapname, 0);
|
||||
- if (!s)
|
||||
+ if (!dm_get_map(mapname, &mapsize, params)) {
|
||||
+ if (strstr(params, "queue_if_no_path"))
|
||||
+ queue_if_no_path = 1;
|
||||
+ }
|
||||
+
|
||||
+ if (queue_if_no_path)
|
||||
+ s = dm_queue_if_no_path((char *)mapname, 0);
|
||||
+ /* Leave queue_if_no_path alone if unset failed */
|
||||
+ if (s)
|
||||
+ queue_if_no_path = 0;
|
||||
+ else
|
||||
s = dm_simplecmd_flush(DM_DEVICE_SUSPEND, mapname, 0);
|
||||
|
||||
if (!dm_flush_map(mapname)) {
|
||||
@@ -700,6 +711,8 @@ dm_suspend_and_flush_map (const char * m
|
||||
}
|
||||
condlog(2, "failed to remove multipath map %s", mapname);
|
||||
dm_simplecmd_noflush(DM_DEVICE_RESUME, mapname);
|
||||
+ if (queue_if_no_path)
|
||||
+ s = dm_queue_if_no_path((char *)mapname, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/devmapper.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/devmapper.h
|
||||
+++ multipath-tools-130222/libmultipath/devmapper.h
|
||||
@@ -14,7 +14,7 @@ int dm_simplecmd_noflush (int, const cha
|
||||
int dm_addmap_create (struct multipath *mpp, char *params);
|
||||
int dm_addmap_reload (struct multipath *mpp, char *params);
|
||||
int dm_map_present (const char *);
|
||||
-int dm_get_map(char *, unsigned long long *, char *);
|
||||
+int dm_get_map(const char *, unsigned long long *, char *);
|
||||
int dm_get_status(char *, char *);
|
||||
int dm_type(const char *, char *);
|
||||
int _dm_flush_map (const char *, int);
|
||||
|
|
@ -1,127 +0,0 @@
|
|||
---
|
||||
libmultipath/uevent.c | 17 ++++++++++++-----
|
||||
libmultipath/uevent.h | 4 +++-
|
||||
multipathd/main.c | 8 +++++---
|
||||
3 files changed, 20 insertions(+), 9 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/uevent.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/uevent.c
|
||||
+++ multipath-tools-130222/libmultipath/uevent.c
|
||||
@@ -47,7 +47,6 @@
|
||||
#include "list.h"
|
||||
#include "uevent.h"
|
||||
#include "vector.h"
|
||||
-#include "config.h"
|
||||
|
||||
typedef int (uev_trigger)(struct uevent *, void * trigger_data);
|
||||
|
||||
@@ -127,11 +126,14 @@ service_uevq(struct list_head *tmpq)
|
||||
|
||||
static void uevq_stop(void *arg)
|
||||
{
|
||||
+ struct udev *udev = arg;
|
||||
+
|
||||
condlog(3, "Stopping uev queue");
|
||||
pthread_mutex_lock(uevq_lockp);
|
||||
my_uev_trigger = NULL;
|
||||
pthread_cond_signal(uev_condp);
|
||||
pthread_mutex_unlock(uevq_lockp);
|
||||
+ udev_unref(udev);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -399,9 +401,9 @@ exit:
|
||||
return 1;
|
||||
}
|
||||
|
||||
-int uevent_listen(void)
|
||||
+int uevent_listen(struct udev *udev)
|
||||
{
|
||||
- int err;
|
||||
+ int err = 2;
|
||||
struct udev_monitor *monitor = NULL;
|
||||
int fd, socket_flags;
|
||||
int need_failback = 1;
|
||||
@@ -411,9 +413,14 @@ int uevent_listen(void)
|
||||
* thereby not getting to empty the socket's receive buffer queue
|
||||
* often enough.
|
||||
*/
|
||||
- pthread_cleanup_push(uevq_stop, NULL);
|
||||
+ if (!udev) {
|
||||
+ condlog(1, "no udev context");
|
||||
+ return 1;
|
||||
+ }
|
||||
+ udev_ref(udev);
|
||||
+ pthread_cleanup_push(uevq_stop, udev);
|
||||
|
||||
- monitor = udev_monitor_new_from_netlink(conf->udev, "udev");
|
||||
+ monitor = udev_monitor_new_from_netlink(udev, "udev");
|
||||
if (!monitor) {
|
||||
condlog(2, "failed to create udev monitor");
|
||||
goto out;
|
||||
Index: multipath-tools-130222/libmultipath/uevent.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/uevent.h
|
||||
+++ multipath-tools-130222/libmultipath/uevent.h
|
||||
@@ -13,6 +13,8 @@
|
||||
#define NETLINK_KOBJECT_UEVENT 15
|
||||
#endif
|
||||
|
||||
+struct udev;
|
||||
+
|
||||
struct uevent {
|
||||
struct list_head node;
|
||||
struct udev_device *udev;
|
||||
@@ -27,7 +29,7 @@ struct uevent {
|
||||
int is_uevent_busy(void);
|
||||
void setup_thread_attr(pthread_attr_t *attr, size_t stacksize, int detached);
|
||||
|
||||
-int uevent_listen(void);
|
||||
+int uevent_listen(struct udev *udev);
|
||||
int uevent_dispatch(int (*store_uev)(struct uevent *, void * trigger_data),
|
||||
void * trigger_data);
|
||||
int uevent_get_major(struct uevent *uev);
|
||||
Index: multipath-tools-130222/multipathd/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/main.c
|
||||
+++ multipath-tools-130222/multipathd/main.c
|
||||
@@ -840,7 +840,7 @@ out:
|
||||
static void *
|
||||
ueventloop (void * ap)
|
||||
{
|
||||
- if (uevent_listen())
|
||||
+ if (uevent_listen(udev))
|
||||
condlog(0, "error starting uevent listener");
|
||||
|
||||
return NULL;
|
||||
@@ -1593,7 +1593,7 @@ static int
|
||||
child (void * param)
|
||||
{
|
||||
pthread_t check_thr, uevent_thr, uxlsnr_thr, uevq_thr;
|
||||
- pthread_attr_t log_attr, misc_attr;
|
||||
+ pthread_attr_t log_attr, misc_attr, uevent_attr;
|
||||
struct vectors * vecs;
|
||||
struct multipath * mpp;
|
||||
int i;
|
||||
@@ -1606,6 +1606,7 @@ child (void * param)
|
||||
udev = udev_new();
|
||||
|
||||
setup_thread_attr(&misc_attr, 64 * 1024, 1);
|
||||
+ setup_thread_attr(&uevent_attr, 128 * 1024, 1);
|
||||
setup_thread_attr(&waiter_attr, 32 * 1024, 1);
|
||||
|
||||
if (logsink) {
|
||||
@@ -1671,10 +1672,11 @@ child (void * param)
|
||||
/*
|
||||
* Start uevent listener early to catch events
|
||||
*/
|
||||
- if ((rc = pthread_create(&uevent_thr, &misc_attr, ueventloop, vecs))) {
|
||||
+ if ((rc = pthread_create(&uevent_thr, &uevent_attr, ueventloop, udev))) {
|
||||
condlog(0, "failed to create uevent thread: %d", rc);
|
||||
exit(1);
|
||||
}
|
||||
+ pthread_attr_destroy(&uevent_attr);
|
||||
if ((rc = pthread_create(&uxlsnr_thr, &misc_attr, uxlsnrloop, vecs))) {
|
||||
condlog(0, "failed to create cli listener: %d", rc);
|
||||
exit(1);
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
---
|
||||
libmultipath/dict.c | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/dict.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/dict.c
|
||||
+++ multipath-tools-130222/libmultipath/dict.c
|
||||
@@ -2717,8 +2717,6 @@ snprint_def_log_checker_err (char * buff
|
||||
static int
|
||||
snprint_def_find_multipaths (char * buff, int len, void * data)
|
||||
{
|
||||
- if (conf->find_multipaths == DEFAULT_FIND_MULTIPATHS)
|
||||
- return 0;
|
||||
if (!conf->find_multipaths)
|
||||
return snprintf(buff, len, "no");
|
||||
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
---
|
||||
multipathd/main.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/multipathd/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/main.c
|
||||
+++ multipath-tools-130222/multipathd/main.c
|
||||
@@ -1735,8 +1735,9 @@ child (void * param)
|
||||
vecs->pathvec = NULL;
|
||||
unlock(vecs->lock);
|
||||
/* Now all the waitevent threads will start rushing in. */
|
||||
+ /* freeing vecs isn't worth the races
|
||||
while (vecs->lock.depth > 0) {
|
||||
- sleep (1); /* This is weak. */
|
||||
+ sleep (1);
|
||||
condlog(3, "Have %d wait event checkers threads to de-alloc,"
|
||||
" waiting...", vecs->lock.depth);
|
||||
}
|
||||
@@ -1746,7 +1747,7 @@ child (void * param)
|
||||
vecs->lock.mutex = NULL;
|
||||
FREE(vecs);
|
||||
vecs = NULL;
|
||||
-
|
||||
+ */
|
||||
cleanup_checkers();
|
||||
cleanup_prio();
|
||||
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
---
|
||||
kpartx/dasd.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
Index: multipath-tools-130222/kpartx/dasd.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/kpartx/dasd.c
|
||||
+++ multipath-tools-130222/kpartx/dasd.c
|
||||
@@ -46,6 +46,8 @@ unsigned long long sectors512(unsigned l
|
||||
return sectors * (blocksize >> 9);
|
||||
}
|
||||
|
||||
+typedef unsigned int __attribute__((__may_alias__)) label_ints_t;
|
||||
+
|
||||
/*
|
||||
*/
|
||||
int
|
||||
@@ -169,7 +171,7 @@ read_dasd_pt(int fd, struct slice all, s
|
||||
/*
|
||||
* VM style CMS1 labeled disk
|
||||
*/
|
||||
- unsigned int *label = (unsigned int *) &vlabel;
|
||||
+ label_ints_t *label = (label_ints_t *) &vlabel;
|
||||
|
||||
blocksize = label[4];
|
||||
if (label[14] != 0) {
|
||||
|
|
@ -1,383 +0,0 @@
|
|||
---
|
||||
libmultipath/defaults.h | 3 -
|
||||
libmultipath/file.c | 89 +++++++++++++++++++++++++++++++++++++++++-
|
||||
libmultipath/file.h | 3 +
|
||||
libmultipath/wwids.c | 7 ++-
|
||||
multipath/main.c | 36 +++++++++++++++-
|
||||
multipath/multipath.rules | 26 +++++++++---
|
||||
multipathd/main.c | 4 +
|
||||
multipathd/multipathd.service | 2
|
||||
multipathd/pidfile.c | 3 +
|
||||
9 files changed, 160 insertions(+), 13 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/defaults.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/defaults.h
|
||||
+++ multipath-tools-130222/libmultipath/defaults.h
|
||||
@@ -24,7 +24,8 @@
|
||||
#define MAX_CHECKINT(a) (a << 2)
|
||||
|
||||
#define MAX_DEV_LOSS_TMO 0x7FFFFFFF
|
||||
-#define DEFAULT_PIDFILE "/var/run/multipathd.pid"
|
||||
+#define DEFAULT_PIDFILE "/var/run/multipathd/multipathd.pid"
|
||||
+#define DEFAULT_TIMESTAMP_FILE "/var/run/multipathd/timestamp"
|
||||
#define DEFAULT_SOCKET "/org/kernel/linux/storage/multipathd"
|
||||
#define DEFAULT_CONFIGFILE "/etc/multipath.conf"
|
||||
#define DEFAULT_BINDINGS_FILE "/etc/multipath/bindings"
|
||||
Index: multipath-tools-130222/libmultipath/file.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/file.c
|
||||
+++ multipath-tools-130222/libmultipath/file.c
|
||||
@@ -12,10 +12,12 @@
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
+#include <time.h>
|
||||
|
||||
#include "file.h"
|
||||
#include "debug.h"
|
||||
#include "uxsock.h"
|
||||
+#include "defaults.h"
|
||||
|
||||
|
||||
/*
|
||||
@@ -36,8 +38,8 @@
|
||||
* See the file COPYING included with this distribution for more details.
|
||||
*/
|
||||
|
||||
-static int
|
||||
-ensure_directories_exist(char *str, mode_t dir_mode)
|
||||
+int
|
||||
+ensure_directories_exist(const char *str, mode_t dir_mode)
|
||||
{
|
||||
char *pathname;
|
||||
char *end;
|
||||
@@ -178,3 +180,86 @@ fail:
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
+
|
||||
+/* If you can't get the timestamp, return equal to just keep using the
|
||||
+ * existing value.
|
||||
+ */
|
||||
+int timestamp_equal(long int chk_timestamp)
|
||||
+{
|
||||
+ char buf[4096];
|
||||
+ FILE *file;
|
||||
+ long int file_timestamp;
|
||||
+ int ret = 1;
|
||||
+
|
||||
+ if ((file = fopen(DEFAULT_TIMESTAMP_FILE, "r")) == NULL) {
|
||||
+ if (errno != ENOENT)
|
||||
+ condlog(2, "Cannot open timestamp file [%s]: %s",
|
||||
+ DEFAULT_TIMESTAMP_FILE, strerror(errno));
|
||||
+ goto out;
|
||||
+ }
|
||||
+ errno = 0;
|
||||
+ if (fgets(buf, sizeof(buf), file) == NULL) {
|
||||
+ if (errno)
|
||||
+ condlog(2, "Cannot read from timestamp file: %s",
|
||||
+ strerror(errno));
|
||||
+ goto out;
|
||||
+ }
|
||||
+ if (sscanf(buf, "DM_MULTIPATH_TIMESTAMP=%ld", &file_timestamp) != 1) {
|
||||
+ if (errno)
|
||||
+ condlog(0, "Cannot get timestamp: %s", strerror(errno));
|
||||
+ else
|
||||
+ condlog(0, "invalid timestamp file [%s]: %s",
|
||||
+ DEFAULT_TIMESTAMP_FILE, strerror(errno));
|
||||
+ goto out;
|
||||
+ }
|
||||
+ if (file_timestamp != chk_timestamp) {
|
||||
+ condlog(3, "timestamp has changed");
|
||||
+ ret = 0;
|
||||
+ }
|
||||
+ else
|
||||
+ condlog(3, "timestamp has not changed");
|
||||
+out:
|
||||
+ if (file)
|
||||
+ fclose(file);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+int update_timestamp(int create)
|
||||
+{
|
||||
+ char buf[44];
|
||||
+ time_t timestamp;
|
||||
+ int fd;
|
||||
+ int flags = O_WRONLY;
|
||||
+ if (create)
|
||||
+ flags |= O_CREAT;
|
||||
+ if((fd = open(DEFAULT_TIMESTAMP_FILE, flags,
|
||||
+ (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))) < 0) {
|
||||
+ if (errno == ENOENT)
|
||||
+ return 0;
|
||||
+ condlog(0, "Cannot open timestamp file [%s]: %s",
|
||||
+ DEFAULT_TIMESTAMP_FILE, strerror(errno));
|
||||
+ return 1;
|
||||
+ }
|
||||
+ if (ftruncate(fd, 0) < 0) {
|
||||
+ condlog(0, "Cannot truncate timestamp file [%s]: %s",
|
||||
+ DEFAULT_TIMESTAMP_FILE, strerror(errno));
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ if (time(×tamp) == -1) {
|
||||
+ condlog(0, "Cannot get current time: %s", strerror(errno));
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ memset(buf, 0, sizeof(buf));
|
||||
+ snprintf(buf, sizeof(buf)-1, "DM_MULTIPATH_TIMESTAMP=%ld\n",
|
||||
+ timestamp);
|
||||
+ if (write(fd, buf, strlen(buf)) != strlen(buf)) {
|
||||
+ condlog(0, "Cannot write out timestamp to %s: %s",
|
||||
+ DEFAULT_TIMESTAMP_FILE, strerror(errno));
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ close(fd);
|
||||
+ return 0;
|
||||
+fail:
|
||||
+ close(fd);
|
||||
+ return 1;
|
||||
+}
|
||||
Index: multipath-tools-130222/libmultipath/file.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/file.h
|
||||
+++ multipath-tools-130222/libmultipath/file.h
|
||||
@@ -7,5 +7,8 @@
|
||||
|
||||
#define FILE_TIMEOUT 30
|
||||
int open_file(char *file, int *can_write, char *header);
|
||||
+int ensure_directories_exist(const char *str, mode_t dir_mode);
|
||||
+int update_timestamp(int create);
|
||||
+int timestamp_equal(long int chk_timestamp);
|
||||
|
||||
#endif /* _FILE_H */
|
||||
Index: multipath-tools-130222/multipathd/pidfile.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/pidfile.c
|
||||
+++ multipath-tools-130222/multipathd/pidfile.c
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <fcntl.h> /* for fcntl() */
|
||||
|
||||
#include <debug.h>
|
||||
+#include <file.h>
|
||||
|
||||
#include "pidfile.h"
|
||||
|
||||
@@ -18,6 +19,8 @@ int pidfile_create(const char *pidFile,
|
||||
struct flock lock;
|
||||
int fd, value;
|
||||
|
||||
+ if (ensure_directories_exist(pidFile, 0700))
|
||||
+ return 1;
|
||||
if((fd = open(pidFile, O_WRONLY | O_CREAT,
|
||||
(S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))) < 0) {
|
||||
condlog(0, "Cannot open pidfile [%s], error was [%s]",
|
||||
Index: multipath-tools-130222/libmultipath/wwids.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/wwids.c
|
||||
+++ multipath-tools-130222/libmultipath/wwids.c
|
||||
@@ -125,6 +125,7 @@ replace_wwids(vector mp)
|
||||
goto out_file;
|
||||
}
|
||||
ret = 0;
|
||||
+ update_timestamp(0);
|
||||
out_file:
|
||||
close(fd);
|
||||
out:
|
||||
@@ -209,6 +210,8 @@ remove_wwid(char *wwid) {
|
||||
goto out_file;
|
||||
}
|
||||
ret = do_remove_wwid(fd, str);
|
||||
+ if (!ret)
|
||||
+ update_timestamp(0);
|
||||
|
||||
out_file:
|
||||
close(fd);
|
||||
@@ -294,8 +297,10 @@ remember_wwid(char *wwid)
|
||||
condlog(3, "failed writing wwid %s to wwids file", wwid);
|
||||
return -1;
|
||||
}
|
||||
- if (ret == 1)
|
||||
+ if (ret == 1) {
|
||||
condlog(3, "wrote wwid %s to wwids file", wwid);
|
||||
+ update_timestamp(0);
|
||||
+ }
|
||||
else
|
||||
condlog(4, "wwid %s already in wwids file", wwid);
|
||||
return 0;
|
||||
Index: multipath-tools-130222/multipath/multipath.rules
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/multipath.rules
|
||||
+++ multipath-tools-130222/multipath/multipath.rules
|
||||
@@ -4,18 +4,34 @@ SUBSYSTEM!="block", GOTO="end_mpath"
|
||||
|
||||
IMPORT{cmdline}="nompath"
|
||||
ENV{nompath}=="?*", GOTO="end_mpath"
|
||||
+ENV{DEVTYPE}=="partition", GOTO="end_mpath"
|
||||
ENV{MPATH_SBIN_PATH}="/sbin"
|
||||
TEST!="$env{MPATH_SBIN_PATH}/multipath", ENV{MPATH_SBIN_PATH}="/usr/sbin"
|
||||
+TEST!="/etc/multipath.conf", GOTO="check_kpartx"
|
||||
|
||||
-ACTION=="add", ENV{DEVTYPE}!="partition", \
|
||||
- ENV{DM_MULTIPATH_DEVICE_PATH}!="1", \
|
||||
- TEST=="/etc/multipath.conf", \
|
||||
+ACTION=="add", ENV{DM_MULTIPATH_DEVICE_PATH}!="1", \
|
||||
PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -c $tempnode", \
|
||||
- ENV{DM_MULTIPATH_DEVICE_PATH}="1" ENV{ID_FS_TYPE}="mpath_member"
|
||||
+ ENV{DM_MULTIPATH_DEVICE_PATH}="1", ENV{ID_FS_TYPE}="mpath_member"
|
||||
|
||||
-ENV{DM_MULTIPATH_DEVICE_PATH}=="1", ENV{DEVTYPE}!="partition", \
|
||||
+ENV{DM_MULTIPATH_DEVICE_PATH}=="1", \
|
||||
RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
|
||||
|
||||
+ACTION!="change", GOTO="update_timestamp"
|
||||
+IMPORT{db}="DM_MULTIPATH_TIMESTAMP"
|
||||
+IMPORT{db}="DM_MULTIPATH_DEVICE_PATH"
|
||||
+# Check if the device is part of a multipath device. the -T option just keeps
|
||||
+# the old result if the timestamp hasn't changed.
|
||||
+PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -T $env{DM_MULTIPATH_TIMESTAMP}:$env{DM_MULTIPATH_DEVICE_PATH} -c $env{DEVNAME}", \
|
||||
+ ENV{DM_MULTIPATH_DEVICE_PATH}="1", ENV{ID_FS_TYPE}="mpath_member", \
|
||||
+ GOTO="update_timestamp"
|
||||
+
|
||||
+# If the device isn't part of a multipath device, clear this
|
||||
+ENV{DM_MULTIPATH_DEVICE_PATH}=""
|
||||
+
|
||||
+LABEL="update_timestamp"
|
||||
+IMPORT{file}="/run/multipathd/timestamp"
|
||||
+
|
||||
+LABEL="check_kpartx"
|
||||
KERNEL!="dm-*", GOTO="end_mpath"
|
||||
ENV{DM_UUID}=="mpath-?*|part[0-9]*-mpath-?*", OPTIONS+="link_priority=10"
|
||||
ACTION!="change", GOTO="end_mpath"
|
||||
Index: multipath-tools-130222/multipathd/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/main.c
|
||||
+++ multipath-tools-130222/multipathd/main.c
|
||||
@@ -54,6 +54,7 @@
|
||||
#include <pgpolicies.h>
|
||||
#include <uevent.h>
|
||||
#include <log.h>
|
||||
+#include <file.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "pidfile.h"
|
||||
@@ -1417,6 +1418,7 @@ reconfigure (struct vectors * vecs)
|
||||
free_config(old);
|
||||
retval = 0;
|
||||
}
|
||||
+ update_timestamp(0);
|
||||
|
||||
return retval;
|
||||
}
|
||||
@@ -1709,6 +1711,7 @@ child (void * param)
|
||||
|
||||
/* Startup complete, create logfile */
|
||||
pid_rc = pidfile_create(DEFAULT_PIDFILE, daemon_pid);
|
||||
+ update_timestamp(1);
|
||||
/* Ignore errors, we can live without */
|
||||
|
||||
running_state = DAEMON_RUNNING;
|
||||
@@ -1758,6 +1761,7 @@ child (void * param)
|
||||
if (!pid_rc) {
|
||||
condlog(3, "unlink pidfile");
|
||||
unlink(DEFAULT_PIDFILE);
|
||||
+ unlink(DEFAULT_TIMESTAMP_FILE);
|
||||
}
|
||||
|
||||
condlog(2, "--------shut down-------");
|
||||
Index: multipath-tools-130222/multipathd/multipathd.service
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/multipathd.service
|
||||
+++ multipath-tools-130222/multipathd/multipathd.service
|
||||
@@ -9,7 +9,7 @@ Conflicts=shutdown.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
-PIDFile=/var/run/multipathd.pid
|
||||
+PIDFile=/var/run/multipathd/multipathd.pid
|
||||
ExecStartPre=/sbin/modprobe dm-multipath
|
||||
ExecStart=/sbin/multipathd
|
||||
ExecReload=/sbin/multipathd reconfigure
|
||||
Index: multipath-tools-130222/multipath/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/main.c
|
||||
+++ multipath-tools-130222/multipath/main.c
|
||||
@@ -55,6 +55,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <wwids.h>
|
||||
+#include <file.h>
|
||||
#include "dev_t.h"
|
||||
|
||||
int logsink;
|
||||
@@ -84,7 +85,7 @@ usage (char * progname)
|
||||
{
|
||||
fprintf (stderr, VERSION_STRING);
|
||||
fprintf (stderr, "Usage:\n");
|
||||
- fprintf (stderr, " %s [-c|-w|-W] [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
|
||||
+ fprintf (stderr, " %s [-c|-w|-W] [-d] [-T tm:val] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
|
||||
fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname);
|
||||
fprintf (stderr, " %s -F [-v lvl]\n", progname);
|
||||
fprintf (stderr, " %s -t\n", progname);
|
||||
@@ -98,6 +99,9 @@ usage (char * progname)
|
||||
" -f flush a multipath device map\n" \
|
||||
" -F flush all multipath device maps\n" \
|
||||
" -c check if a device should be a path in a multipath device\n" \
|
||||
+ " -T tm:val\n" \
|
||||
+ " check if tm matches the multipathd timestamp. If so val is\n" \
|
||||
+ " whether or not the device is a path in a multipath device\n" \
|
||||
" -q allow queue_if_no_path when multipathd is not running\n"\
|
||||
" -d dry run, do not create or update devmaps\n" \
|
||||
" -t dump internal hardware table\n" \
|
||||
@@ -441,7 +445,31 @@ main (int argc, char *argv[])
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
int r = 1;
|
||||
-
|
||||
+ long int timestamp = -1;
|
||||
+ int valid = -1;
|
||||
+ while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
|
||||
+ switch(arg) {
|
||||
+ case 'T':
|
||||
+ if (optarg[0] == ':')
|
||||
+ sscanf(optarg, ":%d", &valid);
|
||||
+ else
|
||||
+ sscanf(optarg, "%ld:%d", ×tamp, &valid);
|
||||
+ if (timestamp_equal(timestamp))
|
||||
+ return (valid != 1);
|
||||
+ break;
|
||||
+ case ':':
|
||||
+ fprintf(stderr, "Missing option argument\n");
|
||||
+ usage(argv[0]);
|
||||
+ exit(1);
|
||||
+ case '?':
|
||||
+ fprintf(stderr, "Unknown switch: %s\n", optarg);
|
||||
+ usage(argv[0]);
|
||||
+ exit(1);
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ optind = 1;
|
||||
if (getuid() != 0) {
|
||||
fprintf(stderr, "need to be root\n");
|
||||
exit(1);
|
||||
@@ -455,7 +483,7 @@ main (int argc, char *argv[])
|
||||
if (dm_prereq())
|
||||
exit(1);
|
||||
|
||||
- while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:BrtqwW")) != EOF ) {
|
||||
+ while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
|
||||
switch(arg) {
|
||||
case 1: printf("optarg : %s\n",optarg);
|
||||
break;
|
||||
@@ -517,6 +545,8 @@ main (int argc, char *argv[])
|
||||
case 't':
|
||||
r = dump_config();
|
||||
goto out;
|
||||
+ case 'T':
|
||||
+ break;
|
||||
case 'h':
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
---
|
||||
libmultipath/checkers/rdac.c | 5 ++---
|
||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/checkers/rdac.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/checkers/rdac.c
|
||||
+++ multipath-tools-130222/libmultipath/checkers/rdac.c
|
||||
@@ -222,10 +222,9 @@ libcheck_check (struct checker * c)
|
||||
goto done;
|
||||
}
|
||||
|
||||
- /* check if controller is in service mode */
|
||||
+ /* check if controller is reporting asymmetric access state of unavailable */
|
||||
if ((inq.avtcvp & 0x10) &&
|
||||
- ((inq.asym_access_state_cur & 0x0F) == 0x3) &&
|
||||
- (inq.vendor_specific_cur == 0x7)) {
|
||||
+ ((inq.asym_access_state_cur & 0x0F) == 0x3)) {
|
||||
ret = PATH_DOWN;
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -1,159 +0,0 @@
|
|||
---
|
||||
kpartx/dos.c | 17 ++++++++++-------
|
||||
kpartx/gpt.c | 20 +-------------------
|
||||
kpartx/kpartx.c | 12 ++++++++++++
|
||||
kpartx/kpartx.h | 8 ++++++++
|
||||
4 files changed, 31 insertions(+), 26 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/kpartx/dos.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/kpartx/dos.c
|
||||
+++ multipath-tools-130222/kpartx/dos.c
|
||||
@@ -26,7 +26,9 @@ read_extended_partition(int fd, struct p
|
||||
int moretodo = 1;
|
||||
int i, n=0;
|
||||
|
||||
- next = start = le32_to_cpu(ep->start_sect);
|
||||
+ int sector_size_mul = get_sector_size(fd)/512;
|
||||
+
|
||||
+ next = start = sector_size_mul * le32_to_cpu(ep->start_sect);
|
||||
|
||||
while (moretodo) {
|
||||
here = next;
|
||||
@@ -45,14 +47,14 @@ read_extended_partition(int fd, struct p
|
||||
memcpy(&p, bp + 0x1be + i * sizeof (p), sizeof (p));
|
||||
if (is_extended(p.sys_type)) {
|
||||
if (p.nr_sects && !moretodo) {
|
||||
- next = start + le32_to_cpu(p.start_sect);
|
||||
+ next = start + sector_size_mul * le32_to_cpu(p.start_sect);
|
||||
moretodo = 1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (n < ns) {
|
||||
- sp[n].start = here + le32_to_cpu(p.start_sect);
|
||||
- sp[n].size = le32_to_cpu(p.nr_sects);
|
||||
+ sp[n].start = here + sector_size_mul * le32_to_cpu(p.start_sect);
|
||||
+ sp[n].size = sector_size_mul * le32_to_cpu(p.nr_sects);
|
||||
n++;
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
@@ -76,6 +78,7 @@ read_dos_pt(int fd, struct slice all, st
|
||||
unsigned long offset = all.start;
|
||||
int i, n=4;
|
||||
unsigned char *bp;
|
||||
+ int sector_size_mul = get_sector_size(fd)/512;
|
||||
|
||||
bp = (unsigned char *)getblock(fd, offset);
|
||||
if (bp == NULL)
|
||||
@@ -89,8 +92,8 @@ read_dos_pt(int fd, struct slice all, st
|
||||
if (is_gpt(p.sys_type))
|
||||
return 0;
|
||||
if (i < ns) {
|
||||
- sp[i].start = le32_to_cpu(p.start_sect);
|
||||
- sp[i].size = le32_to_cpu(p.nr_sects);
|
||||
+ sp[i].start = sector_size_mul * le32_to_cpu(p.start_sect);
|
||||
+ sp[i].size = sector_size_mul * le32_to_cpu(p.nr_sects);
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
"dos_partition: too many slices\n");
|
||||
@@ -99,7 +102,7 @@ read_dos_pt(int fd, struct slice all, st
|
||||
if (is_extended(p.sys_type)) {
|
||||
n += read_extended_partition(fd, &p, sp+n, ns-n);
|
||||
/* hide the extended partition itself */
|
||||
- sp[i].size = 2;
|
||||
+ sp[i].size = sector_size_mul * 2;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
Index: multipath-tools-130222/kpartx/gpt.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/kpartx/gpt.c
|
||||
+++ multipath-tools-130222/kpartx/gpt.c
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <byteswap.h>
|
||||
#include <linux/fs.h>
|
||||
#include "crc32.h"
|
||||
+#include "kpartx.h"
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
# define __le16_to_cpu(x) (x)
|
||||
@@ -116,25 +117,6 @@ is_pmbr_valid(legacy_mbr *mbr)
|
||||
|
||||
|
||||
/************************************************************
|
||||
- * get_sector_size
|
||||
- * Requires:
|
||||
- * - filedes is an open file descriptor, suitable for reading
|
||||
- * Modifies: nothing
|
||||
- * Returns:
|
||||
- * sector size, or 512.
|
||||
- ************************************************************/
|
||||
-static int
|
||||
-get_sector_size(int filedes)
|
||||
-{
|
||||
- int rc, sector_size = 512;
|
||||
-
|
||||
- rc = ioctl(filedes, BLKSSZGET, §or_size);
|
||||
- if (rc)
|
||||
- sector_size = 512;
|
||||
- return sector_size;
|
||||
-}
|
||||
-
|
||||
-/************************************************************
|
||||
* _get_num_sectors
|
||||
* Requires:
|
||||
* - filedes is an open file descriptor, suitable for reading
|
||||
Index: multipath-tools-130222/kpartx/kpartx.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/kpartx/kpartx.c
|
||||
+++ multipath-tools-130222/kpartx/kpartx.c
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
+#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <ctype.h>
|
||||
@@ -606,3 +607,14 @@ getblock (int fd, unsigned int secnr) {
|
||||
|
||||
return bp->block;
|
||||
}
|
||||
+
|
||||
+int
|
||||
+get_sector_size(int filedes)
|
||||
+{
|
||||
+ int rc, sector_size = 512;
|
||||
+
|
||||
+ rc = ioctl(filedes, BLKSSZGET, §or_size);
|
||||
+ if (rc)
|
||||
+ sector_size = 512;
|
||||
+ return sector_size;
|
||||
+}
|
||||
Index: multipath-tools-130222/kpartx/kpartx.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/kpartx/kpartx.h
|
||||
+++ multipath-tools-130222/kpartx/kpartx.h
|
||||
@@ -2,6 +2,7 @@
|
||||
#define _KPARTX_H
|
||||
|
||||
#include <stdint.h>
|
||||
+#include <sys/ioctl.h>
|
||||
|
||||
/*
|
||||
* For each partition type there is a routine that takes
|
||||
@@ -18,6 +19,13 @@
|
||||
#define safe_sprintf(var, format, args...) \
|
||||
snprintf(var, sizeof(var), format, ##args) >= sizeof(var)
|
||||
|
||||
+#ifndef BLKSSZGET
|
||||
+#define BLKSSZGET _IO(0x12,104) /* get block device sector size */
|
||||
+#endif
|
||||
+
|
||||
+int
|
||||
+get_sector_size(int filedes);
|
||||
+
|
||||
/*
|
||||
* units: 512 byte sectors
|
||||
*/
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
---
|
||||
multipath/multipath.rules | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
Index: multipath-tools-130222/multipath/multipath.rules
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/multipath.rules
|
||||
+++ multipath-tools-130222/multipath/multipath.rules
|
||||
@@ -13,12 +13,13 @@ ACTION=="add", ENV{DM_MULTIPATH_DEVICE_P
|
||||
PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -c $tempnode", \
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}="1", ENV{ID_FS_TYPE}="mpath_member"
|
||||
|
||||
-ENV{DM_MULTIPATH_DEVICE_PATH}=="1", \
|
||||
+ENV{DM_MULTIPATH_DEVICE_PATH}=="1", ENV{DM_MULTIPATH_WIPE_PARTS}="1", \
|
||||
RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
|
||||
|
||||
ACTION!="change", GOTO="update_timestamp"
|
||||
IMPORT{db}="DM_MULTIPATH_TIMESTAMP"
|
||||
IMPORT{db}="DM_MULTIPATH_DEVICE_PATH"
|
||||
+IMPORT{db}="DM_MULTIPATH_WIPE_PARTS"
|
||||
# Check if the device is part of a multipath device. the -T option just keeps
|
||||
# the old result if the timestamp hasn't changed.
|
||||
PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -T $env{DM_MULTIPATH_TIMESTAMP}:$env{DM_MULTIPATH_DEVICE_PATH} -c $env{DEVNAME}", \
|
||||
@@ -27,8 +28,13 @@ PROGRAM=="$env{MPATH_SBIN_PATH}/multipat
|
||||
|
||||
# If the device isn't part of a multipath device, clear this
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=""
|
||||
+ENV{DM_MULTIPATH_WIPE_PARTS}=""
|
||||
|
||||
LABEL="update_timestamp"
|
||||
+ENV{DM_MULTIPATH_DEVICE_PATH}=="1", ENV{DM_MULTIPATH_WIPE_PARTS}!="1", \
|
||||
+ ENV{DM_MULTIPATH_WIPE_PARTS}="1", \
|
||||
+ RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
|
||||
+
|
||||
IMPORT{file}="/run/multipathd/timestamp"
|
||||
|
||||
LABEL="check_kpartx"
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
---
|
||||
multipath/multipath.rules | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
Index: multipath-tools-130222/multipath/multipath.rules
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/multipath.rules
|
||||
+++ multipath-tools-130222/multipath/multipath.rules
|
||||
@@ -4,7 +4,8 @@ SUBSYSTEM!="block", GOTO="end_mpath"
|
||||
|
||||
IMPORT{cmdline}="nompath"
|
||||
ENV{nompath}=="?*", GOTO="end_mpath"
|
||||
-ENV{DEVTYPE}=="partition", GOTO="end_mpath"
|
||||
+ENV{DEVTYPE}=="partition", IMPORT{parent}="DM_MULTIPATH_DEVICE_PATH", \
|
||||
+ GOTO="end_mpath"
|
||||
ENV{MPATH_SBIN_PATH}="/sbin"
|
||||
TEST!="$env{MPATH_SBIN_PATH}/multipath", ENV{MPATH_SBIN_PATH}="/usr/sbin"
|
||||
TEST!="/etc/multipath.conf", GOTO="check_kpartx"
|
||||
|
|
@ -1,153 +0,0 @@
|
|||
---
|
||||
libmultipath/checkers/rdac.c | 91 ++++++++++++++++++++++++++++++++++++++-----
|
||||
libmultipath/discovery.c | 2
|
||||
2 files changed, 81 insertions(+), 12 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/checkers/rdac.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/checkers/rdac.c
|
||||
+++ multipath-tools-130222/libmultipath/checkers/rdac.c
|
||||
@@ -34,6 +34,18 @@
|
||||
#define MSG_RDAC_UP "rdac checker reports path is up"
|
||||
#define MSG_RDAC_DOWN "rdac checker reports path is down"
|
||||
#define MSG_RDAC_GHOST "rdac checker reports path is ghost"
|
||||
+#define MSG_RDAC_DOWN_TYPE(STR) MSG_RDAC_DOWN": "STR
|
||||
+
|
||||
+#define RTPG_UNAVAILABLE 0x3
|
||||
+#define RTPG_OFFLINE 0xE
|
||||
+#define RTPG_TRANSITIONING 0xF
|
||||
+
|
||||
+#define RTPG_UNAVAIL_NON_RESPONSIVE 0x2
|
||||
+#define RTPG_UNAVAIL_IN_RESET 0x3
|
||||
+#define RTPG_UNAVAIL_CFW_DL1 0x4
|
||||
+#define RTPG_UNAVAIL_CFW_DL2 0x5
|
||||
+#define RTPG_UNAVAIL_QUIESCED 0x6
|
||||
+#define RTPG_UNAVAIL_SERVICE_MODE 0x7
|
||||
|
||||
struct control_mode_page {
|
||||
unsigned char header[8];
|
||||
@@ -199,22 +211,64 @@ struct volume_access_inq
|
||||
char PQ_PDT;
|
||||
char dontcare0[7];
|
||||
char avtcvp;
|
||||
- char dontcare1;
|
||||
- char asym_access_state_cur;
|
||||
+ char vol_ppp;
|
||||
+ char aas_cur;
|
||||
char vendor_specific_cur;
|
||||
- char dontcare2[36];
|
||||
+ char aas_alt;
|
||||
+ char vendor_specific_alt;
|
||||
+ char dontcare1[34];
|
||||
};
|
||||
|
||||
+const char
|
||||
+*checker_msg_string(struct volume_access_inq *inq)
|
||||
+{
|
||||
+ /* lun not connected */
|
||||
+ if (((inq->PQ_PDT & 0xE0) == 0x20) || (inq->PQ_PDT & 0x7f))
|
||||
+ return MSG_RDAC_DOWN_TYPE("lun not connected");
|
||||
+
|
||||
+ /* if no tpg data is available, give the generic path down message */
|
||||
+ if (!(inq->avtcvp & 0x10))
|
||||
+ return MSG_RDAC_DOWN;
|
||||
+
|
||||
+ /* controller is booting up */
|
||||
+ if (((inq->aas_cur & 0x0F) == RTPG_TRANSITIONING) &&
|
||||
+ (inq->aas_alt & 0x0F) != RTPG_TRANSITIONING)
|
||||
+ return MSG_RDAC_DOWN_TYPE("ctlr is in startup sequence");
|
||||
+
|
||||
+ /* if not unavailable, give generic message */
|
||||
+ if ((inq->aas_cur & 0x0F) != RTPG_UNAVAILABLE)
|
||||
+ return MSG_RDAC_DOWN;
|
||||
+
|
||||
+ /* target port group unavailable */
|
||||
+ switch (inq->vendor_specific_cur) {
|
||||
+ case RTPG_UNAVAIL_NON_RESPONSIVE:
|
||||
+ return MSG_RDAC_DOWN_TYPE("non-responsive to queries");
|
||||
+ case RTPG_UNAVAIL_IN_RESET:
|
||||
+ return MSG_RDAC_DOWN_TYPE("ctlr held in reset");
|
||||
+ case RTPG_UNAVAIL_CFW_DL1:
|
||||
+ case RTPG_UNAVAIL_CFW_DL2:
|
||||
+ return MSG_RDAC_DOWN_TYPE("ctlr firmware downloading");
|
||||
+ case RTPG_UNAVAIL_QUIESCED:
|
||||
+ return MSG_RDAC_DOWN_TYPE("ctlr quiesced by admin request");
|
||||
+ case RTPG_UNAVAIL_SERVICE_MODE:
|
||||
+ return MSG_RDAC_DOWN_TYPE("ctlr is in service mode");
|
||||
+ default:
|
||||
+ return MSG_RDAC_DOWN_TYPE("ctlr is unavailable");
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
extern int
|
||||
libcheck_check (struct checker * c)
|
||||
{
|
||||
struct volume_access_inq inq;
|
||||
- int ret;
|
||||
+ int ret, inqfail;
|
||||
|
||||
+ inqfail = 0;
|
||||
memset(&inq, 0, sizeof(struct volume_access_inq));
|
||||
if (0 != do_inq(c->fd, 0xC9, &inq, sizeof(struct volume_access_inq),
|
||||
c->timeout)) {
|
||||
ret = PATH_DOWN;
|
||||
+ inqfail = 1;
|
||||
goto done;
|
||||
} else if (((inq.PQ_PDT & 0xE0) == 0x20) || (inq.PQ_PDT & 0x7f)) {
|
||||
/* LUN not connected*/
|
||||
@@ -222,11 +276,27 @@ libcheck_check (struct checker * c)
|
||||
goto done;
|
||||
}
|
||||
|
||||
- /* check if controller is reporting asymmetric access state of unavailable */
|
||||
- if ((inq.avtcvp & 0x10) &&
|
||||
- ((inq.asym_access_state_cur & 0x0F) == 0x3)) {
|
||||
- ret = PATH_DOWN;
|
||||
- goto done;
|
||||
+ /* If TPGDE bit set, evaluate TPG information */
|
||||
+ if ((inq.avtcvp & 0x10)) {
|
||||
+ switch (inq.aas_cur & 0x0F) {
|
||||
+ /* Never use the path if it reports unavailable */
|
||||
+ case RTPG_UNAVAILABLE:
|
||||
+ ret = PATH_DOWN;
|
||||
+ goto done;
|
||||
+ /*
|
||||
+ * If both controllers report transitioning, it
|
||||
+ * means mode select or STPG is being processed.
|
||||
+ *
|
||||
+ * If this controller alone is transitioning, it's
|
||||
+ * booting and we shouldn't use it yet.
|
||||
+ */
|
||||
+ case RTPG_TRANSITIONING:
|
||||
+ if ((inq.aas_alt & 0xF) != RTPG_TRANSITIONING) {
|
||||
+ ret = PATH_DOWN;
|
||||
+ goto done;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
|
||||
/* If owner set or ioship mode is enabled return PATH_UP always */
|
||||
@@ -238,7 +308,8 @@ libcheck_check (struct checker * c)
|
||||
done:
|
||||
switch (ret) {
|
||||
case PATH_DOWN:
|
||||
- MSG(c, MSG_RDAC_DOWN);
|
||||
+ MSG(c, (inqfail) ? MSG_RDAC_DOWN_TYPE("inquiry failed") :
|
||||
+ checker_msg_string(&inq));
|
||||
break;
|
||||
case PATH_UP:
|
||||
MSG(c, MSG_RDAC_UP);
|
||||
Index: multipath-tools-130222/libmultipath/discovery.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/discovery.c
|
||||
+++ multipath-tools-130222/libmultipath/discovery.c
|
||||
@@ -1116,8 +1116,6 @@ pathinfo (struct path *pp, vector hwtabl
|
||||
if (!strlen(pp->wwid))
|
||||
get_uid(pp);
|
||||
get_prio(pp);
|
||||
- } else {
|
||||
- pp->priority = PRIO_UNDEF;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
---
|
||||
libmultipath/blacklist.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/blacklist.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/blacklist.c
|
||||
+++ multipath-tools-130222/libmultipath/blacklist.c
|
||||
@@ -163,7 +163,7 @@ setup_default_blist (struct config * con
|
||||
if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
|
||||
return 1;
|
||||
|
||||
- str = STRDUP("^hd[a-z]");
|
||||
+ str = STRDUP("^(td|hd)[a-z]");
|
||||
if (!str)
|
||||
return 1;
|
||||
if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
|
||||
|
|
@ -1,248 +0,0 @@
|
|||
---
|
||||
libmultipath/util.c | 22 ++++++++++++++++++++++
|
||||
libmultipath/util.h | 1 +
|
||||
multipath/main.c | 23 +----------------------
|
||||
multipathd/cli_handlers.c | 18 ++++++++++++++++++
|
||||
4 files changed, 42 insertions(+), 22 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/util.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/util.c
|
||||
+++ multipath-tools-130222/libmultipath/util.c
|
||||
@@ -236,6 +236,28 @@ skip_proc:
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/* This function returns a pointer inside of the supplied pathname string.
|
||||
+ * If is_path_device is true, it may also modify the supplied string */
|
||||
+char *convert_dev(char *name, int is_path_device)
|
||||
+{
|
||||
+ char *ptr;
|
||||
+
|
||||
+ if (!name)
|
||||
+ return NULL;
|
||||
+ if (is_path_device) {
|
||||
+ ptr = strstr(name, "cciss/");
|
||||
+ if (ptr) {
|
||||
+ ptr += 5;
|
||||
+ *ptr = '!';
|
||||
+ }
|
||||
+ }
|
||||
+ if (!strncmp(name, "/dev/", 5) && strlen(name) > 5)
|
||||
+ ptr = name + 5;
|
||||
+ else
|
||||
+ ptr = name;
|
||||
+ return ptr;
|
||||
+}
|
||||
+
|
||||
dev_t parse_devt(const char *dev_t)
|
||||
{
|
||||
int maj, min;
|
||||
Index: multipath-tools-130222/libmultipath/util.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/util.h
|
||||
+++ multipath-tools-130222/libmultipath/util.h
|
||||
@@ -10,6 +10,7 @@ size_t strlcat(char *dst, const char *sr
|
||||
void remove_trailing_chars(char *path, char c);
|
||||
int devt2devname (char *, int, char *);
|
||||
dev_t parse_devt(const char *dev_t);
|
||||
+char *convert_dev(char *dev, int is_path_device);
|
||||
|
||||
#define safe_sprintf(var, format, args...) \
|
||||
snprintf(var, sizeof(var), format, ##args) >= sizeof(var)
|
||||
Index: multipath-tools-130222/multipath/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/main.c
|
||||
+++ multipath-tools-130222/multipath/main.c
|
||||
@@ -254,16 +254,7 @@ configure (void)
|
||||
vecs.pathvec = pathvec;
|
||||
vecs.mpvec = curmp;
|
||||
|
||||
- /*
|
||||
- * dev is "/dev/" . "sysfs block dev"
|
||||
- */
|
||||
- if (conf->dev) {
|
||||
- if (!strncmp(conf->dev, "/dev/", 5) &&
|
||||
- strlen(conf->dev) > 5)
|
||||
- dev = conf->dev + 5;
|
||||
- else
|
||||
- dev = conf->dev;
|
||||
- }
|
||||
+ dev = convert_dev(conf->dev, (conf->dev_type == DEV_DEVNODE));
|
||||
|
||||
/*
|
||||
* if we have a blacklisted device parameter, exit early
|
||||
@@ -427,16 +418,6 @@ get_dev_type(char *dev) {
|
||||
return DEV_DEVMAP;
|
||||
}
|
||||
|
||||
-static void
|
||||
-convert_dev(char *dev)
|
||||
-{
|
||||
- char *ptr = strstr(dev, "cciss/");
|
||||
- if (ptr) {
|
||||
- ptr += 5;
|
||||
- *ptr = '!';
|
||||
- }
|
||||
-}
|
||||
-
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
@@ -577,8 +558,6 @@ main (int argc, char *argv[])
|
||||
|
||||
strncpy(conf->dev, argv[optind], FILE_NAME_SIZE);
|
||||
conf->dev_type = get_dev_type(conf->dev);
|
||||
- if (conf->dev_type == DEV_DEVNODE)
|
||||
- convert_dev(conf->dev);
|
||||
}
|
||||
conf->daemon = 0;
|
||||
|
||||
Index: multipath-tools-130222/multipathd/cli_handlers.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/cli_handlers.c
|
||||
+++ multipath-tools-130222/multipathd/cli_handlers.c
|
||||
@@ -235,6 +235,7 @@ cli_list_map_topology (void * v, char **
|
||||
struct vectors * vecs = (struct vectors *)data;
|
||||
char * param = get_keyparam(v, MAP);
|
||||
|
||||
+ param = convert_dev(param, 0);
|
||||
get_path_layout(vecs->pathvec, 0);
|
||||
mpp = find_mp_by_str(vecs->mpvec, param);
|
||||
|
||||
@@ -416,6 +417,7 @@ cli_add_path (void * v, char ** reply, i
|
||||
struct path *pp;
|
||||
int r;
|
||||
|
||||
+ param = convert_dev(param, 1);
|
||||
condlog(2, "%s: add path (operator)", param);
|
||||
|
||||
if (filter_devnode(conf->blist_devnode, conf->elist_devnode,
|
||||
@@ -459,6 +461,7 @@ cli_del_path (void * v, char ** reply, i
|
||||
char * param = get_keyparam(v, PATH);
|
||||
struct path *pp;
|
||||
|
||||
+ param = convert_dev(param, 1);
|
||||
condlog(2, "%s: remove path (operator)", param);
|
||||
pp = find_path_by_dev(vecs->pathvec, param);
|
||||
if (!pp) {
|
||||
@@ -478,6 +481,7 @@ cli_add_map (void * v, char ** reply, in
|
||||
char *alias;
|
||||
int rc;
|
||||
|
||||
+ param = convert_dev(param, 0);
|
||||
condlog(2, "%s: add map (operator)", param);
|
||||
|
||||
if (filter_wwid(conf->blist_wwid, conf->elist_wwid, param) > 0) {
|
||||
@@ -518,6 +522,7 @@ cli_del_map (void * v, char ** reply, in
|
||||
char *alias;
|
||||
int rc;
|
||||
|
||||
+ param = convert_dev(param, 0);
|
||||
condlog(2, "%s: remove map (operator)", param);
|
||||
minor = dm_get_minor(param);
|
||||
if (minor < 0) {
|
||||
@@ -549,6 +554,7 @@ cli_reload(void *v, char **reply, int *l
|
||||
struct multipath *mpp;
|
||||
int minor;
|
||||
|
||||
+ mapname = convert_dev(mapname, 0);
|
||||
condlog(2, "%s: reload map (operator)", mapname);
|
||||
if (sscanf(mapname, "dm-%d", &minor) == 1)
|
||||
mpp = find_mp_by_minor(vecs->mpvec, minor);
|
||||
@@ -591,6 +597,7 @@ cli_resize(void *v, char **reply, int *l
|
||||
struct pathgroup *pgp;
|
||||
struct path *pp;
|
||||
|
||||
+ mapname = convert_dev(mapname, 0);
|
||||
condlog(2, "%s: resize map (operator)", mapname);
|
||||
if (sscanf(mapname, "dm-%d", &minor) == 1)
|
||||
mpp = find_mp_by_minor(vecs->mpvec, minor);
|
||||
@@ -665,6 +672,7 @@ cli_restore_queueing(void *v, char **rep
|
||||
struct multipath *mpp;
|
||||
int minor;
|
||||
|
||||
+ mapname = convert_dev(mapname, 0);
|
||||
condlog(2, "%s: restore map queueing (operator)", mapname);
|
||||
if (sscanf(mapname, "dm-%d", &minor) == 1)
|
||||
mpp = find_mp_by_minor(vecs->mpvec, minor);
|
||||
@@ -716,6 +724,7 @@ cli_disable_queueing(void *v, char **rep
|
||||
struct multipath *mpp;
|
||||
int minor;
|
||||
|
||||
+ mapname = convert_dev(mapname, 0);
|
||||
condlog(2, "%s: disable map queueing (operator)", mapname);
|
||||
if (sscanf(mapname, "dm-%d", &minor) == 1)
|
||||
mpp = find_mp_by_minor(vecs->mpvec, minor);
|
||||
@@ -753,6 +762,7 @@ cli_switch_group(void * v, char ** reply
|
||||
char * mapname = get_keyparam(v, MAP);
|
||||
int groupnum = atoi(get_keyparam(v, GROUP));
|
||||
|
||||
+ mapname = convert_dev(mapname, 0);
|
||||
condlog(2, "%s: switch to path group #%i (operator)", mapname, groupnum);
|
||||
|
||||
return dm_switchgroup(mapname, groupnum);
|
||||
@@ -775,6 +785,7 @@ cli_suspend(void * v, char ** reply, int
|
||||
char * param = get_keyparam(v, MAP);
|
||||
int r = dm_simplecmd_noflush(DM_DEVICE_SUSPEND, param);
|
||||
|
||||
+ param = convert_dev(param, 0);
|
||||
condlog(2, "%s: suspend (operator)", param);
|
||||
|
||||
if (!r) /* error */
|
||||
@@ -796,6 +807,7 @@ cli_resume(void * v, char ** reply, int
|
||||
char * param = get_keyparam(v, MAP);
|
||||
int r = dm_simplecmd_noflush(DM_DEVICE_RESUME, param);
|
||||
|
||||
+ param = convert_dev(param, 0);
|
||||
condlog(2, "%s: resume (operator)", param);
|
||||
|
||||
if (!r) /* error */
|
||||
@@ -817,6 +829,7 @@ cli_reinstate(void * v, char ** reply, i
|
||||
char * param = get_keyparam(v, PATH);
|
||||
struct path * pp;
|
||||
|
||||
+ param = convert_dev(param, 1);
|
||||
pp = find_path_by_dev(vecs->pathvec, param);
|
||||
|
||||
if (!pp)
|
||||
@@ -837,6 +850,7 @@ cli_reassign (void * v, char ** reply, i
|
||||
{
|
||||
char * param = get_keyparam(v, MAP);
|
||||
|
||||
+ param = convert_dev(param, 0);
|
||||
condlog(3, "%s: reset devices (operator)", param);
|
||||
|
||||
dm_reassign(param);
|
||||
@@ -851,6 +865,7 @@ cli_fail(void * v, char ** reply, int *
|
||||
struct path * pp;
|
||||
int r;
|
||||
|
||||
+ param = convert_dev(param, 1);
|
||||
pp = find_path_by_dev(vecs->pathvec, param);
|
||||
|
||||
if (!pp)
|
||||
@@ -962,6 +977,7 @@ cli_getprstatus (void * v, char ** reply
|
||||
struct vectors * vecs = (struct vectors *)data;
|
||||
char * param = get_keyparam(v, MAP);
|
||||
|
||||
+ param = convert_dev(param, 0);
|
||||
get_path_layout(vecs->pathvec, 0);
|
||||
mpp = find_mp_by_str(vecs->mpvec, param);
|
||||
|
||||
@@ -991,6 +1007,7 @@ cli_setprstatus(void * v, char ** reply,
|
||||
struct vectors * vecs = (struct vectors *)data;
|
||||
char * param = get_keyparam(v, MAP);
|
||||
|
||||
+ param = convert_dev(param, 0);
|
||||
get_path_layout(vecs->pathvec, 0);
|
||||
mpp = find_mp_by_str(vecs->mpvec, param);
|
||||
|
||||
@@ -1013,6 +1030,7 @@ cli_unsetprstatus(void * v, char ** repl
|
||||
struct vectors * vecs = (struct vectors *)data;
|
||||
char * param = get_keyparam(v, MAP);
|
||||
|
||||
+ param = convert_dev(param, 0);
|
||||
get_path_layout(vecs->pathvec, 0);
|
||||
mpp = find_mp_by_str(vecs->mpvec, param);
|
||||
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
---
|
||||
kpartx/lopart.c | 18 ++++++++++++++++--
|
||||
1 file changed, 16 insertions(+), 2 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/kpartx/lopart.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/kpartx/lopart.c
|
||||
+++ multipath-tools-130222/kpartx/lopart.c
|
||||
@@ -32,6 +32,10 @@
|
||||
#include "lopart.h"
|
||||
#include "xstrncpy.h"
|
||||
|
||||
+#ifndef LOOP_CTL_GET_FREE
|
||||
+#define LOOP_CTL_GET_FREE 0x4C82
|
||||
+#endif
|
||||
+
|
||||
#if !defined (__alpha__) && !defined (__ia64__) && !defined (__x86_64__) \
|
||||
&& !defined (__s390x__)
|
||||
#define int2ptr(x) ((void *) ((int) x))
|
||||
@@ -140,14 +144,24 @@ find_unused_loop_device (void)
|
||||
|
||||
char dev[20];
|
||||
char *loop_formats[] = { "/dev/loop%d", "/dev/loop/%d" };
|
||||
- int i, j, fd, somedev = 0, someloop = 0, loop_known = 0;
|
||||
+ int i, j, fd, first = 0, somedev = 0, someloop = 0, loop_known = 0;
|
||||
struct stat statbuf;
|
||||
struct loop_info loopinfo;
|
||||
FILE *procdev;
|
||||
|
||||
+ if (stat("/dev/loop-control", &statbuf) == 0 &&
|
||||
+ S_ISCHR(statbuf.st_mode)) {
|
||||
+ fd = open("/dev/loop-control", O_RDWR);
|
||||
+ if (fd >= 0) {
|
||||
+ first = ioctl(fd, LOOP_CTL_GET_FREE);
|
||||
+ close(fd);
|
||||
+ }
|
||||
+ if (first < 0)
|
||||
+ first = 0;
|
||||
+ }
|
||||
for (j = 0; j < SIZE(loop_formats); j++) {
|
||||
|
||||
- for(i = 0; i < 256; i++) {
|
||||
+ for(i = first; i < 256; i++) {
|
||||
sprintf(dev, loop_formats[j], i);
|
||||
|
||||
if (stat (dev, &statbuf) == 0 && S_ISBLK(statbuf.st_mode)) {
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
---
|
||||
Makefile.inc | 2 +-
|
||||
libmultipath/checkers/rdac.c | 4 ++--
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/Makefile.inc
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/Makefile.inc
|
||||
+++ multipath-tools-130222/Makefile.inc
|
||||
@@ -39,7 +39,7 @@ GZIP = /bin/gzip -9 -c
|
||||
INSTALL_PROGRAM = install
|
||||
|
||||
ifndef RPM_OPT_FLAGS
|
||||
- RPM_OPT_FLAGS = -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4
|
||||
+ RPM_OPT_FLAGS = -O2 -g -pipe -Wformat-security -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4
|
||||
endif
|
||||
|
||||
LDFLAGS += -Wl,-z,relro
|
||||
Index: multipath-tools-130222/libmultipath/checkers/rdac.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/checkers/rdac.c
|
||||
+++ multipath-tools-130222/libmultipath/checkers/rdac.c
|
||||
@@ -308,8 +308,8 @@ libcheck_check (struct checker * c)
|
||||
done:
|
||||
switch (ret) {
|
||||
case PATH_DOWN:
|
||||
- MSG(c, (inqfail) ? MSG_RDAC_DOWN_TYPE("inquiry failed") :
|
||||
- checker_msg_string(&inq));
|
||||
+ MSG(c, "%s", (inqfail) ? MSG_RDAC_DOWN_TYPE("inquiry failed") :
|
||||
+ checker_msg_string(&inq));
|
||||
break;
|
||||
case PATH_UP:
|
||||
MSG(c, MSG_RDAC_UP);
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
---
|
||||
multipath/11-dm-mpath.rules | 34 ++++++++++++++++++++++++++++++++++
|
||||
multipath/Makefile | 2 ++
|
||||
2 files changed, 36 insertions(+)
|
||||
|
||||
Index: multipath-tools-130222/multipath/11-dm-mpath.rules
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ multipath-tools-130222/multipath/11-dm-mpath.rules
|
||||
@@ -0,0 +1,34 @@
|
||||
+ACTION!="add|change", GOTO="mpath_end"
|
||||
+ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="mpath_end"
|
||||
+ENV{DM_UUID}!="mpath-?*", GOTO="mpath_end"
|
||||
+
|
||||
+# Do not initiate scanning if no path is available,
|
||||
+# otherwise there would be a hang or IO error on access.
|
||||
+# We'd like to avoid this, especially within udev processing.
|
||||
+ENV{DM_NR_VALID_PATHS}!="?*", IMPORT{db}="DM_NR_VALID_PATHS"
|
||||
+ENV{DM_NR_VALID_PATHS}=="0", ENV{DM_NOSCAN}="1"
|
||||
+
|
||||
+# Also skip all foreign rules if no path is available.
|
||||
+# Remember the original value of DM_DISABLE_OTHER_RULES_FLAG
|
||||
+# and restore it back once we have at least one path available.
|
||||
+IMPORT{db}="DM_DISABLE_OTHER_RULES_FLAG_OLD"
|
||||
+ENV{DM_ACTION}=="PATH_FAILED",\
|
||||
+ ENV{DM_NR_VALID_PATHS}=="0",\
|
||||
+ ENV{DM_DISABLE_OTHER_RULES_FLAG_OLD}=="",\
|
||||
+ ENV{DM_DISABLE_OTHER_RULES_FLAG_OLD}="$env{DM_UDEV_DISABLE_OTHER_RULES_FLAG}",\
|
||||
+ ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1"
|
||||
+ENV{DM_ACTION}=="PATH_REINSTATED",\
|
||||
+ ENV{DM_NR_VALID_PATHS}=="1",\
|
||||
+ ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="$env{DM_DISABLE_OTHER_RULES_FLAG_OLD}",\
|
||||
+ ENV{DM_DISABLE_OTHER_RULES_FLAG_OLD}="",\
|
||||
+ ENV{DM_ACTIVATION}="1"
|
||||
+
|
||||
+# DM_SUBSYSTEM_UDEV_FLAG0 is the "RELOAD" flag for multipath subsystem.
|
||||
+# Drop the DM_ACTIVATION flag here as mpath reloads tables if any of its
|
||||
+# paths are lost/recovered. For any stack above the mpath device, this is not
|
||||
+# something that should be reacted upon since it would be useless extra work.
|
||||
+# It's exactly mpath's job to provide *seamless* device access to any of the
|
||||
+# paths that are available underneath.
|
||||
+ENV{DM_SUBSYSTEM_UDEV_FLAG0}=="1", ENV{DM_ACTIVATION}="0"
|
||||
+
|
||||
+LABEL="mpath_end"
|
||||
Index: multipath-tools-130222/multipath/Makefile
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/Makefile
|
||||
+++ multipath-tools-130222/multipath/Makefile
|
||||
@@ -25,6 +25,7 @@ install:
|
||||
$(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/
|
||||
$(INSTALL_PROGRAM) -d $(DESTDIR)/usr/lib/udev/rules.d
|
||||
$(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/usr/lib/udev/rules.d/62-multipath.rules
|
||||
+ $(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)/usr/lib/udev/rules.d/11-dm-mpath.rules
|
||||
$(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir)
|
||||
$(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir)
|
||||
$(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir)
|
||||
@@ -33,6 +34,7 @@ install:
|
||||
|
||||
uninstall:
|
||||
rm $(DESTDIR)/usr/lib/udev/rules.d/62-multipath.rules
|
||||
+ rm $(DESTDIR)/usr/lib/udev/rules.d/11-dm-mpath.rules
|
||||
rm $(DESTDIR)$(bindir)/$(EXEC)
|
||||
rm $(DESTDIR)$(bindir)/mpathconf
|
||||
rm $(DESTDIR)$(mandir)/$(EXEC).8.gz
|
||||
|
|
@ -1,246 +0,0 @@
|
|||
---
|
||||
kpartx/devmapper.c | 4 ++--
|
||||
kpartx/devmapper.h | 8 +++++++-
|
||||
kpartx/kpartx.c | 6 +++---
|
||||
libmultipath/configure.c | 4 ++--
|
||||
libmultipath/devmapper.c | 26 ++++++++++++++------------
|
||||
libmultipath/devmapper.h | 10 ++++++++--
|
||||
multipathd/cli_handlers.c | 4 ++--
|
||||
7 files changed, 38 insertions(+), 24 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/kpartx/devmapper.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/kpartx/devmapper.c
|
||||
+++ multipath-tools-130222/kpartx/devmapper.c
|
||||
@@ -60,7 +60,7 @@ dm_prereq (char * str, int x, int y, int
|
||||
}
|
||||
|
||||
extern int
|
||||
-dm_simplecmd (int task, const char *name, int no_flush, uint32_t *cookie) {
|
||||
+dm_simplecmd (int task, const char *name, int no_flush, uint32_t *cookie, uint16_t udev_flags) {
|
||||
int r = 0;
|
||||
int udev_wait_flag = (task == DM_DEVICE_RESUME ||
|
||||
task == DM_DEVICE_REMOVE);
|
||||
@@ -78,7 +78,7 @@ dm_simplecmd (int task, const char *name
|
||||
if (no_flush)
|
||||
dm_task_no_flush(dmt);
|
||||
|
||||
- if (udev_wait_flag && !dm_task_set_cookie(dmt, cookie, (udev_sync)? 0 : DM_UDEV_DISABLE_LIBRARY_FALLBACK))
|
||||
+ if (udev_wait_flag && !dm_task_set_cookie(dmt, cookie, ((udev_sync)? 0 : DM_UDEV_DISABLE_LIBRARY_FALLBACK) | udev_flags))
|
||||
goto out;
|
||||
r = dm_task_run(dmt);
|
||||
|
||||
Index: multipath-tools-130222/kpartx/devmapper.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/kpartx/devmapper.h
|
||||
+++ multipath-tools-130222/kpartx/devmapper.h
|
||||
@@ -2,10 +2,16 @@
|
||||
#define MINOR(dev) ((dev & 0xff) | ((dev >> 12) & 0xfff00))
|
||||
#define MKDEV(ma,mi) ((mi & 0xff) | (ma << 8) | ((mi & ~0xff) << 12))
|
||||
|
||||
+#ifdef DM_SUBSYSTEM_UDEV_FLAG0
|
||||
+#define MPATH_UDEV_RELOAD_FLAG DM_SUBSYSTEM_UDEV_FLAG0
|
||||
+#else
|
||||
+#define MPATH_UDEV_RELOAD_FLAG 0
|
||||
+#endif
|
||||
+
|
||||
extern int udev_sync;
|
||||
|
||||
int dm_prereq (char *, int, int, int);
|
||||
-int dm_simplecmd (int, const char *, int, uint32_t *);
|
||||
+int dm_simplecmd (int, const char *, int, uint32_t *, uint16_t);
|
||||
int dm_addmap (int, const char *, const char *, const char *, uint64_t,
|
||||
int, const char *, int, mode_t, uid_t, gid_t, uint32_t *);
|
||||
int dm_map_present (char *);
|
||||
Index: multipath-tools-130222/kpartx/kpartx.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/kpartx/kpartx.c
|
||||
+++ multipath-tools-130222/kpartx/kpartx.c
|
||||
@@ -421,7 +421,7 @@ main(int argc, char **argv){
|
||||
continue;
|
||||
|
||||
if (!dm_simplecmd(DM_DEVICE_REMOVE, partname,
|
||||
- 0, &cookie)) {
|
||||
+ 0, &cookie, 0)) {
|
||||
r++;
|
||||
continue;
|
||||
}
|
||||
@@ -473,7 +473,7 @@ main(int argc, char **argv){
|
||||
}
|
||||
if (op == DM_DEVICE_RELOAD &&
|
||||
!dm_simplecmd(DM_DEVICE_RESUME, partname,
|
||||
- 1, &cookie)) {
|
||||
+ 1, &cookie, MPATH_UDEV_RELOAD_FLAG)) {
|
||||
fprintf(stderr, "resume failed on %s\n",
|
||||
partname);
|
||||
r++;
|
||||
@@ -505,7 +505,7 @@ main(int argc, char **argv){
|
||||
continue;
|
||||
|
||||
if (!dm_simplecmd(DM_DEVICE_REMOVE,
|
||||
- partname, 1, &cookie)) {
|
||||
+ partname, 1, &cookie, 0)) {
|
||||
r++;
|
||||
continue;
|
||||
}
|
||||
Index: multipath-tools-130222/libmultipath/configure.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/configure.c
|
||||
+++ multipath-tools-130222/libmultipath/configure.c
|
||||
@@ -390,13 +390,13 @@ domap (struct multipath * mpp, char * pa
|
||||
case ACT_RELOAD:
|
||||
r = dm_addmap_reload(mpp, params);
|
||||
if (r)
|
||||
- r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias);
|
||||
+ r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias, MPATH_UDEV_RELOAD_FLAG);
|
||||
break;
|
||||
|
||||
case ACT_RESIZE:
|
||||
r = dm_addmap_reload(mpp, params);
|
||||
if (r)
|
||||
- r = dm_simplecmd_flush(DM_DEVICE_RESUME, mpp->alias, 1);
|
||||
+ r = dm_simplecmd_flush(DM_DEVICE_RESUME, mpp->alias, 1, 0);
|
||||
break;
|
||||
|
||||
case ACT_RENAME:
|
||||
Index: multipath-tools-130222/libmultipath/devmapper.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/devmapper.c
|
||||
+++ multipath-tools-130222/libmultipath/devmapper.c
|
||||
@@ -103,7 +103,9 @@ dm_lib_prereq (void)
|
||||
{
|
||||
char version[64];
|
||||
int v[3];
|
||||
-#ifdef LIBDM_API_COOKIE
|
||||
+#if defined(DM_SUBSYSTEM_UDEV_FLAG0)
|
||||
+ int minv[3] = {1, 2, 82};
|
||||
+#elif defined(LIBDM_API_COOKIE)
|
||||
int minv[3] = {1, 2, 38};
|
||||
#else
|
||||
int minv[3] = {1, 2, 8};
|
||||
@@ -200,7 +202,7 @@ dm_prereq (void)
|
||||
}
|
||||
|
||||
static int
|
||||
-dm_simplecmd (int task, const char *name, int no_flush, int need_sync) {
|
||||
+dm_simplecmd (int task, const char *name, int no_flush, int need_sync, uint16_t udev_flags) {
|
||||
int r = 0;
|
||||
int udev_wait_flag = (need_sync && (task == DM_DEVICE_RESUME ||
|
||||
task == DM_DEVICE_REMOVE));
|
||||
@@ -219,7 +221,7 @@ dm_simplecmd (int task, const char *name
|
||||
dm_task_no_flush(dmt); /* for DM_DEVICE_SUSPEND/RESUME */
|
||||
#endif
|
||||
|
||||
- if (udev_wait_flag && !dm_task_set_cookie(dmt, &conf->cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0))
|
||||
+ if (udev_wait_flag && !dm_task_set_cookie(dmt, &conf->cookie, ((conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0) | udev_flags))
|
||||
goto out;
|
||||
r = dm_task_run (dmt);
|
||||
|
||||
@@ -229,13 +231,13 @@ dm_simplecmd (int task, const char *name
|
||||
}
|
||||
|
||||
extern int
|
||||
-dm_simplecmd_flush (int task, const char *name, int needsync) {
|
||||
- return dm_simplecmd(task, name, 0, needsync);
|
||||
+dm_simplecmd_flush (int task, const char *name, int needsync, uint16_t udev_flags) {
|
||||
+ return dm_simplecmd(task, name, 0, needsync, udev_flags);
|
||||
}
|
||||
|
||||
extern int
|
||||
-dm_simplecmd_noflush (int task, const char *name) {
|
||||
- return dm_simplecmd(task, name, 1, 1);
|
||||
+dm_simplecmd_noflush (int task, const char *name, uint16_t udev_flags) {
|
||||
+ return dm_simplecmd(task, name, 1, 1, udev_flags);
|
||||
}
|
||||
|
||||
extern int
|
||||
@@ -670,7 +672,7 @@ _dm_flush_map (const char * mapname, int
|
||||
return 1;
|
||||
}
|
||||
|
||||
- r = dm_simplecmd_flush(DM_DEVICE_REMOVE, mapname, need_sync);
|
||||
+ r = dm_simplecmd_flush(DM_DEVICE_REMOVE, mapname, need_sync, 0);
|
||||
|
||||
if (r) {
|
||||
condlog(4, "multipath map %s removed", mapname);
|
||||
@@ -703,14 +705,14 @@ dm_suspend_and_flush_map (const char * m
|
||||
if (s)
|
||||
queue_if_no_path = 0;
|
||||
else
|
||||
- s = dm_simplecmd_flush(DM_DEVICE_SUSPEND, mapname, 0);
|
||||
+ s = dm_simplecmd_flush(DM_DEVICE_SUSPEND, mapname, 0, 0);
|
||||
|
||||
if (!dm_flush_map(mapname)) {
|
||||
condlog(4, "multipath map %s removed", mapname);
|
||||
return 0;
|
||||
}
|
||||
condlog(2, "failed to remove multipath map %s", mapname);
|
||||
- dm_simplecmd_noflush(DM_DEVICE_RESUME, mapname);
|
||||
+ dm_simplecmd_noflush(DM_DEVICE_RESUME, mapname, 0);
|
||||
if (queue_if_no_path)
|
||||
s = dm_queue_if_no_path((char *)mapname, 1);
|
||||
return 1;
|
||||
@@ -1077,7 +1079,7 @@ dm_remove_partmaps (const char * mapname
|
||||
condlog(4, "partition map %s removed",
|
||||
names->name);
|
||||
dm_simplecmd_flush(DM_DEVICE_REMOVE, names->name,
|
||||
- need_sync);
|
||||
+ need_sync, 0);
|
||||
}
|
||||
|
||||
next = names->next;
|
||||
@@ -1305,7 +1307,7 @@ int dm_reassign_table(const char *name,
|
||||
condlog(3, "%s: failed to reassign targets", name);
|
||||
goto out_reload;
|
||||
}
|
||||
- dm_simplecmd_noflush(DM_DEVICE_RESUME, name);
|
||||
+ dm_simplecmd_noflush(DM_DEVICE_RESUME, name, MPATH_UDEV_RELOAD_FLAG);
|
||||
}
|
||||
r = 1;
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/devmapper.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/devmapper.h
|
||||
+++ multipath-tools-130222/libmultipath/devmapper.h
|
||||
@@ -6,11 +6,17 @@
|
||||
#define TGT_MPATH "multipath"
|
||||
#define TGT_PART "linear"
|
||||
|
||||
+#ifdef DM_SUBSYSTEM_UDEV_FLAG0
|
||||
+#define MPATH_UDEV_RELOAD_FLAG DM_SUBSYSTEM_UDEV_FLAG0
|
||||
+#else
|
||||
+#define MPATH_UDEV_RELOAD_FLAG 0
|
||||
+#endif
|
||||
+
|
||||
void dm_init(void);
|
||||
int dm_prereq (void);
|
||||
int dm_drv_version (unsigned int * version, char * str);
|
||||
-int dm_simplecmd_flush (int, const char *, int);
|
||||
-int dm_simplecmd_noflush (int, const char *);
|
||||
+int dm_simplecmd_flush (int, const char *, int, uint16_t);
|
||||
+int dm_simplecmd_noflush (int, const char *, uint16_t);
|
||||
int dm_addmap_create (struct multipath *mpp, char *params);
|
||||
int dm_addmap_reload (struct multipath *mpp, char *params);
|
||||
int dm_map_present (const char *);
|
||||
Index: multipath-tools-130222/multipathd/cli_handlers.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/cli_handlers.c
|
||||
+++ multipath-tools-130222/multipathd/cli_handlers.c
|
||||
@@ -783,7 +783,7 @@ cli_suspend(void * v, char ** reply, int
|
||||
{
|
||||
struct vectors * vecs = (struct vectors *)data;
|
||||
char * param = get_keyparam(v, MAP);
|
||||
- int r = dm_simplecmd_noflush(DM_DEVICE_SUSPEND, param);
|
||||
+ int r = dm_simplecmd_noflush(DM_DEVICE_SUSPEND, param, 0);
|
||||
|
||||
param = convert_dev(param, 0);
|
||||
condlog(2, "%s: suspend (operator)", param);
|
||||
@@ -805,7 +805,7 @@ cli_resume(void * v, char ** reply, int
|
||||
{
|
||||
struct vectors * vecs = (struct vectors *)data;
|
||||
char * param = get_keyparam(v, MAP);
|
||||
- int r = dm_simplecmd_noflush(DM_DEVICE_RESUME, param);
|
||||
+ int r = dm_simplecmd_noflush(DM_DEVICE_RESUME, param, 0);
|
||||
|
||||
param = convert_dev(param, 0);
|
||||
condlog(2, "%s: resume (operator)", param);
|
||||
|
|
@ -1,125 +0,0 @@
|
|||
---
|
||||
libmultipath/config.c | 10 ++++++++--
|
||||
libmultipath/config.h | 1 +
|
||||
libmultipath/dict.c | 28 ++++++++++++++++++++++++++++
|
||||
multipath/multipath.conf.5 | 11 +++++++++++
|
||||
4 files changed, 48 insertions(+), 2 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/config.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/config.c
|
||||
+++ multipath-tools-130222/libmultipath/config.c
|
||||
@@ -431,11 +431,16 @@ restart:
|
||||
break;
|
||||
j = n;
|
||||
vector_foreach_slot_after(hw, hwe2, j) {
|
||||
- if (hwe_regmatch(hwe1, hwe2))
|
||||
+ if (conf->hw_strmatch) {
|
||||
+ if (hwe_strmatch(hwe2, hwe1))
|
||||
+ continue;
|
||||
+ }
|
||||
+ else if (hwe_regmatch(hwe1, hwe2))
|
||||
continue;
|
||||
/* dup */
|
||||
merge_hwe(hwe2, hwe1);
|
||||
- if (hwe_strmatch(hwe2, hwe1) == 0) {
|
||||
+ if (conf->hw_strmatch ||
|
||||
+ hwe_strmatch(hwe2, hwe1) == 0) {
|
||||
vector_del_slot(hw, i);
|
||||
free_hwe(hwe1);
|
||||
n -= 1;
|
||||
@@ -550,6 +555,7 @@ load_config (char * file, struct udev *u
|
||||
conf->fast_io_fail = DEFAULT_FAST_IO_FAIL;
|
||||
conf->retain_hwhandler = DEFAULT_RETAIN_HWHANDLER;
|
||||
conf->detect_prio = DEFAULT_DETECT_PRIO;
|
||||
+ conf->hw_strmatch = 0;
|
||||
|
||||
/*
|
||||
* preload default hwtable
|
||||
Index: multipath-tools-130222/libmultipath/config.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/config.h
|
||||
+++ multipath-tools-130222/libmultipath/config.h
|
||||
@@ -107,6 +107,7 @@ struct config {
|
||||
int log_checker_err;
|
||||
int allow_queueing;
|
||||
int find_multipaths;
|
||||
+ int hw_strmatch;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
mode_t mode;
|
||||
Index: multipath-tools-130222/libmultipath/dict.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/dict.c
|
||||
+++ multipath-tools-130222/libmultipath/dict.c
|
||||
@@ -693,6 +693,25 @@ def_detect_prio_handler(vector strvec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int
|
||||
+def_hw_strmatch_handler(vector strvec)
|
||||
+{
|
||||
+ char *buff;
|
||||
+
|
||||
+ buff = set_value(strvec);
|
||||
+ if (!buff)
|
||||
+ return 1;
|
||||
+
|
||||
+ if (!strncmp(buff, "on", 2) || !strncmp(buff, "yes", 3) ||
|
||||
+ !strncmp(buff, "1", 1))
|
||||
+ conf->hw_strmatch = 1;
|
||||
+ else
|
||||
+ conf->hw_strmatch = 0;
|
||||
+
|
||||
+ FREE(buff);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* blacklist block handlers
|
||||
*/
|
||||
@@ -2795,6 +2814,14 @@ snprint_def_detect_prio(char * buff, int
|
||||
}
|
||||
|
||||
static int
|
||||
+snprint_def_hw_strmatch(char * buff, int len, void * data)
|
||||
+{
|
||||
+ if (conf->hw_strmatch)
|
||||
+ return snprintf(buff, len, "yes");
|
||||
+ return snprintf(buff, len, "no");
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
snprint_ble_simple (char * buff, int len, void * data)
|
||||
{
|
||||
struct blentry * ble = (struct blentry *)data;
|
||||
@@ -2861,6 +2888,7 @@ init_keywords(void)
|
||||
install_keyword("find_multipaths", &def_find_multipaths_handler, &snprint_def_find_multipaths);
|
||||
install_keyword("retain_attached_hw_handler", &def_retain_hwhandler_handler, &snprint_def_retain_hwhandler_handler);
|
||||
install_keyword("detect_prio", &def_detect_prio_handler, &snprint_def_detect_prio);
|
||||
+ install_keyword("hw_str_match", &def_hw_strmatch_handler, &snprint_def_hw_strmatch);
|
||||
__deprecated install_keyword("default_selector", &def_selector_handler, NULL);
|
||||
__deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL);
|
||||
__deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL);
|
||||
Index: multipath-tools-130222/multipath/multipath.conf.5
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/multipath.conf.5
|
||||
+++ multipath-tools-130222/multipath/multipath.conf.5
|
||||
@@ -400,6 +400,17 @@ will automatically use the
|
||||
.I alua
|
||||
prioritizer. If not, the prioritizer will be selected as usual. Default is
|
||||
.I no
|
||||
+.TP
|
||||
+.B hw_str_match
|
||||
+If set to
|
||||
+.I yes
|
||||
+, the vendor, product, and revision parameters of user device configs will be
|
||||
+string matched against the built-in device configs to determine if they should
|
||||
+modify an existing config, or create a new one. If set to
|
||||
+.I no
|
||||
+, the user device configs will be regular expression matched against the
|
||||
+built-in configs instead. Default is
|
||||
+.I no
|
||||
.
|
||||
.SH "blacklist section"
|
||||
The
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
---
|
||||
multipath/mpathconf.8 | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
Index: multipath-tools-130222/multipath/mpathconf.8
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/mpathconf.8
|
||||
+++ multipath-tools-130222/multipath/mpathconf.8
|
||||
@@ -86,7 +86,7 @@ If set to \fBy\fP, this runs
|
||||
.B service multipathd start
|
||||
to start the multipathd daemon on \fB--enable\fP,
|
||||
.B service multipathd stop
|
||||
-to start the multipathd daemon on \fB--disable\fP, and
|
||||
+to stop the multipathd daemon on \fB--disable\fP, and
|
||||
.B service multipathd reload
|
||||
to reconfigure multipathd on \fB--user_frindly_names\fP and
|
||||
\fB--find_multipaths\fP.
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
---
|
||||
multipath/main.c | 19 ++++++++++++++++---
|
||||
multipath/multipath.8 | 5 ++++-
|
||||
2 files changed, 20 insertions(+), 4 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/multipath/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/main.c
|
||||
+++ multipath-tools-130222/multipath/main.c
|
||||
@@ -85,7 +85,7 @@ usage (char * progname)
|
||||
{
|
||||
fprintf (stderr, VERSION_STRING);
|
||||
fprintf (stderr, "Usage:\n");
|
||||
- fprintf (stderr, " %s [-c|-w|-W] [-d] [-T tm:val] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
|
||||
+ fprintf (stderr, " %s [-a|-c|-w|-W] [-d] [-T tm:val] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
|
||||
fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname);
|
||||
fprintf (stderr, " %s -F [-v lvl]\n", progname);
|
||||
fprintf (stderr, " %s -t\n", progname);
|
||||
@@ -98,6 +98,7 @@ usage (char * progname)
|
||||
" -ll show multipath topology (maximum info)\n" \
|
||||
" -f flush a multipath device map\n" \
|
||||
" -F flush all multipath device maps\n" \
|
||||
+ " -a add a device wwid to the wwids file\n" \
|
||||
" -c check if a device should be a path in a multipath device\n" \
|
||||
" -T tm:val\n" \
|
||||
" check if tm matches the multipathd timestamp. If so val is\n" \
|
||||
@@ -292,6 +293,15 @@ configure (void)
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
+ if (conf->dry_run == 5) {
|
||||
+ r = remember_wwid(refwwid);
|
||||
+ if (r == 0)
|
||||
+ printf("wwid '%s' added\n", refwwid);
|
||||
+ else
|
||||
+ printf("failed adding '%s' to wwids file\n",
|
||||
+ refwwid);
|
||||
+ goto out;
|
||||
+ }
|
||||
condlog(3, "scope limited to %s", refwwid);
|
||||
if (conf->dry_run == 2) {
|
||||
if (check_wwids_file(refwwid, 0) == 0){
|
||||
@@ -428,7 +438,7 @@ main (int argc, char *argv[])
|
||||
int r = 1;
|
||||
long int timestamp = -1;
|
||||
int valid = -1;
|
||||
- while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
|
||||
+ while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
|
||||
switch(arg) {
|
||||
case 'T':
|
||||
if (optarg[0] == ':')
|
||||
@@ -464,7 +474,7 @@ main (int argc, char *argv[])
|
||||
if (dm_prereq())
|
||||
exit(1);
|
||||
|
||||
- while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
|
||||
+ while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
|
||||
switch(arg) {
|
||||
case 1: printf("optarg : %s\n",optarg);
|
||||
break;
|
||||
@@ -537,6 +547,9 @@ main (int argc, char *argv[])
|
||||
case 'W':
|
||||
conf->dry_run = 4;
|
||||
break;
|
||||
+ case 'a':
|
||||
+ conf->dry_run = 5;
|
||||
+ break;
|
||||
case ':':
|
||||
fprintf(stderr, "Missing option argument\n");
|
||||
usage(argv[0]);
|
||||
Index: multipath-tools-130222/multipath/multipath.8
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/multipath.8
|
||||
+++ multipath-tools-130222/multipath/multipath.8
|
||||
@@ -8,7 +8,7 @@ multipath \- Device mapper target autoco
|
||||
.RB [\| \-b\ \c
|
||||
.IR bindings_file \|]
|
||||
.RB [\| \-d \|]
|
||||
-.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-w | \-W \|]
|
||||
+.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-a | \-w | \-W \|]
|
||||
.RB [\| \-p\ \c
|
||||
.BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|]
|
||||
.RB [\| device \|]
|
||||
@@ -68,6 +68,9 @@ check if a block device should be a path
|
||||
.B \-q
|
||||
allow device tables with queue_if_no_path when multipathd is not running
|
||||
.TP
|
||||
+.B \-a
|
||||
+add the wwid for the specified device to the wwids file
|
||||
+.TP
|
||||
.B \-w
|
||||
remove the wwid for the specified device from the wwids file
|
||||
.TP
|
||||
|
|
@ -1,157 +0,0 @@
|
|||
---
|
||||
libmultipath/wwids.c | 44 ++++++++++++++++++++++++++++++++++++++++++
|
||||
libmultipath/wwids.h | 1
|
||||
multipath/main.c | 12 ++++++++---
|
||||
multipath/multipath.8 | 5 +++-
|
||||
multipathd/multipathd.service | 1
|
||||
5 files changed, 59 insertions(+), 4 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/wwids.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/wwids.c
|
||||
+++ multipath-tools-130222/libmultipath/wwids.c
|
||||
@@ -305,3 +305,47 @@ remember_wwid(char *wwid)
|
||||
condlog(4, "wwid %s already in wwids file", wwid);
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+int remember_cmdline_wwid(void)
|
||||
+{
|
||||
+ FILE *f = NULL;
|
||||
+ char buf[LINE_MAX], *next, *ptr;
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ f = fopen("/proc/cmdline", "re");
|
||||
+ if (!f) {
|
||||
+ condlog(0, "can't open /proc/cmdline : %s", strerror(errno));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (!fgets(buf, sizeof(buf), f)) {
|
||||
+ if (ferror(f))
|
||||
+ condlog(0, "read of /proc/cmdline failed : %s",
|
||||
+ strerror(errno));
|
||||
+ else
|
||||
+ condlog(0, "couldn't read /proc/cmdline");
|
||||
+ fclose(f);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ fclose(f);
|
||||
+ next = buf;
|
||||
+ while((ptr = strstr(next, "mpath.wwid="))) {
|
||||
+ ptr += 11;
|
||||
+ next = strpbrk(ptr, " \t\n");
|
||||
+ if (next) {
|
||||
+ *next = '\0';
|
||||
+ next++;
|
||||
+ }
|
||||
+ if (strlen(ptr)) {
|
||||
+ if (remember_wwid(ptr) != 0)
|
||||
+ ret = -1;
|
||||
+ }
|
||||
+ else {
|
||||
+ condlog(0, "empty mpath.wwid kernel command line option");
|
||||
+ ret = -1;
|
||||
+ }
|
||||
+ if (!next)
|
||||
+ break;
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
Index: multipath-tools-130222/libmultipath/wwids.h
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/wwids.h
|
||||
+++ multipath-tools-130222/libmultipath/wwids.h
|
||||
@@ -17,5 +17,6 @@ int remember_wwid(char *wwid);
|
||||
int check_wwids_file(char *wwid, int write_wwid);
|
||||
int remove_wwid(char *wwid);
|
||||
int replace_wwids(vector mp);
|
||||
+int remember_cmdline_wwid(void);
|
||||
|
||||
#endif /* _WWIDS_H */
|
||||
Index: multipath-tools-130222/multipath/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/main.c
|
||||
+++ multipath-tools-130222/multipath/main.c
|
||||
@@ -85,7 +85,7 @@ usage (char * progname)
|
||||
{
|
||||
fprintf (stderr, VERSION_STRING);
|
||||
fprintf (stderr, "Usage:\n");
|
||||
- fprintf (stderr, " %s [-a|-c|-w|-W] [-d] [-T tm:val] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
|
||||
+ fprintf (stderr, " %s [-a|-A|-c|-w|-W] [-d] [-T tm:val] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
|
||||
fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname);
|
||||
fprintf (stderr, " %s -F [-v lvl]\n", progname);
|
||||
fprintf (stderr, " %s -t\n", progname);
|
||||
@@ -99,6 +99,8 @@ usage (char * progname)
|
||||
" -f flush a multipath device map\n" \
|
||||
" -F flush all multipath device maps\n" \
|
||||
" -a add a device wwid to the wwids file\n" \
|
||||
+ " -A add devices from kernel command line mpath.wwids\n"
|
||||
+ " parameters to wwids file\n" \
|
||||
" -c check if a device should be a path in a multipath device\n" \
|
||||
" -T tm:val\n" \
|
||||
" check if tm matches the multipathd timestamp. If so val is\n" \
|
||||
@@ -438,7 +440,7 @@ main (int argc, char *argv[])
|
||||
int r = 1;
|
||||
long int timestamp = -1;
|
||||
int valid = -1;
|
||||
- while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
|
||||
+ while ((arg = getopt(argc, argv, ":aAdchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
|
||||
switch(arg) {
|
||||
case 'T':
|
||||
if (optarg[0] == ':')
|
||||
@@ -474,7 +476,7 @@ main (int argc, char *argv[])
|
||||
if (dm_prereq())
|
||||
exit(1);
|
||||
|
||||
- while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
|
||||
+ while ((arg = getopt(argc, argv, ":aAdchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
|
||||
switch(arg) {
|
||||
case 1: printf("optarg : %s\n",optarg);
|
||||
break;
|
||||
@@ -538,6 +540,10 @@ main (int argc, char *argv[])
|
||||
goto out;
|
||||
case 'T':
|
||||
break;
|
||||
+ case 'A':
|
||||
+ if (remember_cmdline_wwid() != 0)
|
||||
+ exit(1);
|
||||
+ exit(0);
|
||||
case 'h':
|
||||
usage(argv[0]);
|
||||
exit(0);
|
||||
Index: multipath-tools-130222/multipathd/multipathd.service
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/multipathd.service
|
||||
+++ multipath-tools-130222/multipathd/multipathd.service
|
||||
@@ -11,6 +11,7 @@ Conflicts=shutdown.target
|
||||
Type=forking
|
||||
PIDFile=/var/run/multipathd/multipathd.pid
|
||||
ExecStartPre=/sbin/modprobe dm-multipath
|
||||
+ExecStartPre=-/sbin/multipath -A
|
||||
ExecStart=/sbin/multipathd
|
||||
ExecReload=/sbin/multipathd reconfigure
|
||||
#ExecStop=/path/to/scrip delete-me if not necessary
|
||||
Index: multipath-tools-130222/multipath/multipath.8
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipath/multipath.8
|
||||
+++ multipath-tools-130222/multipath/multipath.8
|
||||
@@ -8,7 +8,7 @@ multipath \- Device mapper target autoco
|
||||
.RB [\| \-b\ \c
|
||||
.IR bindings_file \|]
|
||||
.RB [\| \-d \|]
|
||||
-.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-a | \-w | \-W \|]
|
||||
+.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-a | \-A | \-w | \-W \|]
|
||||
.RB [\| \-p\ \c
|
||||
.BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|]
|
||||
.RB [\| device \|]
|
||||
@@ -71,6 +71,9 @@ allow device tables with queue_if_no_pat
|
||||
.B \-a
|
||||
add the wwid for the specified device to the wwids file
|
||||
.TP
|
||||
+.B \-A
|
||||
+add wwids from any kernel command line mpath.wwid parameters to the wwids file
|
||||
+.TP
|
||||
.B \-w
|
||||
remove the wwid for the specified device from the wwids file
|
||||
.TP
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
---
|
||||
libmultipath/devmapper.c | 12 ++++++++++--
|
||||
1 file changed, 10 insertions(+), 2 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/devmapper.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/devmapper.c
|
||||
+++ multipath-tools-130222/libmultipath/devmapper.c
|
||||
@@ -1151,6 +1151,8 @@ dm_rename_partmaps (char * old, char * n
|
||||
unsigned long long size;
|
||||
char dev_t[32];
|
||||
int r = 1;
|
||||
+ int offset;
|
||||
+ char *delim;
|
||||
|
||||
if (!(dmt = dm_task_create(DM_DEVICE_LIST)))
|
||||
return 1;
|
||||
@@ -1171,6 +1173,11 @@ dm_rename_partmaps (char * old, char * n
|
||||
if (dm_dev_t(old, &dev_t[0], 32))
|
||||
goto out;
|
||||
|
||||
+ if (isdigit(new[strlen(new)-1]))
|
||||
+ delim = "p";
|
||||
+ else
|
||||
+ delim = "";
|
||||
+
|
||||
do {
|
||||
if (
|
||||
/*
|
||||
@@ -1198,8 +1205,9 @@ dm_rename_partmaps (char * old, char * n
|
||||
* then it's a kpartx generated partition.
|
||||
* Rename it.
|
||||
*/
|
||||
- snprintf(buff, PARAMS_SIZE, "%s%s",
|
||||
- new, names->name + strlen(old));
|
||||
+ for (offset = strlen(old); names->name[offset] && !(isdigit(names->name[offset])); offset++); /* do nothing */
|
||||
+ snprintf(buff, PARAMS_SIZE, "%s%s%s",
|
||||
+ new, delim, names->name + offset);
|
||||
dm_rename(names->name, buff);
|
||||
condlog(4, "partition map %s renamed",
|
||||
names->name);
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
---
|
||||
libmultipath/checkers/tur.c | 9 +++------
|
||||
1 file changed, 3 insertions(+), 6 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/checkers/tur.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/checkers/tur.c
|
||||
+++ multipath-tools-130222/libmultipath/checkers/tur.c
|
||||
@@ -409,7 +409,6 @@ libcheck_check (struct checker * c)
|
||||
ct->running = 0;
|
||||
MSG(c, MSG_TUR_TIMEOUT);
|
||||
tur_status = PATH_DOWN;
|
||||
- ct->state = PATH_UNCHECKED;
|
||||
} else {
|
||||
condlog(3, "%d:%d: tur checker not finished",
|
||||
TUR_DEVT(ct));
|
||||
@@ -426,12 +425,10 @@ libcheck_check (struct checker * c)
|
||||
pthread_mutex_unlock(&ct->lock);
|
||||
} else {
|
||||
if (ct->thread) {
|
||||
- /* pthread cancel failed. continue in sync mode */
|
||||
pthread_mutex_unlock(&ct->lock);
|
||||
- condlog(3, "%d:%d: tur thread not responding, "
|
||||
- "using sync mode", TUR_DEVT(ct));
|
||||
- return tur_check(c->fd, c->timeout, c->message,
|
||||
- ct->wwid);
|
||||
+ condlog(3, "%d:%d: tur thread not responding, ",
|
||||
+ TUR_DEVT(ct));
|
||||
+ return PATH_DOWN;
|
||||
}
|
||||
/* Start new TUR checker */
|
||||
ct->state = PATH_UNCHECKED;
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
---
|
||||
libmultipath/structs_vec.c | 31 +++++++++++++++++++++++++++----
|
||||
multipathd/main.c | 4 ++++
|
||||
2 files changed, 31 insertions(+), 4 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/structs_vec.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/structs_vec.c
|
||||
+++ multipath-tools-130222/libmultipath/structs_vec.c
|
||||
@@ -280,12 +280,38 @@ update_multipath_status (struct multipat
|
||||
return 0;
|
||||
}
|
||||
|
||||
+void sync_paths(struct multipath *mpp, vector pathvec)
|
||||
+{
|
||||
+ struct path *pp;
|
||||
+ struct pathgroup *pgp;
|
||||
+ int found, i, j;
|
||||
+
|
||||
+ vector_foreach_slot (mpp->paths, pp, i) {
|
||||
+ found = 0;
|
||||
+ vector_foreach_slot(mpp->pg, pgp, j) {
|
||||
+ if (find_slot(pgp->paths, (void *)pp) != -1) {
|
||||
+ found = 1;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ if (!found) {
|
||||
+ condlog(3, "%s dropped path %s", mpp->alias, pp->dev);
|
||||
+ vector_del_slot(mpp->paths, i--);
|
||||
+ orphan_path(pp);
|
||||
+ }
|
||||
+ }
|
||||
+ update_mpp_paths(mpp, pathvec);
|
||||
+ vector_foreach_slot (mpp->paths, pp, i)
|
||||
+ pp->mpp = mpp;
|
||||
+}
|
||||
+
|
||||
extern int
|
||||
update_multipath_strings (struct multipath *mpp, vector pathvec)
|
||||
{
|
||||
if (!mpp)
|
||||
return 1;
|
||||
|
||||
+ update_mpp_paths(mpp, pathvec);
|
||||
condlog(4, "%s: %s", mpp->alias, __FUNCTION__);
|
||||
|
||||
free_multipath_attributes(mpp);
|
||||
@@ -294,6 +320,7 @@ update_multipath_strings (struct multipa
|
||||
|
||||
if (update_multipath_table(mpp, pathvec))
|
||||
return 1;
|
||||
+ sync_paths(mpp, pathvec);
|
||||
|
||||
if (update_multipath_status(mpp))
|
||||
return 1;
|
||||
@@ -494,13 +521,9 @@ int update_multipath (struct vectors *ve
|
||||
return 2;
|
||||
}
|
||||
|
||||
- free_pgvec(mpp->pg, KEEP_PATHS);
|
||||
- mpp->pg = NULL;
|
||||
-
|
||||
if (__setup_multipath(vecs, mpp, reset))
|
||||
return 1; /* mpp freed in setup_multipath */
|
||||
|
||||
- adopt_paths(vecs->pathvec, mpp, 0);
|
||||
/*
|
||||
* compare checkers states with DM states
|
||||
*/
|
||||
Index: multipath-tools-130222/multipathd/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/main.c
|
||||
+++ multipath-tools-130222/multipathd/main.c
|
||||
@@ -1152,6 +1152,10 @@ check_path (struct vectors * vecs, struc
|
||||
pp->dev);
|
||||
pp->dmstate = PSTATE_UNDEF;
|
||||
}
|
||||
+ /* if update_multipath_strings orphaned the path, quit early */
|
||||
+ if (!pp->mpp)
|
||||
+ return;
|
||||
+
|
||||
pp->chkrstate = newstate;
|
||||
if (newstate != pp->state) {
|
||||
int oldstate = pp->state;
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
---
|
||||
libmultipath/prioritizers/alua.c | 4 ++--
|
||||
multipathd/multipathd.8 | 37 +++++++++++++++++++++++++++++++++----
|
||||
2 files changed, 35 insertions(+), 6 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/multipathd/multipathd.8
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/multipathd.8
|
||||
+++ multipath-tools-130222/multipathd/multipathd.8
|
||||
@@ -42,6 +42,9 @@ format wildcards.
|
||||
.B list|show maps|multipaths
|
||||
Show the multipath devices that the multipathd is monitoring.
|
||||
.TP
|
||||
+.B list|show daemon
|
||||
+Show the current state of the multipathd daemon
|
||||
+.TP
|
||||
.B list|show maps|multipaths format $format
|
||||
Show the status of all multipath devices that the multipathd is monitoring,
|
||||
using a format string with multipath format wildcards.
|
||||
@@ -83,16 +86,16 @@ Add a path to the list of monitored path
|
||||
.B remove|del path $path
|
||||
Stop monitoring a path. $path is as listed in /sys/block (e.g. sda).
|
||||
.TP
|
||||
-.B add map $map
|
||||
+.B add map|multipath $map
|
||||
Add a multipath device to the list of monitored devices. $map can either be a device-mapper device as listed in /sys/block (e.g. dm-0) or it can be the alias for the multipath device (e.g. mpath1) or the uid of the multipath device (e.g. 36005076303ffc56200000000000010aa).
|
||||
.TP
|
||||
-.B remove|del map $map
|
||||
+.B remove|del map|multipath $map
|
||||
Stop monitoring a multipath device.
|
||||
.TP
|
||||
.B resize map|multipath $map
|
||||
Resizes map $map to the given size
|
||||
.TP
|
||||
-.B switch|switchgroup map $map group $group
|
||||
+.B switch|switchgroup map|multipath $map group $group
|
||||
Force a multipath device to switch to a specific path group. $group is the path group index, starting with 1.
|
||||
.TP
|
||||
.B reconfigure
|
||||
@@ -104,6 +107,13 @@ Sets map $map into suspend state.
|
||||
.B resume map|multipath $map
|
||||
Resumes map $map from suspend state.
|
||||
.TP
|
||||
+.B reset map|multipath $map
|
||||
+Reassign existing device-mapper table(s) use use the multipath device, instead
|
||||
+of its path devices.
|
||||
+.TP
|
||||
+.B reload map|multipath $map
|
||||
+Reload a multipath device.
|
||||
+.TP
|
||||
.B fail path $path
|
||||
Sets path $path into failed state.
|
||||
.TP
|
||||
@@ -120,10 +130,29 @@ Restore queueing on all multipath device
|
||||
Disable queuing on multipathed map $map
|
||||
.TP
|
||||
.B restorequeueing map|multipath $map
|
||||
-Restore queuing on multipahted map $map
|
||||
+Restore queuing on multipathed map $map
|
||||
+.TP
|
||||
+.B forcequeueing daemon
|
||||
+Forces multipathd into queue_without_daemon mode, so that no_path_retry queueing
|
||||
+will not be disabled when the daemon stops
|
||||
+.TP
|
||||
+.B restorequeueing daemon
|
||||
+Restores configured queue_without_daemon mode
|
||||
+.TP
|
||||
+.B map|multipath $map setprstatus
|
||||
+Enable persistent reservation management on $map
|
||||
+.TP
|
||||
+.B map|multipath $map unsetprstatus
|
||||
+Disable persistent reservation management on $map
|
||||
+.TP
|
||||
+.B map|multipath $map getprstatus
|
||||
+Get the current persistent reservation management status of $map
|
||||
.TP
|
||||
.B quit|exit
|
||||
End interactive session.
|
||||
+.TP
|
||||
+.B shutdown
|
||||
+Stop multipathd.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR multipath (8)
|
||||
Index: multipath-tools-130222/libmultipath/prioritizers/alua.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/prioritizers/alua.c
|
||||
+++ multipath-tools-130222/libmultipath/prioritizers/alua.c
|
||||
@@ -119,10 +119,10 @@ int getprio (struct path * pp, char * ar
|
||||
condlog(0, "%s: couldn't get target port group", pp->dev);
|
||||
break;
|
||||
case ALUA_PRIO_GETAAS_FAILED:
|
||||
- condlog(0, "%s: couln't get asymmetric access state", pp->dev);
|
||||
+ condlog(0, "%s: couldn't get asymmetric access state", pp->dev);
|
||||
break;
|
||||
case ALUA_PRIO_TPGS_FAILED:
|
||||
- condlog(3, "%s: couln't get supported alua states", pp->dev);
|
||||
+ condlog(3, "%s: couldn't get supported alua states", pp->dev);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
---
|
||||
libmultipath/hwtable.c | 13 +++++++++++++
|
||||
1 file changed, 13 insertions(+)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/hwtable.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/hwtable.c
|
||||
+++ multipath-tools-130222/libmultipath/hwtable.c
|
||||
@@ -1108,6 +1108,19 @@ static struct hwentry default_hw[] = {
|
||||
.prio_name = PRIO_ALUA,
|
||||
.prio_args = NULL,
|
||||
},
|
||||
+ {
|
||||
+ .vendor = "DataCore",
|
||||
+ .product = "Virtual Disk",
|
||||
+ .features = DEFAULT_FEATURES,
|
||||
+ .hwhandler = DEFAULT_HWHANDLER,
|
||||
+ .pgpolicy = GROUP_BY_PRIO,
|
||||
+ .pgfailback = -FAILBACK_IMMEDIATE,
|
||||
+ .rr_weight = RR_WEIGHT_NONE,
|
||||
+ .no_path_retry = NO_PATH_RETRY_QUEUE,
|
||||
+ .checker_name = TUR,
|
||||
+ .prio_name = PRIO_ALUA,
|
||||
+ .prio_args = NULL,
|
||||
+ },
|
||||
/*
|
||||
* EOL
|
||||
*/
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
---
|
||||
multipathd/main.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
Index: multipath-tools-130222/multipathd/main.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/multipathd/main.c
|
||||
+++ multipath-tools-130222/multipathd/main.c
|
||||
@@ -562,7 +562,7 @@ rescan:
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
- return 1;
|
||||
+ goto fail;
|
||||
|
||||
fail_map:
|
||||
remove_map(mpp, vecs, 1);
|
||||
|
|
@ -1,190 +0,0 @@
|
|||
---
|
||||
libmultipath/parser.c | 154 ++++++++++++++++++++++++++++++++++++++++----------
|
||||
1 file changed, 126 insertions(+), 28 deletions(-)
|
||||
|
||||
Index: multipath-tools-130222/libmultipath/parser.c
|
||||
===================================================================
|
||||
--- multipath-tools-130222.orig/libmultipath/parser.c
|
||||
+++ multipath-tools-130222/libmultipath/parser.c
|
||||
@@ -395,36 +395,57 @@ set_value(vector strvec)
|
||||
char *alloc = NULL;
|
||||
char *tmp;
|
||||
|
||||
- if (!str)
|
||||
+ if (!str) {
|
||||
+ condlog(0, "option '%s' missing value",
|
||||
+ (char *)VECTOR_SLOT(strvec, 0));
|
||||
return NULL;
|
||||
-
|
||||
+ }
|
||||
size = strlen(str);
|
||||
- if (size == 0)
|
||||
+ if (size == 0) {
|
||||
+ condlog(0, "option '%s' has empty value",
|
||||
+ (char *)VECTOR_SLOT(strvec, 0));
|
||||
return NULL;
|
||||
-
|
||||
- if (*str == '"') {
|
||||
- for (i = 2; i < VECTOR_SIZE(strvec); i++) {
|
||||
- str = VECTOR_SLOT(strvec, i);
|
||||
- len += strlen(str);
|
||||
- if (!alloc)
|
||||
- alloc =
|
||||
- (char *) MALLOC(sizeof (char *) *
|
||||
- (len + 1));
|
||||
- else {
|
||||
- alloc =
|
||||
- REALLOC(alloc, sizeof (char *) * (len + 1));
|
||||
- tmp = VECTOR_SLOT(strvec, i-1);
|
||||
- if (alloc && *str != '"' && *tmp != '"')
|
||||
- strncat(alloc, " ", 1);
|
||||
- }
|
||||
-
|
||||
- if (alloc && i != VECTOR_SIZE(strvec)-1)
|
||||
- strncat(alloc, str, strlen(str));
|
||||
- }
|
||||
- } else {
|
||||
- alloc = MALLOC(sizeof (char *) * (size + 1));
|
||||
+ }
|
||||
+ if (*str != '"') {
|
||||
+ alloc = MALLOC(sizeof (char) * (size + 1));
|
||||
if (alloc)
|
||||
memcpy(alloc, str, size);
|
||||
+ else
|
||||
+ condlog(0, "can't allocate memeory for option '%s'",
|
||||
+ (char *)VECTOR_SLOT(strvec, 0));
|
||||
+ return alloc;
|
||||
+ }
|
||||
+ /* Even empty quotes counts as a value (An empty string) */
|
||||
+ alloc = (char *) MALLOC(sizeof (char));
|
||||
+ if (!alloc) {
|
||||
+ condlog(0, "can't allocate memeory for option '%s'",
|
||||
+ (char *)VECTOR_SLOT(strvec, 0));
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ for (i = 2; i < VECTOR_SIZE(strvec); i++) {
|
||||
+ str = VECTOR_SLOT(strvec, i);
|
||||
+ if (!str) {
|
||||
+ free(alloc);
|
||||
+ condlog(0, "parse error for option '%s'",
|
||||
+ (char *)VECTOR_SLOT(strvec, 0));
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ if (*str == '"')
|
||||
+ break;
|
||||
+ tmp = alloc;
|
||||
+ /* The first +1 is for the NULL byte. The rest are for the
|
||||
+ * spaces between words */
|
||||
+ len += strlen(str) + 1;
|
||||
+ alloc = REALLOC(alloc, sizeof (char) * len);
|
||||
+ if (!alloc) {
|
||||
+ FREE(tmp);
|
||||
+ condlog(0, "can't allocate memeory for option '%s'",
|
||||
+ (char *)VECTOR_SLOT(strvec, 0));
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ if (*alloc != '\0')
|
||||
+ strncat(alloc, " ", 1);
|
||||
+ strncat(alloc, str, strlen(str));
|
||||
}
|
||||
return alloc;
|
||||
}
|
||||
@@ -465,6 +486,74 @@ void free_uniques(vector uniques)
|
||||
}
|
||||
|
||||
int
|
||||
+is_sublevel_keyword(char *str)
|
||||
+{
|
||||
+ return (strcmp(str, "defaults") == 0 || strcmp(str, "blacklist") == 0 ||
|
||||
+ strcmp(str, "blacklist_exceptions") == 0 ||
|
||||
+ strcmp(str, "devices") == 0 || strcmp(str, "devices") == 0 ||
|
||||
+ strcmp(str, "device") == 0 || strcmp(str, "multipaths") == 0 ||
|
||||
+ strcmp(str, "multipath") == 0);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+validate_config_strvec(vector strvec)
|
||||
+{
|
||||
+ char *str;
|
||||
+ int i;
|
||||
+
|
||||
+ str = VECTOR_SLOT(strvec, 0);
|
||||
+ if (str == NULL) {
|
||||
+ condlog(0, "can't parse option on line %d of config file",
|
||||
+ line_nr);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (*str == '}') {
|
||||
+ if (VECTOR_SIZE(strvec) > 1)
|
||||
+ condlog(0, "ignoring extra data starting with '%s' on line %d of config file", (char *)VECTOR_SLOT(strvec, 1), line_nr);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if (*str == '{') {
|
||||
+ condlog(0, "invalid keyword '%s' on line %d of config file", str, line_nr);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (is_sublevel_keyword(str)) {
|
||||
+ str = VECTOR_SLOT(strvec, 1);
|
||||
+ if (str == NULL)
|
||||
+ condlog(0, "missing '{' on line %d of config file", line_nr);
|
||||
+ else if (*str != '{')
|
||||
+ condlog(0, "expecting '{' on line %d of config file. found '%s'", line_nr, str);
|
||||
+ else if (VECTOR_SIZE(strvec) > 2)
|
||||
+ condlog(0, "ignoring extra data starting with '%s' on line %d of config file", (char *)VECTOR_SLOT(strvec, 2), line_nr);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ str = VECTOR_SLOT(strvec, 1);
|
||||
+ if (str == NULL) {
|
||||
+ condlog(0, "missing value for option '%s' on line %d of config file", (char *)VECTOR_SLOT(strvec, 0), line_nr);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (*str != '"') {
|
||||
+ if (VECTOR_SIZE(strvec) > 2)
|
||||
+ condlog(0, "ignoring extra data starting with '%s' on line %d of config file", (char *)VECTOR_SLOT(strvec, 2), line_nr);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ for (i = 2; i < VECTOR_SIZE(strvec); i++) {
|
||||
+ str = VECTOR_SLOT(strvec, i);
|
||||
+ if (str == NULL) {
|
||||
+ condlog(0, "can't parse value on line %d of config file", line_nr);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ if (*str == '"') {
|
||||
+ if (VECTOR_SIZE(strvec) > i + 1)
|
||||
+ condlog(0, "ignoring extra data starting with '%s' on line %d of config file", (char *)VECTOR_SLOT(strvec, (i + 1)), line_nr);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ condlog(0, "missing closing quotes on line %d of config file",
|
||||
+ line_nr);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
process_stream(vector keywords)
|
||||
{
|
||||
int i;
|
||||
@@ -494,11 +583,20 @@ process_stream(vector keywords)
|
||||
if (!strvec)
|
||||
continue;
|
||||
|
||||
+ if (validate_config_strvec(strvec) != 0) {
|
||||
+ free_strvec(strvec);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
str = VECTOR_SLOT(strvec, 0);
|
||||
|
||||
- if (!strcmp(str, EOB) && kw_level > 0) {
|
||||
- free_strvec(strvec);
|
||||
- break;
|
||||
+ if (!strcmp(str, EOB)) {
|
||||
+ if (kw_level > 0) {
|
||||
+ free_strvec(strvec);
|
||||
+ break;
|
||||
+ }
|
||||
+ condlog(0, "unmatched '%s' at line %d of config file",
|
||||
+ EOB, line_nr);
|
||||
}
|
||||
|
||||
for (i = 0; i < VECTOR_SIZE(keywords); i++) {
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue