Skip to content

Commit c08a8e7

Browse files
committed
Fix unfortunate NULL in spa_update_dspace
After 1325434, we can in certain circumstances end up calling spa_update_dspace with vd->vdev_mg NULL, which ends poorly during vdev removal. So let's not do that further space adjustment when we can't. Closes #12380 Signed-off-by: Rich Ercolani <[email protected]>
1 parent 1b50749 commit c08a8e7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

module/zfs/spa_misc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1853,7 +1853,8 @@ spa_update_dspace(spa_t *spa)
18531853
spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER);
18541854
vdev_t *vd =
18551855
vdev_lookup_top(spa, spa->spa_vdev_removal->svr_vdev_id);
1856-
if (vd->vdev_mg->mg_class == spa_normal_class(spa)) {
1856+
if (vd->vdev_mg &&
1857+
vd->vdev_mg->mg_class == spa_normal_class(spa)) {
18571858
spa->spa_dspace -= spa_deflate(spa) ?
18581859
vd->vdev_stat.vs_dspace : vd->vdev_stat.vs_space;
18591860
}

0 commit comments

Comments
 (0)