Skip to contentSkip to conversation

master - scan: work around udev problems by avoiding open RDWR

PATCH David Teigland 1 participant 1 message Jun 20, 2018

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=42f7caf1c267a5b75ee38ea77a7e2fd7c582e704
Commit:        42f7caf1c267a5b75ee38ea77a7e2fd7c582e704
Parent:        f85a010a6bc9dc0414ccdf9c6b195c78231f1914
Author:        David Teigland <[email protected]>
AuthorDate:    Wed Jun 20 11:32:45 2018 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Wed Jun 20 14:08:12 2018 -0500

scan: work around udev problems by avoiding open RDWR

udev creates a train wreck of events if we open devices with RDWR. Until we can fix/disable/scrap udev, work around this by opening RDONLY and then closing/reopening RDWR when a write is needed. This invalidates the bcache blocks for the device before writing so it can trigger unnecessary rereading.

---
 lib/device/device.h |    1 +
 lib/label/label.c   |   56 +++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 55 insertions(+), 2 deletions(-)
lib/device/device.h +1 -0
index 00e398a..e879dbb 100644
@@ -35,6 +35,7 @@
 #define DEV_BCACHE_EXCL		0x00001000      /* bcache_fd should be open EXCL */
 #define DEV_FILTER_AFTER_SCAN	0x00002000	/* apply filter after bcache has data */
 #define DEV_FILTER_OUT_SCAN	0x00004000	/* filtered out during label scan */
+#define DEV_BCACHE_WRITE	0x00008000      /* bcache_fd is open with RDWR */
 
 /*
  * Support for external device info.
lib/label/label.c +54 -2

97 lines not on this page · raw message