summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ctld/ctld.c
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2014-07-15 17:05:11 +0000
committermav <mav@FreeBSD.org>2014-07-15 17:05:11 +0000
commitb40b547aa1da9759435fa451a9927dadeeef00d2 (patch)
tree3d9ca3626166615c016ecdeda80ab70d51e47c14 /usr.sbin/ctld/ctld.c
parent5df1093df8b7eccb4b223002262ad786b0df65ce (diff)
downloadFreeBSD-src-b40b547aa1da9759435fa451a9927dadeeef00d2.zip
FreeBSD-src-b40b547aa1da9759435fa451a9927dadeeef00d2.tar.gz
MFC r268291:
Create separate CTL port for every iSCSI target (and maybe portal group). Having single port for all iSCSI connections makes problematic implementing some more advanced SCSI functionality in CTL, that require proper ports enumeration and identification. This change extends CTL iSCSI API, making ctld daemon to control list of iSCSI ports in CTL. When new target is defined in config fine, ctld will create respective port in CTL. When target is removed -- port will be also removed after all active commands through that port properly aborted. This change require ctld to be rebuilt to match the kernel. As a minor side effect, this allows to have iSCSI targets without LUNs. While that may look odd and not very useful, that is not incorrect.
Diffstat (limited to 'usr.sbin/ctld/ctld.c')
-rw-r--r--usr.sbin/ctld/ctld.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c
index 2cda316..e2b9ebe 100644
--- a/usr.sbin/ctld/ctld.c
+++ b/usr.sbin/ctld/ctld.c
@@ -1120,7 +1120,6 @@ conf_verify(struct conf *conf)
if (!found_lun) {
log_warnx("no LUNs defined for target \"%s\"",
targ->t_name);
- return (1);
}
}
TAILQ_FOREACH(pg, &conf->conf_portal_groups, pg_next) {
@@ -1209,19 +1208,6 @@ conf_apply(struct conf *oldconf, struct conf *newconf)
}
}
- if (oldconf->conf_kernel_port_on != newconf->conf_kernel_port_on) {
- if (newconf->conf_kernel_port_on == true) {
- log_debugx("enabling CTL iSCSI port");
- error = kernel_port_on();
- if (error != 0)
- log_errx(1, "failed to enable CTL iSCSI port; exiting");
- } else {
- error = kernel_port_off();
- if (error != 0)
- log_warnx("failed to disable CTL iSCSI port");
- }
- }
-
/*
* XXX: If target or lun removal fails, we should somehow "move"
* the old lun or target into newconf, so that subsequent
@@ -1253,6 +1239,7 @@ conf_apply(struct conf *oldconf, struct conf *newconf)
}
lun_delete(oldlun);
}
+ kernel_port_remove(oldtarg);
target_delete(oldtarg);
continue;
}
@@ -1387,6 +1374,8 @@ conf_apply(struct conf *oldconf, struct conf *newconf)
cumulated_error++;
}
}
+ if (oldtarg == NULL)
+ kernel_port_add(newtarg);
}
/*
OpenPOWER on IntegriCloud