When iscsid detects a new transport (e.g. iscsi_tcp, ib_iser), it
allocates an entry for it in the transport list. If the transport
is unloaded and then reloaded, iscsid would still use the old
transport entry. Therefore, the transport entry must be deleted
when the transport is unloaded.

Signed-off-by: Erez Zilber <[EMAIL PROTECTED]>
---
 usr/iscsi_sysfs.c |   15 +++++++++++++++
 usr/iscsi_sysfs.h |    1 +
 usr/netlink.c     |   10 ++++++++++
 3 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index dd38379..6efb8a9 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -107,6 +107,21 @@ void free_transports(void)
        }
 }
 
+int free_transport_by_handle(uint64_t handle)
+{
+       struct iscsi_transport *t;
+
+       list_for_each_entry(t, &transports, list) {
+               if (t->handle == handle) {
+                       list_del(&t->list);
+                       free(t);
+                       return 0;
+               }
+       }
+
+       return 1;
+}
+
 static int trans_filter(const struct dirent *dir)
 {
        return strcmp(dir->d_name, ".") && strcmp(dir->d_name, "..");
diff --git a/usr/iscsi_sysfs.h b/usr/iscsi_sysfs.h
index a6163af..0e10b34 100644
--- a/usr/iscsi_sysfs.h
+++ b/usr/iscsi_sysfs.h
@@ -90,6 +90,7 @@ extern struct iscsi_transport *get_transport_by_hba(long 
host_no);
 extern struct iscsi_transport *get_transport_by_session(char *sys_session);
 extern struct iscsi_transport *get_transport_by_sid(uint32_t sid);
 extern struct iscsi_transport *get_transport_by_name(char *transport_name);
+int free_transport_by_handle(uint64_t handle);
 
 extern struct list_head transports;
 extern int num_transports;
diff --git a/usr/netlink.c b/usr/netlink.c
index d6ebc86..4f811a8 100644
--- a/usr/netlink.c
+++ b/usr/netlink.c
@@ -916,6 +916,16 @@ static int ctldev_handle(void)
                ; /* fall through */
        }
 
+       /* Handle transport error which is not connection related */
+       if (ev->type == ISCSI_KEVENT_TRANS_ERROR) {
+               rc = free_transport_by_handle(ev->transport_handle);
+               if (rc) {
+                       log_error("Could not release transport 0x%lx\n", 
ev->transport_handle);
+               }
+               drop_data(nlh);
+               return rc;
+       }
+
        /* verify connection */
        session = session_find_by_sid(sid);
        if (!session) {
-- 
1.5.3.6



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~----------~----~----~----~------~----~------~--~---

Reply via email to