summaryrefslogtreecommitdiffstats
path: root/0159-UPBZ-1255885-udev-waits.patch
diff options
context:
space:
mode:
Diffstat (limited to '0159-UPBZ-1255885-udev-waits.patch')
-rw-r--r--0159-UPBZ-1255885-udev-waits.patch188
1 files changed, 25 insertions, 163 deletions
diff --git a/0159-UPBZ-1255885-udev-waits.patch b/0159-UPBZ-1255885-udev-waits.patch
index 9af0981..9e0921b 100644
--- a/0159-UPBZ-1255885-udev-waits.patch
+++ b/0159-UPBZ-1255885-udev-waits.patch
@@ -1,14 +1,11 @@
---
- 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(-)
+ kpartx/devmapper.c | 41 ++++++++++++++++++++++++++++-------------
+ kpartx/devmapper.h | 4 ++--
+ kpartx/kpartx.c | 16 ++++++++--------
+ libmultipath/config.h | 1 -
+ libmultipath/devmapper.c | 19 +++++++++++++------
+ multipath/main.c | 2 --
+ 6 files changed, 51 insertions(+), 32 deletions(-)
Index: multipath-tools-130222/kpartx/devmapper.c
===================================================================
@@ -43,7 +40,7 @@ Index: multipath-tools-130222/kpartx/devmapper.c
struct dm_task *dmt;
if (!(dmt = dm_task_create(task)))
-@@ -78,10 +74,23 @@ dm_simplecmd (int task, const char *name
+@@ -78,10 +74,17 @@ dm_simplecmd (int task, const char *name
if (no_flush)
dm_task_no_flush(dmt);
@@ -51,25 +48,19 @@ Index: multipath-tools-130222/kpartx/devmapper.c
+#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);
++ if (udev_wait_flag && !dm_task_set_cookie(dmt, &cookie, udev_flags))
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);
-+ }
++ if (udev_wait_flag)
++ dm_udev_wait(cookie);
+#endif
out:
dm_task_destroy(dmt);
return r;
-@@ -90,10 +99,14 @@ dm_simplecmd (int task, const char *name
+@@ -90,10 +93,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,
@@ -85,7 +76,7 @@ Index: multipath-tools-130222/kpartx/devmapper.c
if (!(dmt = dm_task_create (task)))
return 0;
-@@ -128,10 +141,24 @@ dm_addmap (int task, const char *name, c
+@@ -128,10 +135,18 @@ dm_addmap (int task, const char *name, c
dm_task_no_open_count(dmt);
@@ -94,20 +85,14 @@ Index: multipath-tools-130222/kpartx/devmapper.c
+ 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);
++ !dm_task_set_cookie(dmt, &cookie, udev_flags))
goto addout;
-+ }
+#endif
r = dm_task_run (dmt);
-
+#ifdef LIBDM_API_COOKIE
-+ if (task == DM_DEVICE_CREATE) {
-+ if (!r)
-+ dm_udev_complete(cookie);
-+ else
++ if (task == DM_DEVICE_CREATE)
+ dm_udev_wait(cookie);
-+ }
+#endif
addout:
dm_task_destroy (dmt);
@@ -214,29 +199,6 @@ Index: multipath-tools-130222/libmultipath/config.h
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
@@ -249,38 +211,21 @@ Index: multipath-tools-130222/libmultipath/devmapper.c
struct dm_task *dmt;
if (!(dmt = dm_task_create (task)))
-@@ -233,10 +234,18 @@ dm_simplecmd (int task, const char *name
+@@ -233,10 +234,12 @@ 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);
++ if (udev_wait_flag && !dm_task_set_cookie(dmt, &cookie, ((conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0) | udev_flags))
goto out;
-+ }
r = dm_task_run (dmt);
-+ if (udev_wait_flag) {
-+ if (!r)
-+ dm_udev_complete(cookie);
-+ else
++ if (udev_wait_flag)
+ 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,
+@@ -264,6 +267,7 @@ dm_addmap (int task, const char *target,
int r = 0;
struct dm_task *dmt;
char *prefixed_uuid = NULL;
@@ -288,54 +233,21 @@ Index: multipath-tools-130222/libmultipath/devmapper.c
if (!(dmt = dm_task_create (task)))
return 0;
-@@ -304,10 +314,18 @@ dm_addmap (int task, const char *target,
+@@ -304,10 +308,12 @@ 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);
++ !dm_task_set_cookie(dmt, &cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0))
goto freeout;
-+ }
r = dm_task_run (dmt);
-+ if (task == DM_DEVICE_CREATE) {
-+ if (!r)
-+ dm_udev_complete(cookie);
-+ else
++ if (task == DM_DEVICE_CREATE)
+ 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)
+@@ -1366,6 +1372,7 @@ dm_rename (const char * old, char * new)
{
int r = 0;
struct dm_task *dmt;
@@ -343,7 +255,7 @@ Index: multipath-tools-130222/libmultipath/devmapper.c
if (dm_rename_partmaps(old, new))
return r;
-@@ -1381,14 +1401,18 @@ dm_rename (const char * old, char * new)
+@@ -1381,12 +1388,12 @@ dm_rename (const char * old, char * new)
dm_task_no_open_count(dmt);
@@ -354,40 +266,12 @@ Index: multipath-tools-130222/libmultipath/devmapper.c
goto out;
+ r = dm_task_run(dmt);
+
-+ if (!r)
-+ dm_udev_complete(cookie);
-+ else
-+ udev_wait(cookie);
++ 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
@@ -401,25 +285,3 @@ Index: multipath-tools-130222/multipath/main.c
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);
-