diff --git a/go.mod b/go.mod index 63d04edfb04..5552593ed36 100644 --- a/go.mod +++ b/go.mod @@ -53,7 +53,7 @@ require ( github.com/gogo/protobuf v1.3.1 github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e github.com/golang/mock v1.4.4 - github.com/google/cadvisor v0.38.6 + github.com/google/cadvisor v0.38.7 github.com/google/go-cmp v0.5.2 github.com/google/gofuzz v1.1.0 github.com/google/uuid v1.1.2 @@ -281,7 +281,7 @@ replace ( github.com/golangplus/fmt => github.com/golangplus/fmt v0.0.0-20150411045040-2a5d6d7d2995 github.com/golangplus/testing => github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e github.com/google/btree => github.com/google/btree v1.0.0 - github.com/google/cadvisor => github.com/google/cadvisor v0.38.6 + github.com/google/cadvisor => github.com/google/cadvisor v0.38.7 github.com/google/go-cmp => github.com/google/go-cmp v0.5.2 github.com/google/gofuzz => github.com/google/gofuzz v1.1.0 github.com/google/martian => github.com/google/martian v2.1.0+incompatible diff --git a/go.sum b/go.sum index ffa44028839..5730aa42d4c 100644 --- a/go.sum +++ b/go.sum @@ -234,8 +234,8 @@ github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e h1:KhcknUwkWHKZ github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e/go.mod h1:0AA//k/eakGydO4jKRoRL2j92ZKSzTgj9tclaCrvXHk= github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/cadvisor v0.38.6 h1:5vu8NaOqsBKF6wOxBLeDPD7hcmxfg/4I5NZGYXK7gIo= -github.com/google/cadvisor v0.38.6/go.mod h1:1OFB9sOOMkBdUBGCO/1SArawTnDscgMzTodacVDe8mA= +github.com/google/cadvisor v0.38.7 h1:ZWyUz+23k1PRmEA+yrnDGtEC6IuU4Vc6439x2NQLHnA= +github.com/google/cadvisor v0.38.7/go.mod h1:1OFB9sOOMkBdUBGCO/1SArawTnDscgMzTodacVDe8mA= github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g= diff --git a/vendor/github.com/google/cadvisor/fs/fs.go b/vendor/github.com/google/cadvisor/fs/fs.go index cb45c33c933..fd2772f9983 100644 --- a/vendor/github.com/google/cadvisor/fs/fs.go +++ b/vendor/github.com/google/cadvisor/fs/fs.go @@ -527,6 +527,26 @@ func (i *RealFsInfo) GetDeviceInfoByFsUUID(uuid string) (*DeviceInfo, error) { return &DeviceInfo{deviceName, p.major, p.minor}, nil } +func (i *RealFsInfo) mountInfoFromDir(dir string) (*mount.MountInfo, bool) { + mount, found := i.mounts[dir] + // try the parent dir if not found until we reach the root dir + // this is an issue on btrfs systems where the directory is not + // the subvolume + for !found { + pathdir, _ := filepath.Split(dir) + // break when we reach root + if pathdir == "/" { + mount, found = i.mounts["/"] + break + } + // trim "/" from the new parent path otherwise the next possible + // filepath.Split in the loop will not split the string any further + dir = strings.TrimSuffix(pathdir, "/") + mount, found = i.mounts[dir] + } + return &mount, found +} + func (i *RealFsInfo) GetDirFsDevice(dir string) (*DeviceInfo, error) { buf := new(syscall.Stat_t) err := syscall.Stat(dir, buf) @@ -543,24 +563,9 @@ func (i *RealFsInfo) GetDirFsDevice(dir string) (*DeviceInfo, error) { } } - mount, found := i.mounts[dir] - // try the parent dir if not found until we reach the root dir - // this is an issue on btrfs systems where the directory is not - // the subvolume - for !found { - pathdir, _ := filepath.Split(dir) - // break when we reach root - if pathdir == "/" { - break - } - // trim "/" from the new parent path otherwise the next possible - // filepath.Split in the loop will not split the string any further - dir = strings.TrimSuffix(pathdir, "/") - mount, found = i.mounts[dir] - } - + mount, found := i.mountInfoFromDir(dir) if found && mount.FsType == "btrfs" && mount.Major == 0 && strings.HasPrefix(mount.Source, "/dev/") { - major, minor, err := getBtrfsMajorMinorIds(&mount) + major, minor, err := getBtrfsMajorMinorIds(mount) if err != nil { klog.Warningf("%s", err) } else { diff --git a/vendor/modules.txt b/vendor/modules.txt index ebf9e8817d5..472a50873c8 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -521,9 +521,9 @@ github.com/golang/protobuf/ptypes/wrappers # github.com/google/btree v1.0.0 => github.com/google/btree v1.0.0 github.com/google/btree # github.com/google/btree => github.com/google/btree v1.0.0 -# github.com/google/cadvisor v0.38.6 => github.com/google/cadvisor v0.38.6 +# github.com/google/cadvisor v0.38.7 => github.com/google/cadvisor v0.38.7 ## explicit -# github.com/google/cadvisor => github.com/google/cadvisor v0.38.6 +# github.com/google/cadvisor => github.com/google/cadvisor v0.38.7 github.com/google/cadvisor/accelerators github.com/google/cadvisor/cache/memory github.com/google/cadvisor/client/v2