File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -533,6 +533,21 @@ func (self *RealFsInfo) GetDirFsDevice(dir string) (*DeviceInfo, error) {
533533 }
534534
535535 mount , found := self .mounts [dir ]
536+ // try the parent dir if not found until we reach the root dir
537+ // this is an issue on btrfs systems where the directory is not
538+ // the subvolume
539+ for ! found {
540+ pathdir , _ := filepath .Split (dir )
541+ // break when we reach root
542+ if pathdir == "/" {
543+ break
544+ }
545+ // trim "/" from the new parent path otherwise the next possible
546+ // filepath.Split in the loop will not split the string any further
547+ dir = strings .TrimSuffix (pathdir , "/" )
548+ mount , found = self .mounts [dir ]
549+ }
550+
536551 if found && mount .Fstype == "btrfs" && mount .Major == 0 && strings .HasPrefix (mount .Source , "/dev/" ) {
537552 major , minor , err := getBtrfsMajorMinorIds (mount )
538553 if err != nil {
You can’t perform that action at this time.
0 commit comments