Skip to content

Commit 59a628d

Browse files
kofemannmksahakyan
authored andcommitted
pool: add workaround space mismanagementd by XFS (and others?)
Motivation: Some filesystems miscalculate/report free space in respect tu used space: ``` $ df /dcache/pool-a Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda1 558602657792 558397210232 205447560 100% /dcache/pool-a $ du -s /dcache/pool-a 554502450484 /dcache/pool-a $ bc 558602657792 - 554502450484 4100207308 ``` File system reports 200GB of the free space, however, total - real used gives ~4TB. Thus dCache assumes 4TB and write the file system full... ==> IO error Modification: use an `effective` free space, which is the minimum between disk reported and internal accounting free spaces. Result: Pool uses the effective free space instead of mathematically correct value. Acked-by: Dmitry Litvintsev Target: master, 10.2 Require-book: no Require-notes: yes (cherry picked from commit 208bfbe) Signed-off-by: Tigran Mkrtchyan <[email protected]>
1 parent 501fc7e commit 59a628d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

modules/dcache/src/main/java/org/dcache/pool/repository/v5/ReplicaRepository.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,8 +838,16 @@ public SpaceRecord getSpaceRecord() {
838838
SpaceRecord space = _account.getSpaceRecord();
839839
long lru = (System.currentTimeMillis() - _sweeper.getLru()) / 1000L;
840840
long gap = _gap.orElse(Math.min(space.getTotalSpace() / 4, DEFAULT_GAP));
841+
842+
// REVISIT: This workaround addresses a filesystem behavior where the effective free space
843+
// may be smaller than the total - used.
844+
// To ensure correctness, we take the minimum of the disk reported and
845+
// the dCache accounting expected free spaces.
846+
long storeFreeSpace = _store.getFreeSpace();
847+
long effectiveFreeSpace = Math.min(storeFreeSpace, space.getFreeSpace());
848+
841849
return new SpaceRecord(space.getTotalSpace(),
842-
space.getFreeSpace(),
850+
effectiveFreeSpace,
843851
space.getPreciousSpace(),
844852
space.getRemovableSpace(),
845853
lru,

0 commit comments

Comments
 (0)