diff options
Diffstat (limited to 'module/zfs/vdev.c')
-rw-r--r-- | module/zfs/vdev.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c index 50d230ccb..def98ad13 100644 --- a/module/zfs/vdev.c +++ b/module/zfs/vdev.c @@ -4162,6 +4162,11 @@ vdev_space_update(vdev_t *vd, int64_t alloc_delta, int64_t defer_delta, dspace_delta = vdev_deflated_space(vd, space_delta); mutex_enter(&vd->vdev_stat_lock); + /* ensure we won't underflow */ + if (alloc_delta < 0) { + ASSERT3U(vd->vdev_stat.vs_alloc, >=, -alloc_delta); + } + vd->vdev_stat.vs_alloc += alloc_delta; vd->vdev_stat.vs_space += space_delta; vd->vdev_stat.vs_dspace += dspace_delta; @@ -4169,6 +4174,7 @@ vdev_space_update(vdev_t *vd, int64_t alloc_delta, int64_t defer_delta, /* every class but log contributes to root space stats */ if (vd->vdev_mg != NULL && !vd->vdev_islog) { + ASSERT(!vd->vdev_isl2cache); mutex_enter(&rvd->vdev_stat_lock); rvd->vdev_stat.vs_alloc += alloc_delta; rvd->vdev_stat.vs_space += space_delta; |