From: Hannes Reinecke Date: Tue, 18 Nov 2008 09:57:27 +0000 (+0100) Subject: Unload priority modules X-Git-Tag: upstream/0.5.0~106^2~34 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=932e93baa101a7677afc4fe4032818f40da35b80;p=platform%2Fupstream%2Fmultipath-tools.git Unload priority modules We only load the priority modules, but never unload them. Signed-off-by: Hannes Reinecke --- diff --git a/libmultipath/prio.c b/libmultipath/prio.c index 7491682..13e6823 100644 --- a/libmultipath/prio.c +++ b/libmultipath/prio.c @@ -23,6 +23,9 @@ static struct prio * alloc_prio (void) void free_prio (struct prio * p) { + list_del(&p->node); + if (p->handle) + dlclose(p->handle); FREE(p); } @@ -32,7 +35,6 @@ void cleanup_prio(void) struct prio * prio_temp; list_for_each_entry_safe(prio_loop, prio_temp, &prioritizers, node) { - list_del(&prio_loop->node); free_prio(prio_loop); } } @@ -56,7 +58,6 @@ int prio_set_args (struct prio * p, char * args) struct prio * add_prio (char * name) { char libname[LIB_PRIO_NAMELEN]; - void * handle; struct prio * p; char *errstr; @@ -66,16 +67,16 @@ struct prio * add_prio (char * name) snprintf(libname, LIB_PRIO_NAMELEN, "%s/libprio%s.so", conf->multipath_dir, name); condlog(3, "loading %s prioritizer", libname); - handle = dlopen(libname, RTLD_NOW); + p->handle = dlopen(libname, RTLD_NOW); errstr = dlerror(); if (errstr != NULL) - condlog(0, "A dynamic linking error occurred: (%s)", errstr); - if (!handle) + condlog(0, "A dynamic linking error occurred: (%s)", errstr); + if (!p->handle) goto out; - p->getprio = (int (*)(struct path *, char *)) dlsym(handle, "getprio"); + p->getprio = (int (*)(struct path *, char *)) dlsym(p->handle, "getprio"); errstr = dlerror(); if (errstr != NULL) - condlog(0, "A dynamic linking error occurred: (%s)", errstr); + condlog(0, "A dynamic linking error occurred: (%s)", errstr); if (!p->getprio) goto out; snprintf(p->name, PRIO_NAME_LEN, "%s", name); diff --git a/libmultipath/prio.h b/libmultipath/prio.h index c948783..36929fb 100644 --- a/libmultipath/prio.h +++ b/libmultipath/prio.h @@ -40,6 +40,7 @@ #define PRIO_ARGS_LEN 255 struct prio { + void *handle; struct list_head node; char name[PRIO_NAME_LEN]; char args[PRIO_ARGS_LEN];