[PATCH 2/2] libmultipath: accept wwids in find_mp_by_str

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the device string is not an alias, check if it's a wwid. This allows
multipathd commands to use WWIDs for $map arguments. In find_mp_by_wwid,
only check strings that are small enough to be WWIDs.

Signed-off-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx>
---
 libmultipath/structs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index d89f2187..be3125ed 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -443,7 +443,7 @@ find_mp_by_wwid (const struct _vector *mpvec, const char * wwid)
 	int i;
 	struct multipath * mpp;
 
-	if (!mpvec)
+	if (!mpvec || strlen(wwid) >= WWID_SIZE)
 		return NULL;
 
 	vector_foreach_slot (mpvec, mpp, i)
@@ -487,6 +487,8 @@ find_mp_by_str (const struct _vector *mpvec, const char * str)
 		mpp = find_mp_by_minor(mpvec, minor);
 	if (!mpp)
 		mpp = find_mp_by_alias(mpvec, str);
+	if (!mpp)
+		mpp = find_mp_by_wwid(mpvec, str);
 
 	if (!mpp)
 		condlog(2, "%s: invalid map name.", str);
-- 
2.45.0





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux