aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/ctl/ctl_frontend_iscsi.c
diff options
context:
space:
mode:
authorEdward Tomasz Napierala <trasz@FreeBSD.org>2015-02-08 19:18:23 +0000
committerEdward Tomasz Napierala <trasz@FreeBSD.org>2015-02-08 19:18:23 +0000
commitd5153415b8c1a25e4b28baae992e319924431d3c (patch)
treea9ad442b006a45470f5fcf529f5ecb6caabb1355 /sys/cam/ctl/ctl_frontend_iscsi.c
parent7a03d007cfcd2dba45cbe1bc1affe938fd375af6 (diff)
downloadsrc-d5153415b8c1a25e4b28baae992e319924431d3c.tar.gz
src-d5153415b8c1a25e4b28baae992e319924431d3c.zip
Fix ordering of "*logout" and "*terminate"; no functional changes.
MFC after: 1 month Sponsored by: The FreeBSD Foundation
Notes
Notes: svn path=/head/; revision=278398
Diffstat (limited to 'sys/cam/ctl/ctl_frontend_iscsi.c')
-rw-r--r--sys/cam/ctl/ctl_frontend_iscsi.c80
1 files changed, 40 insertions, 40 deletions
diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c
index 29054725d5ea..2742c3da4893 100644
--- a/sys/cam/ctl/ctl_frontend_iscsi.c
+++ b/sys/cam/ctl/ctl_frontend_iscsi.c
@@ -1702,41 +1702,40 @@ cfiscsi_ioctl_list(struct ctl_iscsi *ci)
}
static void
-cfiscsi_ioctl_terminate(struct ctl_iscsi *ci)
+cfiscsi_ioctl_logout(struct ctl_iscsi *ci)
{
struct icl_pdu *response;
struct iscsi_bhs_asynchronous_message *bhsam;
- struct ctl_iscsi_terminate_params *citp;
+ struct ctl_iscsi_logout_params *cilp;
struct cfiscsi_session *cs;
struct cfiscsi_softc *softc;
int found = 0;
- citp = (struct ctl_iscsi_terminate_params *)&(ci->data);
+ cilp = (struct ctl_iscsi_logout_params *)&(ci->data);
softc = &cfiscsi_softc;
mtx_lock(&softc->lock);
TAILQ_FOREACH(cs, &softc->sessions, cs_next) {
- if (citp->all == 0 && cs->cs_id != citp->connection_id &&
- strcmp(cs->cs_initiator_name, citp->initiator_name) != 0 &&
- strcmp(cs->cs_initiator_addr, citp->initiator_addr) != 0)
+ if (cilp->all == 0 && cs->cs_id != cilp->connection_id &&
+ strcmp(cs->cs_initiator_name, cilp->initiator_name) != 0 &&
+ strcmp(cs->cs_initiator_addr, cilp->initiator_addr) != 0)
continue;
response = icl_pdu_new(cs->cs_conn, M_NOWAIT);
if (response == NULL) {
- /*
- * Oh well. Just terminate the connection.
- */
- } else {
- bhsam = (struct iscsi_bhs_asynchronous_message *)
- response->ip_bhs;
- bhsam->bhsam_opcode = ISCSI_BHS_OPCODE_ASYNC_MESSAGE;
- bhsam->bhsam_flags = 0x80;
- bhsam->bhsam_0xffffffff = 0xffffffff;
- bhsam->bhsam_async_event =
- BHSAM_EVENT_TARGET_TERMINATES_SESSION;
- cfiscsi_pdu_queue(response);
+ ci->status = CTL_ISCSI_ERROR;
+ snprintf(ci->error_str, sizeof(ci->error_str),
+ "Unable to allocate memory");
+ mtx_unlock(&softc->lock);
+ return;
}
- cfiscsi_session_terminate(cs);
+ bhsam =
+ (struct iscsi_bhs_asynchronous_message *)response->ip_bhs;
+ bhsam->bhsam_opcode = ISCSI_BHS_OPCODE_ASYNC_MESSAGE;
+ bhsam->bhsam_flags = 0x80;
+ bhsam->bhsam_async_event = BHSAM_EVENT_TARGET_REQUESTS_LOGOUT;
+ bhsam->bhsam_parameter3 = htons(10);
+ cfiscsi_pdu_queue(response);
found++;
}
mtx_unlock(&softc->lock);
@@ -1752,40 +1751,41 @@ cfiscsi_ioctl_terminate(struct ctl_iscsi *ci)
}
static void
-cfiscsi_ioctl_logout(struct ctl_iscsi *ci)
+cfiscsi_ioctl_terminate(struct ctl_iscsi *ci)
{
struct icl_pdu *response;
struct iscsi_bhs_asynchronous_message *bhsam;
- struct ctl_iscsi_logout_params *cilp;
+ struct ctl_iscsi_terminate_params *citp;
struct cfiscsi_session *cs;
struct cfiscsi_softc *softc;
int found = 0;
- cilp = (struct ctl_iscsi_logout_params *)&(ci->data);
+ citp = (struct ctl_iscsi_terminate_params *)&(ci->data);
softc = &cfiscsi_softc;
mtx_lock(&softc->lock);
TAILQ_FOREACH(cs, &softc->sessions, cs_next) {
- if (cilp->all == 0 && cs->cs_id != cilp->connection_id &&
- strcmp(cs->cs_initiator_name, cilp->initiator_name) != 0 &&
- strcmp(cs->cs_initiator_addr, cilp->initiator_addr) != 0)
+ if (citp->all == 0 && cs->cs_id != citp->connection_id &&
+ strcmp(cs->cs_initiator_name, citp->initiator_name) != 0 &&
+ strcmp(cs->cs_initiator_addr, citp->initiator_addr) != 0)
continue;
response = icl_pdu_new(cs->cs_conn, M_NOWAIT);
if (response == NULL) {
- ci->status = CTL_ISCSI_ERROR;
- snprintf(ci->error_str, sizeof(ci->error_str),
- "Unable to allocate memory");
- mtx_unlock(&softc->lock);
- return;
+ /*
+ * Oh well. Just terminate the connection.
+ */
+ } else {
+ bhsam = (struct iscsi_bhs_asynchronous_message *)
+ response->ip_bhs;
+ bhsam->bhsam_opcode = ISCSI_BHS_OPCODE_ASYNC_MESSAGE;
+ bhsam->bhsam_flags = 0x80;
+ bhsam->bhsam_0xffffffff = 0xffffffff;
+ bhsam->bhsam_async_event =
+ BHSAM_EVENT_TARGET_TERMINATES_SESSION;
+ cfiscsi_pdu_queue(response);
}
- bhsam =
- (struct iscsi_bhs_asynchronous_message *)response->ip_bhs;
- bhsam->bhsam_opcode = ISCSI_BHS_OPCODE_ASYNC_MESSAGE;
- bhsam->bhsam_flags = 0x80;
- bhsam->bhsam_async_event = BHSAM_EVENT_TARGET_REQUESTS_LOGOUT;
- bhsam->bhsam_parameter3 = htons(10);
- cfiscsi_pdu_queue(response);
+ cfiscsi_session_terminate(cs);
found++;
}
mtx_unlock(&softc->lock);
@@ -2241,12 +2241,12 @@ cfiscsi_ioctl(struct cdev *dev,
case CTL_ISCSI_LIST:
cfiscsi_ioctl_list(ci);
break;
- case CTL_ISCSI_TERMINATE:
- cfiscsi_ioctl_terminate(ci);
- break;
case CTL_ISCSI_LOGOUT:
cfiscsi_ioctl_logout(ci);
break;
+ case CTL_ISCSI_TERMINATE:
+ cfiscsi_ioctl_terminate(ci);
+ break;
case CTL_ISCSI_LIMITS:
cfiscsi_ioctl_limits(ci);
break;