From bffb68a2b863bc43c42b53ba56d3ee7a4a45ca96 Mon Sep 17 00:00:00 2001 From: Chunwei Chen Date: Wed, 6 Jul 2016 17:06:17 -0700 Subject: Fix Large kmem_alloc in vdev_metaslab_init This allocation can go way over 1MB, so we should use vmem_alloc instead of kmem_alloc. Large kmem_alloc(1430784, 0x1000), please file an issue... Call Trace: [] ? spl_kmem_zalloc+0xef/0x160 [spl] [] ? vdev_metaslab_init+0x9d/0x1f0 [zfs] [] ? vdev_load+0xc0/0xd0 [zfs] [] ? vdev_load+0x33/0xd0 [zfs] [] ? spa_load+0xfc4/0x1b60 [zfs] [] ? spa_tryimport+0x98/0x430 [zfs] [] ? zfs_ioc_pool_tryimport+0x41/0x80 [zfs] [] ? zfsdev_ioctl+0x4a9/0x4e0 [zfs] [] ? do_vfs_ioctl+0x2cf/0x4b0 [] ? SyS_ioctl+0x81/0xa0 Signed-off-by: Chunwei Chen Signed-off-by: Brian Behlendorf Closes #4752 --- module/zfs/vdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module') diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c index fb0a2c31f..5d5e3c5d1 100644 --- a/module/zfs/vdev.c +++ b/module/zfs/vdev.c @@ -892,11 +892,11 @@ vdev_metaslab_init(vdev_t *vd, uint64_t txg) ASSERT(oldc <= newc); - mspp = kmem_zalloc(newc * sizeof (*mspp), KM_SLEEP); + mspp = vmem_zalloc(newc * sizeof (*mspp), KM_SLEEP); if (oldc != 0) { bcopy(vd->vdev_ms, mspp, oldc * sizeof (*mspp)); - kmem_free(vd->vdev_ms, oldc * sizeof (*mspp)); + vmem_free(vd->vdev_ms, oldc * sizeof (*mspp)); } vd->vdev_ms = mspp; @@ -950,7 +950,7 @@ vdev_metaslab_fini(vdev_t *vd) if (msp != NULL) metaslab_fini(msp); } - kmem_free(vd->vdev_ms, count * sizeof (metaslab_t *)); + vmem_free(vd->vdev_ms, count * sizeof (metaslab_t *)); vd->vdev_ms = NULL; } -- cgit v1.2.3