forked from pool/docker
1552a120e1
OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/docker?expand=0&rev=33
65 lines
1.8 KiB
Diff
65 lines
1.8 KiB
Diff
diff -Naur a/daemon/graphdriver/devmapper/deviceset.go b/daemon/graphdriver/devmapper/deviceset.go
|
|
--- a/daemon/graphdriver/devmapper/deviceset.go 2015-09-10 20:43:43.000000000 +0200
|
|
+++ b/daemon/graphdriver/devmapper/deviceset.go 2015-09-11 00:27:54.818876198 +0200
|
|
@@ -1482,12 +1482,16 @@
|
|
if err != nil {
|
|
return err
|
|
}
|
|
- if d, err := devicemapper.GetDeps(devname); err == nil {
|
|
- // Access to more Debug output
|
|
- logrus.Debugf("[devmapper] devicemapper.GetDeps() %s: %#v", devname, d)
|
|
+
|
|
+ if devinfo.Exists == 0 {
|
|
+ return nil
|
|
+ }
|
|
+ if err := devicemapper.RemoveDevice(devname); err != nil {
|
|
+ return err
|
|
}
|
|
- if devinfo.Exists != 0 {
|
|
- return devicemapper.RemoveDevice(devname)
|
|
+
|
|
+ if d, err := devicemapper.GetDeps(devname); err == nil {
|
|
+ logrus.Warnf("[devmapper] device %s still has %d active dependents", devname, d.Count)
|
|
}
|
|
|
|
return nil
|
|
diff -Naur a/pkg/devicemapper/devmapper_wrapper.go b/pkg/devicemapper/devmapper_wrapper.go
|
|
--- a/pkg/devicemapper/devmapper_wrapper.go 2015-09-10 20:43:43.000000000 +0200
|
|
+++ b/pkg/devicemapper/devmapper_wrapper.go 2015-09-11 00:27:54.819876198 +0200
|
|
@@ -38,7 +38,10 @@
|
|
*/
|
|
import "C"
|
|
|
|
-import "unsafe"
|
|
+import (
|
|
+ "reflect"
|
|
+ "unsafe"
|
|
+)
|
|
|
|
type (
|
|
CDmTask C.struct_dm_task
|
|
@@ -184,12 +187,21 @@
|
|
if Cdeps == nil {
|
|
return nil
|
|
}
|
|
+
|
|
+ // golang issue: https://github.com/golang/go/issues/11925
|
|
+ hdr := reflect.SliceHeader{
|
|
+ Data: uintptr(unsafe.Pointer(uintptr(unsafe.Pointer(Cdeps)) + unsafe.Sizeof(*Cdeps))),
|
|
+ Len: int(Cdeps.count),
|
|
+ Cap: int(Cdeps.count),
|
|
+ }
|
|
+ devices := *(*[]C.uint64_t)(unsafe.Pointer(&hdr))
|
|
+
|
|
deps := &Deps{
|
|
Count: uint32(Cdeps.count),
|
|
Filler: uint32(Cdeps.filler),
|
|
}
|
|
- for _, device := range Cdeps.device {
|
|
- deps.Device = append(deps.Device, (uint64)(device))
|
|
+ for _, device := range devices {
|
|
+ deps.Device = append(deps.Device, uint64(device))
|
|
}
|
|
return deps
|
|
}
|