do not allow in-use path to change wwid
authorBenjamin Marzinski <bmarzins@redhat.com>
Sat, 29 Oct 2016 02:55:19 +0000 (21:55 -0500)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Thu, 3 Nov 2016 13:24:33 +0000 (14:24 +0100)
When a path is part of a multipath device, it must not change it's wwid.
If it can, when multipathd is reconfigured, you can end up with two
multipath devices owning the same path, eventually leading to a crash.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
libmultipath/dmparser.c

index 9e79ecd..87e8398 100644 (file)
@@ -380,6 +380,14 @@ disassemble_map (vector pathvec, char * params, struct multipath * mpp,
                                strncpy(pp->wwid, mpp->wwid,
                                        WWID_SIZE - 1);
 
+                       /*
+                        * Do not allow in-use patch to change wwid
+                        */
+                       else if (strcmp(pp->wwid, mpp->wwid) != 0) {
+                               condlog(0, "%s: path wwid appears to have changed. Using map wwid.\n", pp->dev_t);
+                               strncpy(pp->wwid, mpp->wwid, WWID_SIZE);
+                       }
+
                        pgp->id ^= (long)pp;
                        pp->pgindex = i + 1;