|
|
4ae388 |
---
|
|
|
4ae388 |
kpartx/devmapper.c | 41 ++++++++++++++++++++++++++++-------------
|
|
|
4ae388 |
kpartx/devmapper.h | 4 ++--
|
|
|
4ae388 |
kpartx/kpartx.c | 16 ++++++++--------
|
|
|
4ae388 |
libmultipath/config.h | 1 -
|
|
|
4ae388 |
libmultipath/devmapper.c | 19 +++++++++++++------
|
|
|
4ae388 |
multipath/main.c | 2 --
|
|
|
4ae388 |
6 files changed, 51 insertions(+), 32 deletions(-)
|
|
|
4ae388 |
|
|
|
4ae388 |
Index: multipath-tools-130222/kpartx/devmapper.c
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/kpartx/devmapper.c
|
|
|
4ae388 |
+++ multipath-tools-130222/kpartx/devmapper.c
|
|
|
4ae388 |
@@ -14,13 +14,6 @@
|
|
|
4ae388 |
#define MAX_PREFIX_LEN 8
|
|
|
4ae388 |
#define PARAMS_SIZE 1024
|
|
|
4ae388 |
|
|
|
4ae388 |
-#ifndef LIBDM_API_COOKIE
|
|
|
4ae388 |
-static inline int dm_task_set_cookie(struct dm_task *dmt, uint32_t *c, int a)
|
|
|
4ae388 |
-{
|
|
|
4ae388 |
- return 1;
|
|
|
4ae388 |
-}
|
|
|
4ae388 |
-#endif
|
|
|
4ae388 |
-
|
|
|
4ae388 |
extern int
|
|
|
4ae388 |
dm_prereq (char * str, int x, int y, int z)
|
|
|
4ae388 |
{
|
|
|
4ae388 |
@@ -60,10 +53,13 @@ dm_prereq (char * str, int x, int y, int
|
|
|
4ae388 |
}
|
|
|
4ae388 |
|
|
|
4ae388 |
extern int
|
|
|
4ae388 |
-dm_simplecmd (int task, const char *name, int no_flush, uint32_t *cookie, uint16_t udev_flags) {
|
|
|
4ae388 |
+dm_simplecmd (int task, const char *name, int no_flush, uint16_t udev_flags) {
|
|
|
4ae388 |
int r = 0;
|
|
|
4ae388 |
int udev_wait_flag = (task == DM_DEVICE_RESUME ||
|
|
|
4ae388 |
task == DM_DEVICE_REMOVE);
|
|
|
4ae388 |
+#ifdef LIBDM_API_COOKIE
|
|
|
4ae388 |
+ uint32_t cookie = 0;
|
|
|
4ae388 |
+#endif
|
|
|
4ae388 |
struct dm_task *dmt;
|
|
|
4ae388 |
|
|
|
4ae388 |
if (!(dmt = dm_task_create(task)))
|
|
|
4ae388 |
@@ -78,10 +74,17 @@ dm_simplecmd (int task, const char *name
|
|
|
4ae388 |
if (no_flush)
|
|
|
4ae388 |
dm_task_no_flush(dmt);
|
|
|
4ae388 |
|
|
|
4ae388 |
- if (udev_wait_flag && !dm_task_set_cookie(dmt, cookie, ((udev_sync)? 0 : DM_UDEV_DISABLE_LIBRARY_FALLBACK) | udev_flags))
|
|
|
4ae388 |
+#ifdef LIBDM_API_COOKIE
|
|
|
4ae388 |
+ if (!udev_sync)
|
|
|
4ae388 |
+ udev_flags |= DM_UDEV_DISABLE_LIBRARY_FALLBACK;
|
|
|
4ae388 |
+ if (udev_wait_flag && !dm_task_set_cookie(dmt, &cookie, udev_flags))
|
|
|
4ae388 |
goto out;
|
|
|
4ae388 |
+#endif
|
|
|
4ae388 |
r = dm_task_run(dmt);
|
|
|
4ae388 |
-
|
|
|
4ae388 |
+#ifdef LIBDM_API_COOKIE
|
|
|
4ae388 |
+ if (udev_wait_flag)
|
|
|
4ae388 |
+ dm_udev_wait(cookie);
|
|
|
4ae388 |
+#endif
|
|
|
4ae388 |
out:
|
|
|
4ae388 |
dm_task_destroy(dmt);
|
|
|
4ae388 |
return r;
|
|
|
4ae388 |
@@ -90,10 +93,14 @@ dm_simplecmd (int task, const char *name
|
|
|
4ae388 |
extern int
|
|
|
4ae388 |
dm_addmap (int task, const char *name, const char *target,
|
|
|
4ae388 |
const char *params, uint64_t size, int ro, const char *uuid, int part,
|
|
|
4ae388 |
- mode_t mode, uid_t uid, gid_t gid, uint32_t *cookie) {
|
|
|
4ae388 |
+ mode_t mode, uid_t uid, gid_t gid) {
|
|
|
4ae388 |
int r = 0;
|
|
|
4ae388 |
struct dm_task *dmt;
|
|
|
4ae388 |
char *prefixed_uuid = NULL;
|
|
|
4ae388 |
+#ifdef LIBDM_API_COOKIE
|
|
|
4ae388 |
+ uint32_t cookie = 0;
|
|
|
4ae388 |
+ uint16_t udev_flags = 0;
|
|
|
4ae388 |
+#endif
|
|
|
4ae388 |
|
|
|
4ae388 |
if (!(dmt = dm_task_create (task)))
|
|
|
4ae388 |
return 0;
|
|
|
4ae388 |
@@ -128,10 +135,18 @@ dm_addmap (int task, const char *name, c
|
|
|
4ae388 |
|
|
|
4ae388 |
dm_task_no_open_count(dmt);
|
|
|
4ae388 |
|
|
|
4ae388 |
- if (task == DM_DEVICE_CREATE && !dm_task_set_cookie(dmt, cookie, (udev_sync)? 0 : DM_UDEV_DISABLE_LIBRARY_FALLBACK))
|
|
|
4ae388 |
+#ifdef LIBDM_API_COOKIE
|
|
|
4ae388 |
+ if (!udev_sync)
|
|
|
4ae388 |
+ udev_flags = DM_UDEV_DISABLE_LIBRARY_FALLBACK;
|
|
|
4ae388 |
+ if (task == DM_DEVICE_CREATE &&
|
|
|
4ae388 |
+ !dm_task_set_cookie(dmt, &cookie, udev_flags))
|
|
|
4ae388 |
goto addout;
|
|
|
4ae388 |
+#endif
|
|
|
4ae388 |
r = dm_task_run (dmt);
|
|
|
4ae388 |
-
|
|
|
4ae388 |
+#ifdef LIBDM_API_COOKIE
|
|
|
4ae388 |
+ if (task == DM_DEVICE_CREATE)
|
|
|
4ae388 |
+ dm_udev_wait(cookie);
|
|
|
4ae388 |
+#endif
|
|
|
4ae388 |
addout:
|
|
|
4ae388 |
dm_task_destroy (dmt);
|
|
|
4ae388 |
free(prefixed_uuid);
|
|
|
4ae388 |
Index: multipath-tools-130222/kpartx/devmapper.h
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/kpartx/devmapper.h
|
|
|
4ae388 |
+++ multipath-tools-130222/kpartx/devmapper.h
|
|
|
4ae388 |
@@ -11,9 +11,9 @@
|
|
|
4ae388 |
extern int udev_sync;
|
|
|
4ae388 |
|
|
|
4ae388 |
int dm_prereq (char *, int, int, int);
|
|
|
4ae388 |
-int dm_simplecmd (int, const char *, int, uint32_t *, uint16_t);
|
|
|
4ae388 |
+int dm_simplecmd (int, const char *, int, uint16_t);
|
|
|
4ae388 |
int dm_addmap (int, const char *, const char *, const char *, uint64_t,
|
|
|
4ae388 |
- int, const char *, int, mode_t, uid_t, gid_t, uint32_t *);
|
|
|
4ae388 |
+ int, const char *, int, mode_t, uid_t, gid_t);
|
|
|
4ae388 |
int dm_map_present (char *, char **);
|
|
|
4ae388 |
char * dm_mapname(int major, int minor);
|
|
|
4ae388 |
dev_t dm_get_first_dep(char *devname);
|
|
|
4ae388 |
Index: multipath-tools-130222/kpartx/kpartx.c
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/kpartx/kpartx.c
|
|
|
4ae388 |
+++ multipath-tools-130222/kpartx/kpartx.c
|
|
|
4ae388 |
@@ -224,7 +224,6 @@ main(int argc, char **argv){
|
|
|
4ae388 |
int hotplug = 0;
|
|
|
4ae388 |
int loopcreated = 0;
|
|
|
4ae388 |
struct stat buf;
|
|
|
4ae388 |
- uint32_t cookie = 0;
|
|
|
4ae388 |
|
|
|
4ae388 |
initpts();
|
|
|
4ae388 |
init_crc32();
|
|
|
4ae388 |
@@ -300,6 +299,8 @@ main(int argc, char **argv){
|
|
|
4ae388 |
#ifdef LIBDM_API_COOKIE
|
|
|
4ae388 |
if (!udev_sync)
|
|
|
4ae388 |
dm_udev_set_sync_support(0);
|
|
|
4ae388 |
+ else
|
|
|
4ae388 |
+ dm_udev_set_sync_support(1);
|
|
|
4ae388 |
#endif
|
|
|
4ae388 |
|
|
|
4ae388 |
if (dm_prereq(DM_TARGET, 0, 0, 0) && (what == ADD || what == DELETE || what == UPDATE)) {
|
|
|
4ae388 |
@@ -451,7 +452,7 @@ main(int argc, char **argv){
|
|
|
4ae388 |
}
|
|
|
4ae388 |
|
|
|
4ae388 |
if (!dm_simplecmd(DM_DEVICE_REMOVE, partname,
|
|
|
4ae388 |
- 0, &cookie, 0)) {
|
|
|
4ae388 |
+ 0, 0)) {
|
|
|
4ae388 |
r++;
|
|
|
4ae388 |
continue;
|
|
|
4ae388 |
}
|
|
|
4ae388 |
@@ -508,7 +509,7 @@ main(int argc, char **argv){
|
|
|
4ae388 |
if (!dm_addmap(op, partname, DM_TARGET, params,
|
|
|
4ae388 |
slices[j].size, ro, uuid, j+1,
|
|
|
4ae388 |
buf.st_mode & 0777, buf.st_uid,
|
|
|
4ae388 |
- buf.st_gid, &cookie)) {
|
|
|
4ae388 |
+ buf.st_gid)) {
|
|
|
4ae388 |
fprintf(stderr, "create/reload failed on %s\n",
|
|
|
4ae388 |
partname);
|
|
|
4ae388 |
r++;
|
|
|
4ae388 |
@@ -516,12 +517,13 @@ main(int argc, char **argv){
|
|
|
4ae388 |
}
|
|
|
4ae388 |
if (op == DM_DEVICE_RELOAD &&
|
|
|
4ae388 |
!dm_simplecmd(DM_DEVICE_RESUME, partname,
|
|
|
4ae388 |
- 1, &cookie, MPATH_UDEV_RELOAD_FLAG)) {
|
|
|
4ae388 |
+ 1, MPATH_UDEV_RELOAD_FLAG)) {
|
|
|
4ae388 |
fprintf(stderr, "resume failed on %s\n",
|
|
|
4ae388 |
partname);
|
|
|
4ae388 |
r++;
|
|
|
4ae388 |
continue;
|
|
|
4ae388 |
}
|
|
|
4ae388 |
+
|
|
|
4ae388 |
dm_devn(partname, &slices[j].major,
|
|
|
4ae388 |
&slices[j].minor);
|
|
|
4ae388 |
|
|
|
4ae388 |
@@ -560,7 +562,7 @@ main(int argc, char **argv){
|
|
|
4ae388 |
}
|
|
|
4ae388 |
|
|
|
4ae388 |
if (!dm_simplecmd(DM_DEVICE_REMOVE,
|
|
|
4ae388 |
- partname, 1, &cookie, 0)) {
|
|
|
4ae388 |
+ partname, 1, 0)) {
|
|
|
4ae388 |
r++;
|
|
|
4ae388 |
continue;
|
|
|
4ae388 |
}
|
|
|
4ae388 |
@@ -586,9 +588,7 @@ main(int argc, char **argv){
|
|
|
4ae388 |
}
|
|
|
4ae388 |
printf("loop deleted : %s\n", device);
|
|
|
4ae388 |
}
|
|
|
4ae388 |
-#ifdef LIBDM_API_COOKIE
|
|
|
4ae388 |
- dm_udev_wait(cookie);
|
|
|
4ae388 |
-#endif
|
|
|
4ae388 |
+
|
|
|
4ae388 |
dm_lib_release();
|
|
|
4ae388 |
dm_lib_exit();
|
|
|
4ae388 |
|
|
|
4ae388 |
Index: multipath-tools-130222/libmultipath/config.h
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/libmultipath/config.h
|
|
|
4ae388 |
+++ multipath-tools-130222/libmultipath/config.h
|
|
|
4ae388 |
@@ -129,7 +129,6 @@ struct config {
|
|
|
4ae388 |
uid_t uid;
|
|
|
4ae388 |
gid_t gid;
|
|
|
4ae388 |
mode_t mode;
|
|
|
4ae388 |
- uint32_t cookie;
|
|
|
4ae388 |
int reassign_maps;
|
|
|
4ae388 |
int retain_hwhandler;
|
|
|
4ae388 |
int detect_prio;
|
|
|
4ae388 |
Index: multipath-tools-130222/libmultipath/devmapper.c
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/libmultipath/devmapper.c
|
|
|
4ae388 |
+++ multipath-tools-130222/libmultipath/devmapper.c
|
|
|
4ae388 |
@@ -215,6 +215,7 @@ dm_simplecmd (int task, const char *name
|
|
|
4ae388 |
int r = 0;
|
|
|
4ae388 |
int udev_wait_flag = (need_sync && (task == DM_DEVICE_RESUME ||
|
|
|
4ae388 |
task == DM_DEVICE_REMOVE));
|
|
|
4ae388 |
+ uint32_t cookie = 0;
|
|
|
4ae388 |
struct dm_task *dmt;
|
|
|
4ae388 |
|
|
|
4ae388 |
if (!(dmt = dm_task_create (task)))
|
|
|
4ae388 |
@@ -233,10 +234,12 @@ dm_simplecmd (int task, const char *name
|
|
|
4ae388 |
if (do_deferred(deferred_remove))
|
|
|
4ae388 |
dm_task_deferred_remove(dmt);
|
|
|
4ae388 |
#endif
|
|
|
4ae388 |
- if (udev_wait_flag && !dm_task_set_cookie(dmt, &conf->cookie, ((conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0) | udev_flags))
|
|
|
4ae388 |
+ if (udev_wait_flag && !dm_task_set_cookie(dmt, &cookie, ((conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0) | udev_flags))
|
|
|
4ae388 |
goto out;
|
|
|
4ae388 |
r = dm_task_run (dmt);
|
|
|
4ae388 |
|
|
|
4ae388 |
+ if (udev_wait_flag)
|
|
|
4ae388 |
+ udev_wait(cookie);
|
|
|
4ae388 |
out:
|
|
|
4ae388 |
dm_task_destroy (dmt);
|
|
|
4ae388 |
return r;
|
|
|
4ae388 |
@@ -264,6 +267,7 @@ dm_addmap (int task, const char *target,
|
|
|
4ae388 |
int r = 0;
|
|
|
4ae388 |
struct dm_task *dmt;
|
|
|
4ae388 |
char *prefixed_uuid = NULL;
|
|
|
4ae388 |
+ uint32_t cookie = 0;
|
|
|
4ae388 |
|
|
|
4ae388 |
if (!(dmt = dm_task_create (task)))
|
|
|
4ae388 |
return 0;
|
|
|
4ae388 |
@@ -304,10 +308,12 @@ dm_addmap (int task, const char *target,
|
|
|
4ae388 |
dm_task_no_open_count(dmt);
|
|
|
4ae388 |
|
|
|
4ae388 |
if (task == DM_DEVICE_CREATE &&
|
|
|
4ae388 |
- !dm_task_set_cookie(dmt, &conf->cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0))
|
|
|
4ae388 |
+ !dm_task_set_cookie(dmt, &cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0))
|
|
|
4ae388 |
goto freeout;
|
|
|
4ae388 |
r = dm_task_run (dmt);
|
|
|
4ae388 |
|
|
|
4ae388 |
+ if (task == DM_DEVICE_CREATE)
|
|
|
4ae388 |
+ udev_wait(cookie);
|
|
|
4ae388 |
freeout:
|
|
|
4ae388 |
if (prefixed_uuid)
|
|
|
4ae388 |
FREE(prefixed_uuid);
|
|
|
4ae388 |
@@ -1366,6 +1372,7 @@ dm_rename (const char * old, char * new)
|
|
|
4ae388 |
{
|
|
|
4ae388 |
int r = 0;
|
|
|
4ae388 |
struct dm_task *dmt;
|
|
|
4ae388 |
+ uint32_t cookie;
|
|
|
4ae388 |
|
|
|
4ae388 |
if (dm_rename_partmaps(old, new))
|
|
|
4ae388 |
return r;
|
|
|
4ae388 |
@@ -1381,12 +1388,12 @@ dm_rename (const char * old, char * new)
|
|
|
4ae388 |
|
|
|
4ae388 |
dm_task_no_open_count(dmt);
|
|
|
4ae388 |
|
|
|
4ae388 |
- if (!dm_task_set_cookie(dmt, &conf->cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0))
|
|
|
4ae388 |
- goto out;
|
|
|
4ae388 |
- if (!dm_task_run(dmt))
|
|
|
4ae388 |
+ if (!dm_task_set_cookie(dmt, &cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0))
|
|
|
4ae388 |
goto out;
|
|
|
4ae388 |
+ r = dm_task_run(dmt);
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+ udev_wait(cookie);
|
|
|
4ae388 |
|
|
|
4ae388 |
- r = 1;
|
|
|
4ae388 |
out:
|
|
|
4ae388 |
dm_task_destroy(dmt);
|
|
|
4ae388 |
return r;
|
|
|
4ae388 |
Index: multipath-tools-130222/multipath/main.c
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/multipath/main.c
|
|
|
4ae388 |
+++ multipath-tools-130222/multipath/main.c
|
|
|
4ae388 |
@@ -681,8 +681,6 @@ main (int argc, char *argv[])
|
|
|
4ae388 |
condlog(3, "restart multipath configuration process");
|
|
|
4ae388 |
|
|
|
4ae388 |
out:
|
|
|
4ae388 |
- udev_wait(conf->cookie);
|
|
|
4ae388 |
-
|
|
|
4ae388 |
dm_lib_release();
|
|
|
4ae388 |
dm_lib_exit();
|
|
|
4ae388 |
|