diff --git a/vfs/vfs.go b/vfs/vfs.go index 58e7630b1..ccd10265c 100644 --- a/vfs/vfs.go +++ b/vfs/vfs.go @@ -510,6 +510,15 @@ func (vfs *VFS) Statfs() (total, used, free int64) { if u.Used != nil { used = *u.Used } + if total < 0 && free >= 0 && used >= 0 { + total = free + used + } + if free < 0 && total >= 0 && used >= 0 { + free = total - used + } + if used < 0 && total >= 0 && free >= 0 { + used = total - free + } } return }