|
|
0fe00a |
---
|
|
|
0fe00a |
libmultipath/checkers.c | 29 +++++++++++++++++++++++++++--
|
|
|
0fe00a |
libmultipath/checkers.h | 2 ++
|
|
|
0fe00a |
libmultipath/checkers/cciss_tur.c | 5 +++++
|
|
|
0fe00a |
libmultipath/checkers/directio.c | 5 +++++
|
|
|
0fe00a |
libmultipath/checkers/emc_clariion.c | 7 +++++++
|
|
|
0fe00a |
libmultipath/checkers/hp_sw.c | 5 +++++
|
|
|
0fe00a |
libmultipath/checkers/rdac.c | 5 +++++
|
|
|
0fe00a |
libmultipath/checkers/readsector0.c | 5 +++++
|
|
|
0fe00a |
libmultipath/checkers/tur.c | 5 +++++
|
|
|
0fe00a |
libmultipath/discovery.c | 2 ++
|
|
|
0fe00a |
10 files changed, 68 insertions(+), 2 deletions(-)
|
|
|
0fe00a |
|
|
|
0fe00a |
Index: multipath-tools-130222/libmultipath/checkers.c
|
|
|
0fe00a |
===================================================================
|
|
|
0fe00a |
--- multipath-tools-130222.orig/libmultipath/checkers.c
|
|
|
0fe00a |
+++ multipath-tools-130222/libmultipath/checkers.c
|
|
|
0fe00a |
@@ -132,6 +132,13 @@ struct checker * add_checker (char * nam
|
|
|
0fe00a |
if (!c->init)
|
|
|
0fe00a |
goto out;
|
|
|
0fe00a |
|
|
|
0fe00a |
+ c->mp_init = (int (*)(struct checker *)) dlsym(c->handle, "libcheck_mp_init");
|
|
|
0fe00a |
+ errstr = dlerror();
|
|
|
0fe00a |
+ if (errstr != NULL)
|
|
|
0fe00a |
+ condlog(0, "A dynamic linking error occurred: (%s)", errstr);
|
|
|
0fe00a |
+ if (!c->mp_init)
|
|
|
0fe00a |
+ goto out;
|
|
|
0fe00a |
+
|
|
|
0fe00a |
c->free = (void (*)(struct checker *)) dlsym(c->handle, "libcheck_free");
|
|
|
0fe00a |
errstr = dlerror();
|
|
|
0fe00a |
if (errstr != NULL)
|
|
|
0fe00a |
@@ -189,8 +196,25 @@ int checker_init (struct checker * c, vo
|
|
|
0fe00a |
if (!c)
|
|
|
0fe00a |
return 1;
|
|
|
0fe00a |
c->mpcontext = mpctxt_addr;
|
|
|
0fe00a |
- if (c->init)
|
|
|
0fe00a |
- return c->init(c);
|
|
|
0fe00a |
+ if (c->init && c->init(c) != 0)
|
|
|
0fe00a |
+ return 1;
|
|
|
0fe00a |
+ if (mpctxt_addr && *mpctxt_addr == NULL && c->mp_init &&
|
|
|
0fe00a |
+ c->mp_init(c) != 0) /* for now, continue even if mp_init fails */
|
|
|
0fe00a |
+ c->mpcontext = NULL;
|
|
|
0fe00a |
+ return 0;
|
|
|
0fe00a |
+}
|
|
|
0fe00a |
+
|
|
|
0fe00a |
+int checker_mp_init(struct checker * c, void ** mpctxt_addr)
|
|
|
0fe00a |
+{
|
|
|
0fe00a |
+ if (!c)
|
|
|
0fe00a |
+ return 1;
|
|
|
0fe00a |
+ if (c->mp_init && !c->mpcontext && mpctxt_addr) {
|
|
|
0fe00a |
+ c->mpcontext = mpctxt_addr;
|
|
|
0fe00a |
+ if (c->mp_init(c) != 0) {
|
|
|
0fe00a |
+ c->mpcontext = NULL;
|
|
|
0fe00a |
+ return 1;
|
|
|
0fe00a |
+ }
|
|
|
0fe00a |
+ }
|
|
|
0fe00a |
return 0;
|
|
|
0fe00a |
}
|
|
|
0fe00a |
|
|
|
0fe00a |
@@ -277,6 +301,7 @@ void checker_get (struct checker * dst,
|
|
|
0fe00a |
strncpy(dst->message, src->message, CHECKER_MSG_LEN);
|
|
|
0fe00a |
dst->check = src->check;
|
|
|
0fe00a |
dst->init = src->init;
|
|
|
0fe00a |
+ dst->mp_init = src->mp_init;
|
|
|
0fe00a |
dst->free = src->free;
|
|
|
0fe00a |
dst->handle = NULL;
|
|
|
0fe00a |
src->refcount++;
|
|
|
0fe00a |
Index: multipath-tools-130222/libmultipath/checkers.h
|
|
|
0fe00a |
===================================================================
|
|
|
0fe00a |
--- multipath-tools-130222.orig/libmultipath/checkers.h
|
|
|
0fe00a |
+++ multipath-tools-130222/libmultipath/checkers.h
|
|
|
0fe00a |
@@ -107,6 +107,7 @@ struct checker {
|
|
|
0fe00a |
you want to stuff data in. */
|
|
|
0fe00a |
int (*check)(struct checker *);
|
|
|
0fe00a |
int (*init)(struct checker *); /* to allocate the context */
|
|
|
0fe00a |
+ int (*mp_init)(struct checker *); /* to allocate the mpcontext */
|
|
|
0fe00a |
void (*free)(struct checker *); /* to free the context */
|
|
|
0fe00a |
};
|
|
|
0fe00a |
|
|
|
0fe00a |
@@ -118,6 +119,7 @@ void cleanup_checkers (void);
|
|
|
0fe00a |
struct checker * add_checker (char *);
|
|
|
0fe00a |
struct checker * checker_lookup (char *);
|
|
|
0fe00a |
int checker_init (struct checker *, void **);
|
|
|
0fe00a |
+int checker_mp_init (struct checker *, void **);
|
|
|
0fe00a |
void checker_put (struct checker *);
|
|
|
0fe00a |
void checker_reset (struct checker *);
|
|
|
0fe00a |
void checker_set_sync (struct checker *);
|
|
|
0fe00a |
Index: multipath-tools-130222/libmultipath/discovery.c
|
|
|
0fe00a |
===================================================================
|
|
|
0fe00a |
--- multipath-tools-130222.orig/libmultipath/discovery.c
|
|
|
0fe00a |
+++ multipath-tools-130222/libmultipath/discovery.c
|
|
|
0fe00a |
@@ -1217,6 +1217,8 @@ get_state (struct path * pp, int daemon,
|
|
|
0fe00a |
return PATH_UNCHECKED;
|
|
|
0fe00a |
}
|
|
|
0fe00a |
}
|
|
|
0fe00a |
+ if (pp->mpp && !c->mpcontext)
|
|
|
0fe00a |
+ checker_mp_init(c, &pp->mpp->mpcontext);
|
|
|
0fe00a |
checker_clear_message(c);
|
|
|
0fe00a |
if (daemon) {
|
|
|
0fe00a |
if (conf->force_sync == 0)
|
|
|
0fe00a |
Index: multipath-tools-130222/libmultipath/checkers/cciss_tur.c
|
|
|
0fe00a |
===================================================================
|
|
|
0fe00a |
--- multipath-tools-130222.orig/libmultipath/checkers/cciss_tur.c
|
|
|
0fe00a |
+++ multipath-tools-130222/libmultipath/checkers/cciss_tur.c
|
|
|
0fe00a |
@@ -58,6 +58,11 @@ int libcheck_init (struct checker * c)
|
|
|
0fe00a |
return 0;
|
|
|
0fe00a |
}
|
|
|
0fe00a |
|
|
|
0fe00a |
+int libcheck_mp_init (struct checker * c)
|
|
|
0fe00a |
+{
|
|
|
0fe00a |
+ return 0;
|
|
|
0fe00a |
+}
|
|
|
0fe00a |
+
|
|
|
0fe00a |
void libcheck_free (struct checker * c)
|
|
|
0fe00a |
{
|
|
|
0fe00a |
return;
|
|
|
0fe00a |
Index: multipath-tools-130222/libmultipath/checkers/directio.c
|
|
|
0fe00a |
===================================================================
|
|
|
0fe00a |
--- multipath-tools-130222.orig/libmultipath/checkers/directio.c
|
|
|
0fe00a |
+++ multipath-tools-130222/libmultipath/checkers/directio.c
|
|
|
0fe00a |
@@ -94,6 +94,11 @@ out:
|
|
|
0fe00a |
return 1;
|
|
|
0fe00a |
}
|
|
|
0fe00a |
|
|
|
0fe00a |
+int libcheck_mp_init(struct checker * c)
|
|
|
0fe00a |
+{
|
|
|
0fe00a |
+ return 0;
|
|
|
0fe00a |
+}
|
|
|
0fe00a |
+
|
|
|
0fe00a |
void libcheck_free (struct checker * c)
|
|
|
0fe00a |
{
|
|
|
0fe00a |
struct directio_context * ct = (struct directio_context *)c->context;
|
|
|
0fe00a |
Index: multipath-tools-130222/libmultipath/checkers/emc_clariion.c
|
|
|
0fe00a |
===================================================================
|
|
|
0fe00a |
--- multipath-tools-130222.orig/libmultipath/checkers/emc_clariion.c
|
|
|
0fe00a |
+++ multipath-tools-130222/libmultipath/checkers/emc_clariion.c
|
|
|
0fe00a |
@@ -73,11 +73,18 @@ int libcheck_init (struct checker * c)
|
|
|
0fe00a |
return 1;
|
|
|
0fe00a |
((struct emc_clariion_checker_path_context *)c->context)->wwn_set = 0;
|
|
|
0fe00a |
|
|
|
0fe00a |
+ return 0;
|
|
|
0fe00a |
+}
|
|
|
0fe00a |
+
|
|
|
0fe00a |
+int libcheck_mp_init (struct checker * c)
|
|
|
0fe00a |
+{
|
|
|
0fe00a |
/*
|
|
|
0fe00a |
* Allocate and initialize the multi-path global context.
|
|
|
0fe00a |
*/
|
|
|
0fe00a |
if (c->mpcontext && *c->mpcontext == NULL) {
|
|
|
0fe00a |
void * mpctxt = malloc(sizeof(int));
|
|
|
0fe00a |
+ if (!mpctxt)
|
|
|
0fe00a |
+ return 1;
|
|
|
0fe00a |
*c->mpcontext = mpctxt;
|
|
|
0fe00a |
CLR_INACTIVE_SNAP(c);
|
|
|
0fe00a |
}
|
|
|
0fe00a |
Index: multipath-tools-130222/libmultipath/checkers/hp_sw.c
|
|
|
0fe00a |
===================================================================
|
|
|
0fe00a |
--- multipath-tools-130222.orig/libmultipath/checkers/hp_sw.c
|
|
|
0fe00a |
+++ multipath-tools-130222/libmultipath/checkers/hp_sw.c
|
|
|
0fe00a |
@@ -39,6 +39,11 @@ int libcheck_init (struct checker * c)
|
|
|
0fe00a |
return 0;
|
|
|
0fe00a |
}
|
|
|
0fe00a |
|
|
|
0fe00a |
+int libcheck_mp_init(struct checker * c)
|
|
|
0fe00a |
+{
|
|
|
0fe00a |
+ return 0;
|
|
|
0fe00a |
+}
|
|
|
0fe00a |
+
|
|
|
0fe00a |
void libcheck_free (struct checker * c)
|
|
|
0fe00a |
{
|
|
|
0fe00a |
return;
|
|
|
0fe00a |
Index: multipath-tools-130222/libmultipath/checkers/rdac.c
|
|
|
0fe00a |
===================================================================
|
|
|
0fe00a |
--- multipath-tools-130222.orig/libmultipath/checkers/rdac.c
|
|
|
0fe00a |
+++ multipath-tools-130222/libmultipath/checkers/rdac.c
|
|
|
0fe00a |
@@ -134,6 +134,11 @@ out:
|
|
|
0fe00a |
return 0;
|
|
|
0fe00a |
}
|
|
|
0fe00a |
|
|
|
0fe00a |
+int libcheck_mp_init(struct checker * c)
|
|
|
0fe00a |
+{
|
|
|
0fe00a |
+ return 0;
|
|
|
0fe00a |
+}
|
|
|
0fe00a |
+
|
|
|
0fe00a |
void libcheck_free (struct checker * c)
|
|
|
0fe00a |
{
|
|
|
0fe00a |
return;
|
|
|
0fe00a |
Index: multipath-tools-130222/libmultipath/checkers/readsector0.c
|
|
|
0fe00a |
===================================================================
|
|
|
0fe00a |
--- multipath-tools-130222.orig/libmultipath/checkers/readsector0.c
|
|
|
0fe00a |
+++ multipath-tools-130222/libmultipath/checkers/readsector0.c
|
|
|
0fe00a |
@@ -18,6 +18,11 @@ int libcheck_init (struct checker * c)
|
|
|
0fe00a |
return 0;
|
|
|
0fe00a |
}
|
|
|
0fe00a |
|
|
|
0fe00a |
+int libcheck_mp_init(struct checker * c)
|
|
|
0fe00a |
+{
|
|
|
0fe00a |
+ return 0;
|
|
|
0fe00a |
+}
|
|
|
0fe00a |
+
|
|
|
0fe00a |
void libcheck_free (struct checker * c)
|
|
|
0fe00a |
{
|
|
|
0fe00a |
return;
|
|
|
0fe00a |
Index: multipath-tools-130222/libmultipath/checkers/tur.c
|
|
|
0fe00a |
===================================================================
|
|
|
0fe00a |
--- multipath-tools-130222.orig/libmultipath/checkers/tur.c
|
|
|
0fe00a |
+++ multipath-tools-130222/libmultipath/checkers/tur.c
|
|
|
0fe00a |
@@ -158,6 +158,11 @@ int libcheck_init (struct checker * c)
|
|
|
0fe00a |
return 0;
|
|
|
0fe00a |
}
|
|
|
0fe00a |
|
|
|
0fe00a |
+int libcheck_mp_init(struct checker * c)
|
|
|
0fe00a |
+{
|
|
|
0fe00a |
+ return 0;
|
|
|
0fe00a |
+}
|
|
|
0fe00a |
+
|
|
|
0fe00a |
void cleanup_context(struct tur_checker_context *ct)
|
|
|
0fe00a |
{
|
|
|
0fe00a |
pthread_mutex_destroy(&ct->lock);
|