]> granicus.if.org Git - zfs/commitdiff
Fix null pointer in arc_kmem_reap_now on 32-bit
authortuxoko <tuxoko@gmail.com>
Fri, 30 Oct 2015 21:34:22 +0000 (14:34 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 20 Nov 2015 00:01:47 +0000 (16:01 -0800)
On 32 bit system, zio_buf_cache is limit to 1M. Larger than that is all NULL.
So we need to avoid reaping them.

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #3973

module/zfs/arc.c

index 06fb72b602c285b64a0acb8715ab4f78f713591c..c1e0bfbbaf14a74e42940117b6d8ff190ccd9910 100644 (file)
@@ -3373,6 +3373,11 @@ arc_kmem_reap_now(void)
        }
 
        for (i = 0; i < SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT; i++) {
+#ifdef _ILP32
+               /* reach upper limit of cache size on 32-bit */
+               if (zio_buf_cache[i] == NULL)
+                       break;
+#endif
                if (zio_buf_cache[i] != prev_cache) {
                        prev_cache = zio_buf_cache[i];
                        kmem_cache_reap_now(zio_buf_cache[i]);