multipath-tools: Preventing silent swapping of underlying LUNs
I found multipathd could unexpectedly swaps underlying LUNs
when it should swap names.
Suppose someone has following /etc/multipath/bindings:
mpathA <wwid of LUN0>
mpathB <wwid of LUN1>
and created those multipath devices.
If he modified bindings as below and do 'multipathd -kreconfigure':
mpathB <wwid of LUN0>
mpathA <wwid of LUN1>
I think it is natural to expect the mpath device for <wwid of LUN0>
("mpathA") is renamed to "mpathB" and vice versa.
However, what actually happens is mpathA's underlying device is
changed to LUN1 and mpathB's underlying device is changed to LUN0.
As a result, users of those devices (mounted file systems, LVs, etc.)
could get errors and/or corrupt data.
(This not just about dynamic reconfiguration.
Similar thing could happen if you forget to rebuild initrd
after modifying bindings.)
If there is smarter solution such as swapping aliases correctly,
it would be nice.
But I think it's good to have a patch like this at a minimum
to prevent the bad thing from happening.
Jun'ichi Nomura, NEC Corporation
Given alias/wwid pair in config, if there is a mpath with the wwid
and different alias, the mpath should be renamed to the given alias.
If there is already other mpath with the alias, though, we could not
simply rename it.
However, we must NOT try to create a mpath with the given alias/wwid
by changing the wwid (i.e. mappings) of the other mpath, that could
The patch checks this case and give up processing.