546 if (rc != 0) {
547 goto cleanup;
548 }
549
550 /* Translate nvlist */
551 rc = it_nv_to_config(cfg_nvlist, &cfg);
552 if (rc != 0) {
553 cmn_err(CE_WARN, "Configuration is invalid");
554 goto cleanup;
555 }
556
557 /* Update config */
558 rc = iscsit_config_merge(cfg);
559 /* FALLTHROUGH */
560
561 cleanup:
562 if (cfg)
563 it_config_free_cmn(cfg);
564 if (cfg_pnvlist)
565 kmem_free(cfg_pnvlist, setcfg.set_cfg_pnvlist_len);
566 if (cfg_nvlist)
567 nvlist_free(cfg_nvlist);
568
569 /*
570 * Now that the reconfig is complete set our state back to
571 * enabled.
572 */
573 mutex_enter(&iscsit_global.global_state_mutex);
574 iscsit_global.global_svc_state = ISE_ENABLED;
575 mutex_exit(&iscsit_global.global_state_mutex);
576 break;
577 case ISCSIT_IOC_ENABLE_SVC: {
578 iscsit_hostinfo_t hostinfo;
579
580 if (ddi_copyin((void *)argp, &hostinfo.length,
581 sizeof (hostinfo.length), flag) != 0) {
582 mutex_enter(&iscsit_global.global_state_mutex);
583 iscsit_global.global_svc_state = ISE_DISABLED;
584 mutex_exit(&iscsit_global.global_state_mutex);
585 return (EFAULT);
586 }
|
546 if (rc != 0) {
547 goto cleanup;
548 }
549
550 /* Translate nvlist */
551 rc = it_nv_to_config(cfg_nvlist, &cfg);
552 if (rc != 0) {
553 cmn_err(CE_WARN, "Configuration is invalid");
554 goto cleanup;
555 }
556
557 /* Update config */
558 rc = iscsit_config_merge(cfg);
559 /* FALLTHROUGH */
560
561 cleanup:
562 if (cfg)
563 it_config_free_cmn(cfg);
564 if (cfg_pnvlist)
565 kmem_free(cfg_pnvlist, setcfg.set_cfg_pnvlist_len);
566 nvlist_free(cfg_nvlist);
567
568 /*
569 * Now that the reconfig is complete set our state back to
570 * enabled.
571 */
572 mutex_enter(&iscsit_global.global_state_mutex);
573 iscsit_global.global_svc_state = ISE_ENABLED;
574 mutex_exit(&iscsit_global.global_state_mutex);
575 break;
576 case ISCSIT_IOC_ENABLE_SVC: {
577 iscsit_hostinfo_t hostinfo;
578
579 if (ddi_copyin((void *)argp, &hostinfo.length,
580 sizeof (hostinfo.length), flag) != 0) {
581 mutex_enter(&iscsit_global.global_state_mutex);
582 iscsit_global.global_svc_state = ISE_DISABLED;
583 mutex_exit(&iscsit_global.global_state_mutex);
584 return (EFAULT);
585 }
|