chiark / gitweb /
[PATCH] DEVNAME on device removal
authorsjoerd@spring.luon.net <sjoerd@spring.luon.net>
Tue, 23 Nov 2004 15:49:55 +0000 (07:49 -0800)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 05:42:36 +0000 (22:42 -0700)
  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.

udev.c

diff --git a/udev.c b/udev.c
index dad64288a9b08f0706807f305a47d7d115df930c..efeb1b505073f3f258c86b2d2ced20592bf1d394 100644 (file)
--- a/udev.c
+++ b/udev.c
@@ -192,6 +192,10 @@ int main(int argc, char *argv[], char *envp[])
                        /* get node from db, remove db-entry, delete created node */
                        retval = udev_remove_device(&udev);
 
+                       /* Set the DEVNAME if known */
+                       if (udev.devname[0] != '\0') {
+                               setenv("DEVNAME", udev.devname, 1);
+                       }
                        /* run dev.d/ scripts if we're not instructed to ignore the event */
                        if (udev.devname[0] != '\0') {
                                setenv("DEVNAME", udev.devname, 1);