diff options
author | mav <mav@FreeBSD.org> | 2014-07-15 17:10:48 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2014-07-15 17:10:48 +0000 |
commit | 100d0f0aa6e25177e25a030a8ecb3c3154c95549 (patch) | |
tree | 10f6840e8c090ae213d342d6c52ed801afd83354 /usr.sbin/ctld | |
parent | 247c4d205304f59552dd4f5ed2727409e52c64df (diff) | |
download | FreeBSD-src-100d0f0aa6e25177e25a030a8ecb3c3154c95549.zip FreeBSD-src-100d0f0aa6e25177e25a030a8ecb3c3154c95549.tar.gz |
MFC r268328:
Close race in r268291 between port destruction, delayed by sessions
teardown, and new port creation during `service ctld restart`.
Close it by returning iSCSI port internal state, that allows to identify
dying ports, which should not be counted as existing, from really alive.
Diffstat (limited to 'usr.sbin/ctld')
-rw-r--r-- | usr.sbin/ctld/kernel.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/usr.sbin/ctld/kernel.c b/usr.sbin/ctld/kernel.c index 0b55449..af8c5c5 100644 --- a/usr.sbin/ctld/kernel.c +++ b/usr.sbin/ctld/kernel.c @@ -120,6 +120,7 @@ struct cctl_lun { struct cctl_port { uint32_t port_id; + int cfiscsi_status; char *cfiscsi_target; uint16_t cfiscsi_portal_group_tag; STAILQ_HEAD(,cctl_lun_nv) attr_list; @@ -332,6 +333,8 @@ cctl_end_pelement(void *user_data, const char *name) if (strcmp(name, "cfiscsi_target") == 0) { cur_port->cfiscsi_target = str; str = NULL; + } else if (strcmp(name, "cfiscsi_status") == 0) { + cur_port->cfiscsi_status = strtoul(str, NULL, 0); } else if (strcmp(name, "cfiscsi_portal_group_tag") == 0) { cur_port->cfiscsi_portal_group_tag = strtoul(str, NULL, 0); } else if (strcmp(name, "targ_port") == 0) { @@ -494,6 +497,11 @@ retry_port: "ignoring", (uintmax_t)port->port_id); continue; } + if (port->cfiscsi_status != 1) { + log_debugx("CTL port %ju is not active (%d); ignoring", + (uintmax_t)port->port_id, port->cfiscsi_status); + continue; + } targ = target_find(conf, port->cfiscsi_target); if (targ == NULL) { |