* [PATCH] Correctly ignore empty prio names
@ 2013-05-08 9:13 Hannes Reinecke
2013-05-08 9:52 ` Christophe Varoqui
2013-05-08 16:28 ` Benjamin Marzinski
0 siblings, 2 replies; 4+ messages in thread
From: Hannes Reinecke @ 2013-05-08 9:13 UTC (permalink / raw)
To: Christope Varoqui; +Cc: dm-devel
This is a partial revert of commit
'Stop annoying prio_lookup warning messages',
as that patch would only fix the 'prio_put' case.
However, as the prio name might be empty even in
in prio_get() we should rather fix this in
prio_lookup() and handle both cases.
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/libmultipath/prio.c b/libmultipath/prio.c
index 186cc4d..05a8cf1 100644
--- a/libmultipath/prio.c
+++ b/libmultipath/prio.c
@@ -64,6 +64,9 @@ struct prio * prio_lookup (char * name)
{
struct prio * p;
+ if (!name || !strlen(name))
+ return NULL;
+
list_for_each_entry(p, &prioritizers, node) {
if (!strncmp(name, p->name, PRIO_NAME_LEN))
return p;
@@ -162,10 +165,7 @@ void prio_put (struct prio * dst)
if (!dst)
return;
- if (!strlen(dst->name))
- src = NULL;
- else
- src = prio_lookup(dst->name);
+ src = prio_lookup(dst->name);
memset(dst, 0x0, sizeof(struct prio));
free_prio(src);
}
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] Correctly ignore empty prio names
2013-05-08 9:13 [PATCH] Correctly ignore empty prio names Hannes Reinecke
@ 2013-05-08 9:52 ` Christophe Varoqui
2013-05-08 16:28 ` Benjamin Marzinski
1 sibling, 0 replies; 4+ messages in thread
From: Christophe Varoqui @ 2013-05-08 9:52 UTC (permalink / raw)
To: Hannes Reinecke; +Cc: dm-devel
On mer., 2013-05-08 at 11:13 +0200, Hannes Reinecke wrote:
> This is a partial revert of commit
> 'Stop annoying prio_lookup warning messages',
> as that patch would only fix the 'prio_put' case.
> However, as the prio name might be empty even in
> in prio_get() we should rather fix this in
> prio_lookup() and handle both cases.
>
Sorry I overlooked your comments on this patch.
Applied.
> Signed-off-by: Hannes Reinecke <hare@suse.de>
>
> diff --git a/libmultipath/prio.c b/libmultipath/prio.c
> index 186cc4d..05a8cf1 100644
> --- a/libmultipath/prio.c
> +++ b/libmultipath/prio.c
> @@ -64,6 +64,9 @@ struct prio * prio_lookup (char * name)
> {
> struct prio * p;
>
> + if (!name || !strlen(name))
> + return NULL;
> +
> list_for_each_entry(p, &prioritizers, node) {
> if (!strncmp(name, p->name, PRIO_NAME_LEN))
> return p;
> @@ -162,10 +165,7 @@ void prio_put (struct prio * dst)
> if (!dst)
> return;
>
> - if (!strlen(dst->name))
> - src = NULL;
> - else
> - src = prio_lookup(dst->name);
> + src = prio_lookup(dst->name);
> memset(dst, 0x0, sizeof(struct prio));
> free_prio(src);
> }
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Correctly ignore empty prio names
2013-05-08 9:13 [PATCH] Correctly ignore empty prio names Hannes Reinecke
2013-05-08 9:52 ` Christophe Varoqui
@ 2013-05-08 16:28 ` Benjamin Marzinski
2013-05-10 14:48 ` Hannes Reinecke
1 sibling, 1 reply; 4+ messages in thread
From: Benjamin Marzinski @ 2013-05-08 16:28 UTC (permalink / raw)
To: Hannes Reinecke; +Cc: dm-devel, Christope Varoqui
On Wed, May 08, 2013 at 11:13:43AM +0200, Hannes Reinecke wrote:
> This is a partial revert of commit
> 'Stop annoying prio_lookup warning messages',
> as that patch would only fix the 'prio_put' case.
> However, as the prio name might be empty even in
> in prio_get() we should rather fix this in
> prio_lookup() and handle both cases.
My feeling was that you would want to get that warning message if you
failed to get the prioritizer in prio_get() because the name was empty.
With this change it will silently fail unless you have the verbosity set
to 3, in which case you'll get a message like
sdb: prio = (config file default)
Which doesn't really look that much like an error.
On the other hand, if you never got a prioritizer at all, you don't want
a warning message when you try to free it in prio_put() since that's
only happening because there is nothing to free.
What you you think?
-Ben
>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
>
> diff --git a/libmultipath/prio.c b/libmultipath/prio.c
> index 186cc4d..05a8cf1 100644
> --- a/libmultipath/prio.c
> +++ b/libmultipath/prio.c
> @@ -64,6 +64,9 @@ struct prio * prio_lookup (char * name)
> {
> struct prio * p;
>
> + if (!name || !strlen(name))
> + return NULL;
> +
> list_for_each_entry(p, &prioritizers, node) {
> if (!strncmp(name, p->name, PRIO_NAME_LEN))
> return p;
> @@ -162,10 +165,7 @@ void prio_put (struct prio * dst)
> if (!dst)
> return;
>
> - if (!strlen(dst->name))
> - src = NULL;
> - else
> - src = prio_lookup(dst->name);
> + src = prio_lookup(dst->name);
> memset(dst, 0x0, sizeof(struct prio));
> free_prio(src);
> }
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Correctly ignore empty prio names
2013-05-08 16:28 ` Benjamin Marzinski
@ 2013-05-10 14:48 ` Hannes Reinecke
0 siblings, 0 replies; 4+ messages in thread
From: Hannes Reinecke @ 2013-05-10 14:48 UTC (permalink / raw)
To: Benjamin Marzinski; +Cc: dm-devel, Christope Varoqui
On 05/08/2013 06:28 PM, Benjamin Marzinski wrote:
> On Wed, May 08, 2013 at 11:13:43AM +0200, Hannes Reinecke wrote:
>> This is a partial revert of commit
>> 'Stop annoying prio_lookup warning messages',
>> as that patch would only fix the 'prio_put' case.
>> However, as the prio name might be empty even in
>> in prio_get() we should rather fix this in
>> prio_lookup() and handle both cases.
>
> My feeling was that you would want to get that warning message if you
> failed to get the prioritizer in prio_get() because the name was empty.
> With this change it will silently fail unless you have the verbosity set
> to 3, in which case you'll get a message like
>
> sdb: prio = (config file default)
>
> Which doesn't really look that much like an error.
>
Yeah, one should modify this message.
> On the other hand, if you never got a prioritizer at all, you don't want
> a warning message when you try to free it in prio_put() since that's
> only happening because there is nothing to free.
>
I'd rather have the functions to do the correct thing.
We've had tons and tons of issues with multipathing just because
no-one ever checked the function arguments.
So we should not be introducing this behaviour again.
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-05-10 14:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-08 9:13 [PATCH] Correctly ignore empty prio names Hannes Reinecke
2013-05-08 9:52 ` Christophe Varoqui
2013-05-08 16:28 ` Benjamin Marzinski
2013-05-10 14:48 ` Hannes Reinecke
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.