From: Zdenek Kabelac <zkabelac@redhat.com>
To: device-mapper development <dm-devel@redhat.com>
Cc: Nicholas Nevin <njnevin@gmail.com>
Subject: Re: /dev/mapper/<dm_name> symlink not being created
Date: Mon, 14 May 2012 15:43:03 +0200 [thread overview]
Message-ID: <4FB10BE7.8090602@redhat.com> (raw)
In-Reply-To: <CACmkXc5cEhvdBgHzbNW13cFcoj83LjFea=qwZOq5UUq5vpwdAw@mail.gmail.com>
Dne 12.5.2012 16:59, Nicholas Nevin napsal(a):
> Anyone have any thoughts on this?
>
> Thanks, Nick.
>
> On Mon, Apr 30, 2012 at 8:08 AM, Nicholas Nevin <njnevin@gmail.com> wrote:
>
>> In nightly testing of our product the tests do a fair bit of
>> creating/destroying of device mapper devices and we have been seeing
>> infrequent cases where the device is created OK but the corresponding
>> /dev/mapper/<dm_name> symlink does not exist.
>>
>> Here is an example of the dmsetup command used to create the devices.
>>
>> # dmsetup create tap0 --table '0 47247164 linear /dev/xen/blktap-2/tapdev0
>> 1'
>>
>> I managed to reproduce this problem with udev logging enabled and 'udevadm
>> monitor' running and from the logs the cause appears to be that the udev
>> add action (from the device create) and the udev change action (from when
>> the device is resumed after loading the table) are running
>> concurrently. The processing of the rules for the change action creates the
>> /dev/mapper/tap0 symlink but then the processing of the add action deletes
>> the symlink because /dev/mapper/tap0 is not in the add action DEVLINKS.
>>
>> The question I have is should dmsetup be ensuring that the add action
>> completes before the change action is handled or is this behaviour expected?
>>
>> That /dev/mapper/tap0 is not in the DEVLINKS for the add action is AFAICT
>> because of a race between the creation of the sysfs entries for the device
>> and the processing of the add action in udevd. This can be fixed by
>> sprinkling in some WAIT_FOR conditions in the dm udev rules. Our system is
>> based on Ubuntu 12.04.
>>
>> I have attached the udevadm monitor output and the relevant piece of
>> syslog for a test case where the /dev/mapper/tap0 symlink wasn't present
>> when dmsetup returned.
>>
>> I hope this is the right place to ask this. If not please point me in the
>> right direction.
You have not specified version of lvm2 tools in use.
But on udev system there are 2 options when nodes/links are created.
By default it's on RESUME - since this is the moment table is defined,
and proper messages are passed across udev system.
For backward compatibility (and for non-udev systems) there is
dmsetup create --addnodeoncreate - which basically creates links on 'create'
phase - but with old 'badness' behind - since normally no one should create
nodes in /dev - it's the udev 'kingdom' which should not be externally
modified (udev might not know about such entries).
So the proper moment to work with created devices is after they have been
resumed - everything else will be ugly udev hack with unpredictable results.
Zdenek
next prev parent reply other threads:[~2012-05-14 13:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-30 12:08 /dev/mapper/<dm_name> symlink not being created Nicholas Nevin
2012-05-12 14:59 ` Nicholas Nevin
2012-05-14 13:43 ` Zdenek Kabelac [this message]
2012-05-15 13:55 ` Nicholas Nevin
2012-05-15 14:07 ` Alasdair G Kergon
2012-05-15 14:32 ` Nicholas Nevin
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=4FB10BE7.8090602@redhat.com \
--to=zkabelac@redhat.com \
--cc=dm-devel@redhat.com \
--cc=njnevin@gmail.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.