From 2b8319c4bf394c5c8037997de87756dc798e46f9 Mon Sep 17 00:00:00 2001 From: frankyang Date: Tue, 14 May 2019 15:21:55 +0800 Subject: [PATCH 14/14] bugfix: fetch the right device number which great than 255 Signed-off-by: frankyang Upstream-commit: b9f31912deb511e732763e4fa5ecd0208b104eb2 Component: engine --- components/engine/daemon/daemon_unix.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/engine/daemon/daemon_unix.go b/components/engine/daemon/daemon_unix.go index 10d0b3197d..06b3ee39fc 100644 --- a/components/engine/daemon/daemon_unix.go +++ b/components/engine/daemon/daemon_unix.go @@ -179,8 +179,8 @@ func getBlkioWeightDevices(config containertypes.Resources) ([]specs.LinuxWeight } weight := weightDevice.Weight d := specs.LinuxWeightDevice{Weight: &weight} - d.Major = int64(stat.Rdev / 256) - d.Minor = int64(stat.Rdev % 256) + d.Major = int64(unix.Major(stat.Rdev)) + d.Minor = int64(unix.Minor(stat.Rdev)) blkioWeightDevices = append(blkioWeightDevices, d) } @@ -265,8 +265,8 @@ func getBlkioThrottleDevices(devs []*blkiodev.ThrottleDevice) ([]specs.LinuxThro return nil, errors.Wrapf(err, "Failed to stat device %q", d.Path) } d := specs.LinuxThrottleDevice{Rate: d.Rate} - d.Major = int64(stat.Rdev / 256) - d.Minor = int64(stat.Rdev % 256) + d.Major = int64(unix.Major(stat.Rdev)) + d.Minor = int64(unix.Minor(stat.Rdev)) throttleDevices = append(throttleDevices, d) } -- 2.33.0