Fix panic on kern.cam.ctl.ha_role change after r333446.

MFC after:	1 week
Sponsored by:	iXsystems, Inc.
This commit is contained in:
Alexander Motin 2020-04-07 03:19:00 +00:00
parent a8b8edb25e
commit efeedddcb5
2 changed files with 8 additions and 4 deletions

View File

@ -2574,8 +2574,10 @@ ctl_be_block_modify(struct ctl_be_block_softc *softc, struct ctl_lun_req *req)
if (params->lun_size_bytes != 0) if (params->lun_size_bytes != 0)
be_lun->params.lun_size_bytes = params->lun_size_bytes; be_lun->params.lun_size_bytes = params->lun_size_bytes;
nvlist_destroy(cbe_lun->options); if (req->args_nvl != NULL) {
cbe_lun->options = nvlist_clone(req->args_nvl); nvlist_destroy(cbe_lun->options);
cbe_lun->options = nvlist_clone(req->args_nvl);
}
wasprim = (cbe_lun->flags & CTL_LUN_FLAG_PRIMARY); wasprim = (cbe_lun->flags & CTL_LUN_FLAG_PRIMARY);
value = dnvlist_get_string(cbe_lun->options, "ha_role", NULL); value = dnvlist_get_string(cbe_lun->options, "ha_role", NULL);

View File

@ -1252,8 +1252,10 @@ ctl_backend_ramdisk_modify(struct ctl_be_ramdisk_softc *softc,
if (params->lun_size_bytes != 0) if (params->lun_size_bytes != 0)
be_lun->params.lun_size_bytes = params->lun_size_bytes; be_lun->params.lun_size_bytes = params->lun_size_bytes;
nvlist_destroy(cbe_lun->options); if (req->args_nvl != NULL) {
cbe_lun->options = nvlist_clone(req->args_nvl); nvlist_destroy(cbe_lun->options);
cbe_lun->options = nvlist_clone(req->args_nvl);
}
wasprim = (cbe_lun->flags & CTL_LUN_FLAG_PRIMARY); wasprim = (cbe_lun->flags & CTL_LUN_FLAG_PRIMARY);
value = dnvlist_get_string(cbe_lun->options, "ha_role", NULL); value = dnvlist_get_string(cbe_lun->options, "ha_role", NULL);