From a73ce1024afbc4719a90dc109a8d913a6d8fcaa8f874f3ad6ee37297f1df9042 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Thu, 26 Oct 2017 22:42:12 +0000 Subject: [PATCH] Accepting request 536989 from home:mwilck:branches:Base:System - dmraid: remove partitions with O_RDONLY * add 0001-remove-partitions-with-O_RDONLY.patch OBS-URL: https://build.opensuse.org/request/show/536989 OBS-URL: https://build.opensuse.org/package/show/Base:System/dmraid?expand=0&rev=53 --- 0001-remove-partitions-with-O_RDONLY.patch | 30 ++++++++++++++++++++++ dmraid.changes | 6 +++++ dmraid.spec | 2 ++ 3 files changed, 38 insertions(+) create mode 100644 0001-remove-partitions-with-O_RDONLY.patch diff --git a/0001-remove-partitions-with-O_RDONLY.patch b/0001-remove-partitions-with-O_RDONLY.patch new file mode 100644 index 0000000..4b0facc --- /dev/null +++ b/0001-remove-partitions-with-O_RDONLY.patch @@ -0,0 +1,30 @@ +From 3e073f5ac0b1d8d930615cd3fbb1401b56ceb848 Mon Sep 17 00:00:00 2001 +From: Martin Wilck +Date: Thu, 26 Oct 2017 14:31:04 +0200 +Subject: [PATCH] remove partitions with O_RDONLY + +It's not necessary to use O_RDWR to use BLKPG_DEL_PARTITION. +It's actually harmful, because closing the device will cause +an IN_CLOSE_WRITE inotify event, which will trigger a BLKRRPART +from systemd, which will reinstate all partitions just deleted. +--- + lib/device/partition.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/lib/device/partition.c b/lib/device/partition.c +index 99e92f6a66cd..bcc8de819eb4 100644 +--- a/1.0.0.rc16/lib/device/partition.c ++++ b/1.0.0.rc16/lib/device/partition.c +@@ -22,8 +22,7 @@ _remove_subset_partitions(struct lib_context *lc, struct raid_set *rs) + }; + + list_for_each_entry(rd, &rs->devs, devs) { +- int fd = open(rd->di->path, O_RDWR); +- ++ int fd = open(rd->di->path, O_RDONLY); + if (fd < 0) + LOG_ERR(lc, 0, "opening %s: %s\n", rd->di->path, + strerror(errno)); +-- +2.14.2 + diff --git a/dmraid.changes b/dmraid.changes index e91fdff..d84db80 100644 --- a/dmraid.changes +++ b/dmraid.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Oct 26 21:02:43 UTC 2017 - mwilck@suse.com + +- dmraid: remove partitions with O_RDONLY + * add 0001-remove-partitions-with-O_RDONLY.patch + ------------------------------------------------------------------- Sat Feb 18 05:26:58 UTC 2017 - kukuk@suse.com diff --git a/dmraid.spec b/dmraid.spec index ae920ac..de48803 100644 --- a/dmraid.spec +++ b/dmraid.spec @@ -49,6 +49,7 @@ Patch7: ddf-erase Patch8: dmraid-move-var-lock-to-run-lock.patch Patch9: dmraid-destdir.patch Patch10: fix-undefined-symbol.patch +Patch11: 0001-remove-partitions-with-O_RDONLY.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build PreReq: %fillup_prereq @@ -99,6 +100,7 @@ devices with respective mappings for the ATARAID sets discovered. %patch8 -p1 %patch9 -p1 %patch10 -p1 +%patch11 -p2 cp %{SOURCE3} .