Fix null pointer in arc_kmem_reap_now on 32-bit

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
This commit is contained in:
tuxoko 2015-10-30 14:34:22 -07:00 committed by Ned Bass
parent d8ac2b39c9
commit becc31dda7
1 changed files with 5 additions and 0 deletions

View File

@ -3373,6 +3373,11 @@ arc_kmem_reap_now(void)
} }
for (i = 0; i < SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT; i++) { 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) { if (zio_buf_cache[i] != prev_cache) {
prev_cache = zio_buf_cache[i]; prev_cache = zio_buf_cache[i];
kmem_cache_reap_now(zio_buf_cache[i]); kmem_cache_reap_now(zio_buf_cache[i]);