multipath-tools: prevent unexpected swapping of underlying LUNs
authorJun'ichi Nomura <j-nomura@ce.jp.nec.com>
Fri, 17 Aug 2012 08:40:39 +0000 (17:40 +0900)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Fri, 17 Aug 2012 19:53:12 +0000 (21:53 +0200)
commit13a54e835bf9825f80071ca4ae85c9d96cb8d474
treea07c2fbe91521be48d494c0d8f525b60cdb9bf32
parent8f6b7cdf74af7fcdecb9eac53d573474a7fea268
multipath-tools: prevent unexpected swapping of underlying LUNs

When you want to rename a multipath device
but the new alias is already used by other multipath device,
multipath-tools mistakenly reload a table for the original multipath device
to the other multipath device.
That could lead to very bad result, such as I/O error and data corruption.

This patch checks such a condition and gives up renaming with error log.

For example, suppose you have following 'bindings' file:

   # cat /etc/multipath/bindings
   mpatha 212140084abcd0000
   mpathb 212150084abcd0000

and a logical volume 'VG/LV0' on top of mpathb,
which is on top of /dev/sde(8:64) and /dev/sdk(8:160):

   # dmsetup ls --tree
   mpatha (253:1)
    ├─ (8:144)
    └─ (8:48)
   VG-LV0 (253:2)
    └─mpathb (253:0)
       ├─ (8:160)
       └─ (8:64)

Then you decide to swap their names and change the 'bindings' as follows:

   # cat /etc/multipath/bindings
   mpathb 212140084abcd0000
   mpatha 212150084abcd0000

you'll get this after 'service multipathd reload':

   # dmsetup ls --tree
   mpatha (253:1)
    ├─ (8:160)
    └─ (8:64)
   VG-LV0 (253:2)
    └─mpathb (253:0)
       ├─ (8:144)
       └─ (8:48)

Now you suddenly have 'VG/LV0' on top of /dev/sdd(8:48) and /dev/sdj(8:144),
that is obviously wrong and will corrupt data if you write to 'VG/LV0'.
libmultipath/configure.c