Added fix for Kubernetes btrfs issue #38337
https://github.com/kubernetes/kubernetes/issues/38337
This commit is contained in:
parent
fb28b0da1b
commit
3e43b4573d
25
fs/fs.go
25
fs/fs.go
@ -149,6 +149,31 @@ func processMounts(mounts []*mount.Info, excludedMountpointPrefixes []string) ma
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// btrfs fix: following workaround fixes wrong btrfs Major and Minor Ids reported in /proc/self/mountinfo.
|
||||||
|
// instead of using values from /proc/self/mountinfo we use stat to get Ids from btrfs mount point
|
||||||
|
if mount.Fstype == "btrfs" && mount.Major == 0 && strings.HasPrefix(mount.Source, "/dev/") {
|
||||||
|
|
||||||
|
buf := new(syscall.Stat_t)
|
||||||
|
err := syscall.Stat(mount.Source, buf)
|
||||||
|
if err != nil {
|
||||||
|
glog.Warningf("stat failed on %s with error: %s", mount.Source, err)
|
||||||
|
} else {
|
||||||
|
glog.Infof("btrfs mount %#v", mount)
|
||||||
|
if buf.Mode&syscall.S_IFMT == syscall.S_IFBLK {
|
||||||
|
err := syscall.Stat(mount.Mountpoint, buf)
|
||||||
|
if err != nil {
|
||||||
|
glog.Warningf("stat failed on %s with error: %s", mount.Mountpoint, err)
|
||||||
|
} else {
|
||||||
|
glog.Infof("btrfs dev major:minor %d:%d\n", int(major(buf.Dev)), int(minor(buf.Dev)))
|
||||||
|
glog.Infof("btrfs rdev major:minor %d:%d\n", int(major(buf.Rdev)), int(minor(buf.Rdev)))
|
||||||
|
|
||||||
|
mount.Major = int(major(buf.Dev))
|
||||||
|
mount.Minor = int(minor(buf.Dev))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
partitions[mount.Source] = partition{
|
partitions[mount.Source] = partition{
|
||||||
fsType: mount.Fstype,
|
fsType: mount.Fstype,
|
||||||
mountpoint: mount.Mountpoint,
|
mountpoint: mount.Mountpoint,
|
||||||
|
Loading…
Reference in New Issue
Block a user