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

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