Skip to contentSkip to conversation

HAL: Ignore internal DM devices with new DM udev rules

PATCH In review Milan Broz 2 participants 3 messages Jul 13, 2010 – Jul 14, 2010

lore
Share & tools
lore

Milan Broz

author
#0 lore raw

PATCH 1/1 HAL: Ignore internal DM devices with new DM udev rules

With new device-mapper udev rules are /dev/mapper/* symlinks to basic device name /dev/dm-X.
(Change requested by udev upstream.)

This change breaks temporary-cryptsetup workaround inside hal.

With new dm-udev rules (uncluded since device-mapper 1.02.39) there is DM_UDEV_DISABLE_OTHER_RULES_FLAG variable
which controls that scan should be ignored for this device (it is set for all internal devices, including temporary cryptsetup, internal parts of lvm devices etc.)

Ignore device if this flag is set.

See bugs
https://bugzilla.redhat.com/show_bug.cgi?ida3909
http://bugs.debian.org/cgi-bin/bugreport.cgi?bugX6286

---
 hald/linux/osspec.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
hald/linux/osspec.c +5 -0
index a8233fd..6d616bc 100644
@@ -215,6 +215,11 @@ hald_udev_data (GIOChannel *source, GIOCondition condition, gpointer user_data)
 				g_free (str);
 			}
 			g_free (dstr);
+		} else if (strncmp(key, "DM_UDEV_DISABLE_OTHER_RULES_FLAG=", 33) = 0) {
+			if (strtoul(&key[33], NULL, 10) = 1) {
+				HAL_INFO (("ignoring device requested by DM udev rules"));
+				goto invalid;
+			}
 		}
 	}
 
Signature · 1 line
1.7.1
#1 lore raw
Quoted 12 lines · On Tue, 13 Jul 2010 14:08:14 +0200 Milan Broz <[email protected]> wrote:

With new device-mapper udev rules are /dev/mapper/* symlinks to basic device name /dev/dm-X.
(Change requested by udev upstream.)

This change breaks temporary-cryptsetup workaround inside hal.

With new dm-udev rules (uncluded since device-mapper 1.02.39) there is DM_UDEV_DISABLE_OTHER_RULES_FLAG variable
which controls that scan should be ignored for this device (it is set for all internal devices, including temporary cryptsetup, internal parts of lvm devices etc.)

Quoted 5 lines

Ignore device if this flag is set.

See bugs
https://bugzilla.redhat.com/show_bug.cgi?id=613909
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=586286

Perhaps this is a problem with how Xfce's automount implementation calls everything (although it worked fine prior to our move to udev-enabled LVM2 and newer cryptsetup (1.1.x)), but I still don't get an encrypted usb thumbdrive mounted when plugging it in after applying this patch and rebuilding hal.

I get two separate dialog windows to enter the passphrase (the first appears, I enter the passphrase, and then the second appears), and after entering the passphrase for the second time, I get this:

Failed to setup the encrypted volume.
/dev/sdb is already setup?

Just for grins and giggles, I tested an old mmc card, and it works as expected.

I'm attaching a debug log created by running hald in verbose mode; any ideas on where to go from here?

-RW

author
#2 lore raw
In reply to Milan Broz
Quoted 7 lines · Robby Workman

On Tue, 13 Jul 2010 14:08:14 +0200
Milan Broz <[email protected]> wrote:

I get two separate dialog windows to enter the passphrase (the first appears, I enter the passphrase, and then the second appears), and after entering the passphrase for the second time, I get this:

sigh. If udev rule set this flag, it is not top-level device and nobody should touch it.

Top level device is then visible, that's the one you want to mount...

if you see the log, event comes there for top-level:

04:04:20.064 [D] osspec.c:249: Found a dm-device (/dev/dm-6), mark it
04:04:20.064 [I] osspec.c:256: SEQNUM"50, ACTION=change, SUBSYSTEM=block, DEVPATH=/sys/devices/virtual/block/dm-6, DEVNAME=/dev/dm-6, IFINDEX=0

so I do not think it is problem with this patch.

But in fact I have no idea how the whole desktop machinery above that works, I expect that there is some race with another auto mount system - see dmsetup table if the device is not mapped elsewhere already:-)

Milan