|
|
f20720 |
---
|
|
|
f20720 |
libmultipath/config.c | 3 +
|
|
|
f20720 |
libmultipath/config.h | 3 +
|
|
|
f20720 |
libmultipath/configure.c | 15 +++--
|
|
|
f20720 |
libmultipath/defaults.h | 1
|
|
|
f20720 |
libmultipath/devmapper.c | 35 +++++++++----
|
|
|
f20720 |
libmultipath/devmapper.h | 8 ++-
|
|
|
f20720 |
libmultipath/dict.c | 114 +++++++++++++++++++++++++++++++++++++++++++++
|
|
|
f20720 |
libmultipath/propsel.c | 26 ++++++++++
|
|
|
f20720 |
libmultipath/propsel.h | 1
|
|
|
f20720 |
libmultipath/structs.h | 7 ++
|
|
|
f20720 |
multipath/multipath.conf.5 | 10 +++
|
|
|
f20720 |
multipath/multipath.rules | 1
|
|
|
f20720 |
multipathd/cli_handlers.c | 4 +
|
|
|
f20720 |
13 files changed, 211 insertions(+), 17 deletions(-)
|
|
|
f20720 |
|
|
|
f20720 |
Index: multipath-tools-130222/libmultipath/config.c
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/libmultipath/config.c
|
|
|
f20720 |
+++ multipath-tools-130222/libmultipath/config.c
|
|
|
f20720 |
@@ -343,6 +343,7 @@ merge_hwe (struct hwentry * dst, struct
|
|
|
f20720 |
merge_num(deferred_remove);
|
|
|
f20720 |
merge_num(delay_watch_checks);
|
|
|
f20720 |
merge_num(delay_wait_checks);
|
|
|
f20720 |
+ merge_num(skip_kpartx);
|
|
|
f20720 |
|
|
|
f20720 |
/*
|
|
|
f20720 |
* Make sure features is consistent with
|
|
|
f20720 |
@@ -403,6 +404,7 @@ overwrite_hwe (struct hwentry * dst, str
|
|
|
f20720 |
overwrite_num(deferred_remove);
|
|
|
f20720 |
overwrite_num(delay_watch_checks);
|
|
|
f20720 |
overwrite_num(delay_wait_checks);
|
|
|
f20720 |
+ overwrite_num(skip_kpartx);
|
|
|
f20720 |
|
|
|
f20720 |
/*
|
|
|
f20720 |
* Make sure features is consistent with
|
|
|
f20720 |
@@ -677,6 +679,7 @@ load_config (char * file, struct udev *u
|
|
|
f20720 |
conf->retrigger_delay = DEFAULT_RETRIGGER_DELAY;
|
|
|
f20720 |
conf->new_bindings_in_boot = 0;
|
|
|
f20720 |
conf->uev_wait_timeout = DEFAULT_UEV_WAIT_TIMEOUT;
|
|
|
f20720 |
+ conf->skip_kpartx = DEFAULT_SKIP_KPARTX;
|
|
|
f20720 |
|
|
|
f20720 |
/*
|
|
|
f20720 |
* preload default hwtable
|
|
|
f20720 |
Index: multipath-tools-130222/libmultipath/config.h
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/libmultipath/config.h
|
|
|
f20720 |
+++ multipath-tools-130222/libmultipath/config.h
|
|
|
f20720 |
@@ -64,6 +64,7 @@ struct hwentry {
|
|
|
f20720 |
int deferred_remove;
|
|
|
f20720 |
int delay_watch_checks;
|
|
|
f20720 |
int delay_wait_checks;
|
|
|
f20720 |
+ int skip_kpartx;
|
|
|
f20720 |
char * bl_product;
|
|
|
f20720 |
};
|
|
|
f20720 |
|
|
|
f20720 |
@@ -90,6 +91,7 @@ struct mpentry {
|
|
|
f20720 |
int deferred_remove;
|
|
|
f20720 |
int delay_watch_checks;
|
|
|
f20720 |
int delay_wait_checks;
|
|
|
f20720 |
+ int skip_kpartx;
|
|
|
f20720 |
uid_t uid;
|
|
|
f20720 |
gid_t gid;
|
|
|
f20720 |
mode_t mode;
|
|
|
f20720 |
@@ -143,6 +145,7 @@ struct config {
|
|
|
f20720 |
int new_bindings_in_boot;
|
|
|
f20720 |
int delayed_reconfig;
|
|
|
f20720 |
int uev_wait_timeout;
|
|
|
f20720 |
+ int skip_kpartx;
|
|
|
f20720 |
unsigned int version[3];
|
|
|
f20720 |
|
|
|
f20720 |
char * dev;
|
|
|
f20720 |
Index: multipath-tools-130222/libmultipath/configure.c
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/libmultipath/configure.c
|
|
|
f20720 |
+++ multipath-tools-130222/libmultipath/configure.c
|
|
|
f20720 |
@@ -294,6 +294,7 @@ setup_map (struct multipath * mpp, char
|
|
|
f20720 |
select_deferred_remove(mpp);
|
|
|
f20720 |
select_delay_watch_checks(mpp);
|
|
|
f20720 |
select_delay_wait_checks(mpp);
|
|
|
f20720 |
+ select_skip_kpartx(mpp);
|
|
|
f20720 |
|
|
|
f20720 |
sysfs_set_scsi_tmo(mpp);
|
|
|
f20720 |
/*
|
|
|
f20720 |
@@ -446,6 +447,7 @@ select_action (struct multipath * mpp, v
|
|
|
f20720 |
}
|
|
|
f20720 |
mpp->force_udev_reload = !pathcount(mpp, PATH_WILD);
|
|
|
f20720 |
if (cmpp->size != mpp->size) {
|
|
|
f20720 |
+ mpp->force_udev_reload = 1;
|
|
|
f20720 |
mpp->action = ACT_RESIZE;
|
|
|
f20720 |
condlog(3, "%s: set ACT_RESIZE (size change)",
|
|
|
f20720 |
mpp->alias);
|
|
|
f20720 |
@@ -609,6 +611,7 @@ extern int
|
|
|
f20720 |
domap (struct multipath * mpp, char * params)
|
|
|
f20720 |
{
|
|
|
f20720 |
int r = 0;
|
|
|
f20720 |
+ uint16_t udev_flags = ((mpp->force_udev_reload)? 0 : MPATH_UDEV_RELOAD_FLAG) | ((mpp->skip_kpartx == SKIP_KPARTX_ON)? MPATH_UDEV_NO_KPARTX_FLAG : 0);
|
|
|
f20720 |
|
|
|
f20720 |
/*
|
|
|
f20720 |
* last chance to quit before touching the devmaps
|
|
|
f20720 |
@@ -654,25 +657,27 @@ domap (struct multipath * mpp, char * pa
|
|
|
f20720 |
case ACT_RELOAD:
|
|
|
f20720 |
r = dm_addmap_reload(mpp, params);
|
|
|
f20720 |
if (r)
|
|
|
f20720 |
- r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias, (mpp->force_udev_reload)? 0 : MPATH_UDEV_RELOAD_FLAG);
|
|
|
f20720 |
+ r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias,
|
|
|
f20720 |
+ udev_flags);
|
|
|
f20720 |
break;
|
|
|
f20720 |
|
|
|
f20720 |
case ACT_RESIZE:
|
|
|
f20720 |
r = dm_addmap_reload(mpp, params);
|
|
|
f20720 |
if (r)
|
|
|
f20720 |
- r = dm_simplecmd_flush(DM_DEVICE_RESUME, mpp->alias, 1, 0);
|
|
|
f20720 |
+ r = dm_simplecmd_flush(DM_DEVICE_RESUME, mpp->alias, 1,
|
|
|
f20720 |
+ udev_flags);
|
|
|
f20720 |
break;
|
|
|
f20720 |
|
|
|
f20720 |
case ACT_RENAME:
|
|
|
f20720 |
- r = dm_rename(mpp->alias_old, mpp->alias);
|
|
|
f20720 |
+ r = dm_rename(mpp->alias_old, mpp->alias, mpp->skip_kpartx);
|
|
|
f20720 |
break;
|
|
|
f20720 |
|
|
|
f20720 |
case ACT_RENAME2:
|
|
|
f20720 |
- r = dm_rename(mpp->alias_old, mpp->alias);
|
|
|
f20720 |
+ r = dm_rename(mpp->alias_old, mpp->alias, mpp->skip_kpartx);
|
|
|
f20720 |
if (r) {
|
|
|
f20720 |
r = dm_addmap_reload(mpp, params);
|
|
|
f20720 |
if (r)
|
|
|
f20720 |
- r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias, (mpp->force_udev_reload)? 0 : MPATH_UDEV_RELOAD_FLAG);
|
|
|
f20720 |
+ r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias, udev_flags);
|
|
|
f20720 |
}
|
|
|
f20720 |
break;
|
|
|
f20720 |
|
|
|
f20720 |
Index: multipath-tools-130222/libmultipath/defaults.h
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/libmultipath/defaults.h
|
|
|
f20720 |
+++ multipath-tools-130222/libmultipath/defaults.h
|
|
|
f20720 |
@@ -24,6 +24,7 @@
|
|
|
f20720 |
#define DEFAULT_RETRIGGER_DELAY 10
|
|
|
f20720 |
#define DEFAULT_RETRIGGER_TRIES 3
|
|
|
f20720 |
#define DEFAULT_UEV_WAIT_TIMEOUT 30
|
|
|
f20720 |
+#define DEFAULT_SKIP_KPARTX SKIP_KPARTX_OFF
|
|
|
f20720 |
|
|
|
f20720 |
#define DEFAULT_CHECKINT 5
|
|
|
f20720 |
#define MAX_CHECKINT(a) (a << 2)
|
|
|
f20720 |
Index: multipath-tools-130222/libmultipath/devmapper.c
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/libmultipath/devmapper.c
|
|
|
f20720 |
+++ multipath-tools-130222/libmultipath/devmapper.c
|
|
|
f20720 |
@@ -262,13 +262,14 @@ dm_device_remove (const char *name, int
|
|
|
f20720 |
deferred_remove);
|
|
|
f20720 |
}
|
|
|
f20720 |
|
|
|
f20720 |
-extern int
|
|
|
f20720 |
+static int
|
|
|
f20720 |
dm_addmap (int task, const char *target, struct multipath *mpp, char * params,
|
|
|
f20720 |
- int use_uuid, int ro) {
|
|
|
f20720 |
+ int use_uuid, int ro, int skip_kpartx) {
|
|
|
f20720 |
int r = 0;
|
|
|
f20720 |
struct dm_task *dmt;
|
|
|
f20720 |
char *prefixed_uuid = NULL;
|
|
|
f20720 |
uint32_t cookie = 0;
|
|
|
f20720 |
+ uint16_t udev_flags = ((conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0) | ((skip_kpartx == SKIP_KPARTX_ON)? MPATH_UDEV_NO_KPARTX_FLAG : 0);
|
|
|
f20720 |
|
|
|
f20720 |
if (!(dmt = dm_task_create (task)))
|
|
|
f20720 |
return 0;
|
|
|
f20720 |
@@ -309,7 +310,7 @@ dm_addmap (int task, const char *target,
|
|
|
f20720 |
dm_task_no_open_count(dmt);
|
|
|
f20720 |
|
|
|
f20720 |
if (task == DM_DEVICE_CREATE &&
|
|
|
f20720 |
- !dm_task_set_cookie(dmt, &cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0))
|
|
|
f20720 |
+ !dm_task_set_cookie(dmt, &cookie, udev_flags))
|
|
|
f20720 |
goto freeout;
|
|
|
f20720 |
r = dm_task_run (dmt);
|
|
|
f20720 |
|
|
|
f20720 |
@@ -332,7 +333,8 @@ dm_addmap_create (struct multipath *mpp,
|
|
|
f20720 |
for (ro = 0; ro <= 1; ro++) {
|
|
|
f20720 |
int err;
|
|
|
f20720 |
|
|
|
f20720 |
- if (dm_addmap(DM_DEVICE_CREATE, TGT_MPATH, mpp, params, 1, ro))
|
|
|
f20720 |
+ if (dm_addmap(DM_DEVICE_CREATE, TGT_MPATH,
|
|
|
f20720 |
+ mpp, params, 1, ro, mpp->skip_kpartx))
|
|
|
f20720 |
return 1;
|
|
|
f20720 |
/*
|
|
|
f20720 |
* DM_DEVICE_CREATE is actually DM_DEV_CREATE + DM_TABLE_LOAD.
|
|
|
f20720 |
@@ -354,11 +356,11 @@ dm_addmap_create (struct multipath *mpp,
|
|
|
f20720 |
|
|
|
f20720 |
extern int
|
|
|
f20720 |
dm_addmap_reload (struct multipath *mpp, char *params) {
|
|
|
f20720 |
- if (dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RW))
|
|
|
f20720 |
+ if (dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RW, SKIP_KPARTX_OFF))
|
|
|
f20720 |
return 1;
|
|
|
f20720 |
if (errno != EROFS)
|
|
|
f20720 |
return 0;
|
|
|
f20720 |
- return dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RO);
|
|
|
f20720 |
+ return dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RO, SKIP_KPARTX_OFF);
|
|
|
f20720 |
}
|
|
|
f20720 |
|
|
|
f20720 |
extern int
|
|
|
f20720 |
@@ -720,6 +722,12 @@ out:
|
|
|
f20720 |
}
|
|
|
f20720 |
|
|
|
f20720 |
static int
|
|
|
f20720 |
+has_partmap(const char *name, void *data)
|
|
|
f20720 |
+{
|
|
|
f20720 |
+ return 1;
|
|
|
f20720 |
+}
|
|
|
f20720 |
+
|
|
|
f20720 |
+static int
|
|
|
f20720 |
partmap_in_use(const char *name, void *data)
|
|
|
f20720 |
{
|
|
|
f20720 |
int part_count, *ret_count = (int *)data;
|
|
|
f20720 |
@@ -798,10 +806,16 @@ dm_suspend_and_flush_map (const char * m
|
|
|
f20720 |
int s = 0, queue_if_no_path = 0;
|
|
|
f20720 |
unsigned long long mapsize;
|
|
|
f20720 |
char params[PARAMS_SIZE] = {0};
|
|
|
f20720 |
+ int udev_flags = 0;
|
|
|
f20720 |
|
|
|
f20720 |
if (!dm_is_mpath(mapname))
|
|
|
f20720 |
return 0; /* nothing to do */
|
|
|
f20720 |
|
|
|
f20720 |
+ /* if the device currently has no partitions, do not
|
|
|
f20720 |
+ run kpartx on it if you fail to delete it */
|
|
|
f20720 |
+ if (do_foreach_partmaps(mapname, has_partmap, NULL) == 0)
|
|
|
f20720 |
+ udev_flags |= MPATH_UDEV_NO_KPARTX_FLAG;
|
|
|
f20720 |
+
|
|
|
f20720 |
if (!dm_get_map(mapname, &mapsize, params)) {
|
|
|
f20720 |
if (strstr(params, "queue_if_no_path"))
|
|
|
f20720 |
queue_if_no_path = 1;
|
|
|
f20720 |
@@ -820,7 +834,7 @@ dm_suspend_and_flush_map (const char * m
|
|
|
f20720 |
return 0;
|
|
|
f20720 |
}
|
|
|
f20720 |
condlog(2, "failed to remove multipath map %s", mapname);
|
|
|
f20720 |
- dm_simplecmd_noflush(DM_DEVICE_RESUME, mapname, 0);
|
|
|
f20720 |
+ dm_simplecmd_noflush(DM_DEVICE_RESUME, mapname, udev_flags);
|
|
|
f20720 |
if (queue_if_no_path)
|
|
|
f20720 |
s = dm_queue_if_no_path((char *)mapname, 1);
|
|
|
f20720 |
return 1;
|
|
|
f20720 |
@@ -1349,7 +1363,7 @@ rename_partmap (const char *name, void *
|
|
|
f20720 |
for (offset = strlen(rd->old); name[offset] && !(isdigit(name[offset])); offset++); /* do nothing */
|
|
|
f20720 |
snprintf(buff, PARAMS_SIZE, "%s%s%s", rd->new, rd->delim,
|
|
|
f20720 |
name + offset);
|
|
|
f20720 |
- dm_rename(name, buff);
|
|
|
f20720 |
+ dm_rename(name, buff, SKIP_KPARTX_OFF);
|
|
|
f20720 |
condlog(4, "partition map %s renamed", name);
|
|
|
f20720 |
return 0;
|
|
|
f20720 |
}
|
|
|
f20720 |
@@ -1369,11 +1383,12 @@ dm_rename_partmaps (const char * old, ch
|
|
|
f20720 |
}
|
|
|
f20720 |
|
|
|
f20720 |
int
|
|
|
f20720 |
-dm_rename (const char * old, char * new)
|
|
|
f20720 |
+dm_rename (const char * old, char * new, int skip_kpartx)
|
|
|
f20720 |
{
|
|
|
f20720 |
int r = 0;
|
|
|
f20720 |
struct dm_task *dmt;
|
|
|
f20720 |
uint32_t cookie;
|
|
|
f20720 |
+ uint16_t udev_flags = ((conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0) | ((skip_kpartx == SKIP_KPARTX_ON)? MPATH_UDEV_NO_KPARTX_FLAG : 0);
|
|
|
f20720 |
|
|
|
f20720 |
if (dm_rename_partmaps(old, new))
|
|
|
f20720 |
return r;
|
|
|
f20720 |
@@ -1389,7 +1404,7 @@ dm_rename (const char * old, char * new)
|
|
|
f20720 |
|
|
|
f20720 |
dm_task_no_open_count(dmt);
|
|
|
f20720 |
|
|
|
f20720 |
- if (!dm_task_set_cookie(dmt, &cookie, (conf->daemon)? DM_UDEV_DISABLE_LIBRARY_FALLBACK : 0))
|
|
|
f20720 |
+ if (!dm_task_set_cookie(dmt, &cookie, udev_flags))
|
|
|
f20720 |
goto out;
|
|
|
f20720 |
r = dm_task_run(dmt);
|
|
|
f20720 |
|
|
|
f20720 |
Index: multipath-tools-130222/libmultipath/devmapper.h
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/libmultipath/devmapper.h
|
|
|
f20720 |
+++ multipath-tools-130222/libmultipath/devmapper.h
|
|
|
f20720 |
@@ -12,6 +12,12 @@
|
|
|
f20720 |
#define MPATH_UDEV_RELOAD_FLAG 0
|
|
|
f20720 |
#endif
|
|
|
f20720 |
|
|
|
f20720 |
+#ifdef DM_SUBSYSTEM_UDEV_FLAG1
|
|
|
f20720 |
+#define MPATH_UDEV_NO_KPARTX_FLAG DM_SUBSYSTEM_UDEV_FLAG1
|
|
|
f20720 |
+#else
|
|
|
f20720 |
+#define MPATH_UDEV_NO_KPARTX_FLAG 0
|
|
|
f20720 |
+#endif
|
|
|
f20720 |
+
|
|
|
f20720 |
void dm_init(void);
|
|
|
f20720 |
int dm_prereq (void);
|
|
|
f20720 |
int dm_drv_version (unsigned int * version, char * str);
|
|
|
f20720 |
@@ -47,7 +53,7 @@ int dm_remove_partmaps (const char * map
|
|
|
f20720 |
int deferred_remove);
|
|
|
f20720 |
int dm_get_uuid(char *name, char *uuid);
|
|
|
f20720 |
int dm_get_info (char * mapname, struct dm_info ** dmi);
|
|
|
f20720 |
-int dm_rename (const char * old, char * new);
|
|
|
f20720 |
+int dm_rename (const char * old, char * new, int skip_kpartx);
|
|
|
f20720 |
int dm_reassign(const char * mapname);
|
|
|
f20720 |
int dm_reassign_table(const char *name, char *old, char *new);
|
|
|
f20720 |
int dm_setgeometry(struct multipath *mpp);
|
|
|
f20720 |
Index: multipath-tools-130222/libmultipath/dict.c
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/libmultipath/dict.c
|
|
|
f20720 |
+++ multipath-tools-130222/libmultipath/dict.c
|
|
|
f20720 |
@@ -779,6 +779,29 @@ def_deferred_remove_handler(vector strve
|
|
|
f20720 |
}
|
|
|
f20720 |
|
|
|
f20720 |
static int
|
|
|
f20720 |
+def_skip_kpartx_handler(vector strvec)
|
|
|
f20720 |
+{
|
|
|
f20720 |
+ char * buff;
|
|
|
f20720 |
+
|
|
|
f20720 |
+ buff = set_value(strvec);
|
|
|
f20720 |
+
|
|
|
f20720 |
+ if (!buff)
|
|
|
f20720 |
+ return 1;
|
|
|
f20720 |
+
|
|
|
f20720 |
+ if ((strlen(buff) == 2 && !strcmp(buff, "no")) ||
|
|
|
f20720 |
+ (strlen(buff) == 1 && !strcmp(buff, "0")))
|
|
|
f20720 |
+ conf->skip_kpartx = SKIP_KPARTX_OFF;
|
|
|
f20720 |
+ else if ((strlen(buff) == 3 && !strcmp(buff, "yes")) ||
|
|
|
f20720 |
+ (strlen(buff) == 1 && !strcmp(buff, "1")))
|
|
|
f20720 |
+ conf->skip_kpartx = SKIP_KPARTX_ON;
|
|
|
f20720 |
+ else
|
|
|
f20720 |
+ conf->skip_kpartx = DEFAULT_SKIP_KPARTX;
|
|
|
f20720 |
+
|
|
|
f20720 |
+ FREE(buff);
|
|
|
f20720 |
+ return 0;
|
|
|
f20720 |
+}
|
|
|
f20720 |
+
|
|
|
f20720 |
+static int
|
|
|
f20720 |
def_ignore_new_boot_devs_handler(vector strvec)
|
|
|
f20720 |
{
|
|
|
f20720 |
char * buff;
|
|
|
f20720 |
@@ -1629,6 +1652,33 @@ hw_deferred_remove_handler(vector strvec
|
|
|
f20720 |
}
|
|
|
f20720 |
|
|
|
f20720 |
static int
|
|
|
f20720 |
+hw_skip_kpartx_handler(vector strvec)
|
|
|
f20720 |
+{
|
|
|
f20720 |
+ struct hwentry *hwe = VECTOR_LAST_SLOT(conf->hwtable);
|
|
|
f20720 |
+ char * buff;
|
|
|
f20720 |
+
|
|
|
f20720 |
+ if (!hwe)
|
|
|
f20720 |
+ return 1;
|
|
|
f20720 |
+
|
|
|
f20720 |
+ buff = set_value(strvec);
|
|
|
f20720 |
+
|
|
|
f20720 |
+ if (!buff)
|
|
|
f20720 |
+ return 1;
|
|
|
f20720 |
+
|
|
|
f20720 |
+ if ((strlen(buff) == 2 && !strcmp(buff, "no")) ||
|
|
|
f20720 |
+ (strlen(buff) == 1 && !strcmp(buff, "0")))
|
|
|
f20720 |
+ hwe->skip_kpartx = SKIP_KPARTX_OFF;
|
|
|
f20720 |
+ else if ((strlen(buff) == 3 && !strcmp(buff, "yes")) ||
|
|
|
f20720 |
+ (strlen(buff) == 1 && !strcmp(buff, "1")))
|
|
|
f20720 |
+ hwe->skip_kpartx = SKIP_KPARTX_ON;
|
|
|
f20720 |
+ else
|
|
|
f20720 |
+ hwe->skip_kpartx = SKIP_KPARTX_UNDEF;
|
|
|
f20720 |
+
|
|
|
f20720 |
+ FREE(buff);
|
|
|
f20720 |
+ return 0;
|
|
|
f20720 |
+}
|
|
|
f20720 |
+
|
|
|
f20720 |
+static int
|
|
|
f20720 |
hw_delay_watch_checks_handler(vector strvec)
|
|
|
f20720 |
{
|
|
|
f20720 |
struct hwentry *hwe = VECTOR_LAST_SLOT(conf->hwtable);
|
|
|
f20720 |
@@ -2154,6 +2204,32 @@ mp_deferred_remove_handler(vector strvec
|
|
|
f20720 |
}
|
|
|
f20720 |
|
|
|
f20720 |
static int
|
|
|
f20720 |
+mp_skip_kpartx_handler(vector strvec)
|
|
|
f20720 |
+{
|
|
|
f20720 |
+ struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable);
|
|
|
f20720 |
+ char * buff;
|
|
|
f20720 |
+
|
|
|
f20720 |
+ if (!mpe)
|
|
|
f20720 |
+ return 1;
|
|
|
f20720 |
+
|
|
|
f20720 |
+ buff = set_value(strvec);
|
|
|
f20720 |
+ if (!buff)
|
|
|
f20720 |
+ return 1;
|
|
|
f20720 |
+
|
|
|
f20720 |
+ if ((strlen(buff) == 2 && strcmp(buff, "no") == 0) ||
|
|
|
f20720 |
+ (strlen(buff) == 1 && strcmp(buff, "0") == 0))
|
|
|
f20720 |
+ mpe->skip_kpartx = SKIP_KPARTX_OFF;
|
|
|
f20720 |
+ else if ((strlen(buff) == 3 && strcmp(buff, "yes") == 0) ||
|
|
|
f20720 |
+ (strlen(buff) == 1 && strcmp(buff, "1") == 0))
|
|
|
f20720 |
+ mpe->skip_kpartx = SKIP_KPARTX_ON;
|
|
|
f20720 |
+ else
|
|
|
f20720 |
+ mpe->skip_kpartx = SKIP_KPARTX_UNDEF;
|
|
|
f20720 |
+
|
|
|
f20720 |
+ FREE(buff);
|
|
|
f20720 |
+ return 0;
|
|
|
f20720 |
+}
|
|
|
f20720 |
+
|
|
|
f20720 |
+static int
|
|
|
f20720 |
mp_delay_watch_checks_handler(vector strvec)
|
|
|
f20720 |
{
|
|
|
f20720 |
struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable);
|
|
|
f20720 |
@@ -2461,6 +2537,19 @@ snprint_mp_deferred_remove (char * buff,
|
|
|
f20720 |
}
|
|
|
f20720 |
|
|
|
f20720 |
static int
|
|
|
f20720 |
+snprint_mp_skip_kpartx (char * buff, int len, void * data)
|
|
|
f20720 |
+{
|
|
|
f20720 |
+ struct mpentry * mpe = (struct mpentry *)data;
|
|
|
f20720 |
+
|
|
|
f20720 |
+ if (mpe->skip_kpartx == SKIP_KPARTX_UNDEF)
|
|
|
f20720 |
+ return 0;
|
|
|
f20720 |
+ else if (mpe->skip_kpartx == SKIP_KPARTX_OFF)
|
|
|
f20720 |
+ return snprintf(buff, len, "no");
|
|
|
f20720 |
+ else
|
|
|
f20720 |
+ return snprintf(buff, len, "yes");
|
|
|
f20720 |
+}
|
|
|
f20720 |
+
|
|
|
f20720 |
+static int
|
|
|
f20720 |
snprint_mp_delay_watch_checks(char * buff, int len, void * data)
|
|
|
f20720 |
{
|
|
|
f20720 |
struct mpentry * mpe = (struct mpentry *)data;
|
|
|
f20720 |
@@ -2813,6 +2902,19 @@ snprint_hw_deferred_remove(char * buff,
|
|
|
f20720 |
}
|
|
|
f20720 |
|
|
|
f20720 |
static int
|
|
|
f20720 |
+snprint_hw_skip_kpartx(char * buff, int len, void * data)
|
|
|
f20720 |
+{
|
|
|
f20720 |
+ struct hwentry * hwe = (struct hwentry *)data;
|
|
|
f20720 |
+
|
|
|
f20720 |
+ if (hwe->skip_kpartx == SKIP_KPARTX_ON)
|
|
|
f20720 |
+ return snprintf(buff, len, "yes");
|
|
|
f20720 |
+ else if (hwe->skip_kpartx == SKIP_KPARTX_OFF)
|
|
|
f20720 |
+ return snprintf(buff, len, "no");
|
|
|
f20720 |
+ else
|
|
|
f20720 |
+ return 0;
|
|
|
f20720 |
+}
|
|
|
f20720 |
+
|
|
|
f20720 |
+static int
|
|
|
f20720 |
snprint_hw_delay_watch_checks(char * buff, int len, void * data)
|
|
|
f20720 |
{
|
|
|
f20720 |
struct hwentry * hwe = (struct hwentry *)data;
|
|
|
f20720 |
@@ -3231,6 +3333,15 @@ snprint_def_deferred_remove(char * buff,
|
|
|
f20720 |
}
|
|
|
f20720 |
|
|
|
f20720 |
static int
|
|
|
f20720 |
+snprint_def_skip_kpartx(char * buff, int len, void * data)
|
|
|
f20720 |
+{
|
|
|
f20720 |
+ if (conf->skip_kpartx == SKIP_KPARTX_ON)
|
|
|
f20720 |
+ return snprintf(buff, len, "yes");
|
|
|
f20720 |
+ else
|
|
|
f20720 |
+ return snprintf(buff, len, "no");
|
|
|
f20720 |
+}
|
|
|
f20720 |
+
|
|
|
f20720 |
+static int
|
|
|
f20720 |
snprint_def_ignore_new_boot_devs(char * buff, int len, void * data)
|
|
|
f20720 |
{
|
|
|
f20720 |
if (conf->ignore_new_boot_devs == 1)
|
|
|
f20720 |
@@ -3364,6 +3475,7 @@ init_keywords(void)
|
|
|
f20720 |
install_keyword("force_sync", &def_force_sync_handler, &snprint_def_force_sync);
|
|
|
f20720 |
install_keyword("deferred_remove", &def_deferred_remove_handler, &snprint_def_deferred_remove);
|
|
|
f20720 |
install_keyword("ignore_new_boot_devs", &def_ignore_new_boot_devs_handler, &snprint_def_ignore_new_boot_devs);
|
|
|
f20720 |
+ install_keyword("skip_kpartx", &def_skip_kpartx_handler, &snprint_def_skip_kpartx);
|
|
|
f20720 |
install_keyword("config_dir", &def_config_dir_handler, &snprint_def_config_dir);
|
|
|
f20720 |
install_keyword("delay_watch_checks", &def_delay_watch_checks_handler, &snprint_def_delay_watch_checks);
|
|
|
f20720 |
install_keyword("delay_wait_checks", &def_delay_wait_checks_handler, &snprint_def_delay_wait_checks);
|
|
|
f20720 |
@@ -3438,6 +3550,7 @@ init_keywords(void)
|
|
|
f20720 |
install_keyword("deferred_remove", &hw_deferred_remove_handler, &snprint_hw_deferred_remove);
|
|
|
f20720 |
install_keyword("delay_watch_checks", &hw_delay_watch_checks_handler, &snprint_hw_delay_watch_checks);
|
|
|
f20720 |
install_keyword("delay_wait_checks", &hw_delay_wait_checks_handler, &snprint_hw_delay_wait_checks);
|
|
|
f20720 |
+ install_keyword("skip_kpartx", &hw_skip_kpartx_handler, &snprint_hw_skip_kpartx);
|
|
|
f20720 |
install_sublevel_end();
|
|
|
f20720 |
|
|
|
f20720 |
install_keyword_root("multipaths", &multipaths_handler);
|
|
|
f20720 |
@@ -3465,5 +3578,6 @@ init_keywords(void)
|
|
|
f20720 |
install_keyword("deferred_remove", &mp_deferred_remove_handler, &snprint_mp_deferred_remove);
|
|
|
f20720 |
install_keyword("delay_watch_checks", &mp_delay_watch_checks_handler, &snprint_mp_delay_watch_checks);
|
|
|
f20720 |
install_keyword("delay_wait_checks", &mp_delay_wait_checks_handler, &snprint_mp_delay_wait_checks);
|
|
|
f20720 |
+ install_keyword("skip_kpartx", &mp_skip_kpartx_handler, &snprint_mp_skip_kpartx);
|
|
|
f20720 |
install_sublevel_end();
|
|
|
f20720 |
}
|
|
|
f20720 |
Index: multipath-tools-130222/libmultipath/propsel.c
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/libmultipath/propsel.c
|
|
|
f20720 |
+++ multipath-tools-130222/libmultipath/propsel.c
|
|
|
f20720 |
@@ -854,3 +854,29 @@ select_delay_wait_checks (struct multipa
|
|
|
f20720 |
condlog(3, "delay_wait_checks = DISABLED (internal default)");
|
|
|
f20720 |
return 0;
|
|
|
f20720 |
}
|
|
|
f20720 |
+
|
|
|
f20720 |
+extern int
|
|
|
f20720 |
+select_skip_kpartx (struct multipath * mp)
|
|
|
f20720 |
+{
|
|
|
f20720 |
+ if (mp->mpe && mp->mpe->skip_kpartx != SKIP_KPARTX_UNDEF) {
|
|
|
f20720 |
+ mp->skip_kpartx = mp->mpe->skip_kpartx;
|
|
|
f20720 |
+ condlog(3, "skip_kpartx = %i (multipath setting)",
|
|
|
f20720 |
+ mp->skip_kpartx);
|
|
|
f20720 |
+ return 0;
|
|
|
f20720 |
+ }
|
|
|
f20720 |
+ if (mp->hwe && mp->hwe->skip_kpartx != SKIP_KPARTX_UNDEF) {
|
|
|
f20720 |
+ mp->skip_kpartx = mp->hwe->skip_kpartx;
|
|
|
f20720 |
+ condlog(3, "skip_kpartx = %i (controler setting)",
|
|
|
f20720 |
+ mp->skip_kpartx);
|
|
|
f20720 |
+ return 0;
|
|
|
f20720 |
+ }
|
|
|
f20720 |
+ if (conf->skip_kpartx != SKIP_KPARTX_UNDEF) {
|
|
|
f20720 |
+ mp->skip_kpartx = conf->skip_kpartx;
|
|
|
f20720 |
+ condlog(3, "skip_kpartx = %i (config file default)",
|
|
|
f20720 |
+ mp->skip_kpartx);
|
|
|
f20720 |
+ return 0;
|
|
|
f20720 |
+ }
|
|
|
f20720 |
+ mp->skip_kpartx = DEFAULT_SKIP_KPARTX;
|
|
|
f20720 |
+ condlog(3, "skip_kpartx = DISABLED (internal default)");
|
|
|
f20720 |
+ return 0;
|
|
|
f20720 |
+}
|
|
|
f20720 |
Index: multipath-tools-130222/libmultipath/propsel.h
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/libmultipath/propsel.h
|
|
|
f20720 |
+++ multipath-tools-130222/libmultipath/propsel.h
|
|
|
f20720 |
@@ -23,3 +23,4 @@ int select_detect_prio(struct path * pp)
|
|
|
f20720 |
int select_deferred_remove(struct multipath *mp);
|
|
|
f20720 |
int select_delay_watch_checks (struct multipath * mp);
|
|
|
f20720 |
int select_delay_wait_checks (struct multipath * mp);
|
|
|
f20720 |
+int select_skip_kpartx (struct multipath * mp);
|
|
|
f20720 |
Index: multipath-tools-130222/libmultipath/structs.h
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/libmultipath/structs.h
|
|
|
f20720 |
+++ multipath-tools-130222/libmultipath/structs.h
|
|
|
f20720 |
@@ -121,6 +121,12 @@ enum deferred_remove_states {
|
|
|
f20720 |
DEFERRED_REMOVE_IN_PROGRESS,
|
|
|
f20720 |
};
|
|
|
f20720 |
|
|
|
f20720 |
+enum skip_kpartx_states {
|
|
|
f20720 |
+ SKIP_KPARTX_UNDEF,
|
|
|
f20720 |
+ SKIP_KPARTX_OFF,
|
|
|
f20720 |
+ SKIP_KPARTX_ON,
|
|
|
f20720 |
+};
|
|
|
f20720 |
+
|
|
|
f20720 |
enum scsi_protocol {
|
|
|
f20720 |
SCSI_PROTOCOL_FCP = 0, /* Fibre Channel */
|
|
|
f20720 |
SCSI_PROTOCOL_SPI = 1, /* parallel SCSI */
|
|
|
f20720 |
@@ -236,6 +242,7 @@ struct multipath {
|
|
|
f20720 |
int delay_watch_checks;
|
|
|
f20720 |
int delay_wait_checks;
|
|
|
f20720 |
int force_udev_reload;
|
|
|
f20720 |
+ int skip_kpartx;
|
|
|
f20720 |
unsigned int dev_loss;
|
|
|
f20720 |
uid_t uid;
|
|
|
f20720 |
gid_t gid;
|
|
|
f20720 |
Index: multipath-tools-130222/multipath/multipath.rules
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/multipath/multipath.rules
|
|
|
f20720 |
+++ multipath-tools-130222/multipath/multipath.rules
|
|
|
f20720 |
@@ -44,6 +44,7 @@ KERNEL!="dm-*", GOTO="end_mpath"
|
|
|
f20720 |
ENV{DM_UUID}=="mpath-?*|part[0-9]*-mpath-?*", OPTIONS+="link_priority=10"
|
|
|
f20720 |
ACTION!="change", GOTO="end_mpath"
|
|
|
f20720 |
ENV{DM_UUID}!="mpath-?*", GOTO="end_mpath"
|
|
|
f20720 |
+ENV{DM_SUBSYSTEM_UDEV_FLAG1}=="1", GOTO="end_mpath"
|
|
|
f20720 |
ENV{DM_ACTIVATION}=="1", ENV{DM_MULTIPATH_NEED_KPARTX}="1"
|
|
|
f20720 |
ENV{DM_SUSPENDED}=="1", GOTO="end_mpath"
|
|
|
f20720 |
ENV{DM_ACTION}=="PATH_FAILED", GOTO="end_mpath"
|
|
|
f20720 |
Index: multipath-tools-130222/multipathd/cli_handlers.c
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/multipathd/cli_handlers.c
|
|
|
f20720 |
+++ multipath-tools-130222/multipathd/cli_handlers.c
|
|
|
f20720 |
@@ -825,19 +825,21 @@ cli_resume(void * v, char ** reply, int
|
|
|
f20720 |
char * param = get_keyparam(v, MAP);
|
|
|
f20720 |
int r;
|
|
|
f20720 |
struct multipath * mpp;
|
|
|
f20720 |
+ uint16_t udev_flags;
|
|
|
f20720 |
|
|
|
f20720 |
param = convert_dev(param, 0);
|
|
|
f20720 |
mpp = find_mp_by_alias(vecs->mpvec, param);
|
|
|
f20720 |
if (!mpp)
|
|
|
f20720 |
return 1;
|
|
|
f20720 |
|
|
|
f20720 |
+ udev_flags = (mpp->skip_kpartx)? MPATH_UDEV_NO_KPARTX_FLAG : 0;
|
|
|
f20720 |
if (mpp->wait_for_udev) {
|
|
|
f20720 |
condlog(2, "%s: device not fully created, failing resume",
|
|
|
f20720 |
mpp->alias);
|
|
|
f20720 |
return 1;
|
|
|
f20720 |
}
|
|
|
f20720 |
|
|
|
f20720 |
- r = dm_simplecmd_noflush(DM_DEVICE_RESUME, param, 0);
|
|
|
f20720 |
+ r = dm_simplecmd_noflush(DM_DEVICE_RESUME, param, udev_flags);
|
|
|
f20720 |
|
|
|
f20720 |
condlog(2, "%s: resume (operator)", param);
|
|
|
f20720 |
|
|
|
f20720 |
Index: multipath-tools-130222/multipath/multipath.conf.5
|
|
|
f20720 |
===================================================================
|
|
|
f20720 |
--- multipath-tools-130222.orig/multipath/multipath.conf.5
|
|
|
f20720 |
+++ multipath-tools-130222/multipath/multipath.conf.5
|
|
|
f20720 |
@@ -505,6 +505,12 @@ automatically enabling device reloads. U
|
|
|
f20720 |
on a device until it receives a change uevent from the initial table load. The
|
|
|
f20720 |
default is
|
|
|
f20720 |
.I 30
|
|
|
f20720 |
+.TP
|
|
|
f20720 |
+.B skip_kpartx
|
|
|
f20720 |
+If set to
|
|
|
f20720 |
+.I yes
|
|
|
f20720 |
+, kpartx will not automatically create partitions on the device. The default is
|
|
|
f20720 |
+.I no
|
|
|
f20720 |
.
|
|
|
f20720 |
.SH "blacklist section"
|
|
|
f20720 |
The
|
|
|
f20720 |
@@ -612,6 +618,8 @@ section:
|
|
|
f20720 |
.B delay_watch_checks
|
|
|
f20720 |
.TP
|
|
|
f20720 |
.B delay_wait_checks
|
|
|
f20720 |
+.TP
|
|
|
f20720 |
+.B skip_kpartx
|
|
|
f20720 |
.RE
|
|
|
f20720 |
.PD
|
|
|
f20720 |
.LP
|
|
|
f20720 |
@@ -708,6 +716,8 @@ section:
|
|
|
f20720 |
.B delay_watch_checks
|
|
|
f20720 |
.TP
|
|
|
f20720 |
.B delay_wait_checks
|
|
|
f20720 |
+.TP
|
|
|
f20720 |
+.B skip_kpartx
|
|
|
f20720 |
.RE
|
|
|
f20720 |
.PD
|
|
|
f20720 |
.LP
|