Blame SOURCES/0243-RHBZ-1498724-save-persist-options.patch

4ae388
---
4ae388
 libmpathpersist/mpath_persist.c  |    3 ++-
4ae388
 libmpathpersist/mpath_updatepr.c |   10 ++++++++--
4ae388
 libmpathpersist/mpathpr.h        |    3 ++-
4ae388
 libmultipath/Makefile            |    2 +-
4ae388
 libmultipath/config.h            |    2 ++
4ae388
 libmultipath/dict.c              |   24 ++++++++++++++++++------
4ae388
 libmultipath/prkey.c             |   25 ++++++++++++++++++++++---
4ae388
 libmultipath/prkey.h             |    4 ++--
4ae388
 libmultipath/propsel.c           |   13 ++++++++++---
4ae388
 libmultipath/structs.h           |    1 +
4ae388
 libmultipath/util.c              |   16 ++++++++++++++++
4ae388
 libmultipath/util.h              |    1 +
4ae388
 multipath/multipath.conf.5       |    8 ++++++--
4ae388
 multipathd/cli_handlers.c        |   15 ++++++++++-----
4ae388
 multipathd/main.c                |    1 +
4ae388
 15 files changed, 102 insertions(+), 26 deletions(-)
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
@@ -86,6 +86,7 @@ struct mpentry {
4ae388
 	char * prio_args;
4ae388
 	int prkey_source;
4ae388
 	struct be64 reservation_key;
4ae388
+	uint8_t sa_flags;
4ae388
 	int pgpolicy;
4ae388
 	int pgfailback;
4ae388
 	int rr_weight;
4ae388
@@ -183,6 +184,7 @@ struct config {
4ae388
 	char * config_dir;
4ae388
 	int prkey_source;
4ae388
 	struct be64 reservation_key;
4ae388
+	uint8_t sa_flags;
4ae388
 
4ae388
 	vector keywords;
4ae388
 	vector mptable;
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
@@ -331,6 +331,7 @@ struct multipath {
4ae388
 	struct be64 reservation_key;
4ae388
 	unsigned char prflag;
4ae388
 	int all_tg_pt;
4ae388
+	uint8_t sa_flags;
4ae388
 };
4ae388
 
4ae388
 struct pathgroup {
4ae388
Index: multipath-tools-130222/libmultipath/util.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/util.c
4ae388
+++ multipath-tools-130222/libmultipath/util.c
4ae388
@@ -6,6 +6,8 @@
4ae388
 #include <sys/vfs.h>
4ae388
 #include <linux/magic.h>
4ae388
 #include <errno.h>
4ae388
+#include <libudev.h>
4ae388
+#include <mpath_persist.h>
4ae388
 
4ae388
 #include "debug.h"
4ae388
 #include "memory.h"
4ae388
@@ -317,6 +319,20 @@ int parse_prkey(char *ptr, uint64_t *prk
4ae388
 	return 0;
4ae388
 }
4ae388
 
4ae388
+int parse_prkey_flags(char *ptr, uint64_t *prkey, uint8_t *flags)
4ae388
+{
4ae388
+	char *flagstr;
4ae388
+
4ae388
+	flagstr = strchr(ptr, ':');
4ae388
+	*flags = 0;
4ae388
+	if (flagstr) {
4ae388
+		*flagstr++ = '\0';
4ae388
+		if (strlen(flagstr) == 5 && strcmp(flagstr, "aptpl") == 0)
4ae388
+			*flags = MPATH_F_APTPL_MASK;
4ae388
+	}
4ae388
+	return parse_prkey(ptr, prkey);
4ae388
+}
4ae388
+
4ae388
 int safe_write(int fd, const void *buf, size_t count)
4ae388
 {
4ae388
 	while (count > 0) {
4ae388
Index: multipath-tools-130222/libmultipath/util.h
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/util.h
4ae388
+++ multipath-tools-130222/libmultipath/util.h
4ae388
@@ -15,6 +15,7 @@ dev_t parse_devt(const char *dev_t);
4ae388
 char *convert_dev(char *dev, int is_path_device);
4ae388
 int in_initrd(void);
4ae388
 int parse_prkey(char *ptr, uint64_t *prkey);
4ae388
+int parse_prkey_flags(char *ptr, uint64_t *prkey, uint8_t *flags);
4ae388
 int safe_write(int fd, const void *buf, size_t count);
4ae388
 
4ae388
 #define safe_sprintf(var, format, args...)	\
4ae388
Index: multipath-tools-130222/libmultipath/Makefile
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/Makefile
4ae388
+++ multipath-tools-130222/libmultipath/Makefile
4ae388
@@ -8,7 +8,7 @@ SONAME=0
4ae388
 DEVLIB = libmultipath.so
4ae388
 LIBS = $(DEVLIB).$(SONAME)
4ae388
 LIBDEPS = -lpthread -ldl -ldevmapper -ludev -L$(mpathcmddir) -lmpathcmd
4ae388
-CFLAGS += -fPIC -I$(mpathcmddir)
4ae388
+CFLAGS += -fPIC -I$(mpathcmddir) -I$(mpathpersistdir)
4ae388
 
4ae388
 OBJS = memory.o parser.o vector.o devmapper.o \
4ae388
        hwtable.o blacklist.o util.o dmparser.o config.o \
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
@@ -23,6 +23,8 @@
4ae388
 #include "util.h"
4ae388
 #include "prkey.h"
4ae388
 #include <inttypes.h>
4ae388
+#include <libudev.h>
4ae388
+#include <mpath_persist.h>
4ae388
 
4ae388
 /*
4ae388
  * default block handlers
4ae388
@@ -557,6 +559,7 @@ def_reservation_key_handler(vector strve
4ae388
 {
4ae388
 	char *buff;
4ae388
 	uint64_t prkey = 0;
4ae388
+	uint8_t flags;
4ae388
 
4ae388
 	buff = set_value(strvec);
4ae388
 	if (!buff)
4ae388
@@ -568,12 +571,13 @@ def_reservation_key_handler(vector strve
4ae388
 		FREE(buff);
4ae388
 		return 0;
4ae388
 	}
4ae388
-	else if (parse_prkey(buff, &prkey) != 0) {
4ae388
+	else if (parse_prkey_flags(buff, &prkey, &flags) != 0) {
4ae388
 		FREE(buff);
4ae388
 		return 1;
4ae388
 	}
4ae388
 
4ae388
 	conf->prkey_source = PRKEY_SOURCE_CONF;
4ae388
+	conf->sa_flags = flags;
4ae388
 	put_be64(conf->reservation_key, prkey);
4ae388
 	FREE(buff);
4ae388
 	return 0;
4ae388
@@ -2403,6 +2407,7 @@ mp_reservation_key_handler (vector strve
4ae388
 	char *buff;
4ae388
 	struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable);
4ae388
 	uint64_t prkey;
4ae388
+	uint8_t flags;
4ae388
 
4ae388
 	if (!mpe)
4ae388
 		return 1;
4ae388
@@ -2417,12 +2422,13 @@ mp_reservation_key_handler (vector strve
4ae388
 		FREE(buff);
4ae388
 		return 0;
4ae388
 	}
4ae388
-	else if (parse_prkey(buff, &prkey) != 0) {
4ae388
+	else if (parse_prkey_flags(buff, &prkey, &flags) != 0) {
4ae388
 		FREE(buff);
4ae388
 		return 1;
4ae388
 	}
4ae388
 
4ae388
 	mpe->prkey_source = PRKEY_SOURCE_CONF;
4ae388
+	mpe->sa_flags = flags;
4ae388
 	put_be64(mpe->reservation_key, prkey);
4ae388
 	FREE(buff);
4ae388
 	return 0;
4ae388
@@ -2838,14 +2844,17 @@ snprint_mp_prio_args(char * buff, int le
4ae388
 static int
4ae388
 snprint_mp_reservation_key (char * buff, int len, void * data)
4ae388
 {
4ae388
+	char *flagstr = "";
4ae388
 	struct mpentry * mpe = (struct mpentry *)data;
4ae388
 
4ae388
 	if (mpe->prkey_source == PRKEY_SOURCE_NONE)
4ae388
 		return 0;
4ae388
 	if (mpe->prkey_source == PRKEY_SOURCE_FILE)
4ae388
 		return snprintf(buff, len, "file");
4ae388
-	return snprintf(buff, len, "0x%" PRIx64,
4ae388
-			get_be64(mpe->reservation_key));
4ae388
+	if (mpe->sa_flags == MPATH_F_APTPL_MASK)
4ae388
+		flagstr = ":aptpl";
4ae388
+	return snprintf(buff, len, "0x%" PRIx64 "%s",
4ae388
+			get_be64(mpe->reservation_key), flagstr);
4ae388
 }
4ae388
 
4ae388
 static int
4ae388
@@ -3716,12 +3725,15 @@ snprint_def_prkeys_file (char * buff, in
4ae388
 static int
4ae388
 snprint_def_reservation_key(char * buff, int len, void * data)
4ae388
 {
4ae388
+	char *flagstr = "";
4ae388
 	if (conf->prkey_source == PRKEY_SOURCE_NONE)
4ae388
 		return 0;
4ae388
 	if (conf->prkey_source == PRKEY_SOURCE_FILE)
4ae388
 		return snprintf(buff, len, "file");
4ae388
-	return snprintf(buff, len, "0x%" PRIx64,
4ae388
-			get_be64(conf->reservation_key));
4ae388
+	if (conf->sa_flags == MPATH_F_APTPL_MASK)
4ae388
+		flagstr = ":aptpl";
4ae388
+	return snprintf(buff, len, "0x%" PRIx64 "%s",
4ae388
+			get_be64(conf->reservation_key), flagstr);
4ae388
 }
4ae388
 
4ae388
 static int
4ae388
Index: multipath-tools-130222/libmpathpersist/mpath_persist.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmpathpersist/mpath_persist.c
4ae388
+++ multipath-tools-130222/libmpathpersist/mpath_persist.c
4ae388
@@ -295,7 +295,8 @@ int mpath_persistent_reserve_out ( int f
4ae388
 	      rq_servact == MPATH_PROUT_REG_SA) ||
4ae388
 	     rq_servact == MPATH_PROUT_REG_IGN_SA)) {
4ae388
 		memcpy(&mpp->reservation_key, paramp->sa_key, 8);
4ae388
-		if (update_prkey(alias, get_be64(mpp->reservation_key))) {
4ae388
+		if (update_prkey_flags(alias, get_be64(mpp->reservation_key),
4ae388
+				       paramp->sa_flags)) {
4ae388
 			condlog(0, "%s: failed to set prkey for multipathd.",
4ae388
 				alias);
4ae388
 			ret = MPATH_PR_DMMP_ERROR;
4ae388
Index: multipath-tools-130222/libmpathpersist/mpath_updatepr.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmpathpersist/mpath_updatepr.c
4ae388
+++ multipath-tools-130222/libmpathpersist/mpath_updatepr.c
4ae388
@@ -15,6 +15,8 @@
4ae388
 #include <mpath_cmd.h>
4ae388
 #include <uxsock.h>
4ae388
 #include "memory.h"
4ae388
+#include <libudev.h>
4ae388
+#include <mpath_persist.h>
4ae388
 
4ae388
 unsigned long mem_allocated;    /* Total memory used in Bytes */
4ae388
 
4ae388
@@ -54,11 +56,15 @@ int update_prflag(char *mapname, int set
4ae388
 	return do_update_pr(mapname, (set)? "setprstatus" : "unsetprstatus");
4ae388
 }
4ae388
 
4ae388
-int update_prkey(char *mapname, uint64_t prkey) {
4ae388
+int update_prkey_flags(char *mapname, uint64_t prkey, uint8_t sa_flags) {
4ae388
 	char str[256];
4ae388
+	char *flagstr = "";
4ae388
 
4ae388
+	if (sa_flags & MPATH_F_APTPL_MASK)
4ae388
+		flagstr = ":aptpl";
4ae388
 	if (prkey)
4ae388
-		snprintf(str, sizeof(str), "setprkey key %" PRIx64, prkey);
4ae388
+		snprintf(str, sizeof(str), "setprkey key %" PRIx64 "%s", prkey,
4ae388
+			 flagstr);
4ae388
 	else
4ae388
 		snprintf(str, sizeof(str), "unsetprkey");
4ae388
 	return do_update_pr(mapname, str);
4ae388
Index: multipath-tools-130222/libmpathpersist/mpathpr.h
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmpathpersist/mpathpr.h
4ae388
+++ multipath-tools-130222/libmpathpersist/mpathpr.h
4ae388
@@ -50,7 +50,8 @@ int send_prout_activepath(char * dev, in
4ae388
         unsigned int rq_type,   struct prout_param_descriptor * paramp, int noisy);
4ae388
 
4ae388
 int update_prflag(char *mapname, int set);
4ae388
-int update_prkey(char *mapname, uint64_t prkey);
4ae388
+int update_prkey_flags(char *mapname, uint64_t prkey, uint8_t sa_flags);
4ae388
+#define update_prkey(mapname, prkey) update_prkey_flags(mapname, prkey, 0)
4ae388
 void * mpath_alloc_prin_response(int prin_sa);
4ae388
 int update_map_pr(struct multipath *mpp);
4ae388
 int devt2devname (char *devname, char *devt);
4ae388
Index: multipath-tools-130222/libmultipath/prkey.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/prkey.c
4ae388
+++ multipath-tools-130222/libmultipath/prkey.c
4ae388
@@ -11,6 +11,8 @@
4ae388
 #include <string.h>
4ae388
 #include <inttypes.h>
4ae388
 #include <errno.h>
4ae388
+#include <libudev.h>
4ae388
+#include <mpath_persist.h>
4ae388
 
4ae388
 #define KEYSIZE 19
4ae388
 #define PRKEY_READ 0
4ae388
@@ -109,7 +111,7 @@ static int do_prkey(int fd, char *wwid,
4ae388
 	return 0;
4ae388
 }
4ae388
 
4ae388
-int get_prkey(struct multipath *mpp, uint64_t *prkey)
4ae388
+int get_prkey(struct multipath *mpp, uint64_t *prkey, uint8_t *sa_flags)
4ae388
 {
4ae388
 	int fd;
4ae388
 	int unused;
4ae388
@@ -125,6 +127,9 @@ int get_prkey(struct multipath *mpp, uin
4ae388
 	ret = do_prkey(fd, mpp->wwid, keystr, PRKEY_READ);
4ae388
 	if (ret)
4ae388
 		goto out_file;
4ae388
+	*sa_flags = 0;
4ae388
+	if (strchr(keystr, 'X'))
4ae388
+		*sa_flags = MPATH_F_APTPL_MASK;
4ae388
 	ret = !!parse_prkey(keystr, prkey);
4ae388
 out_file:
4ae388
 	close(fd);
4ae388
@@ -132,7 +137,7 @@ out:
4ae388
 	return ret;
4ae388
 }
4ae388
 
4ae388
-int set_prkey(struct multipath *mpp, uint64_t prkey)
4ae388
+int set_prkey(struct multipath *mpp, uint64_t prkey, uint8_t sa_flags)
4ae388
 {
4ae388
 	int fd;
4ae388
 	int can_write = 1;
4ae388
@@ -142,6 +147,12 @@ int set_prkey(struct multipath *mpp, uin
4ae388
 	if (!strlen(mpp->wwid))
4ae388
 		goto out;
4ae388
 
4ae388
+	if (sa_flags & ~MPATH_F_APTPL_MASK) {
4ae388
+		condlog(0, "unsupported pr flags, 0x%x",
4ae388
+			sa_flags & ~MPATH_F_APTPL_MASK);
4ae388
+		sa_flags &= MPATH_F_APTPL_MASK;
4ae388
+	}
4ae388
+
4ae388
 	fd = open_file(conf->prkeys_file, &can_write, PRKEYS_FILE_HEADER);
4ae388
 	if (fd < 0)
4ae388
 		goto out;
4ae388
@@ -150,7 +161,15 @@ int set_prkey(struct multipath *mpp, uin
4ae388
 		goto out_file;
4ae388
 	}
4ae388
 	if (prkey) {
4ae388
-		snprintf(keystr, KEYSIZE, "0x%016" PRIx64, prkey);
4ae388
+		/* using the capitalization of the 'x' is a hack, but
4ae388
+		 * it's unlikely that mpath_persist will support more options
4ae388
+		 * since sg_persist doesn't, and this lets us keep the
4ae388
+		 * same file format as before instead of needing to change
4ae388
+		 * the format of the prkeys file */
4ae388
+		if (sa_flags)
4ae388
+			snprintf(keystr, KEYSIZE, "0X%016" PRIx64, prkey);
4ae388
+		else
4ae388
+			snprintf(keystr, KEYSIZE, "0x%016" PRIx64, prkey);
4ae388
 		keystr[KEYSIZE - 1] = '\0';
4ae388
 		ret = do_prkey(fd, mpp->wwid, keystr, PRKEY_WRITE);
4ae388
 	}
4ae388
Index: multipath-tools-130222/libmultipath/prkey.h
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/prkey.h
4ae388
+++ multipath-tools-130222/libmultipath/prkey.h
4ae388
@@ -13,7 +13,7 @@
4ae388
 "# prkey wwid\n" \
4ae388
 "#\n"
4ae388
 
4ae388
-int set_prkey(struct multipath *mpp, uint64_t prkey);
4ae388
-int get_prkey(struct multipath *mpp, uint64_t *prkey);
4ae388
+int set_prkey(struct multipath *mpp, uint64_t prkey, uint8_t sa_flags);
4ae388
+int get_prkey(struct multipath *mpp, uint64_t *prkey, uint8_t *sa_flags);
4ae388
 
4ae388
 #endif /* _PRKEY_H */
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
@@ -20,6 +20,8 @@
4ae388
 #include "prioritizers/alua_rtpg.h"
4ae388
 #include "prkey.h"
4ae388
 #include <inttypes.h>
4ae388
+#include <libudev.h>
4ae388
+#include <mpath_persist.h>
4ae388
 
4ae388
 pgpolicyfn *pgpolicies[] = {
4ae388
 	NULL,
4ae388
@@ -715,10 +717,12 @@ select_reservation_key (struct multipath
4ae388
 	uint64_t prkey;
4ae388
 	char *origin = NULL;
4ae388
 	char *from_file = "";
4ae388
+	char *flagstr = "";
4ae388
 
4ae388
 	if (mp->mpe && mp->mpe->prkey_source != PRKEY_SOURCE_NONE) {
4ae388
 		mp->prkey_source = mp->mpe->prkey_source;
4ae388
 		mp->reservation_key = mp->mpe->reservation_key;
4ae388
+		mp->sa_flags = mp->mpe->sa_flags;
4ae388
 		origin = "multipath setting";
4ae388
 		goto out;
4ae388
 	}
4ae388
@@ -726,6 +730,7 @@ select_reservation_key (struct multipath
4ae388
 	if (conf->prkey_source != PRKEY_SOURCE_NONE) {
4ae388
 		mp->prkey_source = conf->prkey_source;
4ae388
 		mp->reservation_key = conf->reservation_key;
4ae388
+		mp->sa_flags = conf->sa_flags;
4ae388
 		origin = "config file default";
4ae388
 		goto out;
4ae388
 	}
4ae388
@@ -736,14 +741,16 @@ select_reservation_key (struct multipath
4ae388
 out:
4ae388
 	if (mp->prkey_source == PRKEY_SOURCE_FILE) {
4ae388
 		from_file = " (from prkeys file)";
4ae388
-		if (get_prkey(mp, &prkey) != 0)
4ae388
+		if (get_prkey(mp, &prkey, &mp->sa_flags) != 0)
4ae388
 			put_be64(mp->reservation_key, 0);
4ae388
 		else
4ae388
 			put_be64(mp->reservation_key, prkey);
4ae388
 	}
4ae388
+	if (mp->sa_flags & MPATH_F_APTPL_MASK)
4ae388
+		flagstr = ":aptpl";
4ae388
 	if (get_be64(mp->reservation_key))
4ae388
-		condlog(0, "%s: reservation_key = 0x%" PRIx64 " (%s)%s",
4ae388
-			mp->alias, get_be64(mp->reservation_key), origin,
4ae388
+		condlog(0, "%s: reservation_key = 0x%" PRIx64 "%s (%s)%s",
4ae388
+			mp->alias, get_be64(mp->reservation_key), flagstr, origin,
4ae388
 			from_file);
4ae388
 	return 0;
4ae388
 }
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
@@ -17,6 +17,7 @@
4ae388
 #include <sysfs.h>
4ae388
 #include <errno.h>
4ae388
 #include <libudev.h>
4ae388
+#include <mpath_persist.h>
4ae388
 #include <util.h>
4ae388
 #include <prkey.h>
4ae388
 
4ae388
@@ -1242,6 +1243,7 @@ cli_getprkey(void * v, char ** reply, in
4ae388
 	struct multipath * mpp;
4ae388
 	struct vectors * vecs = (struct vectors *)data;
4ae388
 	char *mapname = get_keyparam(v, MAP);
4ae388
+	char *flagstr = "";
4ae388
 
4ae388
 	mapname = convert_dev(mapname, 0);
4ae388
 	condlog(3, "%s: get persistent reservation key (operator)", mapname);
4ae388
@@ -1257,8 +1259,10 @@ cli_getprkey(void * v, char ** reply, in
4ae388
 		*len = strlen(*reply) + 1;
4ae388
 		return 0;
4ae388
 	}
4ae388
-	snprintf(*reply, 20, "0x%" PRIx64 "\n",
4ae388
-		 get_be64(mpp->reservation_key));
4ae388
+	if (mpp->sa_flags & MPATH_F_APTPL_MASK)
4ae388
+		flagstr = ":aptpl";
4ae388
+	snprintf(*reply, 20, "0x%" PRIx64 "%s\n",
4ae388
+		 get_be64(mpp->reservation_key), flagstr);
4ae388
 	(*reply)[19] = '\0';
4ae388
 	*len = strlen(*reply) + 1;
4ae388
 	return 0;
4ae388
@@ -1278,7 +1282,7 @@ cli_unsetprkey(void * v, char ** reply,
4ae388
 	if (!mpp)
4ae388
 		return 1;
4ae388
 
4ae388
-	return set_prkey(mpp, 0);
4ae388
+	return set_prkey(mpp, 0, 0);
4ae388
 }
4ae388
 
4ae388
 int cli_setprkey(void * v, char ** reply, int * len, void * data)
4ae388
@@ -1288,6 +1292,7 @@ int cli_setprkey(void * v, char ** reply
4ae388
 	char *mapname = get_keyparam(v, MAP);
4ae388
 	char *keyparam = get_keyparam(v, KEY);
4ae388
 	uint64_t prkey;
4ae388
+	uint8_t flags;
4ae388
 
4ae388
 	mapname = convert_dev(mapname, 0);
4ae388
 	condlog(3, "%s: set persistent reservation key (operator)", mapname);
4ae388
@@ -1296,10 +1301,10 @@ int cli_setprkey(void * v, char ** reply
4ae388
 	if (!mpp)
4ae388
 		return 1;
4ae388
 
4ae388
-	if (parse_prkey(keyparam, &prkey) != 0) {
4ae388
+	if (parse_prkey_flags(keyparam, &prkey, &flags) != 0) {
4ae388
 		condlog(0, "%s: invalid prkey : '%s'", mapname, keyparam);
4ae388
 		return 1;
4ae388
 	}
4ae388
 
4ae388
-	return set_prkey(mpp, prkey);
4ae388
+	return set_prkey(mpp, prkey, flags);
4ae388
 }
4ae388
Index: multipath-tools-130222/multipathd/main.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/multipathd/main.c
4ae388
+++ multipath-tools-130222/multipathd/main.c
4ae388
@@ -2324,6 +2324,7 @@ void *  mpath_pr_event_handler_fn (void
4ae388
 
4ae388
 	param= malloc(sizeof(struct prout_param_descriptor));
4ae388
 	memset(param, 0 , sizeof(struct prout_param_descriptor));
4ae388
+	param->sa_flags = mpp->sa_flags;
4ae388
 	memcpy(param->sa_key, &mpp->reservation_key, 8);
4ae388
 	param->num_transportid = 0;
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
@@ -438,14 +438,18 @@ This is the service action reservation k
4ae388
 set for all multipath devices using persistent reservations, and it must be
4ae388
 the same as the RESERVATION KEY field of the PERSISTENT RESERVE OUT parameter
4ae388
 list which contains an 8-byte value provided by the application client to the
4ae388
-device server to identify the I_T nexus.
4ae388
+device server to identify the I_T nexus. If the \fI--param-aptpl\fR option is
4ae388
+used when registering the key with mpathpersist, \fB:aptpl\fR must be appended
4ae388
+to the end of the reservation key.
4ae388
+
4ae388
 .RS
4ae388
 .PP
4ae388
 Alternatively, this can be set to \fBfile\fR, which will store the RESERVATION
4ae388
 KEY registered by mpathpersist in the \fIprkeys_file\fR. multipathd will then
4ae388
 use this key to register additional paths as they appear.  When the
4ae388
 registration is removed, the RESERVATION KEY is removed from the
4ae388
-\fIprkeys_file\fR.
4ae388
+\fIprkeys_file\fR. The prkeys file will automatically keep track of whether
4ae388
+the key was registered with \fI--param-aptpl\fR.
4ae388
 It is unset by default.
4ae388
 .RE
4ae388
 .TP