All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] libiscsi: fix iscsi pool leak
@ 2009-01-16 18:36 michaelc
  2009-01-16 18:36 ` [PATCH 2/2] qla4xxx: do not reuse session when connecting to different target port michaelc
  2009-01-16 18:38 ` [PATCH 1/2] libiscsi: fix iscsi pool leak Mike Christie
  0 siblings, 2 replies; 3+ messages in thread
From: michaelc @ 2009-01-16 18:36 UTC (permalink / raw)
  To: linux-scsi; +Cc: Mike Christie

From: Mike Christie <michaelc@cs.wisc.edu>

I am not sure what happened. It looks like we have always leaked
the q->queue that is allocated from the kfifo_init call. nab finally
noticed that we were leaking and this patch fixes it by adding a
kfree call to iscsi_pool_free. kfifo_free is not used per kfifo_init's
instructions to use kfree.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
---
 drivers/scsi/libiscsi.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 7225b6e..257c241 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -1981,6 +1981,7 @@ void iscsi_pool_free(struct iscsi_pool *q)
 		kfree(q->pool[i]);
 	if (q->pool)
 		kfree(q->pool);
+	kfree(q->queue);
 }
 EXPORT_SYMBOL_GPL(iscsi_pool_free);
 
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] qla4xxx: do not reuse session when connecting to different target port
  2009-01-16 18:36 [PATCH 1/2] libiscsi: fix iscsi pool leak michaelc
@ 2009-01-16 18:36 ` michaelc
  2009-01-16 18:38 ` [PATCH 1/2] libiscsi: fix iscsi pool leak Mike Christie
  1 sibling, 0 replies; 3+ messages in thread
From: michaelc @ 2009-01-16 18:36 UTC (permalink / raw)
  To: linux-scsi; +Cc: Mike Christie

From: Mike Christie <michaelc@cs.wisc.edu>

qla4xxx does not check the I_T nexus values correctly
so it ends up creating one session to the target. If
a portal should disappear or they should be reported
in different order the driver will think it is already
logged in when it could now be speaking to a different
target portal or accessing it through a different
initiator port (iscsi initiator port is not tied to
hardware and is just the initiator name plus isid
so you could end up with multiple ports through one
host).

This patch has the driver check the iscsi scsi port
values when matching sessions (we do not check
the initiator name because that is static). It results
in a portal from each target portal group getting
logged into instead of just one per target. In the future
the firmware should hopefully send us notification of other
sessions that are created to other portals within the
same tpgt and the sessions should have different isids.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
---
 drivers/scsi/qla4xxx/ql4_def.h  |    1 +
 drivers/scsi/qla4xxx/ql4_init.c |   10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index d6be076..b586f27 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -244,6 +244,7 @@ struct ddb_entry {
 	uint8_t ip_addr[ISCSI_IPADDR_SIZE];
 	uint8_t iscsi_name[ISCSI_NAME_SIZE];	/* 72 x48 */
 	uint8_t iscsi_alias[0x20];
+	uint8_t isid[6];
 };
 
 /*
diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
index 109c5f5..af8c323 100644
--- a/drivers/scsi/qla4xxx/ql4_init.c
+++ b/drivers/scsi/qla4xxx/ql4_init.c
@@ -342,8 +342,12 @@ static struct ddb_entry* qla4xxx_get_ddb_entry(struct scsi_qla_host *ha,
 	DEBUG2(printk("scsi%ld: %s: Looking for ddb[%d]\n", ha->host_no,
 		      __func__, fw_ddb_index));
 	list_for_each_entry(ddb_entry, &ha->ddb_list, list) {
-		if (memcmp(ddb_entry->iscsi_name, fw_ddb_entry->iscsi_name,
-			   ISCSI_NAME_SIZE) == 0) {
+		if ((memcmp(ddb_entry->iscsi_name, fw_ddb_entry->iscsi_name,
+			   ISCSI_NAME_SIZE) == 0) &&
+			(ddb_entry->tpgt ==
+				le32_to_cpu(fw_ddb_entry->tgt_portal_grp)) &&
+			(memcmp(ddb_entry->isid, fw_ddb_entry->isid,
+				sizeof(ddb_entry->isid)) == 0)) {
 			found++;
 			break;
 		}
@@ -430,6 +434,8 @@ static int qla4xxx_update_ddb_entry(struct scsi_qla_host *ha,
 
 	ddb_entry->port = le16_to_cpu(fw_ddb_entry->port);
 	ddb_entry->tpgt = le32_to_cpu(fw_ddb_entry->tgt_portal_grp);
+	memcpy(ddb_entry->isid, fw_ddb_entry->isid, sizeof(ddb_entry->isid));
+
 	memcpy(&ddb_entry->iscsi_name[0], &fw_ddb_entry->iscsi_name[0],
 	       min(sizeof(ddb_entry->iscsi_name),
 		   sizeof(fw_ddb_entry->iscsi_name)));
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] libiscsi: fix iscsi pool leak
  2009-01-16 18:36 [PATCH 1/2] libiscsi: fix iscsi pool leak michaelc
  2009-01-16 18:36 ` [PATCH 2/2] qla4xxx: do not reuse session when connecting to different target port michaelc
@ 2009-01-16 18:38 ` Mike Christie
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Christie @ 2009-01-16 18:38 UTC (permalink / raw)
  To: linux-scsi

I forgot to send a 0/2 patch.

These two patches were made over scsi-rc-fixes.


michaelc@cs.wisc.edu wrote:
> From: Mike Christie <michaelc@cs.wisc.edu>
> 
> I am not sure what happened. It looks like we have always leaked
> the q->queue that is allocated from the kfifo_init call. nab finally
> noticed that we were leaking and this patch fixes it by adding a
> kfree call to iscsi_pool_free. kfifo_free is not used per kfifo_init's
> instructions to use kfree.
> 
> Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
> ---
>  drivers/scsi/libiscsi.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
> index 7225b6e..257c241 100644
> --- a/drivers/scsi/libiscsi.c
> +++ b/drivers/scsi/libiscsi.c
> @@ -1981,6 +1981,7 @@ void iscsi_pool_free(struct iscsi_pool *q)
>  		kfree(q->pool[i]);
>  	if (q->pool)
>  		kfree(q->pool);
> +	kfree(q->queue);
>  }
>  EXPORT_SYMBOL_GPL(iscsi_pool_free);
>  


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-01-16 18:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-16 18:36 [PATCH 1/2] libiscsi: fix iscsi pool leak michaelc
2009-01-16 18:36 ` [PATCH 2/2] qla4xxx: do not reuse session when connecting to different target port michaelc
2009-01-16 18:38 ` [PATCH 1/2] libiscsi: fix iscsi pool leak Mike Christie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.