[PATCH] dmraid: remove partitions with O_RDONLY

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
---
 lib/device/partition.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/device/partition.c b/lib/device/partition.c
index 9352b0437694..a01cc3583514 100644
--- a/lib/device/partition.c
+++ b/lib/device/partition.c
@@ -22,7 +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

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux