Details
Description
FileWithSnapshotFeature#updateQuotaAndCollectBlocks uses list to collect blocks
List<BlockInfo> allBlocks = new ArrayList<BlockInfo>(); if (file.getBlocks() != null) { allBlocks.addAll(Arrays.asList(file.getBlocks())); }
INodeFile#storagespaceConsumedContiguous collects all distinct blocks by set
// Collect all distinct blocks Set<BlockInfo> allBlocks = new HashSet<>(Arrays.asList(getBlocks())); DiffList<FileDiff> diffs = sf.getDiffs().asList(); for(FileDiff diff : diffs) { BlockInfo[] diffBlocks = diff.getBlocks(); if (diffBlocks != null) { allBlocks.addAll(Arrays.asList(diffBlocks)); }
but on updating the reclaim context we subtract these both , so wrong quota value can be updated
QuotaCounts current = file.storagespaceConsumed(bsp); reclaimContext.quotaDelta().add(oldCounts.subtract(current));