Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/ctld/ctld.c
Show First 20 Lines • Show All 2,107 Lines • ▼ Show 20 Lines | if (error != 0) { | ||||
lun_delete(newlun); | lun_delete(newlun); | ||||
cumulated_error++; | cumulated_error++; | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* Now add new ports or modify existing ones. | * Now add new ports or modify existing ones. | ||||
*/ | */ | ||||
TAILQ_FOREACH(newport, &newconf->conf_ports, p_next) { | TAILQ_FOREACH_SAFE(newport, &newconf->conf_ports, p_next, tmpport) { | ||||
if (port_is_dummy(newport)) | if (port_is_dummy(newport)) | ||||
continue; | continue; | ||||
oldport = port_find(oldconf, newport->p_name); | oldport = port_find(oldconf, newport->p_name); | ||||
if (oldport == NULL || port_is_dummy(oldport)) { | if (oldport == NULL || port_is_dummy(oldport)) { | ||||
log_debugx("adding port \"%s\"", newport->p_name); | log_debugx("adding port \"%s\"", newport->p_name); | ||||
error = kernel_port_add(newport); | error = kernel_port_add(newport); | ||||
} else { | } else { | ||||
log_debugx("updating port \"%s\"", newport->p_name); | log_debugx("updating port \"%s\"", newport->p_name); | ||||
newport->p_ctl_port = oldport->p_ctl_port; | newport->p_ctl_port = oldport->p_ctl_port; | ||||
error = kernel_port_update(newport, oldport); | error = kernel_port_update(newport, oldport); | ||||
} | } | ||||
if (error != 0) { | if (error != 0) { | ||||
log_warnx("failed to %s port %s", | log_warnx("failed to %s port %s", | ||||
(oldport == NULL) ? "add" : "update", | (oldport == NULL) ? "add" : "update", | ||||
newport->p_name); | newport->p_name); | ||||
if (oldport == NULL || port_is_dummy(oldport)) | |||||
jhb: Do you want the 'port_is_dummy' check here as well? | |||||
Done Inline ActionsI don't think it's needed. If oldport is a dummy, then we would've tried to add newport. And since there's an error, we should delete it. We know that at this point it isn't possible for newport to be a dummy. asomers: I don't think it's needed. If `oldport` is a dummy, then we would've tried to add `newport`. | |||||
Not Done Inline ActionsRight, I mean that this should match the condition on line 2121 so that this mirrors kernel_port_add(). That is: if (oldport == NULL || port_is_dummy(oldport)) port_delete(newport); Right now if oldport is a dummy and kernel_port_add fails, your change would still not delete newport. jhb: Right, I mean that this should match the condition on line 2121 so that this mirrors… | |||||
Done Inline ActionsYep, you're right. I'll change it. asomers: Yep, you're right. I'll change it. | |||||
port_delete(newport); | |||||
/* | /* | ||||
* XXX: Uncomment after fixing the root cause. | * XXX: Uncomment after fixing the root cause. | ||||
* | * | ||||
* cumulated_error++; | * cumulated_error++; | ||||
*/ | */ | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 758 Lines • Show Last 20 Lines |
Do you want the 'port_is_dummy' check here as well?