6738b34a0b
- Modify 0005-RH-add-mpathconf.patch * changed warning message - Modify 0102-RHBZ-1160478-mpathconf-template.patch * updated man page - Modify 0104-RHBZ-631009-deferred-remove.patch * refactor code and minor fix - Refresh 0107-RHBZ-1169935-no-new-devs.patch - Refresh 0112-RHBZ-1194917-add-config_dir-option.patch - Refresh 0126-RHBZ-1211383-alias-collision.patch - Add 0133-RHBZ-1296979-fix-define.patch * look for the correct libudev function to set define - Add 0134-RHBZ-1241528-check-mpath-prefix.patch * only touch devices with a "mpath-" dm uuid prefix - Add 0135-RHBZ-1299600-path-dev-uevents.patch * trigger path uevent the first time a path is claimed by multipath - Add 0136-RHBZ-1304687-wait-for-map-add.patch * wait for the device to finish being added before reloading it. - Add 0137-RHBZ-1280524-clear-chkr-msg.patch - Add 0138-RHBZ-1288660-fix-mpathconf-allow.patch * don't remove existing lines from blacklist_exceptions section - Add 0139-RHBZ-1273173-queue-no-daemon-doc.patch - Add 0140-RHBZ-1299647-fix-help.patch - Add 0141-RHBZ-1303953-mpathpersist-typo.patch - Add 0142-RHBZ-1283750-kpartx-fix.patch * only remove devices if their uuid says that they are the correct partition device - Add 0143-RHBZ-1299648-kpartx-sync.patch * default to using udev sync mode - Add 0144-RHBZ-1299652-alua-pref-arg.patch * allow "exclusive_pref_bit" argument to alua prioritizer - Add 0145-UP-resize-help-msg.patch - Add 0146-UPBZ-1299651-raw-output.patch * allow raw format mutipathd show commands, that remove headers and padding - Add 0147-RHBZ-1272620-fail-rm-msg.patch - Add 0148-RHBZ-1292599-verify-before-remove.patch * verify that all partitions are unused before attempting to remove a device - Add 0149-RHBZ-1292599-restore-removed-parts.patch * don't disable kpartx when restoring the first path of a device. - Add 0150-RHBZ-1253913-fix-startup-msg.patch * wait for multipathd daemon to write pidfile before returning - Add 0151-RHBZ-1297456-weighted-fix.patch * add wwn keyword to weighted prioritizer for persistent naming - Add 0152-RHBZ-1269293-fix-blk-unit-file.patch * use "Wants" instead of "Requires" - Add 0153-RH-fix-i686-size-bug.patch * use 64-bit keycodes for multipathd client commands - Add 0154-UPBZ-1291406-disable-reinstate.patch * don't automatically reinstate ghost paths for implicit alua devices - Add 0155-UPBZ-1300415-PURE-config.patch * Add default config for PURE FlashArray - Add 0156-UPBZ-1313324-dont-fail-discovery.patch * don't fail discovery because individual paths failed. - Add 0157-RHBZ-1319853-multipath-c-error-msg.patch * better error reporting for multipath -c - Add 0158-RHBZ-1318581-timestamp-doc-fix.patch * add documentation for -T - Add 0159-UPBZ-1255885-udev-waits.patch * make multipath and kpartx wait after for udev after each command
426 lines
13 KiB
Diff
426 lines
13 KiB
Diff
---
|
|
kpartx/devmapper.c | 53 ++++++++++++++++++++++++++++++++++------------
|
|
kpartx/devmapper.h | 4 +--
|
|
kpartx/kpartx.c | 16 ++++++-------
|
|
libmultipath/config.h | 1
|
|
libmultipath/configure.c | 5 ++--
|
|
libmultipath/devmapper.c | 48 +++++++++++++++++++++++++++++++----------
|
|
libmultipath/devmapper.h | 2 -
|
|
multipath/main.c | 2 -
|
|
multipathd/cli_handlers.c | 4 +--
|
|
9 files changed, 92 insertions(+), 43 deletions(-)
|
|
|
|
Index: multipath-tools-130222/kpartx/devmapper.c
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/kpartx/devmapper.c
|
|
+++ multipath-tools-130222/kpartx/devmapper.c
|
|
@@ -14,13 +14,6 @@
|
|
#define MAX_PREFIX_LEN 8
|
|
#define PARAMS_SIZE 1024
|
|
|
|
-#ifndef LIBDM_API_COOKIE
|
|
-static inline int dm_task_set_cookie(struct dm_task *dmt, uint32_t *c, int a)
|
|
-{
|
|
- return 1;
|
|
-}
|
|
-#endif
|
|
-
|
|
extern int
|
|
dm_prereq (char * str, int x, int y, int z)
|
|
{
|
|
@@ -60,10 +53,13 @@ dm_prereq (char * str, int x, int y, int
|
|
}
|
|
|
|
extern int
|
|
-dm_simplecmd (int task, const char *name, int no_flush, uint32_t *cookie, uint16_t udev_flags) {
|
|
+dm_simplecmd (int task, const char *name, int no_flush, uint16_t udev_flags) {
|
|
int r = 0;
|
|
int udev_wait_flag = (task == DM_DEVICE_RESUME ||
|
|
task == DM_DEVICE_REMOVE);
|
|
+#ifdef LIBDM_API_COOKIE
|
|
+ uint32_t cookie = 0;
|
|
+#endif
|
|
struct dm_task *dmt;
|
|
|
|
if (!(dmt = dm_task_create(task)))
|
|
@@ -78,10 +74,23 @@ 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) | udev_flags))
|
|
+#ifdef LIBDM_API_COOKIE
|
|
+ if (!udev_sync)
|
|
+ udev_flags |= DM_UDEV_DISABLE_LIBRARY_FALLBACK;
|
|
+ if (udev_wait_flag && !dm_task_set_cookie(dmt, &cookie, udev_flags)) {
|
|
+ dm_udev_complete(cookie);
|
|
goto out;
|
|
+ }
|
|
+#endif
|
|
r = dm_task_run(dmt);
|
|
-
|
|
+#ifdef LIBDM_API_COOKIE
|
|
+ if (udev_wait_flag) {
|
|
+ if (!r)
|
|
+ dm_udev_complete(cookie);
|
|
+ else
|
|
+ dm_udev_wait(cookie);
|
|
+ }
|
|
+#endif
|
|
out:
|
|
dm_task_destroy(dmt);
|
|
return r;
|
|
@@ -90,10 +99,14 @@ dm_simplecmd (int task, const char *name
|
|
extern int
|
|
dm_addmap (int task, const char *name, const char *target,
|
|
const char *params, uint64_t size, int ro, const char *uuid, int part,
|
|
- mode_t mode, uid_t uid, gid_t gid, uint32_t *cookie) {
|
|
+ mode_t mode, uid_t uid, gid_t gid) {
|
|
int r = 0;
|
|
struct dm_task *dmt;
|
|
char *prefixed_uuid = NULL;
|
|
+#ifdef LIBDM_API_COOKIE
|
|
+ uint32_t cookie = 0;
|
|
+ uint16_t udev_flags = 0;
|
|
+#endif
|
|
|
|
if (!(dmt = dm_task_create (task)))
|
|
return 0;
|
|
@@ -128,10 +141,24 @@ dm_addmap (int task, const char *name, c
|
|
|
|
dm_task_no_open_count(dmt);
|
|
|
|
- if (task == DM_DEVICE_CREATE && !dm_task_set_cookie(dmt, cookie, (udev_sync)? 0 : DM_UDEV_DISABLE_LIBRARY_FALLBACK))
|
|
+#ifdef LIBDM_API_COOKIE
|
|
+ if (!udev_sync)
|
|
+ udev_flags = DM_UDEV_DISABLE_LIBRARY_FALLBACK;
|
|
+ if (task == DM_DEVICE_CREATE &&
|
|
+ !dm_task_set_cookie(dmt, &cookie, udev_flags)) {
|
|
+ dm_udev_complete(cookie);
|
|
goto addout;
|
|
+ }
|
|
+#endif
|
|
r = dm_task_run (dmt);
|
|
-
|
|
+#ifdef LIBDM_API_COOKIE
|
|
+ if (task == DM_DEVICE_CREATE) {
|
|
+ if (!r)
|
|
+ dm_udev_complete(cookie);
|
|
+ else
|
|
+ dm_udev_wait(cookie);
|
|
+ }
|
|
+#endif
|
|
addout:
|
|
dm_task_destroy (dmt);
|
|
free(prefixed_uuid);
|
|
Index: multipath-tools-130222/kpartx/devmapper.h
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/kpartx/devmapper.h
|
|
+++ multipath-tools-130222/kpartx/devmapper.h
|
|
@@ -11,9 +11,9 @@
|
|
extern int udev_sync;
|
|
|
|
int dm_prereq (char *, int, int, int);
|
|
-int dm_simplecmd (int, const char *, int, uint32_t *, uint16_t);
|
|
+int dm_simplecmd (int, const char *, int, 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, const char *, int, mode_t, uid_t, gid_t);
|
|
int dm_map_present (char *, char **);
|
|
char * dm_mapname(int major, int minor);
|
|
dev_t dm_get_first_dep(char *devname);
|
|
Index: multipath-tools-130222/kpartx/kpartx.c
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/kpartx/kpartx.c
|
|
+++ multipath-tools-130222/kpartx/kpartx.c
|
|
@@ -224,7 +224,6 @@ main(int argc, char **argv){
|
|
int hotplug = 0;
|
|
int loopcreated = 0;
|
|
struct stat buf;
|
|
- uint32_t cookie = 0;
|
|
|
|
initpts();
|
|
init_crc32();
|
|
@@ -300,6 +299,8 @@ main(int argc, char **argv){
|
|
#ifdef LIBDM_API_COOKIE
|
|
if (!udev_sync)
|
|
dm_udev_set_sync_support(0);
|
|
+ else
|
|
+ dm_udev_set_sync_support(1);
|
|
#endif
|
|
|
|
if (dm_prereq(DM_TARGET, 0, 0, 0) && (what == ADD || what == DELETE || what == UPDATE)) {
|
|
@@ -451,7 +452,7 @@ main(int argc, char **argv){
|
|
}
|
|
|
|
if (!dm_simplecmd(DM_DEVICE_REMOVE, partname,
|
|
- 0, &cookie, 0)) {
|
|
+ 0, 0)) {
|
|
r++;
|
|
continue;
|
|
}
|
|
@@ -508,7 +509,7 @@ main(int argc, char **argv){
|
|
if (!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)) {
|
|
+ buf.st_gid)) {
|
|
fprintf(stderr, "create/reload failed on %s\n",
|
|
partname);
|
|
r++;
|
|
@@ -516,12 +517,13 @@ main(int argc, char **argv){
|
|
}
|
|
if (op == DM_DEVICE_RELOAD &&
|
|
!dm_simplecmd(DM_DEVICE_RESUME, partname,
|
|
- 1, &cookie, MPATH_UDEV_RELOAD_FLAG)) {
|
|
+ 1, MPATH_UDEV_RELOAD_FLAG)) {
|
|
fprintf(stderr, "resume failed on %s\n",
|
|
partname);
|
|
r++;
|
|
continue;
|
|
}
|
|
+
|
|
dm_devn(partname, &slices[j].major,
|
|
&slices[j].minor);
|
|
|
|
@@ -560,7 +562,7 @@ main(int argc, char **argv){
|
|
}
|
|
|
|
if (!dm_simplecmd(DM_DEVICE_REMOVE,
|
|
- partname, 1, &cookie, 0)) {
|
|
+ partname, 1, 0)) {
|
|
r++;
|
|
continue;
|
|
}
|
|
@@ -586,9 +588,7 @@ main(int argc, char **argv){
|
|
}
|
|
printf("loop deleted : %s\n", device);
|
|
}
|
|
-#ifdef LIBDM_API_COOKIE
|
|
- dm_udev_wait(cookie);
|
|
-#endif
|
|
+
|
|
dm_lib_release();
|
|
dm_lib_exit();
|
|
|
|
Index: multipath-tools-130222/libmultipath/config.h
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/libmultipath/config.h
|
|
+++ multipath-tools-130222/libmultipath/config.h
|
|
@@ -129,7 +129,6 @@ struct config {
|
|
uid_t uid;
|
|
gid_t gid;
|
|
mode_t mode;
|
|
- uint32_t cookie;
|
|
int reassign_maps;
|
|
int retain_hwhandler;
|
|
int detect_prio;
|
|
Index: multipath-tools-130222/libmultipath/configure.c
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/libmultipath/configure.c
|
|
+++ multipath-tools-130222/libmultipath/configure.c
|
|
@@ -654,7 +654,8 @@ 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, (mpp->force_udev_reload)? 0 : MPATH_UDEV_RELOAD_FLAG);
|
|
+ r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias,
|
|
+ 0, (mpp->force_udev_reload)? 0 : MPATH_UDEV_RELOAD_FLAG);
|
|
break;
|
|
|
|
case ACT_RESIZE:
|
|
@@ -672,7 +673,7 @@ domap (struct multipath * mpp, char * pa
|
|
if (r) {
|
|
r = dm_addmap_reload(mpp, params);
|
|
if (r)
|
|
- r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias, (mpp->force_udev_reload)? 0 : MPATH_UDEV_RELOAD_FLAG);
|
|
+ r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias, 0, (mpp->force_udev_reload)? 0 : MPATH_UDEV_RELOAD_FLAG);
|
|
}
|
|
break;
|
|
|
|
Index: multipath-tools-130222/libmultipath/devmapper.c
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/libmultipath/devmapper.c
|
|
+++ multipath-tools-130222/libmultipath/devmapper.c
|
|
@@ -215,6 +215,7 @@ dm_simplecmd (int task, const char *name
|
|
int r = 0;
|
|
int udev_wait_flag = (need_sync && (task == DM_DEVICE_RESUME ||
|
|
task == DM_DEVICE_REMOVE));
|
|
+ uint32_t cookie = 0;
|
|
struct dm_task *dmt;
|
|
|
|
if (!(dmt = dm_task_create (task)))
|
|
@@ -233,10 +234,18 @@ dm_simplecmd (int task, const char *name
|
|
if (do_deferred(deferred_remove))
|
|
dm_task_deferred_remove(dmt);
|
|
#endif
|
|
- if (udev_wait_flag && !dm_task_set_cookie(dmt, &conf->cookie, ((conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0) | udev_flags))
|
|
+ if (udev_wait_flag && !dm_task_set_cookie(dmt, &cookie, ((conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0) | udev_flags)) {
|
|
+ dm_udev_complete(cookie);
|
|
goto out;
|
|
+ }
|
|
r = dm_task_run (dmt);
|
|
|
|
+ if (udev_wait_flag) {
|
|
+ if (!r)
|
|
+ dm_udev_complete(cookie);
|
|
+ else
|
|
+ udev_wait(cookie);
|
|
+ }
|
|
out:
|
|
dm_task_destroy (dmt);
|
|
return r;
|
|
@@ -248,8 +257,8 @@ dm_simplecmd_flush (int task, const char
|
|
}
|
|
|
|
extern int
|
|
-dm_simplecmd_noflush (int task, const char *name, uint16_t udev_flags) {
|
|
- return dm_simplecmd(task, name, 1, 1, udev_flags, 0);
|
|
+dm_simplecmd_noflush (int task, const char *name, int needsync, uint16_t udev_flags) {
|
|
+ return dm_simplecmd(task, name, 1, needsync, udev_flags, 0);
|
|
}
|
|
|
|
static int
|
|
@@ -264,6 +273,7 @@ dm_addmap (int task, const char *target,
|
|
int r = 0;
|
|
struct dm_task *dmt;
|
|
char *prefixed_uuid = NULL;
|
|
+ uint32_t cookie = 0;
|
|
|
|
if (!(dmt = dm_task_create (task)))
|
|
return 0;
|
|
@@ -304,10 +314,18 @@ dm_addmap (int task, const char *target,
|
|
dm_task_no_open_count(dmt);
|
|
|
|
if (task == DM_DEVICE_CREATE &&
|
|
- !dm_task_set_cookie(dmt, &conf->cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0))
|
|
+ !dm_task_set_cookie(dmt, &cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0)) {
|
|
+ dm_udev_complete(cookie);
|
|
goto freeout;
|
|
+ }
|
|
r = dm_task_run (dmt);
|
|
|
|
+ if (task == DM_DEVICE_CREATE) {
|
|
+ if (!r)
|
|
+ dm_udev_complete(cookie);
|
|
+ else
|
|
+ udev_wait(cookie);
|
|
+ }
|
|
freeout:
|
|
if (prefixed_uuid)
|
|
FREE(prefixed_uuid);
|
|
@@ -325,7 +343,8 @@ dm_addmap_create (struct multipath *mpp,
|
|
for (ro = 0; ro <= 1; ro++) {
|
|
int err;
|
|
|
|
- if (dm_addmap(DM_DEVICE_CREATE, TGT_MPATH, mpp, params, 1, ro))
|
|
+ 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.
|
|
@@ -806,14 +825,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, 0);
|
|
+ s = dm_simplecmd_flush(DM_DEVICE_SUSPEND, mapname, 1, 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, 0);
|
|
+ dm_simplecmd_noflush(DM_DEVICE_RESUME, mapname, 1, 0);
|
|
if (queue_if_no_path)
|
|
s = dm_queue_if_no_path((char *)mapname, 1);
|
|
return 1;
|
|
@@ -1366,6 +1385,7 @@ dm_rename (const char * old, char * new)
|
|
{
|
|
int r = 0;
|
|
struct dm_task *dmt;
|
|
+ uint32_t cookie;
|
|
|
|
if (dm_rename_partmaps(old, new))
|
|
return r;
|
|
@@ -1381,14 +1401,18 @@ dm_rename (const char * old, char * new)
|
|
|
|
dm_task_no_open_count(dmt);
|
|
|
|
- if (!dm_task_set_cookie(dmt, &conf->cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0))
|
|
- goto out;
|
|
- if (!dm_task_run(dmt))
|
|
+ if (!dm_task_set_cookie(dmt, &cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0))
|
|
goto out;
|
|
+ r = dm_task_run(dmt);
|
|
+
|
|
+ if (!r)
|
|
+ dm_udev_complete(cookie);
|
|
+ else
|
|
+ udev_wait(cookie);
|
|
|
|
- r = 1;
|
|
out:
|
|
dm_task_destroy(dmt);
|
|
+
|
|
return r;
|
|
}
|
|
|
|
@@ -1453,7 +1477,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, MPATH_UDEV_RELOAD_FLAG);
|
|
+ dm_simplecmd_noflush(DM_DEVICE_RESUME, name, 1, 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
|
|
@@ -16,7 +16,7 @@ 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, uint16_t);
|
|
-int dm_simplecmd_noflush (int, const char *, uint16_t);
|
|
+int dm_simplecmd_noflush (int, const char *, int, 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/multipath/main.c
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/multipath/main.c
|
|
+++ multipath-tools-130222/multipath/main.c
|
|
@@ -681,8 +681,6 @@ main (int argc, char *argv[])
|
|
condlog(3, "restart multipath configuration process");
|
|
|
|
out:
|
|
- udev_wait(conf->cookie);
|
|
-
|
|
dm_lib_release();
|
|
dm_lib_exit();
|
|
|
|
Index: multipath-tools-130222/multipathd/cli_handlers.c
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/multipathd/cli_handlers.c
|
|
+++ multipath-tools-130222/multipathd/cli_handlers.c
|
|
@@ -807,7 +807,7 @@ cli_suspend(void * v, char ** reply, int
|
|
return 1;
|
|
}
|
|
|
|
- r = dm_simplecmd_noflush(DM_DEVICE_SUSPEND, param, 0);
|
|
+ r = dm_simplecmd_noflush(DM_DEVICE_SUSPEND, param, 0, 0);
|
|
|
|
condlog(2, "%s: suspend (operator)", param);
|
|
|
|
@@ -837,7 +837,7 @@ cli_resume(void * v, char ** reply, int
|
|
return 1;
|
|
}
|
|
|
|
- r = dm_simplecmd_noflush(DM_DEVICE_RESUME, param, 0);
|
|
+ r = dm_simplecmd_noflush(DM_DEVICE_RESUME, param, 0, 0);
|
|
|
|
condlog(2, "%s: resume (operator)", param);
|
|
|