Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zfs filesystem skipped by df -h #8253

Closed
PaulZ-98 opened this issue Jan 8, 2019 · 2 comments · Fixed by #8254
Closed

zfs filesystem skipped by df -h #8253

PaulZ-98 opened this issue Jan 8, 2019 · 2 comments · Fixed by #8254

Comments

@PaulZ-98
Copy link
Contributor

PaulZ-98 commented Jan 8, 2019

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.

# df -h /datto/array1
Filesystem      Size  Used Avail Use% Mounted on
dattoArray         0     0     0    - /datto/array1
@PaulZ-98
Copy link
Contributor Author

PaulZ-98 commented Jan 8, 2019

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);

PaulZ-98 added a commit to datto/zfs that referenced this issue Jan 8, 2019
On full pool when pool root filesystem references very few bytes,
the f_blocks returned to statvfs is 0 but should be at least 1.

Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Fixes openzfs#8253
PaulZ-98 added a commit to datto/zfs that referenced this issue Jan 9, 2019
On full pool when pool root filesystem references very few bytes,
the f_blocks returned to statvfs is 0 but should be at least 1.

Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Fixes openzfs#8253
@PaulZ-98
Copy link
Contributor Author

PaulZ-98 commented Jan 9, 2019

Actually we decided it is slightly better to round refdbytes up to the filesystem recordsize.

PaulZ-98 added a commit to datto/zfs that referenced this issue Jan 9, 2019
On full pool when pool root filesystem references very few bytes,
the f_blocks returned to statvfs is 0 but should be at least 1.

Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Fixes openzfs#8253
PaulZ-98 added a commit to datto/zfs that referenced this issue Jan 9, 2019
On full pool when pool root filesystem references very few bytes,
the f_blocks returned to statvfs is 0 but should be at least 1.

Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Fixes openzfs#8253
PaulZ-98 added a commit to datto/zfs that referenced this issue Jan 11, 2019
On full pool when pool root filesystem references very few bytes,
the f_blocks returned to statvfs is 0 but should be at least 1.

Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Fixes openzfs#8253
PaulZ-98 added a commit to datto/zfs that referenced this issue Jan 11, 2019
On full pool when pool root filesystem references very few bytes,
the f_blocks returned to statvfs is 0 but should be at least 1.

Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Fixes openzfs#8253
behlendorf pushed a commit that referenced this issue Jan 13, 2019
On full pool when pool root filesystem references very few bytes,
the f_blocks returned to statvfs is 0 but should be at least 1.

Reviewed by: Tom Caputi <tcaputi@datto.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Closes #8253 
Closes #8254
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant