fix(client): set usedSize as totalSize if usedSize > totalSize when queried from master, to avoid displaying anomalies such as cmd df

Signed-off-by: true1064 <tangjingyu@oppo.com>
(cherry picked from commit 0c6bb1d0b5)
This commit is contained in:
true1064 2023-12-21 19:52:56 +08:00 committed by AmazingChi
parent f1bf550713
commit 84795afb21

View File

@ -163,6 +163,13 @@ func (mw *MetaWrapper) updateVolStatInfo() (err error) {
log.LogWarnf("updateVolStatInfo: get volume status fail: volume(%v) err(%v)", mw.volname, err)
return
}
if info.UsedSize > info.TotalSize {
log.LogInfof("volume(%v) queried usedSize(%v) is larger than totalSize(%v), force set usedSize as totalSize",
mw.volname, info.UsedSize, info.TotalSize)
info.UsedSize = info.TotalSize
}
atomic.StoreUint64(&mw.totalSize, info.TotalSize)
atomic.StoreUint64(&mw.usedSize, info.UsedSize)
atomic.StoreUint64(&mw.inodeCount, info.InodeCount)