Skip to contentSkip to conversation

DEVNAME on device removal

udev Applied Sjoerd Simons 3 participants 3 messages Nov 22, 2004 – Nov 23, 2004

lore
Share & tools
lore
#0 lore raw

Hi,

I just noticed that the DEVNAME enviroment variable isn't being set anymore in udev 0.046 on device removal, while it was being set in 0.042. We're using the property tto do umount -l <devices> when a block device is removed. Afaik there is no other way to associate a device with it's DEVNAME on removal ?

Also are there cases where doing umount -l on the removed devices is wrong? I guess the device is gone, so there is no sense in keeping it mounted (it's not like the filesystem is gonna come back in a sane state again)..

Attached (trivial) patch brings back the DEVNAME variable on device removal.

Sjoerd

Signature · 3 lines
The optimist thinks that this is the best of all possible worlds,
and the pessimist knows it.
		-- J. Robert Oppenheimer, "Bulletin of Atomic Scientists"
udev.c +4 -0
diff -Naur udev-046.orig/udev.c udev-046/udev.c
@@ -179,6 +179,10 @@
 		/* get node from db, delete it*/
 		retval = udev_remove_device(&udev);
 
+		/* Set the DEVNAME if known */
+		if (udev.devname[0] != '\0') {
+			setenv("DEVNAME", udev.devname, 1);
+		}
 		/* run scripts */
 		dev_d_execute(&udev, DEVD_DIR, DEVD_SUFFIX);
 	}
#1 lore raw
Quoted 3 lines · Sjoerd Simons

Hi,

I just noticed that the DEVNAME enviroment variable isn't being set anymore

Yeah, that wasn't on purpose. It just happened by moving some code where it belongs, sorry.

Quoted 3 lines

in udev 0.046 on device removal, while it was being set in 0.042. We're using the property tto do umount -l <devices> when a block device is removed. Afaik there is no other way to associate a device with it's DEVNAME on removal ?

No that's right. That information is gone that time.

Quoted 5 lines

Also are there cases where doing umount -l on the removed devices is wrong? I guess the device is gone, so there is no sense in keeping it mounted (it's not like the filesystem is gonna come back in a sane state again)..

Attached (trivial) patch brings back the DEVNAME variable on device removal.

I will put that in.

Thanks,
Kay

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

Applied
#2 lore raw
In reply to Sjoerd Simons
Quoted 7 lines · Sjoerd Simons

Hi,

I just noticed that the DEVNAME enviroment variable isn't being set anymore in udev 0.046 on device removal, while it was being set in 0.042. We're using the property tto do umount -l <devices> when a block device is removed. Afaik there is no other way to associate a device with it's DEVNAME on removal ?

Quoted 5 lines

Also are there cases where doing umount -l on the removed devices is wrong? I guess the device is gone, so there is no sense in keeping it mounted (it's not like the filesystem is gonna come back in a sane state again)..

Attached (trivial) patch brings back the DEVNAME variable on device removal.

Applied this to the udev tree, thanks a lot for the patch.

greg k-h

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel