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