Blame SOURCES/0119-RHBZ-1081397-save-alua-info.patch

4ae388
---
4ae388
 libmultipath/prio.c                      |   34 ++++++++++++++++-
4ae388
 libmultipath/prio.h                      |    7 +++
4ae388
 libmultipath/prioritizers/alua.c         |   62 +++++++++++++++++++++++--------
4ae388
 libmultipath/prioritizers/alua_rtpg.c    |   22 +++++++++--
4ae388
 libmultipath/prioritizers/alua_rtpg.h    |    4 +-
4ae388
 libmultipath/prioritizers/const.c        |    4 ++
4ae388
 libmultipath/prioritizers/datacore.c     |    3 +
4ae388
 libmultipath/prioritizers/def_func.h     |   11 +++++
4ae388
 libmultipath/prioritizers/emc.c          |    4 ++
4ae388
 libmultipath/prioritizers/hds.c          |    4 ++
4ae388
 libmultipath/prioritizers/hp_sw.c        |    4 ++
4ae388
 libmultipath/prioritizers/iet.c          |    4 ++
4ae388
 libmultipath/prioritizers/ontap.c        |    4 ++
4ae388
 libmultipath/prioritizers/random.c       |    4 ++
4ae388
 libmultipath/prioritizers/rdac.c         |    4 ++
4ae388
 libmultipath/prioritizers/weightedpath.c |    3 +
4ae388
 libmultipath/propsel.c                   |    4 +-
4ae388
 multipathd/main.c                        |   24 ++++++++----
4ae388
 18 files changed, 174 insertions(+), 32 deletions(-)
4ae388
4ae388
Index: multipath-tools-130222/libmultipath/prio.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/prio.c
4ae388
+++ multipath-tools-130222/libmultipath/prio.c
4ae388
@@ -112,9 +112,24 @@ struct prio * add_prio (char * name)
4ae388
 	p->getprio = (int (*)(struct path *, char *)) dlsym(p->handle, "getprio");
4ae388
 	errstr = dlerror();
4ae388
 	if (errstr != NULL)
4ae388
-		condlog(0, "A dynamic linking error occurred: (%s)", errstr);
4ae388
+		condlog(0, "A dynamic linking error occurred with getprio: (%s)", errstr);
4ae388
 	if (!p->getprio)
4ae388
 		goto out;
4ae388
+
4ae388
+	p->initprio = (int (*)(struct prio *)) dlsym(p->handle, "initprio");
4ae388
+	errstr = dlerror();
4ae388
+	if (errstr != NULL)
4ae388
+		condlog(0, "A dynamic linking error occurred with initprio: (%s)", errstr);
4ae388
+	if (!p->initprio)
4ae388
+		goto out;
4ae388
+
4ae388
+	p->freeprio = (int (*)(struct prio *)) dlsym(p->handle, "freeprio");
4ae388
+	errstr = dlerror();
4ae388
+	if (errstr != NULL)
4ae388
+		condlog(0, "A dynamic linking error occurred with freeprio: (%s)", errstr);
4ae388
+	if (!p->freeprio)
4ae388
+		goto out;
4ae388
+
4ae388
 	list_add(&p->node, &prioritizers);
4ae388
 	return p;
4ae388
 out:
4ae388
@@ -122,6 +137,13 @@ out:
4ae388
 	return NULL;
4ae388
 }
4ae388
 
4ae388
+int prio_init (struct prio * p)
4ae388
+{
4ae388
+	if (!p || !p->initprio)
4ae388
+		return 1;
4ae388
+	return p->initprio(p);
4ae388
+}
4ae388
+
4ae388
 int prio_getprio (struct prio * p, struct path * pp)
4ae388
 {
4ae388
 	return p->getprio(pp, p->args);
4ae388
@@ -156,8 +178,16 @@ void prio_get (struct prio * dst, char *
4ae388
 	strncpy(dst->name, src->name, PRIO_NAME_LEN);
4ae388
 	if (args)
4ae388
 		strncpy(dst->args, args, PRIO_ARGS_LEN);
4ae388
+	dst->initprio = src->initprio;
4ae388
 	dst->getprio = src->getprio;
4ae388
+	dst->freeprio = src->freeprio;
4ae388
 	dst->handle = NULL;
4ae388
+	dst->context = NULL;
4ae388
+
4ae388
+	if (dst->initprio(dst) != 0){
4ae388
+		memset(dst, 0x0, sizeof(struct prio));
4ae388
+		return;
4ae388
+	}
4ae388
 
4ae388
 	src->refcount++;
4ae388
 }
4ae388
@@ -173,6 +203,8 @@ void prio_put (struct prio * dst)
4ae388
 		src = NULL;
4ae388
 	else
4ae388
 		src = prio_lookup(dst->name);
4ae388
+	if (dst->freeprio)
4ae388
+		dst->freeprio(dst);
4ae388
 	memset(dst, 0x0, sizeof(struct prio));
4ae388
 	free_prio(src);
4ae388
 }
4ae388
Index: multipath-tools-130222/libmultipath/prio.h
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/prio.h
4ae388
+++ multipath-tools-130222/libmultipath/prio.h
4ae388
@@ -46,9 +46,15 @@ struct prio {
4ae388
 	void *handle;
4ae388
 	int refcount;
4ae388
 	struct list_head node;
4ae388
+	void * context;
4ae388
 	char name[PRIO_NAME_LEN];
4ae388
 	char args[PRIO_ARGS_LEN];
4ae388
+	int (*initprio)(struct prio * p);
4ae388
+	/* You are allowed to call initprio multiple times without calling
4ae388
+	 * freeprio. Doing so will reinitialize it (possibly skipping
4ae388
+	 * allocations) */
4ae388
 	int (*getprio)(struct path *, char *);
4ae388
+	int (*freeprio)(struct prio * p);
4ae388
 };
4ae388
 
4ae388
 unsigned int get_prio_timeout(unsigned int default_timeout);
4ae388
@@ -57,6 +63,7 @@ void cleanup_prio (void);
4ae388
 struct prio * add_prio (char *);
4ae388
 struct prio * prio_lookup (char *);
4ae388
 int prio_getprio (struct prio *, struct path *);
4ae388
+int prio_init (struct prio *);
4ae388
 void prio_get (struct prio *, char *, char *);
4ae388
 void prio_put (struct prio *);
4ae388
 int prio_selected (struct prio *);
4ae388
Index: multipath-tools-130222/libmultipath/prioritizers/alua.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/prioritizers/alua.c
4ae388
+++ multipath-tools-130222/libmultipath/prioritizers/alua.c
4ae388
@@ -37,6 +37,12 @@ static const char * aas_string[] = {
4ae388
 	[AAS_TRANSITIONING]	= "transitioning between states",
4ae388
 };
4ae388
 
4ae388
+struct alua_context {
4ae388
+	int tpg_support;
4ae388
+	int tpg;
4ae388
+	int buflen;
4ae388
+};
4ae388
+
4ae388
 static const char *aas_print_string(int rc)
4ae388
 {
4ae388
 	rc &= 0x7f;
4ae388
@@ -51,25 +57,26 @@ static const char *aas_print_string(int
4ae388
 }
4ae388
 
4ae388
 int
4ae388
-get_alua_info(int fd)
4ae388
+get_alua_info(int fd, struct alua_context *ct)
4ae388
 {
4ae388
 	int	rc;
4ae388
-	int	tpg;
4ae388
 	int	aas;
4ae388
 
4ae388
-	rc = get_target_port_group_support(fd);
4ae388
-	if (rc < 0)
4ae388
-		return -ALUA_PRIO_TPGS_FAILED;
4ae388
-
4ae388
-	if (rc == TPGS_NONE)
4ae388
-		return -ALUA_PRIO_NOT_SUPPORTED;
4ae388
-
4ae388
-	tpg = get_target_port_group(fd);
4ae388
-	if (tpg < 0)
4ae388
-		return -ALUA_PRIO_RTPG_FAILED;
4ae388
+	if (ct->tpg_support <= 0 || ct->tpg < 0) {
4ae388
+		ct->tpg_support = get_target_port_group_support(fd);
4ae388
+		if (ct->tpg_support < 0)
4ae388
+			return -ALUA_PRIO_TPGS_FAILED;
4ae388
+
4ae388
+		if (ct->tpg_support == TPGS_NONE)
4ae388
+			return -ALUA_PRIO_NOT_SUPPORTED;
4ae388
+
4ae388
+		ct->tpg = get_target_port_group(fd, &ct->buflen);
4ae388
+		if (ct->tpg < 0)
4ae388
+			return -ALUA_PRIO_RTPG_FAILED;
4ae388
+	}
4ae388
 
4ae388
-	condlog(3, "reported target port group is %i", tpg);
4ae388
-	rc = get_asymmetric_access_state(fd, tpg);
4ae388
+	condlog(3, "reported target port group is %i", ct->tpg);
4ae388
+	rc = get_asymmetric_access_state(fd, ct->tpg, &ct->buflen);
4ae388
 	if (rc < 0)
4ae388
 		return -ALUA_PRIO_GETAAS_FAILED;
4ae388
 	aas = (rc & 0x0f);
4ae388
@@ -88,7 +95,7 @@ int getprio (struct path * pp, char * ar
4ae388
 	if (pp->fd < 0)
4ae388
 		return -ALUA_PRIO_NO_INFORMATION;
4ae388
 
4ae388
-	rc = get_alua_info(pp->fd);
4ae388
+	rc = get_alua_info(pp->fd, pp->prio.context);
4ae388
 	if (rc >= 0) {
4ae388
 		aas = (rc & 0x0f);
4ae388
 		priopath = (rc & 0x80);
4ae388
@@ -128,3 +135,28 @@ int getprio (struct path * pp, char * ar
4ae388
 	}
4ae388
 	return rc;
4ae388
 }
4ae388
+
4ae388
+int initprio(struct prio *p)
4ae388
+{
4ae388
+	if (!p->context) {
4ae388
+		struct alua_context *ct;
4ae388
+
4ae388
+		ct = malloc(sizeof(struct alua_context));
4ae388
+		if (!ct)
4ae388
+			return 1;
4ae388
+		p->context = ct;
4ae388
+	}
4ae388
+	memset(p->context, 0, sizeof(struct alua_context));
4ae388
+	return 0;
4ae388
+}
4ae388
+
4ae388
+
4ae388
+int freeprio(struct prio *p)
4ae388
+{
4ae388
+	if (p->context) {
4ae388
+		free(p->context);
4ae388
+		p->context = NULL;
4ae388
+	}
4ae388
+	return 0;
4ae388
+}
4ae388
+
4ae388
Index: multipath-tools-130222/libmultipath/prioritizers/alua_rtpg.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/prioritizers/alua_rtpg.c
4ae388
+++ multipath-tools-130222/libmultipath/prioritizers/alua_rtpg.c
4ae388
@@ -171,7 +171,7 @@ get_target_port_group_support(int fd)
4ae388
 }
4ae388
 
4ae388
 int
4ae388
-get_target_port_group(int fd)
4ae388
+get_target_port_group(int fd, int *buflen_ptr)
4ae388
 {
4ae388
 	unsigned char		*buf;
4ae388
 	struct vpd83_data *	vpd83;
4ae388
@@ -179,7 +179,12 @@ get_target_port_group(int fd)
4ae388
 	int			rc;
4ae388
 	int			buflen, scsi_buflen;
4ae388
 
4ae388
-	buflen = 128; /* Lets start from 128 */
4ae388
+	if (!buflen_ptr || *buflen_ptr == 0) {
4ae388
+		buflen = 128; /* Lets start from 128 */
4ae388
+		if (buflen_ptr)
4ae388
+			*buflen_ptr = 128;
4ae388
+	} else
4ae388
+		buflen = *buflen_ptr;
4ae388
 	buf = (unsigned char *)malloc(buflen);
4ae388
 	if (!buf) {
4ae388
 		PRINT_DEBUG("malloc failed: could not allocate"
4ae388
@@ -202,6 +207,8 @@ get_target_port_group(int fd)
4ae388
 			return -RTPG_RTPG_FAILED;
4ae388
 		}
4ae388
 		buflen = scsi_buflen;
4ae388
+		if (buflen_ptr)
4ae388
+			*buflen_ptr = buflen;
4ae388
 		memset(buf, 0, buflen);
4ae388
 		rc = do_inquiry(fd, 1, 0x83, buf, buflen);
4ae388
 		if (rc < 0)
4ae388
@@ -269,7 +276,7 @@ do_rtpg(int fd, void* resp, long resplen
4ae388
 }
4ae388
 
4ae388
 int
4ae388
-get_asymmetric_access_state(int fd, unsigned int tpg)
4ae388
+get_asymmetric_access_state(int fd, unsigned int tpg, int *buflen_ptr)
4ae388
 {
4ae388
 	unsigned char		*buf;
4ae388
 	struct rtpg_data *	tpgd;
4ae388
@@ -278,7 +285,12 @@ get_asymmetric_access_state(int fd, unsi
4ae388
 	int			buflen;
4ae388
 	uint32_t		scsi_buflen;
4ae388
 
4ae388
-	buflen = 128; /* Initial value from old code */
4ae388
+	if (!buflen_ptr || *buflen_ptr == 0) {
4ae388
+		buflen = 128; /* Initial value from old code */
4ae388
+		if (buflen_ptr)
4ae388
+			*buflen_ptr = 128;
4ae388
+	} else
4ae388
+		buflen = *buflen_ptr;
4ae388
 	buf = (unsigned char *)malloc(buflen);
4ae388
 	if (!buf) {
4ae388
 		PRINT_DEBUG ("malloc failed: could not allocate"
4ae388
@@ -299,6 +311,8 @@ get_asymmetric_access_state(int fd, unsi
4ae388
 			return -RTPG_RTPG_FAILED;
4ae388
 		}
4ae388
 		buflen = scsi_buflen;
4ae388
+		if (buflen_ptr)
4ae388
+			*buflen_ptr = buflen;
4ae388
 		memset(buf, 0, buflen);
4ae388
 		rc = do_rtpg(fd, buf, buflen);
4ae388
 		if (rc < 0)
4ae388
Index: multipath-tools-130222/libmultipath/prioritizers/alua_rtpg.h
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/prioritizers/alua_rtpg.h
4ae388
+++ multipath-tools-130222/libmultipath/prioritizers/alua_rtpg.h
4ae388
@@ -23,8 +23,8 @@
4ae388
 #define RTPG_TPG_NOT_FOUND			4
4ae388
 
4ae388
 int get_target_port_group_support(int fd);
4ae388
-int get_target_port_group(int fd);
4ae388
-int get_asymmetric_access_state(int fd, unsigned int tpg);
4ae388
+int get_target_port_group(int fd, int *buflen_ptr);
4ae388
+int get_asymmetric_access_state(int fd, unsigned int tpg, int *buflen_ptr);
4ae388
 
4ae388
 #endif /* __RTPG_H__ */
4ae388
 
4ae388
Index: multipath-tools-130222/libmultipath/prioritizers/const.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/prioritizers/const.c
4ae388
+++ multipath-tools-130222/libmultipath/prioritizers/const.c
4ae388
@@ -1,8 +1,12 @@
4ae388
 #include <stdio.h>
4ae388
 
4ae388
 #include <prio.h>
4ae388
+#include "def_func.h"
4ae388
 
4ae388
 int getprio (struct path * pp, char * args)
4ae388
 {
4ae388
 	return 1;
4ae388
 }
4ae388
+
4ae388
+declare_nop_prio(initprio)
4ae388
+declare_nop_prio(freeprio)
4ae388
Index: multipath-tools-130222/libmultipath/prioritizers/datacore.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/prioritizers/datacore.c
4ae388
+++ multipath-tools-130222/libmultipath/prioritizers/datacore.c
4ae388
@@ -25,6 +25,7 @@
4ae388
 #include <debug.h>
4ae388
 #include <prio.h>
4ae388
 #include <structs.h>
4ae388
+#include "def_func.h"
4ae388
 
4ae388
 #define INQ_REPLY_LEN 255
4ae388
 #define INQ_CMD_CODE 0x12
4ae388
@@ -111,3 +112,5 @@ int getprio (struct path * pp, char * ar
4ae388
         return datacore_prio(pp->dev, pp->fd, args);
4ae388
 }
4ae388
 
4ae388
+declare_nop_prio(initprio)
4ae388
+declare_nop_prio(freeprio)
4ae388
Index: multipath-tools-130222/libmultipath/prioritizers/def_func.h
4ae388
===================================================================
4ae388
--- /dev/null
4ae388
+++ multipath-tools-130222/libmultipath/prioritizers/def_func.h
4ae388
@@ -0,0 +1,11 @@
4ae388
+#ifndef _DEF_FUNC_H
4ae388
+#define _DEF_FUNC_H
4ae388
+
4ae388
+#include "prio.h"
4ae388
+
4ae388
+#define declare_nop_prio(name)						\
4ae388
+int name (struct prio *p)						\
4ae388
+{									\
4ae388
+	return 0;							\
4ae388
+}
4ae388
+#endif /* _DEF_FUNC_H */
4ae388
Index: multipath-tools-130222/libmultipath/prioritizers/emc.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/prioritizers/emc.c
4ae388
+++ multipath-tools-130222/libmultipath/prioritizers/emc.c
4ae388
@@ -6,6 +6,7 @@
4ae388
 #include <debug.h>
4ae388
 #include <prio.h>
4ae388
 #include <structs.h>
4ae388
+#include "def_func.h"
4ae388
 
4ae388
 #define INQUIRY_CMD     0x12
4ae388
 #define INQUIRY_CMDLEN  6
4ae388
@@ -85,3 +86,6 @@ int getprio (struct path * pp, char * ar
4ae388
 {
4ae388
 	return emc_clariion_prio(pp->dev, pp->fd);
4ae388
 }
4ae388
+
4ae388
+declare_nop_prio(initprio)
4ae388
+declare_nop_prio(freeprio)
4ae388
Index: multipath-tools-130222/libmultipath/prioritizers/hds.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/prioritizers/hds.c
4ae388
+++ multipath-tools-130222/libmultipath/prioritizers/hds.c
4ae388
@@ -76,6 +76,7 @@
4ae388
 #include <debug.h>
4ae388
 #include <prio.h>
4ae388
 #include <structs.h>
4ae388
+#include "def_func.h"
4ae388
 
4ae388
 #define INQ_REPLY_LEN 255
4ae388
 #define INQ_CMD_CODE 0x12
4ae388
@@ -170,3 +171,6 @@ int getprio (struct path * pp, char * ar
4ae388
 {
4ae388
 	return hds_modular_prio(pp->dev, pp->fd);
4ae388
 }
4ae388
+
4ae388
+declare_nop_prio(initprio)
4ae388
+declare_nop_prio(freeprio)
4ae388
Index: multipath-tools-130222/libmultipath/prioritizers/hp_sw.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/prioritizers/hp_sw.c
4ae388
+++ multipath-tools-130222/libmultipath/prioritizers/hp_sw.c
4ae388
@@ -16,6 +16,7 @@
4ae388
 #include <debug.h>
4ae388
 #include <prio.h>
4ae388
 #include <structs.h>
4ae388
+#include "def_func.h"
4ae388
 
4ae388
 #define TUR_CMD_LEN		6
4ae388
 #define SCSI_CHECK_CONDITION	0x2
4ae388
@@ -99,3 +100,6 @@ int getprio (struct path * pp, char * ar
4ae388
 {
4ae388
 	return hp_sw_prio(pp->dev, pp->fd);
4ae388
 }
4ae388
+
4ae388
+declare_nop_prio(initprio)
4ae388
+declare_nop_prio(freeprio)
4ae388
Index: multipath-tools-130222/libmultipath/prioritizers/iet.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/prioritizers/iet.c
4ae388
+++ multipath-tools-130222/libmultipath/prioritizers/iet.c
4ae388
@@ -9,6 +9,7 @@
4ae388
 #include <debug.h>
4ae388
 #include <unistd.h>
4ae388
 #include <structs.h>
4ae388
+#include "def_func.h"
4ae388
 
4ae388
 //
4ae388
 // This prioritizer suits iSCSI needs, makes it possible to prefer one path.
4ae388
@@ -141,3 +142,6 @@ int getprio(struct path * pp, char * arg
4ae388
 {
4ae388
 	return iet_prio(pp->dev, args);
4ae388
 }
4ae388
+
4ae388
+declare_nop_prio(initprio)
4ae388
+declare_nop_prio(freeprio)
4ae388
Index: multipath-tools-130222/libmultipath/prioritizers/ontap.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/prioritizers/ontap.c
4ae388
+++ multipath-tools-130222/libmultipath/prioritizers/ontap.c
4ae388
@@ -23,6 +23,7 @@
4ae388
 #include <debug.h>
4ae388
 #include <prio.h>
4ae388
 #include <structs.h>
4ae388
+#include "def_func.h"
4ae388
 
4ae388
 #define INQUIRY_CMD	0x12
4ae388
 #define INQUIRY_CMDLEN	6
4ae388
@@ -245,3 +246,6 @@ int getprio (struct path * pp, char * ar
4ae388
 {
4ae388
 	return ontap_prio(pp->dev, pp->fd);
4ae388
 }
4ae388
+
4ae388
+declare_nop_prio(initprio)
4ae388
+declare_nop_prio(freeprio)
4ae388
Index: multipath-tools-130222/libmultipath/prioritizers/random.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/prioritizers/random.c
4ae388
+++ multipath-tools-130222/libmultipath/prioritizers/random.c
4ae388
@@ -4,6 +4,7 @@
4ae388
 #include <time.h>
4ae388
 
4ae388
 #include <prio.h>
4ae388
+#include "def_func.h"
4ae388
 
4ae388
 int getprio (struct path * pp, char * args)
4ae388
 {
4ae388
@@ -13,3 +14,6 @@ int getprio (struct path * pp, char * ar
4ae388
 	srand((unsigned int)tv.tv_usec);
4ae388
 	return 1+(int) (10.0*rand()/(RAND_MAX+1.0));
4ae388
 }
4ae388
+
4ae388
+declare_nop_prio(initprio)
4ae388
+declare_nop_prio(freeprio)
4ae388
Index: multipath-tools-130222/libmultipath/prioritizers/rdac.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/prioritizers/rdac.c
4ae388
+++ multipath-tools-130222/libmultipath/prioritizers/rdac.c
4ae388
@@ -6,6 +6,7 @@
4ae388
 #include <debug.h>
4ae388
 #include <prio.h>
4ae388
 #include <structs.h>
4ae388
+#include "def_func.h"
4ae388
 
4ae388
 #define INQUIRY_CMD     0x12
4ae388
 #define INQUIRY_CMDLEN  6
4ae388
@@ -95,3 +96,6 @@ int getprio (struct path * pp, char * ar
4ae388
 {
4ae388
 	return rdac_prio(pp->dev, pp->fd);
4ae388
 }
4ae388
+
4ae388
+declare_nop_prio(initprio)
4ae388
+declare_nop_prio(freeprio)
4ae388
Index: multipath-tools-130222/libmultipath/prioritizers/weightedpath.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/prioritizers/weightedpath.c
4ae388
+++ multipath-tools-130222/libmultipath/prioritizers/weightedpath.c
4ae388
@@ -32,6 +32,7 @@
4ae388
 #include <memory.h>
4ae388
 #include <debug.h>
4ae388
 #include <regex.h>
4ae388
+#include "def_func.h"
4ae388
 
4ae388
 char *get_next_string(char **temp, char *split_char)
4ae388
 {
4ae388
@@ -104,3 +105,5 @@ int getprio(struct path *pp, char *args)
4ae388
 	return prio_path_weight(pp, args);
4ae388
 }
4ae388
 
4ae388
+declare_nop_prio(initprio)
4ae388
+declare_nop_prio(freeprio)
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
@@ -401,10 +401,10 @@ detect_prio(struct path * pp)
4ae388
 
4ae388
 	if (get_target_port_group_support(pp->fd) <= 0)
4ae388
 		return;
4ae388
-	ret = get_target_port_group(pp->fd);
4ae388
+	ret = get_target_port_group(pp->fd, NULL);
4ae388
 	if (ret < 0)
4ae388
 		return;
4ae388
-	if (get_asymmetric_access_state(pp->fd, ret) < 0)
4ae388
+	if (get_asymmetric_access_state(pp->fd, ret, NULL) < 0)
4ae388
 		return;
4ae388
 	prio_get(p, PRIO_ALUA, DEFAULT_PRIO_ARGS);
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
@@ -700,20 +700,23 @@ static int
4ae388
 uev_update_path (struct uevent *uev, struct vectors * vecs)
4ae388
 {
4ae388
 	int ro, retval = 0;
4ae388
+	struct path * pp;
4ae388
+
4ae388
+	pp = find_path_by_dev(vecs->pathvec, uev->kernel);
4ae388
+	if (!pp) {
4ae388
+		condlog(0, "%s: spurious uevent, path not found",
4ae388
+			uev->kernel);
4ae388
+		return 1;
4ae388
+	}
4ae388
+	/* reinit the prio values on change event, in case something is
4ae388
+	 * different */
4ae388
+	prio_init(&pp->prio);
4ae388
 
4ae388
 	ro = uevent_get_disk_ro(uev);
4ae388
 
4ae388
 	if (ro >= 0) {
4ae388
-		struct path * pp;
4ae388
-
4ae388
 		condlog(2, "%s: update path write_protect to '%d' (uevent)",
4ae388
 			uev->kernel, ro);
4ae388
-		pp = find_path_by_dev(vecs->pathvec, uev->kernel);
4ae388
-		if (!pp) {
4ae388
-			condlog(0, "%s: spurious uevent, path not found",
4ae388
-				uev->kernel);
4ae388
-			return 1;
4ae388
-		}
4ae388
 		if (pp->mpp) {
4ae388
 			retval = reload_map(vecs, pp->mpp, 0);
4ae388
 
4ae388
@@ -1218,6 +1221,11 @@ check_path (struct vectors * vecs, struc
4ae388
 		}
4ae388
 
4ae388
 		if(newstate == PATH_UP || newstate == PATH_GHOST){
4ae388
+		 	/*
4ae388
+			 * Reinitialize the prioritizer, in case something
4ae388
+		 	 * changed.
4ae388
+		 	 */
4ae388
+			prio_init(&pp->prio);
4ae388
 			if ( pp->mpp && pp->mpp->prflag ){
4ae388
 				/*
4ae388
 				 * Check Persistent Reservation.