SHA256
1
0
forked from pool/dmraid
dmraid/0001-remove-partitions-with-O_RDONLY.patch
Marcus Meissner d49fe51652 Accepting request 1151814 from home:dimstar:rpm4.20:d
- Use %autosetup macro. Allows to eliminate the usage of deprecated
  PatchN.
- Rebase 0001-remove-partitions-with-O_RDONLY.patch to apply -p1.

OBS-URL: https://build.opensuse.org/request/show/1151814
OBS-URL: https://build.opensuse.org/package/show/Base:System/dmraid?expand=0&rev=66
2024-03-01 13:06:59 +00:00

31 lines
1018 B
Diff

From 3e073f5ac0b1d8d930615cd3fbb1401b56ceb848 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
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/lib/device/partition.c
+++ b/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