Bug 415887

Summary: KIO Core KDiskFreeSpaceInfo freeSpaceInfo using wrong free space on btrfs Filesystems
Product: [Frameworks and Libraries] frameworks-kio Reporter: linux2019
Component: generalAssignee: David Faure <faure>
Status: REPORTED ---    
Severity: normal CC: kdelibs-bugs, nate
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description linux2019 2020-01-05 11:28:04 UTC
Krusader and Dolphin apparently use KIO/core/KDiskFreeSpaceInfo::freeSpaceInfo
to get free space of a certain filesystem/path.

As reported in

https://bugs.kde.org/show_bug.cgi?id=415512

this is reporting errors when there is sufficient capacity available on the drive as it is "just" unallocated - also on a half full disk.

It might be an Kernel or API issue with sys/statvfs
not really knowing or guaranteeing the free space on BTRFS.
Other filesystems with late allocation or delayed allocation might experience similar problems.

STEPS TO REPRODUCE
1. copying files with Krusader or Dolphin
2. observe error popup

EXPECTED RESULT
successful copy

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.4 Kernel/
KDE Plasma Version:5.17.4
KDE Frameworks Version:  5.65.0
Qt Version: 5.14.0

Copying on commandline works as expected

df <path> ouputs 0 space left
btrfs fi usage <path>

Overall:
    Device size:		   7.28TiB
    Device allocated:		   7.21TiB
    Device unallocated:		  69.00GiB
    Device missing:		   7.28TiB
    Used:			   7.15TiB
    Free (estimated):		 130.37GiB	(min: 95.87GiB)
    Data ratio:			      1.00
    Metadata ratio:		      2.00
    Global reserve:		 512.00MiB	(used: 0.00B)

Data,single: Size:7.19TiB, Used:7.13TiB (99.17%)
Metadata,DUP: Size:8.00GiB, Used:7.81GiB (97.64%)
System,DUP: Size:8.00MiB, Used:784.00KiB (9.57%)