In conf_apply() remove iSCSI ports from kernel before removing LUNs.

Previous order confused initiators with messages about "removed" LUNs
during simple ctld restart without any real config change.  After this
commit initiators only reestablish lost connection, receive "Power on
occurred" UNIT ATTENTION status and continue normal operation.

MFC after:	1 month
This commit is contained in:
Alexander Motin 2014-11-21 18:00:00 +00:00
parent abf832a879
commit 6de78f9f24

View File

@ -1662,6 +1662,16 @@ conf_apply(struct conf *oldconf, struct conf *newconf)
*/
newtarg = target_find(newconf, oldtarg->t_name);
if (newtarg == NULL) {
error = kernel_port_remove(oldtarg);
if (error != 0) {
log_warnx("failed to remove target %s",
oldtarg->t_name);
/*
* XXX: Uncomment after fixing the root cause.
*
* cumulated_error++;
*/
}
TAILQ_FOREACH_SAFE(oldlun, &oldtarg->t_luns, l_next,
tmplun) {
log_debugx("target %s not found in new "
@ -1678,16 +1688,6 @@ conf_apply(struct conf *oldconf, struct conf *newconf)
cumulated_error++;
}
}
error = kernel_port_remove(oldtarg);
if (error != 0) {
log_warnx("failed to remove target %s",
oldtarg->t_name);
/*
* XXX: Uncomment after fixing the root cause.
*
* cumulated_error++;
*/
}
continue;
}