Closed PaulZ-98 closed 5 years ago
Use the MAX macro to ensure f_blocks is at least 1.
- statp->f_blocks = (refdbytes + availbytes) >> bshift;
+ statp->f_blocks = MAX(1, (refdbytes + availbytes) >> bshift);
Actually we decided it is slightly better to round refdbytes up to the filesystem recordsize.
Linux Distribution Name | Ubuntu Distribution Version | 16.04 Linux Kernel | 4.10.0-28 Architecture | x86 ZFS Version | 0.8.0-rc2_61_g0f5f238
df -h skips root mount point of pool when pool is full
Create small pool with one child filesystem. Fill the pool by writing to the child filesystem. All the bytes consumed are in the child, so "referenced" statistic of pool root filesystem is very small (< 128k). In zfs_statvfs(), f_blocks becomes zero because the small refdbytes + availbytes (0) gets shifted away.
statp->f_blocks = (refdbytes + availbytes) >> bshift;
And because f_blocks is zero, it is skipped by df -h, unless specified as
df -h <filesystem>
, in which case it shows all zeroes.