Commit f11a016a authored by David Howells's avatar David Howells

afs: Fix afs_statfs() to not let the values go below zero

Fix afs_statfs() so that the value for f_bavail and f_bfree don't go
"negative" if the number of blocks in use by a volume exceeds the max quota
for that volume.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent 3c4c4075
...@@ -729,7 +729,10 @@ static void afs_get_volume_status_success(struct afs_operation *op) ...@@ -729,7 +729,10 @@ static void afs_get_volume_status_success(struct afs_operation *op)
buf->f_blocks = vs->part_max_blocks; buf->f_blocks = vs->part_max_blocks;
else else
buf->f_blocks = vs->max_quota; buf->f_blocks = vs->max_quota;
buf->f_bavail = buf->f_bfree = buf->f_blocks - vs->blocks_in_use;
if (buf->f_blocks > vs->blocks_in_use)
buf->f_bavail = buf->f_bfree =
buf->f_blocks - vs->blocks_in_use;
} }
static const struct afs_operation_ops afs_get_volume_status_operation = { static const struct afs_operation_ops afs_get_volume_status_operation = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment