[Stgt-devel] [PATCH 13/18] iser close free
Pete Wyckoff
pw
Tue Sep 4 22:10:49 CEST 2007
Separate transport close operation from the free operation, as RDMA will
initiate a close, but must not free resources until all references to
the connection have gone away.
Signed-off-by: Pete Wyckoff <pw at osc.edu>
---
usr/iscsi/conn.c | 3 ++-
usr/iscsi/iscsi_tcp.c | 12 +++++++++---
usr/iscsi/transport.h | 3 ++-
3 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/usr/iscsi/conn.c b/usr/iscsi/conn.c
index 1e9dace..9b0c3b9 100644
--- a/usr/iscsi/conn.c
+++ b/usr/iscsi/conn.c
@@ -80,6 +80,7 @@ static void conn_free(struct iscsi_connection *conn)
struct iscsi_session *session = conn->session;
dprintf("freeing connection\n");
+ conn->tp->ep_conn_free(conn);
list_del(&conn->clist);
free(conn->req_buffer);
free(conn->rsp_buffer);
@@ -94,7 +95,7 @@ void conn_close(struct iscsi_connection *conn)
{
struct iscsi_task *task, *tmp;
- conn->tp->ep_close(conn);
+ conn->tp->ep_conn_close(conn);
dprintf("connection closed\n");
diff --git a/usr/iscsi/iscsi_tcp.c b/usr/iscsi/iscsi_tcp.c
index 53cf0e5..f03caa5 100644
--- a/usr/iscsi/iscsi_tcp.c
+++ b/usr/iscsi/iscsi_tcp.c
@@ -244,12 +244,17 @@ static void iscsi_tcp_write_end(struct iscsi_connection *conn)
setsockopt(tci->fd, SOL_TCP, TCP_CORK, &opt, sizeof(opt));
}
-static size_t iscsi_tcp_close(struct iscsi_connection *conn)
+static void iscsi_tcp_conn_close(struct iscsi_connection *conn)
{
struct tcp_conn_info *tci = conn->trans_data;
tgt_event_del(tci->fd);
- return close(tci->fd);
+ close(tci->fd);
+}
+
+static void iscsi_tcp_conn_free(struct iscsi_connection *conn
+ __attribute__((unused)))
+{
}
static int iscsi_tcp_show(struct iscsi_connection *conn, char *buf, int rest)
@@ -327,7 +332,8 @@ struct iscsi_transport iscsi_tcp = {
.ep_read = iscsi_tcp_read,
.ep_write_begin = iscsi_tcp_write_begin,
.ep_write_end = iscsi_tcp_write_end,
- .ep_close = iscsi_tcp_close,
+ .ep_conn_close = iscsi_tcp_conn_close,
+ .ep_conn_free = iscsi_tcp_conn_free,
.ep_show = iscsi_tcp_show,
.ep_event_modify = iscsi_event_modify,
.ep_malloc = iscsi_tcp_malloc,
diff --git a/usr/iscsi/transport.h b/usr/iscsi/transport.h
index a8b8680..f35d9d7 100644
--- a/usr/iscsi/transport.h
+++ b/usr/iscsi/transport.h
@@ -19,7 +19,8 @@ struct iscsi_transport {
size_t (*ep_write_begin) (struct iscsi_connection *conn, void *buf,
size_t nbytes);
void (*ep_write_end) (struct iscsi_connection *conn);
- size_t (*ep_close) (struct iscsi_connection *conn);
+ void (*ep_conn_close) (struct iscsi_connection *conn);
+ void (*ep_conn_free) (struct iscsi_connection *conn);
int (*ep_show) (struct iscsi_connection *conn, char *buf, int rest);
void (*ep_event_modify) (struct iscsi_connection *conn, int events);
void *(*ep_malloc) (struct iscsi_connection *conn, size_t sz);
--
1.5.2.5
More information about the stgt
mailing list