diff mbox series

[v3,4/4] libmultipath: change log level for null uid_attribute

Message ID 1603316366-28735-5-git-send-email-bmarzins@redhat.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show
Series add library to check if device is a valid path | expand

Commit Message

Benjamin Marzinski Oct. 21, 2020, 9:39 p.m. UTC
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 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Martin Wilck Nov. 1, 2020, 8:48 p.m. UTC | #1
On Wed, 2020-10-21 at 16:39 -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>
Reviewed-by:Martin Wilck <mwilck@suse.com>


--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
diff mbox series

Patch

diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index d7e8577f..950b1586 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -2084,8 +2084,11 @@  get_uid (struct path * pp, int path_state, struct udev_device *udev,
 			len = strlen(pp->wwid);
 		origin = "callout";
 	} else {
-		bool udev_available = udev && pp->uid_attribute
+		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 = get_udev_uid(pp, pp->uid_attribute, udev);
@@ -2095,7 +2098,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 || !empty_uid_attr)
+				used_fallback = 1;
 			len = uid_fallback(pp, path_state, &origin);
 		}
 	}