Skip to content

Commit f11a016

Browse files
committed
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: David Howells <dhowells@redhat.com>
1 parent 3c4c407 commit f11a016

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

fs/afs/super.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,10 @@ static void afs_get_volume_status_success(struct afs_operation *op)
729729
buf->f_blocks = vs->part_max_blocks;
730730
else
731731
buf->f_blocks = vs->max_quota;
732-
buf->f_bavail = buf->f_bfree = buf->f_blocks - vs->blocks_in_use;
732+
733+
if (buf->f_blocks > vs->blocks_in_use)
734+
buf->f_bavail = buf->f_bfree =
735+
buf->f_blocks - vs->blocks_in_use;
733736
}
734737

735738
static const struct afs_operation_ops afs_get_volume_status_operation = {

0 commit comments

Comments
 (0)