Skip to content

Commit 1a86b57

Browse files
committed
fix when rootfs is empty, TotalUsageBytes will add extraUsage.Bytes on every update, lead to TotalUsageBytes keep increasing
1 parent 385c659 commit 1a86b57

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

container/common/fsHandler.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ func (fh *realFsHandler) update() error {
9696
fh.usage.TotalUsageBytes = rootUsage.Bytes
9797
}
9898
if fh.extraDir != "" && extraErr == nil {
99-
fh.usage.TotalUsageBytes += extraUsage.Bytes
99+
if fh.rootfs != "" {
100+
fh.usage.TotalUsageBytes += extraUsage.Bytes
101+
} else {
102+
// rootfs is empty, totalUsageBytes use extra usage bytes
103+
fh.usage.TotalUsageBytes = extraUsage.Bytes
104+
}
100105
}
101106

102107
// Combine errors into a single error to return

0 commit comments

Comments
 (0)