Skip to content

Commit c2f6682

Browse files
authored
Merge pull request #1133 from derekhjray/master
v3/diss (Linux): fix disk retrieve partition issue while using in container
2 parents 8d02cf8 + b39f8bb commit c2f6682

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

disk/disk_linux.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,15 @@ var fsTypeMap = map[int64]string{
221221
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) {
222222
useMounts := false
223223

224-
filename := common.HostProc("self/mountinfo")
224+
filename := common.HostProc("1/mountinfo")
225225
lines, err := common.ReadLines(filename)
226226
if err != nil {
227227
if err != err.(*os.PathError) {
228228
return nil, err
229229
}
230-
// if kernel does not support self/mountinfo, fallback to self/mounts (<2.6.26)
230+
// if kernel does not support 1/mountinfo, fallback to 1/mounts (<2.6.26)
231231
useMounts = true
232-
filename = common.HostProc("self/mounts")
232+
filename = common.HostProc("1/mounts")
233233
lines, err = common.ReadLines(filename)
234234
if err != nil {
235235
return nil, err
@@ -261,7 +261,7 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
261261
}
262262
}
263263
} else {
264-
// a line of self/mountinfo has the following structure:
264+
// a line of 1/mountinfo has the following structure:
265265
// 36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue
266266
// (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11)
267267

v3/disk/disk_linux.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,15 @@ var fsTypeMap = map[int64]string{
221221
func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, error) {
222222
useMounts := false
223223

224-
filename := common.HostProc("self/mountinfo")
224+
filename := common.HostProc("1/mountinfo")
225225
lines, err := common.ReadLines(filename)
226226
if err != nil {
227227
if err != err.(*os.PathError) {
228228
return nil, err
229229
}
230-
// if kernel does not support self/mountinfo, fallback to self/mounts (<2.6.26)
230+
// if kernel does not support 1/mountinfo, fallback to 1/mounts (<2.6.26)
231231
useMounts = true
232-
filename = common.HostProc("self/mounts")
232+
filename = common.HostProc("1/mounts")
233233
lines, err = common.ReadLines(filename)
234234
if err != nil {
235235
return nil, err
@@ -261,7 +261,7 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
261261
}
262262
}
263263
} else {
264-
// a line of self/mountinfo has the following structure:
264+
// a line of 1/mountinfo has the following structure:
265265
// 36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue
266266
// (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11)
267267

0 commit comments

Comments
 (0)