Skip to content

Commit

Permalink
v3/diss (Linux): fix disk retrieve partition issue while using in con…
Browse files Browse the repository at this point in the history
…tainer
  • Loading branch information
derekhjray committed Sep 18, 2021
1 parent ce5729c commit 1fa3805
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions v3/disk/disk_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,15 @@ var fsTypeMap = map[int64]string{
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) {
useMounts := false

filename := common.HostProc("self/mountinfo")
filename := common.HostProc("1/mountinfo")
lines, err := common.ReadLines(filename)
if err != nil {
if err != err.(*os.PathError) {
return nil, err
}
// if kernel does not support self/mountinfo, fallback to self/mounts (<2.6.26)
// if kernel does not support 1/mountinfo, fallback to 1/mounts (<2.6.26)
useMounts = true
filename = common.HostProc("self/mounts")
filename = common.HostProc("1/mounts")
lines, err = common.ReadLines(filename)
if err != nil {
return nil, err
Expand Down Expand Up @@ -261,7 +261,7 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
}
}
} else {
// a line of self/mountinfo has the following structure:
// a line of 1/mountinfo has the following structure:
// 36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue
// (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11)

Expand Down

0 comments on commit 1fa3805

Please sign in to comment.