tests/quota_005_pos: use a long int for doubling the quota size

When run in isolation, quota_005_pos would see an empty ~300G dataset.
Doubling it's space overflows a int32, which meant it was trying to then
set the quota to a negative value, and would fail.

When run as part of the quota tests, the filesystem appears to have
stuff in it, and so a lower available space, which doesn't overflow, and
so succeeds.

The bare minimum fix seems to be to use a int64 for the available space,
so it can be comfortably doubled. Here it is.

(Also a typo fix and a tiny bit of cleanup).

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Closes #16097
This commit is contained in:
Rob Norris 2024-04-16 15:03:33 +10:00 committed by Brian Behlendorf
parent cd3e6b4f4c
commit f75574cbaa
1 changed files with 3 additions and 4 deletions

View File

@ -56,14 +56,13 @@ function cleanup
log_onexit cleanup log_onexit cleanup
log_assert "Verify that quota does not inherit its value from parent." log_assert "Verify that quota does not inherit its value from parent."
log_onexit cleanup
fs=$TESTPOOL/$TESTFS fs=$TESTPOOL/$TESTFS
fs_child=$TESTPOOL/$TESTFS/$TESTFS fs_child=$TESTPOOL/$TESTFS/$TESTFS
space_avail=$(get_prop available $fs) space_avail=$(get_prop available $fs)
quota_val=$(get_prop quota $fs) quota_val=$(get_prop quota $fs)
typeset -i quotasize=$space_avail typeset -li quotasize=$space_avail
((quotasize = quotasize * 2 )) ((quotasize = quotasize * 2 ))
log_must zfs set quota=$quotasize $fs log_must zfs set quota=$quotasize $fs