Hello, I've found a lingering bug in udev since udev changed it's
database name from long names to short names 'ex: b9:1'.
The bug is more visible or reproducible on s390(x) has there, we can
remove and add dasd disk/partitions.
The outcome of the bug is that when removing and re-adding a
disk/partition, most or some of the links are not removed correctly or
at all. This leads to multiple UUID links for a single partition or
stale links in /dev/disk/{by-uuid,by-id}.
How to reproduce:
dasdfmt -b 4096 -v -y -f /dev/dasdb
fdasd -a /dev/dasdb
mke2fs /dev/dasdb1
repeat this again and you will notice that /dev/dasdb1 has 2 or more
UUID links in /dev/disk/by-uuid.
If you do not repeat this, just do 'dasdfmt -b 4096 -v -y
-f /dev/dasdb' the UUID link to /dev/dasdb1 will be stale, just the
same as /dev/disk/by-id links.
NOTE: this bug might affect x86 machines too, but it might not be
visible (not sure).
The issue is due to when there is a change event before the remove
event for dasdb/dasdb1, we are trying to resolve the database name into
'<block><major>:<minor>', but event->dev_db doesn't get fill-up with
devnum (<major>:<minor>) information, resulting in a database name
"+block:dasdb1", which doesn't exist.
I've attached the patch, please review it and push it if there is no
complains :)
--
Robert Milasan
L3 Support Engineer
SUSE Linux (http://www.suse.com)
email: [email protected]
GPG fingerprint: B6FE F4A8 0FA3 3040 3402 6FE7 2F64 167C 1909 6D1A
>From 368082520b25722575783f06879fb5fc2e4c219c Mon Sep 17 00:00:00 2001
From: Robert Milasan <[email protected]>
Date: Sat, 13 Sep 2014 15:18:37 +0200
Subject: [PATCH] udev: always resolve correctly database names on 'change'
event
Signed-off-by: Robert Milasan <[email protected]>
---
src/libudev/libudev-device.c | 2 +-
src/libudev/libudev-private.h | 1 +
src/udev/udev-event.c | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index d61a2ad..2699374 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -161,7 +161,7 @@ _public_ dev_t udev_device_get_devnum(struct udev_device *udev_device)
return udev_device->devnum;
}
-static int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum)
+int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum)
{
char num[32];
diff --git a/src/libudev/libudev-private.h b/src/libudev/libudev-private.h
index 35ea7ba..05a6410 100644
--- a/src/libudev/libudev-private.h
+++ b/src/libudev/libudev-private.h
@@ -59,6 +59,7 @@ uid_t udev_device_get_devnode_uid(struct udev_device *udev_device);
gid_t udev_device_get_devnode_gid(struct udev_device *udev_device);
int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem);
int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath);
+int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum);
int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink);
void udev_device_cleanup_devlinks_list(struct udev_device *udev_device);
struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value);
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index e8d6676..2cf0763 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -812,6 +812,7 @@ void udev_event_execute_rules(struct udev_event *event,
if (event->dev_db != NULL) {
udev_device_set_syspath(event->dev_db, udev_device_get_syspath(dev));
udev_device_set_subsystem(event->dev_db, udev_device_get_subsystem(dev));
+ udev_device_set_devnum(event->dev_db, udev_device_get_devnum(dev));
udev_device_read_db(event->dev_db, NULL);
udev_device_set_info_loaded(event->dev_db);
--
1.8.4.5
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel