diff options
author | mav <mav@FreeBSD.org> | 2016-11-08 20:58:25 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2016-11-08 20:58:25 +0000 |
commit | 0df09b33d636c4de1d4361c40fdd86c192738d1a (patch) | |
tree | d1ccee8291eeec8c52623426e0be5f294a2201c0 /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c | |
parent | a0976b36bd568f80075b265b8c15e96330063ca6 (diff) | |
download | FreeBSD-src-0df09b33d636c4de1d4361c40fdd86c192738d1a.zip FreeBSD-src-0df09b33d636c4de1d4361c40fdd86c192738d1a.tar.gz |
MFC r307857: Fix panic after ZVOL renamed to name invalid for DEVFS.
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c index d1427b0..c825930 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c @@ -780,8 +780,10 @@ zvol_remove_zv(zvol_state_t *zv) g_topology_lock(); zvol_geom_destroy(zv); g_topology_unlock(); - } else if (zv->zv_volmode == ZFS_VOLMODE_DEV) - destroy_dev(zv->zv_dev); + } else if (zv->zv_volmode == ZFS_VOLMODE_DEV) { + if (zv->zv_dev != NULL) + destroy_dev(zv->zv_dev); + } #endif avl_destroy(&zv->zv_znode.z_range_avl); @@ -2952,14 +2954,14 @@ zvol_rename_minor(zvol_state_t *zv, const char *newname) } else if (zv->zv_volmode == ZFS_VOLMODE_DEV) { struct make_dev_args args; - dev = zv->zv_dev; - ASSERT(dev != NULL); - zv->zv_dev = NULL; - destroy_dev(dev); - if (zv->zv_total_opens > 0) { - zv->zv_flags &= ~ZVOL_EXCL; - zv->zv_total_opens = 0; - zvol_last_close(zv); + if ((dev = zv->zv_dev) != NULL) { + zv->zv_dev = NULL; + destroy_dev(dev); + if (zv->zv_total_opens > 0) { + zv->zv_flags &= ~ZVOL_EXCL; + zv->zv_total_opens = 0; + zvol_last_close(zv); + } } make_dev_args_init(&args); |