chiark / gitweb /
do not rename the database on device rename
authorKay Sievers <kay.sievers@vrfy.org>
Wed, 11 Aug 2010 12:34:32 +0000 (14:34 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Wed, 11 Aug 2010 12:34:32 +0000 (14:34 +0200)
Harald Hoyer discovered some incorrect behavior while debugging
problems with network interface renaming:

Udev events might be queued for devices which are renamed. A new
device registered the same time may claime the old name and create
a database entry for it. The current rename logic would move over
this databse entry to the wrong device.

Makefile.am
libudev/libudev-device-private.c
libudev/libudev-private.h
libudev/libudev-queue-private.c
udev/udev-event.c

index e80d43abe559bf906abcf170e364bfe4fc4b56b0..c16b2594d44045a110b3aca2b250a1d317e37081 100644 (file)
@@ -30,7 +30,7 @@ CLEANFILES =
 # libudev
 # ------------------------------------------------------------------------------
 LIBUDEV_CURRENT=9
 # libudev
 # ------------------------------------------------------------------------------
 LIBUDEV_CURRENT=9
-LIBUDEV_REVISION=0
+LIBUDEV_REVISION=1
 LIBUDEV_AGE=9
 
 SUBDIRS += libudev/docs
 LIBUDEV_AGE=9
 
 SUBDIRS += libudev/docs
index 8c8ac244be99e57006ccc0c58295d670cf80c612..a4b2fb01695b49c568516b2892b6278188db2590 100644 (file)
@@ -177,19 +177,3 @@ int udev_device_delete_db(struct udev_device *udev_device)
        unlink(filename);
        return 0;
 }
        unlink(filename);
        return 0;
 }
-
-int udev_device_rename_db(struct udev_device *udev_device)
-{
-       struct udev *udev = udev_device_get_udev(udev_device);
-       char filename_old[UTIL_PATH_SIZE];
-       char filename[UTIL_PATH_SIZE];
-
-       if (strcmp(udev_device_get_sysname(udev_device), udev_device_get_sysname_old(udev_device)) == 0)
-               return 0;
-
-       util_strscpyl(filename_old, sizeof(filename_old), udev_get_dev_path(udev), "/.udev/db/",
-                     udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname_old(udev_device), NULL);
-       util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db/",
-                     udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL);
-       return rename(filename_old, filename);
-}
index 475f992ba76ce33a10edf17b5428588cdf8076e0..7ed4afc42c7d1db91e50b494cbdba6ab59709560 100644 (file)
@@ -104,7 +104,6 @@ void udev_device_set_info_loaded(struct udev_device *device);
 /* libudev-device-private.c */
 int udev_device_update_db(struct udev_device *udev_device);
 int udev_device_delete_db(struct udev_device *udev_device);
 /* libudev-device-private.c */
 int udev_device_update_db(struct udev_device *udev_device);
 int udev_device_delete_db(struct udev_device *udev_device);
-int udev_device_rename_db(struct udev_device *udev_device);
 int udev_device_tag_index(struct udev_device *dev, struct udev_device *dev_old, bool add);
 
 /* libudev-monitor.c - netlink/unix socket communication  */
 int udev_device_tag_index(struct udev_device *dev, struct udev_device *dev_old, bool add);
 
 /* libudev-monitor.c - netlink/unix socket communication  */
index 6109837f7ecc44530dcedf81179083fd19d9e919..06dc2f5e0e9bcce06ee81c0bd04b608f39f83d5c 100644 (file)
@@ -423,17 +423,6 @@ static void update_failed(struct udev_queue_export *udev_queue_export,
                break;
 
        case DEVICE_FINISHED:
                break;
 
        case DEVICE_FINISHED:
-               if (udev_device_get_sysname_old(udev_device) != NULL &&
-                   strcmp(udev_device_get_sysname_old(udev_device), udev_device_get_sysname(udev_device)) != 0) {
-                       /* "move" event - rename failed file to current name, do not delete failed */
-                       char filename_old[UTIL_PATH_SIZE];
-
-                       util_strscpyl(filename_old, sizeof(filename_old), udev_get_dev_path(udev), "/.udev/failed/",
-                                     udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname_old(udev_device), NULL);
-                       if (rename(filename_old, filename) == 0)
-                               info(udev, "renamed devpath, moved failed state of '%s' to %s'\n",
-                                    udev_device_get_devpath_old(udev_device), udev_device_get_devpath(udev_device));
-               }
                break;
        }
 
                break;
        }
 
index 1ecf82423f256d6e8cbeaa24d3084d5649be1321..9b5326bf224948dc7bfcc0de49eae5cbf6862a6f 100644 (file)
@@ -534,14 +534,6 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules)
        struct udev_device *dev = event->dev;
        int err = 0;
 
        struct udev_device *dev = event->dev;
        int err = 0;
 
-       if (udev_device_get_sysname_old(dev) != NULL &&
-           strcmp(udev_device_get_sysname_old(dev), udev_device_get_sysname(dev)) != 0) {
-               udev_device_rename_db(dev);
-               info(event->udev, "moved database from '%s:%s' to '%s:%s'\n",
-                    udev_device_get_subsystem(dev), udev_device_get_sysname_old(dev),
-                    udev_device_get_subsystem(dev), udev_device_get_sysname(dev));
-       }
-
        if (strcmp(udev_device_get_action(dev), "remove") == 0) {
                udev_device_read_db(dev);
                udev_device_delete_db(dev);
        if (strcmp(udev_device_get_action(dev), "remove") == 0) {
                udev_device_read_db(dev);
                udev_device_delete_db(dev);