[linux-lvm] libdm cannot swap names between two child volumes

M.H. Tsai mingnus at gmail.com
Thu Jun 11 02:54:31 UTC 2015


2015-06-08 15:17 GMT+08:00 Zdenek Kabelac <zkabelac at redhat.com>:
> It doesn't really matter here what you could confirm here - there is a race
> you can't avoid - i.e. udev is completely 'independent' and may execute
> trigger udev rules at any random point in time or some other command may try
> to open device in parallel (i.e. 'dd')
> So the only way how to ensure there is no such race - is to deactivate such
> device (which should be possible - since as you said - noone has it open)
> Also remember - activation routine is 'separate' from command code - as it
> could run on a completely different node - so you cannot 'validate' from
> command code there is no user of a device on 'activation' node unless device
> is locally active.
> Thus going through the proper sequence of steps and allowing udev to
> properly synchronize (i.e. you should not 'mix'  activation & deactivation
> under same cookie) is clearly the best way how to achieve your desired goal.

Hi,

Sorry for opening this question again. I could image the potential problem in
name swapping. But does that mean, It's even unrecommended to rename
an active device, although the target name are not used? The renaming path
in LVM is not suggested ?

## this is not recommended
# lvchange -ay vg1/lv1
# lvrename vg1/lv1 vg1/lv2

## do this instead
# lvchange -an vg1/lv1
# lvrename vg1/lv1 vg1/lv2


Thanks,
Ming-Hung Tsai


>> 2015-06-05 16:04 GMT+08:00 Zdenek Kabelac <zkabelac at redhat.com>:
>>> The problem with rename is -
>>> you have device   'lv1'  you rename it to 'lv2' - yet
>>> those who opened device with the name 'lv1' still thinks
>>> the 'lv1' device exits.
>>> So for safety reason before you 'reuse' any existing name in-use,
>>> there should be 'deactivating' such device first - so there is no 'race'
>>> in name usage.




More information about the linux-lvm mailing list