diff options
Diffstat (limited to 'drivers/scsi/iscsi_tcp.c')
-rw-r--r-- | drivers/scsi/iscsi_tcp.c | 67 |
1 files changed, 29 insertions, 38 deletions
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 7d784596a1ea..b6c68be6b866 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -1040,9 +1040,8 @@ iscsi_conn_set_callbacks(struct iscsi_conn *conn) | |||
1040 | } | 1040 | } |
1041 | 1041 | ||
1042 | static void | 1042 | static void |
1043 | iscsi_conn_restore_callbacks(struct iscsi_conn *conn) | 1043 | iscsi_conn_restore_callbacks(struct iscsi_tcp_conn *tcp_conn) |
1044 | { | 1044 | { |
1045 | struct iscsi_tcp_conn *tcp_conn = conn->dd_data; | ||
1046 | struct sock *sk = tcp_conn->sock->sk; | 1045 | struct sock *sk = tcp_conn->sock->sk; |
1047 | 1046 | ||
1048 | /* restore socket callbacks, see also: iscsi_conn_set_callbacks() */ | 1047 | /* restore socket callbacks, see also: iscsi_conn_set_callbacks() */ |
@@ -1933,6 +1932,23 @@ tcp_conn_alloc_fail: | |||
1933 | } | 1932 | } |
1934 | 1933 | ||
1935 | static void | 1934 | static void |
1935 | iscsi_tcp_release_conn(struct iscsi_conn *conn) | ||
1936 | { | ||
1937 | struct iscsi_tcp_conn *tcp_conn = conn->dd_data; | ||
1938 | |||
1939 | if (!tcp_conn->sock) | ||
1940 | return; | ||
1941 | |||
1942 | sock_hold(tcp_conn->sock->sk); | ||
1943 | iscsi_conn_restore_callbacks(tcp_conn); | ||
1944 | sock_put(tcp_conn->sock->sk); | ||
1945 | |||
1946 | sock_release(tcp_conn->sock); | ||
1947 | tcp_conn->sock = NULL; | ||
1948 | conn->recv_lock = NULL; | ||
1949 | } | ||
1950 | |||
1951 | static void | ||
1936 | iscsi_tcp_conn_destroy(struct iscsi_cls_conn *cls_conn) | 1952 | iscsi_tcp_conn_destroy(struct iscsi_cls_conn *cls_conn) |
1937 | { | 1953 | { |
1938 | struct iscsi_conn *conn = cls_conn->dd_data; | 1954 | struct iscsi_conn *conn = cls_conn->dd_data; |
@@ -1942,6 +1958,7 @@ iscsi_tcp_conn_destroy(struct iscsi_cls_conn *cls_conn) | |||
1942 | if (conn->hdrdgst_en || conn->datadgst_en) | 1958 | if (conn->hdrdgst_en || conn->datadgst_en) |
1943 | digest = 1; | 1959 | digest = 1; |
1944 | 1960 | ||
1961 | iscsi_tcp_release_conn(conn); | ||
1945 | iscsi_conn_teardown(cls_conn); | 1962 | iscsi_conn_teardown(cls_conn); |
1946 | 1963 | ||
1947 | /* now free tcp_conn */ | 1964 | /* now free tcp_conn */ |
@@ -1965,6 +1982,15 @@ iscsi_tcp_conn_destroy(struct iscsi_cls_conn *cls_conn) | |||
1965 | kfree(tcp_conn); | 1982 | kfree(tcp_conn); |
1966 | } | 1983 | } |
1967 | 1984 | ||
1985 | static void | ||
1986 | iscsi_tcp_conn_stop(struct iscsi_cls_conn *cls_conn, int flag) | ||
1987 | { | ||
1988 | struct iscsi_conn *conn = cls_conn->dd_data; | ||
1989 | |||
1990 | iscsi_conn_stop(cls_conn, flag); | ||
1991 | iscsi_tcp_release_conn(conn); | ||
1992 | } | ||
1993 | |||
1968 | static int | 1994 | static int |
1969 | iscsi_tcp_conn_bind(struct iscsi_cls_session *cls_session, | 1995 | iscsi_tcp_conn_bind(struct iscsi_cls_session *cls_session, |
1970 | struct iscsi_cls_conn *cls_conn, uint64_t transport_eph, | 1996 | struct iscsi_cls_conn *cls_conn, uint64_t transport_eph, |
@@ -2013,38 +2039,6 @@ iscsi_tcp_conn_bind(struct iscsi_cls_session *cls_session, | |||
2013 | return 0; | 2039 | return 0; |
2014 | } | 2040 | } |
2015 | 2041 | ||
2016 | static void | ||
2017 | iscsi_tcp_suspend_conn_rx(struct iscsi_conn *conn) | ||
2018 | { | ||
2019 | struct iscsi_tcp_conn *tcp_conn = conn->dd_data; | ||
2020 | struct sock *sk; | ||
2021 | |||
2022 | if (!tcp_conn->sock) | ||
2023 | return; | ||
2024 | |||
2025 | sk = tcp_conn->sock->sk; | ||
2026 | write_lock_bh(&sk->sk_callback_lock); | ||
2027 | set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx); | ||
2028 | write_unlock_bh(&sk->sk_callback_lock); | ||
2029 | } | ||
2030 | |||
2031 | static void | ||
2032 | iscsi_tcp_terminate_conn(struct iscsi_conn *conn) | ||
2033 | { | ||
2034 | struct iscsi_tcp_conn *tcp_conn = conn->dd_data; | ||
2035 | |||
2036 | if (!tcp_conn->sock) | ||
2037 | return; | ||
2038 | |||
2039 | sock_hold(tcp_conn->sock->sk); | ||
2040 | iscsi_conn_restore_callbacks(conn); | ||
2041 | sock_put(tcp_conn->sock->sk); | ||
2042 | |||
2043 | sock_release(tcp_conn->sock); | ||
2044 | tcp_conn->sock = NULL; | ||
2045 | conn->recv_lock = NULL; | ||
2046 | } | ||
2047 | |||
2048 | /* called with host lock */ | 2042 | /* called with host lock */ |
2049 | static void | 2043 | static void |
2050 | iscsi_tcp_mgmt_init(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask, | 2044 | iscsi_tcp_mgmt_init(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask, |
@@ -2413,10 +2407,7 @@ static struct iscsi_transport iscsi_tcp_transport = { | |||
2413 | .get_conn_param = iscsi_tcp_conn_get_param, | 2407 | .get_conn_param = iscsi_tcp_conn_get_param, |
2414 | .get_session_param = iscsi_session_get_param, | 2408 | .get_session_param = iscsi_session_get_param, |
2415 | .start_conn = iscsi_conn_start, | 2409 | .start_conn = iscsi_conn_start, |
2416 | .stop_conn = iscsi_conn_stop, | 2410 | .stop_conn = iscsi_tcp_conn_stop, |
2417 | /* these are called as part of conn recovery */ | ||
2418 | .suspend_conn_recv = iscsi_tcp_suspend_conn_rx, | ||
2419 | .terminate_conn = iscsi_tcp_terminate_conn, | ||
2420 | /* IO */ | 2411 | /* IO */ |
2421 | .send_pdu = iscsi_conn_send_pdu, | 2412 | .send_pdu = iscsi_conn_send_pdu, |
2422 | .get_stats = iscsi_conn_get_stats, | 2413 | .get_stats = iscsi_conn_get_stats, |