summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/libiscsi.c2
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c14
-rw-r--r--include/scsi/scsi_transport_iscsi.h7
3 files changed, 12 insertions, 11 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 499e79f0cac..7e6e031cc41 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -1290,7 +1290,7 @@ iscsi_session_setup(struct iscsi_transport *iscsit,
if (!try_module_get(iscsit->owner))
goto cls_session_fail;
- cls_session = iscsi_create_session(shost, iscsit);
+ cls_session = iscsi_create_session(shost, iscsit, 0);
if (!cls_session)
goto module_put;
*(unsigned long*)shost->hostdata = (unsigned long)cls_session;
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index f39da0cf5f1..7963c0538de 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -304,6 +304,8 @@ iscsi_alloc_session(struct Scsi_Host *shost,
INIT_LIST_HEAD(&session->host_list);
INIT_LIST_HEAD(&session->sess_list);
+ /* this is released in the dev's release function */
+ scsi_host_get(shost);
session->dev.parent = &shost->shost_gendev;
session->dev.release = iscsi_session_release;
device_initialize(&session->dev);
@@ -313,18 +315,15 @@ iscsi_alloc_session(struct Scsi_Host *shost,
}
EXPORT_SYMBOL_GPL(iscsi_alloc_session);
-int iscsi_add_session(struct iscsi_cls_session *session)
+int iscsi_add_session(struct iscsi_cls_session *session, unsigned int target_id)
{
struct Scsi_Host *shost = iscsi_session_to_shost(session);
struct iscsi_host *ihost;
int err;
- /* this is released in the dev's release function */
- scsi_host_get(shost);
ihost = shost->shost_data;
-
session->sid = iscsi_session_nr++;
- session->target_id = ihost->next_target_id++;
+ session->target_id = target_id;
snprintf(session->dev.bus_id, BUS_ID_SIZE, "session%u",
session->sid);
@@ -356,7 +355,8 @@ EXPORT_SYMBOL_GPL(iscsi_add_session);
**/
struct iscsi_cls_session *
iscsi_create_session(struct Scsi_Host *shost,
- struct iscsi_transport *transport)
+ struct iscsi_transport *transport,
+ unsigned int target_id)
{
struct iscsi_cls_session *session;
@@ -364,7 +364,7 @@ iscsi_create_session(struct Scsi_Host *shost,
if (!session)
return NULL;
- if (iscsi_add_session(session)) {
+ if (iscsi_add_session(session, target_id)) {
iscsi_free_session(session);
return NULL;
}
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 53493d59135..f7b0db5f2f5 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -203,7 +203,6 @@ struct iscsi_cls_session {
iscsi_dev_to_session(_stgt->dev.parent)
struct iscsi_host {
- int next_target_id;
struct list_head sessions;
struct mutex mutex;
};
@@ -213,9 +212,11 @@ struct iscsi_host {
*/
extern struct iscsi_cls_session *iscsi_alloc_session(struct Scsi_Host *shost,
struct iscsi_transport *transport);
-extern int iscsi_add_session(struct iscsi_cls_session *session);
+extern int iscsi_add_session(struct iscsi_cls_session *session,
+ unsigned int target_id);
extern struct iscsi_cls_session *iscsi_create_session(struct Scsi_Host *shost,
- struct iscsi_transport *t);
+ struct iscsi_transport *t,
+ unsigned int target_id);
extern void iscsi_remove_session(struct iscsi_cls_session *session);
extern void iscsi_free_session(struct iscsi_cls_session *session);
extern int iscsi_destroy_session(struct iscsi_cls_session *session);