From 6de78f9f24992462e9081f7ebd377648f64272f1 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Fri, 21 Nov 2014 18:00:00 +0000 Subject: [PATCH] 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 --- usr.sbin/ctld/ctld.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c index 529131aeab49..ca55063a3ccd 100644 --- a/usr.sbin/ctld/ctld.c +++ b/usr.sbin/ctld/ctld.c @@ -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; }