All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@redhat.com>
To: linux-lvm@redhat.com
Subject: Re: [linux-lvm] libdm cannot swap names between two child volumes
Date: Thu, 11 Jun 2015 09:46:50 +0200	[thread overview]
Message-ID: <55793CEA.7000500@redhat.com> (raw)
In-Reply-To: <CAAYit8SO2vwZa3o-ZTTZX=a9=SUafM16FuB8gQHCMDrk-Sw__Q@mail.gmail.com>

Dne 11.6.2015 v 04:54 M.H. Tsai napsal(a):
> 2015-06-08 15:17 GMT+08:00 Zdenek Kabelac <zkabelac@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

Rename is fine as long as you are not reusing names while devices are still 
active.

Check which devices names are reported by i.e. mount after you rename a device 
- keep devices mounted and do rename like this:

lvcreate lv1
mkfs,mount lv1
lvrename lv1 -> lv2
lvcreate lv3
mkfs,mount lv3
lvrename lv3 -> lv1

Check 'mount' result or /proc/self/mountinfo

So doing such 'live' rename may lead to major confusion of system admin - 
since those device names might be completely different from reality in your 
/dev dir.

Zdenek

      reply	other threads:[~2015-06-11  7:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-04 10:02 [linux-lvm] libdm cannot swap names between two child volumes M.H. Tsai
2015-06-04 12:14 ` Zdenek Kabelac
2015-06-05  3:32   ` M.H. Tsai
2015-06-05  8:04     ` Zdenek Kabelac
2015-06-08  2:09       ` M.H. Tsai
2015-06-08  7:17         ` Zdenek Kabelac
2015-06-11  2:54           ` M.H. Tsai
2015-06-11  7:46             ` Zdenek Kabelac [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55793CEA.7000500@redhat.com \
    --to=zkabelac@redhat.com \
    --cc=linux-lvm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.