From 80e73195583c5a9bf02c58ba92832a0bb2819361 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Wed, 13 Nov 2013 14:54:47 -0800 Subject: [PATCH] Make sure setInitialized is called when device is mounted --- devmapper/deviceset.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/devmapper/deviceset.go b/devmapper/deviceset.go index e7e57ab6a..47ae2241a 100644 --- a/devmapper/deviceset.go +++ b/devmapper/deviceset.go @@ -679,7 +679,7 @@ func (devices *DeviceSet) MountDevice(hash, path string, readOnly bool) error { count := devices.activeMounts[path] devices.activeMounts[path] = count + 1 - return nil + return devices.setInitialized(hash) } func (devices *DeviceSet) UnmountDevice(hash, path string, deactivate bool) error { @@ -740,10 +740,7 @@ func (devices *DeviceSet) HasActivatedDevice(hash string) bool { return devinfo != nil && devinfo.Exists != 0 } -func (devices *DeviceSet) SetInitialized(hash string) error { - devices.Lock() - defer devices.Unlock() - +func (devices *DeviceSet) setInitialized(hash string) error { info := devices.Devices[hash] if info == nil { return fmt.Errorf("Unknown device %s", hash)