iscsi bugfixes
These patches fix a memory leak, a oops, and some printk messages. The printk fixup is not critical but is small. The oops in the main write path and memory leak could be so if there are more patches going out for another rc kernel these could be ok.
The patchset was made against scsi-rc-fixes but applies to scsi-misc incase it ends up there.
PATCH 1/4 iscsi: always release crypto
From: Pete Wyckoff <[email protected]>
Unconditionally free crypto state, as it is always allocated during TCP connection creation. Without this, crypto structures leak and crc32c module refcounts grow as connections are created and destroyed.
--- drivers/scsi/iscsi_tcp.c | 15 ++++----------- 1 files changed, 4 insertions(+), 11 deletions(-)
drivers/scsi/iscsi_tcp.c +4 -11
@@ -1816,21 +1816,14 @@ iscsi_tcp_conn_destroy(struct iscsi_cls_ {struct iscsi_conn *conn = cls_conn->dd_data;struct iscsi_tcp_conn *tcp_conn = conn->dd_data; -int digest =0 ; - -if (conn->hdrdgst_en || conn->datadgst_en) - digest =1 ;iscsi_tcp_release_conn (conn);iscsi_conn_teardown (cls_conn); -/* now free tcp_conn */ -if (digest) { -if (tcp_conn->tx_hash.tfm) -crypto_free_hash (tcp_conn->tx_hash.tfm); -if (tcp_conn->rx_hash.tfm) -crypto_free_hash (tcp_conn->rx_hash.tfm); - } +if (tcp_conn->tx_hash.tfm) +crypto_free_hash (tcp_conn->tx_hash.tfm); +if (tcp_conn->rx_hash.tfm) +crypto_free_hash (tcp_conn->rx_hash.tfm);kfree (tcp_conn); }
Signature · 1 line
1.4.1.1
PATCH 2/4 iscsi: add newlines to debug messages
From: Pete Wyckoff <[email protected]>
Some messages from debug_scsi do not have trailing newlines, making console messages difficult to read. Fix that.
--- drivers/scsi/libiscsi.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/scsi/libiscsi.c +5 -4
@@ -975,13 +975,13 @@ int iscsi_eh_host_reset(struct scsi_cmndif (session->state ==ISCSI_STATE_TERMINATE ) { failed:debug_scsi ("failing host reset: session terminated " -"[CID %d age %d]" , conn->id, session->age); +"[CID %d age %d]\n" , conn->id, session->age);spin_unlock_bh (&session->lock);return FAILED ; }if (sc->SCp.phase == session->age) { -debug_scsi ("failing connection CID %d due to SCSI host reset" , +debug_scsi ("failing connection CID %d due to SCSI host reset\n" , conn->id); fail_session =1 ; }
@@ -1054,7 +1054,8 @@ static int iscsi_exec_abort_task(struct NULL, 0);if (rc) {iscsi_conn_failure (conn,ISCSI_ERR_CONN_FAILED ); -debug_scsi ("abort sent failure [itt 0x%x] %d" , ctask->itt, rc); +debug_scsi ("abort sent failure [itt 0x%x] %d\n" , ctask->itt, + rc);return rc; }
@@ -1071,7 +1072,7 @@ static int iscsi_exec_abort_task(struct conn->tmabort_timer.function = iscsi_tmabort_timedout; conn->tmabort_timer.data = (unsigned long )ctask;add_timer (&conn->tmabort_timer); -debug_scsi ("abort set timeout [itt 0x%x]" , ctask->itt); +debug_scsi ("abort set timeout [itt 0x%x]\n" , ctask->itt); }spin_unlock_bh (&session->lock);mutex_unlock (&conn->xmitmutex);
Signature · 1 line
1.4.1.1
PATCH 3/4 iscsi_tcp: fix xmittask oops
XMSTATE_SOL_HDR could be set when the xmit thread tests it, but there may not be anything on the r2tqueue yet. Move the XMSTATE_SOL_HDR set before the addition to the queue to make sure that when we pull something off it it is valid. This does not add locks around the xmstate test or make that a atmoic_t because this is a fast path and if it is set when we test it we can handle it there without the overhead. Later on we check the xmitqueue for all requests with the session lock so we will not miss it.
--- drivers/scsi/iscsi_tcp.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
drivers/scsi/iscsi_tcp.c +5 -2
@@ -415,8 +415,8 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, siscsi_solicit_data_init (conn, ctask, r2t); tcp_ctask->exp_r2tsn = r2tsn +1 ; - tcp_ctask->xmstate |=XMSTATE_SOL_HDR ;__kfifo_put (tcp_ctask->r2tqueue, (void *)&r2t,sizeof (void *)); + tcp_ctask->xmstate |=XMSTATE_SOL_HDR ;list_move_tail (&ctask->running, &conn->xmitqueue);scsi_queue_work (session->host, &conn->xmitwork);
@@ -1627,9 +1627,12 @@ static int iscsi_send_sol_pdu(struct iscif (tcp_ctask->xmstate &XMSTATE_SOL_HDR ) { tcp_ctask->xmstate &= ~XMSTATE_SOL_HDR ; tcp_ctask->xmstate |=XMSTATE_SOL_DATA ; -if (!tcp_ctask->r2t) +if (!tcp_ctask->r2t) { +spin_lock_bh (&session->lock);__kfifo_get (tcp_ctask->r2tqueue, (void *)&tcp_ctask->r2t,sizeof (void *)); +spin_unlock_bh (&session->lock); + } send_hdr: r2t = tcp_ctask->r2t; dtask = &r2t->dtask;
Signature · 1 line
1.4.1.1
PATCH 4/4 iscsi class: update version
Update version number
--- drivers/scsi/scsi_transport_iscsi.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/scsi_transport_iscsi.c +1 -1
@@ -33,7 +33,7 @@ #include <scsi/iscsi_if.h>#define ISCSI_SESSION_ATTRS 11#define ISCSI_CONN_ATTRS 11#define ISCSI_HOST_ATTRS 0 -#define ISCSI_TRANSPORT_VERSION "2.0-685" +#define ISCSI_TRANSPORT_VERSION "2.0-724"struct iscsi_internal {int daemon_pid;
Signature · 1 line
1.4.1.1