From 4652fdc2084753cff33651c77036fe5b45d0799f Mon Sep 17 00:00:00 2001 From: Mike Snitzer Date: Thu, 30 Oct 2014 20:26:39 -0400 Subject: [PATCH] devmapper: use proper DM_UDEV_DISABLE_*_FLAG when creating the thin-pool Otherwise udev can unecessarily execute various rules (and issue scanning IO, etc) against the thin-pool -- which can never be a top-level device. Docker-DCO-1.1-Signed-off-by: Mike Snitzer (github: snitm) --- devicemapper/devmapper.go | 3 ++- devicemapper/devmapper_wrapper.go | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/devicemapper/devmapper.go b/devicemapper/devmapper.go index c0b931c..3de42ba 100644 --- a/devicemapper/devmapper.go +++ b/devicemapper/devmapper.go @@ -361,7 +361,8 @@ func CreatePool(poolName string, dataFile, metadataFile *os.File, poolBlockSize } var cookie uint = 0 - if err := task.SetCookie(&cookie, 0); err != nil { + var flags uint16 = DmUdevDisableSubsystemRulesFlag | DmUdevDisableDiskRulesFlag | DmUdevDisableOtherRulesFlag + if err := task.SetCookie(&cookie, flags); err != nil { return fmt.Errorf("Can't set cookie %s", err) } diff --git a/devicemapper/devmapper_wrapper.go b/devicemapper/devmapper_wrapper.go index c7e96a1..499405a 100644 --- a/devicemapper/devmapper_wrapper.go +++ b/devicemapper/devmapper_wrapper.go @@ -82,6 +82,12 @@ const ( LoNameSize = C.LO_NAME_SIZE ) +const ( + DmUdevDisableSubsystemRulesFlag = C.DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG + DmUdevDisableDiskRulesFlag = C.DM_UDEV_DISABLE_DISK_RULES_FLAG + DmUdevDisableOtherRulesFlag = C.DM_UDEV_DISABLE_OTHER_RULES_FLAG +) + var ( DmGetLibraryVersion = dmGetLibraryVersionFct DmGetNextTarget = dmGetNextTargetFct