forked from pool/systemd
Accepting request 236618 from home:rmilasan:branches:Base:System
- Add upstream patches 1025-udev-exclude-device-mapper-from-block-device-ownersh.patch 1026-udevd-inotify-modernizations.patch 1027-udev-synthesize-change-events-for-partitions-when-to.patch 1028-udev-link-config-fix-mem-leak.patch 1029-udev-try-first-re-reading-the-partition-table.patch 1030-udev-guard-REREADP-logic-with-open-O_ECXL.patch 1031-udev-make-sure-we-always-get-change-for-the-disk.patch 1032-udev-guard-REREADPT-by-exclusive-lock-instead-of-O_E.patch - Add upstream patches 1025-udev-exclude-device-mapper-from-block-device-ownersh.patch 1026-udevd-inotify-modernizations.patch 1027-udev-synthesize-change-events-for-partitions-when-to.patch 1028-udev-link-config-fix-mem-leak.patch 1029-udev-try-first-re-reading-the-partition-table.patch 1030-udev-guard-REREADP-logic-with-open-O_ECXL.patch 1031-udev-make-sure-we-always-get-change-for-the-disk.patch 1032-udev-guard-REREADPT-by-exclusive-lock-instead-of-O_E.patch OBS-URL: https://build.opensuse.org/request/show/236618 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=662
This commit is contained in:
parent
be18cec5e1
commit
d5320bfd62
@ -0,0 +1,39 @@
|
||||
From e918a1b5a94f270186dca59156354acd2a596494 Mon Sep 17 00:00:00 2001
|
||||
From: Kay Sievers <kay@vrfy.org>
|
||||
Date: Tue, 3 Jun 2014 16:49:38 +0200
|
||||
Subject: [PATCH] udev: exclude device-mapper from block device ownership event
|
||||
locking
|
||||
|
||||
Signed-off-by: Robert Milasan <rmilasan@suse.com>
|
||||
---
|
||||
src/udev/udevd.c | 14 +++++++++++++-
|
||||
1 file changed, 13 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
|
||||
index 819ea3b..6c05104 100644
|
||||
--- a/src/udev/udevd.c
|
||||
+++ b/src/udev/udevd.c
|
||||
@@ -290,7 +290,19 @@ static void worker_new(struct event *event)
|
||||
* acquired the lock, the external process will block until
|
||||
* udev has finished its event handling.
|
||||
*/
|
||||
- if (streq_ptr("block", udev_device_get_subsystem(dev))) {
|
||||
+
|
||||
+ /*
|
||||
+ * <kabi_> since we make check - device seems unused - we try
|
||||
+ * ioctl to deactivate - and device is found to be opened
|
||||
+ * <kay> sure, you try to take a write lock
|
||||
+ * <kay> if you get it udev is out
|
||||
+ * <kay> if you can't get it, udev is busy
|
||||
+ * <kabi_> we cannot deactivate openned device (as it is in-use)
|
||||
+ * <kay> maybe we should just exclude dm from that thing entirely
|
||||
+ * <kabi_> IMHO this sounds like a good plan for this moment
|
||||
+ */
|
||||
+ if (streq_ptr("block", udev_device_get_subsystem(dev)) &&
|
||||
+ !startswith("dm-", udev_device_get_sysname(dev))) {
|
||||
struct udev_device *d = dev;
|
||||
|
||||
if (streq_ptr("partition", udev_device_get_devtype(d)))
|
||||
--
|
||||
1.8.4.5
|
||||
|
85
1026-udevd-inotify-modernizations.patch
Normal file
85
1026-udevd-inotify-modernizations.patch
Normal file
@ -0,0 +1,85 @@
|
||||
From edd32000c806e4527c5f376d138f7bff07724c26 Mon Sep 17 00:00:00 2001
|
||||
From: Kay Sievers <kay@vrfy.org>
|
||||
Date: Wed, 4 Jun 2014 11:05:45 +0200
|
||||
Subject: [PATCH] udevd: inotify - modernizations
|
||||
|
||||
Signed-off-by: Robert Milasan <rmilasan@suse.com>
|
||||
---
|
||||
src/udev/udevd.c | 45 ++++++++++++++++++++++-----------------------
|
||||
1 file changed, 22 insertions(+), 23 deletions(-)
|
||||
|
||||
Index: systemd-210/src/udev/udevd.c
|
||||
===================================================================
|
||||
--- systemd-210.orig/src/udev/udevd.c
|
||||
+++ systemd-210/src/udev/udevd.c
|
||||
@@ -736,20 +736,30 @@ out:
|
||||
return udev_ctrl_connection_unref(ctrl_conn);
|
||||
}
|
||||
|
||||
+static void synthesize_change(struct udev_device *dev) {
|
||||
+ char filename[UTIL_PATH_SIZE];
|
||||
+
|
||||
+ log_debug("device %s closed, synthesising 'change'", udev_device_get_devnode(dev));
|
||||
+ strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL);
|
||||
+ write_string_file(filename, "change");
|
||||
+}
|
||||
+
|
||||
/* read inotify messages */
|
||||
static int handle_inotify(struct udev *udev)
|
||||
{
|
||||
int nbytes, pos;
|
||||
char *buf;
|
||||
struct inotify_event *ev;
|
||||
+ int r;
|
||||
|
||||
- if ((ioctl(fd_inotify, FIONREAD, &nbytes) < 0) || (nbytes <= 0))
|
||||
- return 0;
|
||||
+ r = ioctl(fd_inotify, FIONREAD, &nbytes);
|
||||
+ if (r < 0 || nbytes <= 0)
|
||||
+ return -errno;
|
||||
|
||||
buf = malloc(nbytes);
|
||||
- if (buf == NULL) {
|
||||
+ if (!buf) {
|
||||
log_error("error getting buffer for inotify");
|
||||
- return -1;
|
||||
+ return -ENOMEM;
|
||||
}
|
||||
|
||||
nbytes = read(fd_inotify, buf, nbytes);
|
||||
@@ -759,27 +769,16 @@ static int handle_inotify(struct udev *u
|
||||
|
||||
ev = (struct inotify_event *)(buf + pos);
|
||||
dev = udev_watch_lookup(udev, ev->wd);
|
||||
- if (dev != NULL) {
|
||||
- log_debug("inotify event: %x for %s", ev->mask, udev_device_get_devnode(dev));
|
||||
- if (ev->mask & IN_CLOSE_WRITE) {
|
||||
- char filename[UTIL_PATH_SIZE];
|
||||
- int fd;
|
||||
-
|
||||
- log_debug("device %s closed, synthesising 'change'", udev_device_get_devnode(dev));
|
||||
- strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL);
|
||||
- fd = open(filename, O_WRONLY|O_CLOEXEC);
|
||||
- if (fd >= 0) {
|
||||
- if (write(fd, "change", 6) < 0)
|
||||
- log_debug("error writing uevent: %m");
|
||||
- close(fd);
|
||||
- }
|
||||
- }
|
||||
- if (ev->mask & IN_IGNORED)
|
||||
- udev_watch_end(udev, dev);
|
||||
+ if (!dev)
|
||||
+ continue;
|
||||
|
||||
- udev_device_unref(dev);
|
||||
- }
|
||||
+ log_debug("inotify event: %x for %s", ev->mask, udev_device_get_devnode(dev));
|
||||
+ if (ev->mask & IN_CLOSE_WRITE)
|
||||
+ synthesize_change(dev);
|
||||
+ else if (ev->mask & IN_IGNORED)
|
||||
+ udev_watch_end(udev, dev);
|
||||
|
||||
+ udev_device_unref(dev);
|
||||
}
|
||||
|
||||
free(buf);
|
@ -0,0 +1,84 @@
|
||||
From f3a740a5dae792fb6b2d411022ce8c29ced1c3f1 Mon Sep 17 00:00:00 2001
|
||||
From: Kay Sievers <kay@vrfy.org>
|
||||
Date: Wed, 4 Jun 2014 12:16:28 +0200
|
||||
Subject: [PATCH] udev: synthesize "change' events for partitions when tools
|
||||
change the disk
|
||||
|
||||
This should make sure that fdisk-like programs will automatically
|
||||
cause an update of all partitions, just like mkfs-like programs cause
|
||||
an update of the partition.
|
||||
|
||||
Signed-off-by: Robert Milasan <rmilasan@suse.com>
|
||||
---
|
||||
src/udev/udevd.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 42 insertions(+), 2 deletions(-)
|
||||
|
||||
Index: systemd-210/src/udev/udevd.c
|
||||
===================================================================
|
||||
--- systemd-210.orig/src/udev/udevd.c
|
||||
+++ systemd-210/src/udev/udevd.c
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#include "udev.h"
|
||||
+#include "udev-util.h"
|
||||
#include "sd-daemon.h"
|
||||
#include "cgroup-util.h"
|
||||
#include "dev-setup.h"
|
||||
@@ -736,15 +737,54 @@ out:
|
||||
return udev_ctrl_connection_unref(ctrl_conn);
|
||||
}
|
||||
|
||||
-static void synthesize_change(struct udev_device *dev) {
|
||||
+static int synthesize_change(struct udev_device *dev) {
|
||||
char filename[UTIL_PATH_SIZE];
|
||||
+ int r;
|
||||
|
||||
log_debug("device %s closed, synthesising 'change'", udev_device_get_devnode(dev));
|
||||
strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL);
|
||||
write_string_file(filename, "change");
|
||||
+
|
||||
+ /* for disks devices, re-trigger all partitions too */
|
||||
+ if (streq_ptr("block", udev_device_get_subsystem(dev)) &&
|
||||
+ streq_ptr("disk", udev_device_get_devtype(dev))) {
|
||||
+ struct udev *udev = udev_device_get_udev(dev);
|
||||
+ _cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
|
||||
+ struct udev_list_entry *item;
|
||||
+
|
||||
+ e = udev_enumerate_new(udev);
|
||||
+ if (!e)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ r = udev_enumerate_add_match_parent(e, dev);
|
||||
+ if (r < 0)
|
||||
+ return r;
|
||||
+
|
||||
+ r = udev_enumerate_add_match_subsystem(e, "block");
|
||||
+ if (r < 0)
|
||||
+ return r;
|
||||
+
|
||||
+ r = udev_enumerate_scan_devices(e);
|
||||
+ udev_list_entry_foreach(item, udev_enumerate_get_list_entry(e)) {
|
||||
+ _cleanup_udev_device_unref_ struct udev_device *d = NULL;
|
||||
+
|
||||
+ d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item));
|
||||
+ if (!d)
|
||||
+ continue;
|
||||
+
|
||||
+ if (!streq_ptr("partition", udev_device_get_devtype(d)))
|
||||
+ continue;
|
||||
+
|
||||
+ log_debug("device %s closed, synthesising partition '%s' 'change'",
|
||||
+ udev_device_get_devnode(dev), udev_device_get_devnode(d));
|
||||
+ strscpyl(filename, sizeof(filename), udev_device_get_syspath(d), "/uevent", NULL);
|
||||
+ write_string_file(filename, "change");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
-/* read inotify messages */
|
||||
static int handle_inotify(struct udev *udev)
|
||||
{
|
||||
int nbytes, pos;
|
34
1028-udev-link-config-fix-mem-leak.patch
Normal file
34
1028-udev-link-config-fix-mem-leak.patch
Normal file
@ -0,0 +1,34 @@
|
||||
From edf029b7fd9a5853a87d3ca99aac2922bb8a277e Mon Sep 17 00:00:00 2001
|
||||
From: Tom Gundersen <teg@jklm.no>
|
||||
Date: Wed, 4 Jun 2014 12:34:23 +0200
|
||||
Subject: [PATCH] udev: link-config - fix mem leak
|
||||
|
||||
Reported by Kay.
|
||||
|
||||
Signed-off-by: Robert Milasan <rmilasan@suse.com>
|
||||
---
|
||||
src/udev/net/link-config.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
Index: systemd-210/src/udev/net/link-config.c
|
||||
===================================================================
|
||||
--- systemd-210.orig/src/udev/net/link-config.c
|
||||
+++ systemd-210/src/udev/net/link-config.c
|
||||
@@ -118,6 +118,7 @@ static void link_configs_free(link_confi
|
||||
free(link->match_type);
|
||||
free(link->description);
|
||||
free(link->alias);
|
||||
+ free(link->name_policy);
|
||||
|
||||
free(link);
|
||||
}
|
||||
@@ -205,7 +206,8 @@ static bool enable_name_policy(void) {
|
||||
|
||||
int link_config_load(link_config_ctx *ctx) {
|
||||
int r;
|
||||
- char **files, **f;
|
||||
+ _cleanup_strv_free_ char **files;
|
||||
+ char **f;
|
||||
|
||||
link_configs_free(ctx);
|
||||
|
94
1029-udev-try-first-re-reading-the-partition-table.patch
Normal file
94
1029-udev-try-first-re-reading-the-partition-table.patch
Normal file
@ -0,0 +1,94 @@
|
||||
From ede344452a54e1c53f541cad12a06269a4fe96a9 Mon Sep 17 00:00:00 2001
|
||||
From: Kay Sievers <kay@vrfy.org>
|
||||
Date: Wed, 4 Jun 2014 13:30:24 +0200
|
||||
Subject: [PATCH] udev: try first re-reading the partition table
|
||||
|
||||
mounted partitions:
|
||||
# dd if=/dev/zero of=/dev/sda bs=1 count=1
|
||||
UDEV [4157.369250] change .../0:0:0:0/block/sda (block)
|
||||
UDEV [4157.375059] change .../0:0:0:0/block/sda/sda1 (block)
|
||||
UDEV [4157.397088] change .../0:0:0:0/block/sda/sda2 (block)
|
||||
UDEV [4157.404842] change .../0:0:0:0/block/sda/sda4 (block)
|
||||
|
||||
unmounted partitions:
|
||||
# dd if=/dev/zero of=/dev/sdb bs=1 count=1
|
||||
UDEV [4163.450217] remove .../target6:0:0/6:0:0:0/block/sdb/sdb1 (block)
|
||||
UDEV [4163.593167] change .../target6:0:0/6:0:0:0/block/sdb (block)
|
||||
UDEV [4163.713982] add .../target6:0:0/6:0:0:0/block/sdb/sdb1 (block)
|
||||
|
||||
Signed-off-by: Robert Milasan <rmilasan@suse.com>
|
||||
---
|
||||
src/udev/udevd.c | 39 +++++++++++++++++++++++++++++++++------
|
||||
1 file changed, 33 insertions(+), 6 deletions(-)
|
||||
|
||||
Index: systemd-210/src/udev/udevd.c
|
||||
===================================================================
|
||||
--- systemd-210.orig/src/udev/udevd.c
|
||||
+++ systemd-210/src/udev/udevd.c
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <sys/un.h>
|
||||
#include <sys/signalfd.h>
|
||||
#include <sys/epoll.h>
|
||||
+#include <sys/mount.h>
|
||||
#include <sys/poll.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -741,17 +742,37 @@ static int synthesize_change(struct udev
|
||||
char filename[UTIL_PATH_SIZE];
|
||||
int r;
|
||||
|
||||
- log_debug("device %s closed, synthesising 'change'", udev_device_get_devnode(dev));
|
||||
- strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL);
|
||||
- write_string_file(filename, "change");
|
||||
-
|
||||
- /* for disks devices, re-trigger all partitions too */
|
||||
if (streq_ptr("block", udev_device_get_subsystem(dev)) &&
|
||||
- streq_ptr("disk", udev_device_get_devtype(dev))) {
|
||||
+ streq_ptr("disk", udev_device_get_devtype(dev)) &&
|
||||
+ !startswith("dm-", udev_device_get_sysname(dev))) {
|
||||
+ int fd;
|
||||
struct udev *udev = udev_device_get_udev(dev);
|
||||
_cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
|
||||
struct udev_list_entry *item;
|
||||
|
||||
+ /*
|
||||
+ * Try to re-read the partition table, this only succeeds if
|
||||
+ * none of the devices is busy.
|
||||
+ *
|
||||
+ * The kernel will send out a change event for the disk, and
|
||||
+ * "remove/add" for all partitions.
|
||||
+ */
|
||||
+ fd = open(udev_device_get_devnode(dev), O_RDONLY|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK);
|
||||
+ if (fd >= 0) {
|
||||
+ r = ioctl(fd, BLKRRPART, 0);
|
||||
+ close(fd);
|
||||
+ if (r >= 0)
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * Re-reading the partition table did not work, synthesize "change"
|
||||
+ * events for the disk and all partitions.
|
||||
+ */
|
||||
+ log_debug("device %s closed, synthesising 'change'", udev_device_get_devnode(dev));
|
||||
+ strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL);
|
||||
+ write_string_file(filename, "change");
|
||||
+
|
||||
e = udev_enumerate_new(udev);
|
||||
if (!e)
|
||||
return -ENOMEM;
|
||||
@@ -780,8 +801,14 @@ static int synthesize_change(struct udev
|
||||
strscpyl(filename, sizeof(filename), udev_device_get_syspath(d), "/uevent", NULL);
|
||||
write_string_file(filename, "change");
|
||||
}
|
||||
+
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
+ log_debug("device %s closed, synthesising 'change'", udev_device_get_devnode(dev));
|
||||
+ strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL);
|
||||
+ write_string_file(filename, "change");
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
23
1030-udev-guard-REREADP-logic-with-open-O_ECXL.patch
Normal file
23
1030-udev-guard-REREADP-logic-with-open-O_ECXL.patch
Normal file
@ -0,0 +1,23 @@
|
||||
From 10fab50a3091e0b819c3ddab5a7c07acf750c050 Mon Sep 17 00:00:00 2001
|
||||
From: Kay Sievers <kay@vrfy.org>
|
||||
Date: Wed, 4 Jun 2014 14:09:31 +0200
|
||||
Subject: [PATCH] udev: guard REREADP logic with open(O_ECXL)
|
||||
|
||||
Signed-off-by: Robert Milasan <rmilasan@suse.com>
|
||||
---
|
||||
src/udev/udevd.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
Index: systemd-210/src/udev/udevd.c
|
||||
===================================================================
|
||||
--- systemd-210.orig/src/udev/udevd.c
|
||||
+++ systemd-210/src/udev/udevd.c
|
||||
@@ -757,7 +757,7 @@ static int synthesize_change(struct udev
|
||||
* The kernel will send out a change event for the disk, and
|
||||
* "remove/add" for all partitions.
|
||||
*/
|
||||
- fd = open(udev_device_get_devnode(dev), O_RDONLY|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK);
|
||||
+ fd = open(udev_device_get_devnode(dev), O_RDONLY|O_EXCL|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK);
|
||||
if (fd >= 0) {
|
||||
r = ioctl(fd, BLKRRPART, 0);
|
||||
close(fd);
|
98
1031-udev-make-sure-we-always-get-change-for-the-disk.patch
Normal file
98
1031-udev-make-sure-we-always-get-change-for-the-disk.patch
Normal file
@ -0,0 +1,98 @@
|
||||
From e9fc29f4ecc9509ccc02eb8a014341e26c0d7831 Mon Sep 17 00:00:00 2001
|
||||
From: Kay Sievers <kay@vrfy.org>
|
||||
Date: Wed, 4 Jun 2014 15:17:15 +0200
|
||||
Subject: [PATCH] udev: make sure we always get "change" for the disk
|
||||
|
||||
The kernel will return 0 for REREADPT when no partition table
|
||||
is found, we have to send out "change" ourselves.
|
||||
|
||||
Signed-off-by: Robert Milasan <rmilasan@suse.com>
|
||||
---
|
||||
src/udev/udevd.c | 53 +++++++++++++++++++++++++++++++++++++++--------------
|
||||
1 file changed, 39 insertions(+), 14 deletions(-)
|
||||
|
||||
Index: systemd-210/src/udev/udevd.c
|
||||
===================================================================
|
||||
--- systemd-210.orig/src/udev/udevd.c
|
||||
+++ systemd-210/src/udev/udevd.c
|
||||
@@ -745,34 +745,28 @@ static int synthesize_change(struct udev
|
||||
if (streq_ptr("block", udev_device_get_subsystem(dev)) &&
|
||||
streq_ptr("disk", udev_device_get_devtype(dev)) &&
|
||||
!startswith("dm-", udev_device_get_sysname(dev))) {
|
||||
+ bool part_table_read = false;
|
||||
+ bool has_partitions = false;
|
||||
int fd;
|
||||
struct udev *udev = udev_device_get_udev(dev);
|
||||
_cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
|
||||
struct udev_list_entry *item;
|
||||
|
||||
/*
|
||||
- * Try to re-read the partition table, this only succeeds if
|
||||
- * none of the devices is busy.
|
||||
- *
|
||||
- * The kernel will send out a change event for the disk, and
|
||||
- * "remove/add" for all partitions.
|
||||
+ * Try to re-read the partition table. This only succeeds if
|
||||
+ * none of the devices is busy. The kernel returns 0 if no
|
||||
+ * partition table is found, and we will not get an event for
|
||||
+ * the disk.
|
||||
*/
|
||||
fd = open(udev_device_get_devnode(dev), O_RDONLY|O_EXCL|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK);
|
||||
if (fd >= 0) {
|
||||
r = ioctl(fd, BLKRRPART, 0);
|
||||
close(fd);
|
||||
if (r >= 0)
|
||||
- return 0;
|
||||
+ part_table_read = true;
|
||||
}
|
||||
|
||||
- /*
|
||||
- * Re-reading the partition table did not work, synthesize "change"
|
||||
- * events for the disk and all partitions.
|
||||
- */
|
||||
- log_debug("device %s closed, synthesising 'change'", udev_device_get_devnode(dev));
|
||||
- strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL);
|
||||
- write_string_file(filename, "change");
|
||||
-
|
||||
+ /* search for partitions */
|
||||
e = udev_enumerate_new(udev);
|
||||
if (!e)
|
||||
return -ENOMEM;
|
||||
@@ -786,6 +780,37 @@ static int synthesize_change(struct udev
|
||||
return r;
|
||||
|
||||
r = udev_enumerate_scan_devices(e);
|
||||
+
|
||||
+ udev_list_entry_foreach(item, udev_enumerate_get_list_entry(e)) {
|
||||
+ _cleanup_udev_device_unref_ struct udev_device *d = NULL;
|
||||
+
|
||||
+ d = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item));
|
||||
+ if (!d)
|
||||
+ continue;
|
||||
+
|
||||
+ if (!streq_ptr("partition", udev_device_get_devtype(d)))
|
||||
+ continue;
|
||||
+
|
||||
+ has_partitions = true;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * We have partitions and re-read the table, the kernel already sent
|
||||
+ * out a "change" event for the disk, and "remove/add" for all
|
||||
+ * partitions.
|
||||
+ */
|
||||
+ if (part_table_read && has_partitions)
|
||||
+ return 0;
|
||||
+
|
||||
+ /*
|
||||
+ * We have partitions but re-reading the partition table did not
|
||||
+ * work, synthesize "change" for the disk and all partitions.
|
||||
+ */
|
||||
+ log_debug("device %s closed, synthesising 'change'", udev_device_get_devnode(dev));
|
||||
+ strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL);
|
||||
+ write_string_file(filename, "change");
|
||||
+
|
||||
udev_list_entry_foreach(item, udev_enumerate_get_list_entry(e)) {
|
||||
_cleanup_udev_device_unref_ struct udev_device *d = NULL;
|
||||
|
@ -0,0 +1,29 @@
|
||||
From 02ba8fb3357daf57f6120ac512fb464a4c623419 Mon Sep 17 00:00:00 2001
|
||||
From: Kay Sievers <kay@vrfy.org>
|
||||
Date: Wed, 4 Jun 2014 16:21:19 +0200
|
||||
Subject: [PATCH] udev: guard REREADPT by exclusive lock instead of O_EXCL
|
||||
|
||||
Signed-off-by: Robert Milasan <rmilasan@suse.com>
|
||||
---
|
||||
src/udev/udevd.c | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
Index: systemd-210/src/udev/udevd.c
|
||||
===================================================================
|
||||
--- systemd-210.orig/src/udev/udevd.c
|
||||
+++ systemd-210/src/udev/udevd.c
|
||||
@@ -758,9 +758,12 @@ static int synthesize_change(struct udev
|
||||
* partition table is found, and we will not get an event for
|
||||
* the disk.
|
||||
*/
|
||||
- fd = open(udev_device_get_devnode(dev), O_RDONLY|O_EXCL|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK);
|
||||
+ fd = open(udev_device_get_devnode(dev), O_RDONLY|O_CLOEXEC|O_NOFOLLOW|O_NONBLOCK);
|
||||
if (fd >= 0) {
|
||||
- r = ioctl(fd, BLKRRPART, 0);
|
||||
+ r = flock(fd, LOCK_EX|LOCK_NB);
|
||||
+ if (r >= 0)
|
||||
+ r = ioctl(fd, BLKRRPART, 0);
|
||||
+
|
||||
close(fd);
|
||||
if (r >= 0)
|
||||
part_table_read = true;
|
@ -1,3 +1,16 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Jun 9 08:38:33 UTC 2014 - rmilasan@suse.com
|
||||
|
||||
- Add upstream patches
|
||||
1025-udev-exclude-device-mapper-from-block-device-ownersh.patch
|
||||
1026-udevd-inotify-modernizations.patch
|
||||
1027-udev-synthesize-change-events-for-partitions-when-to.patch
|
||||
1028-udev-link-config-fix-mem-leak.patch
|
||||
1029-udev-try-first-re-reading-the-partition-table.patch
|
||||
1030-udev-guard-REREADP-logic-with-open-O_ECXL.patch
|
||||
1031-udev-make-sure-we-always-get-change-for-the-disk.patch
|
||||
1032-udev-guard-REREADPT-by-exclusive-lock-instead-of-O_E.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jun 6 10:24:19 UTC 2014 - werner@suse.de
|
||||
|
||||
|
@ -596,6 +596,22 @@ Patch1022: 1022-udev-remove-seqnum-API-and-all-assumptions-about-seq.patch
|
||||
Patch1023: 1023-udev-builtin-keyboard-do-tell-on-which-device-EVIOCS.patch
|
||||
# PATCH-FIX-UPSTREAM added at 2014/06/03
|
||||
Patch1024: 1024-udev-always-close-lock-file-descriptor.patch
|
||||
# PATCH-FIX-UPSTREAM 1025-udev-exclude-device-mapper-from-block-device-ownersh.patch
|
||||
Patch1025: 1025-udev-exclude-device-mapper-from-block-device-ownersh.patch
|
||||
# PATCH-FIX-UPSTREAM 1026-udevd-inotify-modernizations.patch
|
||||
Patch1026: 1026-udevd-inotify-modernizations.patch
|
||||
# PATCH-FIX-UPSTREAM 1027-udev-synthesize-change-events-for-partitions-when-to.patch
|
||||
Patch1027: 1027-udev-synthesize-change-events-for-partitions-when-to.patch
|
||||
# PATCH-FIX-UPSTREAM 1028-udev-link-config-fix-mem-leak.patch
|
||||
Patch1028: 1028-udev-link-config-fix-mem-leak.patch
|
||||
# PATCH-FIX-UPSTREAM 1029-udev-try-first-re-reading-the-partition-table.patch
|
||||
Patch1029: 1029-udev-try-first-re-reading-the-partition-table.patch
|
||||
# PATCH-FIX-UPSTREAM 1030-udev-guard-REREADP-logic-with-open-O_ECXL.patch
|
||||
Patch1030: 1030-udev-guard-REREADP-logic-with-open-O_ECXL.patch
|
||||
# PATCH-FIX-UPSTREAM 1031-udev-make-sure-we-always-get-change-for-the-disk.patch
|
||||
Patch1031: 1031-udev-make-sure-we-always-get-change-for-the-disk.patch
|
||||
# PATCH-FIX-UPSTREAM 1032-udev-guard-REREADPT-by-exclusive-lock-instead-of-O_E.patch
|
||||
Patch1032: 1032-udev-guard-REREADPT-by-exclusive-lock-instead-of-O_E.patch
|
||||
|
||||
%define util_linux_version %(rpm -q util-linux --qf '%%{VERSION}' | awk -F . '{printf "%%2.2d%%2.2d%%2.2d", $1, $2, $3}')
|
||||
|
||||
@ -1054,6 +1070,14 @@ cp %{SOURCE7} m4/
|
||||
%patch1022 -p1
|
||||
%patch1023 -p0
|
||||
%patch1024 -p0
|
||||
%patch1025 -p1
|
||||
%patch1026 -p1
|
||||
%patch1027 -p1
|
||||
%patch1028 -p1
|
||||
%patch1029 -p1
|
||||
%patch1030 -p1
|
||||
%patch1031 -p1
|
||||
%patch1032 -p1
|
||||
|
||||
# ensure generate files are removed
|
||||
rm -f units/emergency.service
|
||||
|
@ -1,3 +1,16 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Jun 9 08:38:33 UTC 2014 - rmilasan@suse.com
|
||||
|
||||
- Add upstream patches
|
||||
1025-udev-exclude-device-mapper-from-block-device-ownersh.patch
|
||||
1026-udevd-inotify-modernizations.patch
|
||||
1027-udev-synthesize-change-events-for-partitions-when-to.patch
|
||||
1028-udev-link-config-fix-mem-leak.patch
|
||||
1029-udev-try-first-re-reading-the-partition-table.patch
|
||||
1030-udev-guard-REREADP-logic-with-open-O_ECXL.patch
|
||||
1031-udev-make-sure-we-always-get-change-for-the-disk.patch
|
||||
1032-udev-guard-REREADPT-by-exclusive-lock-instead-of-O_E.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jun 6 10:24:19 UTC 2014 - werner@suse.de
|
||||
|
||||
|
24
systemd.spec
24
systemd.spec
@ -591,6 +591,22 @@ Patch1022: 1022-udev-remove-seqnum-API-and-all-assumptions-about-seq.patch
|
||||
Patch1023: 1023-udev-builtin-keyboard-do-tell-on-which-device-EVIOCS.patch
|
||||
# PATCH-FIX-UPSTREAM added at 2014/06/03
|
||||
Patch1024: 1024-udev-always-close-lock-file-descriptor.patch
|
||||
# PATCH-FIX-UPSTREAM 1025-udev-exclude-device-mapper-from-block-device-ownersh.patch
|
||||
Patch1025: 1025-udev-exclude-device-mapper-from-block-device-ownersh.patch
|
||||
# PATCH-FIX-UPSTREAM 1026-udevd-inotify-modernizations.patch
|
||||
Patch1026: 1026-udevd-inotify-modernizations.patch
|
||||
# PATCH-FIX-UPSTREAM 1027-udev-synthesize-change-events-for-partitions-when-to.patch
|
||||
Patch1027: 1027-udev-synthesize-change-events-for-partitions-when-to.patch
|
||||
# PATCH-FIX-UPSTREAM 1028-udev-link-config-fix-mem-leak.patch
|
||||
Patch1028: 1028-udev-link-config-fix-mem-leak.patch
|
||||
# PATCH-FIX-UPSTREAM 1029-udev-try-first-re-reading-the-partition-table.patch
|
||||
Patch1029: 1029-udev-try-first-re-reading-the-partition-table.patch
|
||||
# PATCH-FIX-UPSTREAM 1030-udev-guard-REREADP-logic-with-open-O_ECXL.patch
|
||||
Patch1030: 1030-udev-guard-REREADP-logic-with-open-O_ECXL.patch
|
||||
# PATCH-FIX-UPSTREAM 1031-udev-make-sure-we-always-get-change-for-the-disk.patch
|
||||
Patch1031: 1031-udev-make-sure-we-always-get-change-for-the-disk.patch
|
||||
# PATCH-FIX-UPSTREAM 1032-udev-guard-REREADPT-by-exclusive-lock-instead-of-O_E.patch
|
||||
Patch1032: 1032-udev-guard-REREADPT-by-exclusive-lock-instead-of-O_E.patch
|
||||
|
||||
%define util_linux_version %(rpm -q util-linux --qf '%%{VERSION}' | awk -F . '{printf "%%2.2d%%2.2d%%2.2d", $1, $2, $3}')
|
||||
|
||||
@ -1049,6 +1065,14 @@ cp %{SOURCE7} m4/
|
||||
%patch1022 -p1
|
||||
%patch1023 -p0
|
||||
%patch1024 -p0
|
||||
%patch1025 -p1
|
||||
%patch1026 -p1
|
||||
%patch1027 -p1
|
||||
%patch1028 -p1
|
||||
%patch1029 -p1
|
||||
%patch1030 -p1
|
||||
%patch1031 -p1
|
||||
%patch1032 -p1
|
||||
|
||||
# ensure generate files are removed
|
||||
rm -f units/emergency.service
|
||||
|
Loading…
Reference in New Issue
Block a user