diff options
author | mav <mav@FreeBSD.org> | 2014-07-06 17:57:59 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2014-07-06 17:57:59 +0000 |
commit | ac68a20a27159e0ed74698fc31e53c56228aa396 (patch) | |
tree | a8be5c88fc1a7a227559ba199b9d78ff13302ffa /sys/cam/ctl/ctl_frontend_iscsi.c | |
parent | d74e85dbb9aba51f1ffc63a0ebae250559a8fcd9 (diff) | |
download | FreeBSD-src-ac68a20a27159e0ed74698fc31e53c56228aa396.zip FreeBSD-src-ac68a20a27159e0ed74698fc31e53c56228aa396.tar.gz |
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 'sys/cam/ctl/ctl_frontend_iscsi.c')
-rw-r--r-- | sys/cam/ctl/ctl_frontend_iscsi.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index fa8bd82..3f39a35 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -145,6 +145,7 @@ SYSCTL_INT(_kern_cam_ctl_iscsi, OID_AUTO, maxcmdsn_delta, CTLFLAG_RWTUN, int cfiscsi_init(void); static void cfiscsi_online(void *arg); static void cfiscsi_offline(void *arg); +static int cfiscsi_info(void *arg, struct sbuf *sb); static int cfiscsi_lun_enable(void *arg, struct ctl_id target_id, int lun_id); static int cfiscsi_lun_disable(void *arg, @@ -1411,6 +1412,17 @@ cfiscsi_offline(void *arg) #endif } +static int +cfiscsi_info(void *arg, struct sbuf *sb) +{ + struct cfiscsi_target *ct = (struct cfiscsi_target *)arg; + int retval; + + retval = sbuf_printf(sb, "\t<cfiscsi_state>%d</cfiscsi_state>\n", + ct->ct_state); + return (retval); +} + static void cfiscsi_ioctl_handoff(struct ctl_iscsi *ci) { @@ -1993,6 +2005,7 @@ cfiscsi_ioctl_port_create(struct ctl_req *req) port->virtual_port = strtoul(tag, NULL, 0); port->port_online = cfiscsi_online; port->port_offline = cfiscsi_offline; + port->port_info = cfiscsi_info; port->onoff_arg = ct; port->lun_enable = cfiscsi_lun_enable; port->lun_disable = cfiscsi_lun_disable; |