]> granicus.if.org Git - zfs/commitdiff
Fix comparison signedness in arc_is_overflowing()
authorAlexander Motin <mav@FreeBSD.org>
Mon, 10 Jun 2019 16:52:25 +0000 (12:52 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 11 Jun 2019 17:45:23 +0000 (10:45 -0700)
When ARC size is very small, aggsum_lower_bound(&arc_size) may return
negative values, that due to unsigned comparison caused delays, waiting
for arc_adjust() to "fix" it by calling aggsum_value(&arc_size).  Use
of signed comparison there fixes the problem.

Reviewed-by: Matt Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Closes #8873

module/zfs/arc.c

index 9b500352a4c07b638fe3b63ba117903393bf387f..3dfa6ca202d1c4cee3dce76bf1f845755cfcfedd 100644 (file)
@@ -5480,7 +5480,7 @@ static boolean_t
 arc_is_overflowing(void)
 {
        /* Always allow at least one block of overflow */
-       uint64_t overflow = MAX(SPA_MAXBLOCKSIZE,
+       int64_t overflow = MAX(SPA_MAXBLOCKSIZE,
            arc_c >> zfs_arc_overflow_shift);
 
        /*
@@ -5492,7 +5492,7 @@ arc_is_overflowing(void)
         * in the ARC. In practice, that's in the tens of MB, which is low
         * enough to be safe.
         */
-       return (aggsum_lower_bound(&arc_size) >= arc_c + overflow);
+       return (aggsum_lower_bound(&arc_size) >= (int64_t)arc_c + overflow);
 }
 
 static abd_t *