All of lore.kernel.org
 help / color / mirror / Atom feed
* Make device-mapper udev rules more friendly to udev
@ 2010-06-23 12:45 Xinwei Hu
  2010-06-23 16:21 ` Peter Rajnoha
  0 siblings, 1 reply; 2+ messages in thread
From: Xinwei Hu @ 2010-06-23 12:45 UTC (permalink / raw)
  To: dm-devel

[-- Attachment #1: Type: text/plain, Size: 643 bytes --]

Hi all,

  I found there're changes to udev/10-dm.rules.in, which tries to add
support for uevent triggered outside of libdevmapper.
Think this is a great step.

  In current situation, if an admin calls "echo add >
/sys/block/dm-N/uevent", the symlinks in /dev/mapper and
/dev/$VGNAME/ will still be removed anyway. I'm not sure who many
realistic application will trigger the 'add' event in users
space out side the libdevmapper. But I think it'll be more friendly to udev ;)

  The attached 10-dm.rules.in is an attempt on this direction. It
basically import{db} if the events are not trigged by libdevmapper.

  Please comment.

  Thanks.

[-- Attachment #2: lvm-10-dm.rules.in.diff --]
[-- Type: application/octet-stream, Size: 720 bytes --]

74c74,77
< ACTION=="add", ENV{STARTUP}!="1", NAME="", GOTO="dm_end"
---
> ACTION=="add", ENV{STARTUP}!="1", ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}=="1", NAME="", GOTO="dm_end"
> 
> # If it's the artificial event from other source
> ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}!="1", GOTO="dm_artificial"
91a95,113
> 
> GOTO="dm_normalrule"
> 
> LABEL="dm_artificial"
> IMPORT{db}="DM_NAME"
> IMPORT{db}="DM_UUID"
> IMPORT{db}="DM_SUSPENDED"
> IMPORT{db}="DM_STATE"
> IMPORT{db}="DM_TABLE_STATE"
> IMPORT{db}="DM_OPENCOUNT"
> IMPORT{db}="DM_LAST_EVENT_NR"
> IMPORT{db}="DM_MAJOR"
> IMPORT{db}="DM_MINOR"
> IMPORT{db}="DM_TARGET_COUNT"
> IMPORT{db}="DM_TARGET_TYPES"
> IMPORT{db}="DM_DEPS"
> IMPORT{db}="DM_TYPE"
> 
> LABEL="dm_normalrule"

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Make device-mapper udev rules more friendly to udev
  2010-06-23 12:45 Make device-mapper udev rules more friendly to udev Xinwei Hu
@ 2010-06-23 16:21 ` Peter Rajnoha
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Rajnoha @ 2010-06-23 16:21 UTC (permalink / raw)
  To: device-mapper development

On 06/23/2010 02:45 PM, Xinwei Hu wrote:
> Hi all,
> 
>   I found there're changes to udev/10-dm.rules.in, which tries to add
> support for uevent triggered outside of libdevmapper.
> Think this is a great step.
> 
>   In current situation, if an admin calls "echo add >
> /sys/block/dm-N/uevent", the symlinks in /dev/mapper and
> /dev/$VGNAME/ will still be removed anyway. I'm not sure who many
> realistic application will trigger the 'add' event in users
> space out side the libdevmapper. But I think it'll be more friendly to udev ;)
> 
>   The attached 10-dm.rules.in is an attempt on this direction. It
> basically import{db} if the events are not trigged by libdevmapper.
> 

Yes, the ADD event. There was one major problem with supporting the ADD event this
way and that was the initial udevadm trigger that's called from the udev init script
(it tries to "coldplug" all previously activated devices and repopulate the /dev
content). That's actually the same situation as with triggering individual ADD events
using the "echo add > /sys/.../uevent" that you have mentioned above.

First of all, we needed to remove the STARTUP environment variable from the rules - a
workaround that was awaiting a better solution (it seems we can't expect each distro to use
this trick, there were complaints raised). Another thing that needs to go away is the NAME=""
rule, that's not supported by udevd anymore...

We can do that by using the IMPORT{db} udev rule, but still we had problems with the
initial udevadm trigger since the database was always cleared explicitly before. The line
you can find in udev start scripts goes something like:

  rm -fr $udev_root/.udev

We discussed this with upstream udev whether this is really needed and actually it's
not - the udev database from initrd can be preserved. So it needs a little modification
in udev init script (each distro has its own way to do that).

This way we can access all the information needed anytime we need (after a device is
correctly activated, of course).

This is the most recent change that should be upstream soon. There's a patch
prepared already: https://www.redhat.com/archives/lvm-devel/2010-June/msg00040.html

Anyway, thanks a lot for the heads-up! I appreciate that.

Peter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-23 16:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-23 12:45 Make device-mapper udev rules more friendly to udev Xinwei Hu
2010-06-23 16:21 ` Peter Rajnoha

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.