dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Martin Wilck <martin.wilck@suse.com>
To: "bmarzins@redhat.com" <bmarzins@redhat.com>,
	"christophe.varoqui@opensvc.com" <christophe.varoqui@opensvc.com>
Cc: "dm-devel@redhat.com" <dm-devel@redhat.com>
Subject: Re: [RFC PATCH v2 3/3] libmultipath: change log level for null uid_attribute
Date: Thu, 24 Sep 2020 08:06:41 +0000	[thread overview]
Message-ID: <62ced86c81b139e6461fe0dc14207606548a652a.camel@suse.com> (raw)
In-Reply-To: <1600923569-17412-4-git-send-email-bmarzins@redhat.com>

On Wed, 2020-09-23 at 23:59 -0500, Benjamin Marzinski wrote:
> If uid_attribute is explicitly set to an empty string, multipath
> should
> log the uid at the default log level, since using the fallback code
> is
> the expected behavior.
> 
> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>  libmultipath/discovery.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
> index f650534f..435f2639 100644
> --- a/libmultipath/discovery.c
> +++ b/libmultipath/discovery.c
> @@ -2091,7 +2091,8 @@ get_uid (struct path * pp, int path_state,
> struct udev_device *udev,
>  		}
>  		if ((!udev_available || (len <= 0 && allow_fallback))
>  		    && has_uid_fallback(pp)) {
> -			used_fallback = 1;
> +			if (udev_available || !(udev && pp-
> >uid_attribute))
> +				used_fallback = 1;
>  			len = uid_fallback(pp, path_state, &origin);
>  		}
>  	}

Uff, this logic was convoluted anyway, now it's even harder to grasp.
IIUC, if !udev, used_fallback will be set to 1, even if 
pp->uid_attribute is the empty string. Is that intended?
To make this easier to read, I'd suggest something like this:

		bool valid_uid_attr = pp->uid_attribute
			&& *pp->uid_attribute;
		bool empty_uid_attr = pp->uid_attribute
			&& !*pp->uid_attribute;
		bool udev_available = udev && valid_uid_attr;
      ...
		if ((!udev_available || (len <= 0 && allow_fallback))
		    && has_uid_fallback(pp)) {
			if (!empty_uid_attr)
				used_fallback = 1;
			len = uid_fallback(pp, path_state, &origin);

Regards,
Martin

-- 
Dr. Martin Wilck <mwilck@suse.com>, Tel. +49 (0)911 74053 2107
SUSE  Software Solutions Germany GmbH
HRB 36809, AG Nürnberg GF: Felix
Imendörffer

  reply	other threads:[~2020-09-24  8:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-24  4:59 [RFC PATCH v2 0/3] add library to check if device is a valid path Benjamin Marzinski
2020-09-24  4:59 ` [RFC PATCH v2 1/3] multipath: add libmpathvalid library Benjamin Marzinski
2020-09-24  4:59 ` [RFC PATCH v2 2/3] libmultipath: add uid failback for dasd devices Benjamin Marzinski
2020-09-24  4:59 ` [RFC PATCH v2 3/3] libmultipath: change log level for null uid_attribute Benjamin Marzinski
2020-09-24  8:06   ` Martin Wilck [this message]
2020-09-24 16:20     ` Benjamin Marzinski
2020-09-24 19:03       ` Martin Wilck
2020-09-24  8:18 ` [RFC PATCH v2 0/3] add library to check if device is a valid path Martin Wilck
2020-09-24 16:30   ` Benjamin Marzinski
2020-09-24 19:22     ` Martin Wilck
2020-09-25  1:08       ` Benjamin Marzinski
2020-09-25 10:01         ` Martin Wilck
2020-09-25 15:34           ` Benjamin Marzinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=62ced86c81b139e6461fe0dc14207606548a652a.camel@suse.com \
    --to=martin.wilck@suse.com \
    --cc=bmarzins@redhat.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).