Deleted Added
full compact
ctl_frontend_iscsi.c (268257) ctl_frontend_iscsi.c (268258)
1/*-
2 * Copyright (c) 2012 The FreeBSD Foundation
3 * All rights reserved.
4 *
5 * This software was developed by Edward Tomasz Napierala under sponsorship
6 * from the FreeBSD Foundation.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
1/*-
2 * Copyright (c) 2012 The FreeBSD Foundation
3 * All rights reserved.
4 *
5 * This software was developed by Edward Tomasz Napierala under sponsorship
6 * from the FreeBSD Foundation.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c 268257 2014-07-04 16:06:56Z mav $
29 * $FreeBSD: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c 268258 2014-07-04 16:07:57Z mav $
30 */
31
32/*
33 * CTL frontend for the iSCSI protocol.
34 */
35
36#include <sys/cdefs.h>
30 */
31
32/*
33 * CTL frontend for the iSCSI protocol.
34 */
35
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c 268257 2014-07-04 16:06:56Z mav $");
37__FBSDID("$FreeBSD: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c 268258 2014-07-04 16:07:57Z mav $");
38
39#include <sys/param.h>
40#include <sys/capability.h>
41#include <sys/condvar.h>
42#include <sys/file.h>
43#include <sys/kernel.h>
44#include <sys/kthread.h>
45#include <sys/lock.h>

--- 1078 unchanged lines hidden (view full) ---

1124
1125 if (cs->cs_terminating) {
1126 cfiscsi_session_terminate_tasks(cs);
1127 callout_drain(&cs->cs_callout);
1128
1129 icl_conn_shutdown(cs->cs_conn);
1130 icl_conn_close(cs->cs_conn);
1131
38
39#include <sys/param.h>
40#include <sys/capability.h>
41#include <sys/condvar.h>
42#include <sys/file.h>
43#include <sys/kernel.h>
44#include <sys/kthread.h>
45#include <sys/lock.h>

--- 1078 unchanged lines hidden (view full) ---

1124
1125 if (cs->cs_terminating) {
1126 cfiscsi_session_terminate_tasks(cs);
1127 callout_drain(&cs->cs_callout);
1128
1129 icl_conn_shutdown(cs->cs_conn);
1130 icl_conn_close(cs->cs_conn);
1131
1132 cs->cs_terminating++;
1133
1134 /*
1135 * XXX: We used to wait up to 30 seconds to deliver queued PDUs
1136 * to the initiator. We also tried hard to deliver SCSI Responses
1137 * for the aborted PDUs. We don't do that anymore. We might need
1138 * to revisit that.
1139 */
1140
1141 cfiscsi_session_delete(cs);
1142 kthread_exit();
1143 return;
1144 }
1145 CFISCSI_SESSION_DEBUG(cs, "nothing to do");
1146 }
1147}
1148
1149static void
1150cfiscsi_session_terminate(struct cfiscsi_session *cs)
1151{
1152
1132 /*
1133 * XXX: We used to wait up to 30 seconds to deliver queued PDUs
1134 * to the initiator. We also tried hard to deliver SCSI Responses
1135 * for the aborted PDUs. We don't do that anymore. We might need
1136 * to revisit that.
1137 */
1138
1139 cfiscsi_session_delete(cs);
1140 kthread_exit();
1141 return;
1142 }
1143 CFISCSI_SESSION_DEBUG(cs, "nothing to do");
1144 }
1145}
1146
1147static void
1148cfiscsi_session_terminate(struct cfiscsi_session *cs)
1149{
1150
1153 if (cs->cs_terminating != 0)
1151 if (cs->cs_terminating)
1154 return;
1152 return;
1155 cs->cs_terminating = 1;
1153 cs->cs_terminating = true;
1156 cv_signal(&cs->cs_maintenance_cv);
1157#ifdef ICL_KERNEL_PROXY
1158 cv_signal(&cs->cs_login_cv);
1159#endif
1160}
1161
1162static int
1163cfiscsi_session_register_initiator(struct cfiscsi_session *cs)

--- 1756 unchanged lines hidden ---
1154 cv_signal(&cs->cs_maintenance_cv);
1155#ifdef ICL_KERNEL_PROXY
1156 cv_signal(&cs->cs_login_cv);
1157#endif
1158}
1159
1160static int
1161cfiscsi_session_register_initiator(struct cfiscsi_session *cs)

--- 1756 unchanged lines hidden ---