[PATCH 5/5] [LIO-Target]: Move iscsi_free_all_datain_reqs() to generic location

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From 46a298686ce73eafcfa68782b7a0dba7bb39061f Mon Sep 17 00:00:00 2001
From: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>
Date: Fri, 9 Jan 2009 10:53:35 -0800
Subject: [PATCH 5/5] [LIO-Target]: Move iscsi_free_all_datain_reqs() to generic location

This patch fixes a memory leak of iscsi_datain_req_t during a NON_EXISTENT_LUN
exception for an ISCSI_READ PDU, followed by an immediate explict logout.
iscsi_free_all_datain_reqs() was not being called in iscsi_release_commands_from_conn()
after the explict logout was initiated.

The solution was to move the call to iscsi_free_all_datain_reqs() to a generic location
in iscsi_release_cmd_direct() and __iscsi_release_cmd_to_pool().  This is where
iscsi_free_r2ts_from_list() was already being called for ISCSI_WRITE, so it makes sense
to put the call to release iscsi_datain_req_t for ISCSI_READ here as well.

Signed-off-by: Nicholas A. Bellinger <nab@xxxxxxxxxxxxxxx>
---
 drivers/lio-core/iscsi_target.c      |    1 -
 drivers/lio-core/iscsi_target_util.c |    3 +++
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/lio-core/iscsi_target.c b/drivers/lio-core/iscsi_target.c
index bf7b478..228c9c3 100644
--- a/drivers/lio-core/iscsi_target.c
+++ b/drivers/lio-core/iscsi_target.c
@@ -4792,7 +4792,6 @@ static void iscsi_release_commands_from_conn (iscsi_conn_t *conn)
 		}
 		spin_unlock_bh(&conn->cmd_lock);
 
-		iscsi_free_all_datain_reqs(cmd);
 		iscsi_increment_maxcmdsn(cmd, sess);
 
 		if (SE_CMD(cmd)->transport_wait_for_tasks)
diff --git a/drivers/lio-core/iscsi_target_util.c b/drivers/lio-core/iscsi_target_util.c
index 9c83f33..ea66704 100644
--- a/drivers/lio-core/iscsi_target_util.c
+++ b/drivers/lio-core/iscsi_target_util.c
@@ -53,6 +53,7 @@
 #include <target_core_transport.h>
 
 #include <iscsi_target_core.h>
+#include <iscsi_target_datain_values.h>
 #include <iscsi_target_erl0.h>
 #include <iscsi_target_erl1.h>
 #include <iscsi_target_erl2.h>
@@ -1063,6 +1064,7 @@ extern void iscsi_free_queue_reqs_for_conn (iscsi_conn_t *conn)
 extern void iscsi_release_cmd_direct (iscsi_cmd_t *cmd)
 {
 	iscsi_free_r2ts_from_list(cmd);
+	iscsi_free_all_datain_reqs(cmd);
 
 	if (cmd->buf_ptr)
 		kfree(cmd->buf_ptr);
@@ -1089,6 +1091,7 @@ extern void __iscsi_release_cmd_to_pool (iscsi_cmd_t *cmd, iscsi_session_t *sess
 	iscsi_conn_t *conn = CONN(cmd);
 
 	iscsi_free_r2ts_from_list(cmd);
+	iscsi_free_all_datain_reqs(cmd);
 	
 	if (cmd->buf_ptr)
 		kfree(cmd->buf_ptr);
-- 
1.5.4.1



--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux