Skip to content

Issue with UFS storages #142

Description

@fhost

Hello,

I have a probem with version 0.14.3 (ubuntu resolute version), that I don't have with 0.11.1 (ubuntu noble version).

On my device, I have a UFS storage, split into multiple LUNs. This makes the storage appear as multiple disks (sda, sdb, etc...).
Of course, all those disks have the same wwid (as it is the same storage). So multipath tries to handle them.

This brings 2 issues.

  1. It will find sda, wwid X, then sdb, wwid X, so it will make a map. But sda won't be added, as the size differ. But the map is still created anyway. This has two bad side effect:

    • Puts wwid as a valid wwid in /etc/multipath/wwids, even if it is not;
    • Makes multipath -u /dev/sda # or sdb return 1, so on change uevent on those devices, udev rules 68-del-part-nodes.rules will run /usr/bin/partx -d --nr 1-1024 $env{DEVNAME}. This makes for example disappear my boot partition (/dev/sda1), and so breaks my boot.

    I think size should be checked before making the map. Possible fix:

diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 9384de0..abdf933 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -300,6 +300,7 @@ int adopt_paths(vector pathvec, struct multipath *mpp,
 	int i, ret;
 	struct path * pp;
 	struct config *conf;
+	size_t count;

 	if (!mpp)
 		return 0;
@@ -307,6 +308,23 @@ int adopt_paths(vector pathvec, struct multipath *mpp,
 	if (update_mpp_paths(mpp, pathvec))
 		return 1;

+	count = 0;
+	vector_foreach_slot (pathvec, pp, i) {
+		if (!strncmp(mpp->wwid, pp->wwid, WWID_SIZE)) {
+			if (pp->size != 0 && mpp->size != 0 &&
+			    pp->size != mpp->size) {
+				condlog(3, "%s: size mismatch for %s, not adding path",
+					pp->dev, mpp->alias);
+				continue;
+			}
+		count += 1;
+		}
+	}
+	if (count < 2) {
+		condlog(3, "%s: only one path, cancel creation", mpp->alias);
+		return 1;
+	}
+
 	vector_foreach_slot (pathvec, pp, i) {
 		if (!strncmp(mpp->wwid, pp->wwid, WWID_SIZE)) {
 			if (pp->size != 0 && mpp->size != 0 &&
  1. A more generic issue with UFS. What if my two LUN have the same size? multipath would consider them as the same! I do think UFS storages should be blacklisted from multipath. But I don´t know how to do that. Note that this issue could also happen with 0.11.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions