Blame SOURCES/0161-RHBZ-1311659-no-kpartx.patch

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