FAQ Search Today's Posts Mark Forums Read

» Linux Archive
Home
New Posts
Search
FAQ


Go Back   Linux Archive > Redhat > Device-mapper Development

 
 
LinkBack Thread Tools
 
Old 05-08-2008, 06:26 PM
Benjamin Marzinski
 
Default Only return the requested path checker

checker_lookup() silently returns the default checker if the requested
one can't be loaded. Even worse, it the default checker can't be loaded,
it gets stuck in an infinite loop.

It seems to me that if the requested checker can't be loaded, we should
just throw an error. That's what this patch does.

-Ben
Index: multipath-tools-temp/libmultipath/checkers.c
================================================== =================
--- multipath-tools-temp.orig/libmultipath/checkers.c
+++ multipath-tools-temp/libmultipath/checkers.c
@@ -47,10 +47,7 @@ struct checker * checker_lookup (char *
if (!strncmp(name, c->name, CHECKER_NAME_LEN))
return c;
}
- c = add_checker(name);
- if (c)
- return c;
- return checker_default();
+ return add_checker(name);
}

struct checker * add_checker (char * name)
@@ -179,6 +176,8 @@ struct checker * checker_default (void)

void checker_get (struct checker * dst, struct checker * src)
{
+ if (!src)
+ dst->check == NULL;
dst->fd = src->fd;
dst->sync = src->sync;
strncpy(dst->name, src->name, CHECKER_NAME_LEN);
Index: multipath-tools-temp/libmultipath/config.c
================================================== =================
--- multipath-tools-temp.orig/libmultipath/config.c
+++ multipath-tools-temp/libmultipath/config.c
@@ -457,6 +457,8 @@ load_config (char * file)

if (!conf->checker)
conf->checker = checker_lookup(DEFAULT_CHECKER);
+ if (!conf->checker)
+ goto out;

return 0;
out:
Index: multipath-tools-temp/libmultipath/dict.c
================================================== =================
--- multipath-tools-temp.orig/libmultipath/dict.c
+++ multipath-tools-temp/libmultipath/dict.c
@@ -129,6 +129,8 @@ def_path_checker_handler(vector strvec)

conf->checker = checker_lookup(buff);
FREE(buff);
+ if (!conf->checker)
+ return 1;

return 0;
}
@@ -562,6 +564,8 @@ hw_path_checker_handler(vector strvec)

hwe->checker = checker_lookup(buff);
FREE(buff);
+ if (!hwe->checker)
+ return 1;

return 0;
}
Index: multipath-tools-temp/libmultipath/hwtable.c
================================================== =================
--- multipath-tools-temp.orig/libmultipath/hwtable.c
+++ multipath-tools-temp/libmultipath/hwtable.c
@@ -733,6 +733,8 @@ setup_default_hwtable (vector hw)

while (hwe->vendor) {
hwe->checker = checker_lookup(hwe->checker_name);
+ if (!hwe->checker)
+ r++;
hwe->prio = prio_lookup(hwe->prio_name);
r += store_hwe(hw, hwe);
hwe++;
--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 

Thread Tools




All times are GMT. The time now is 09:53 PM.

VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org