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 |   16 ++++++++++++++++
 usr/iscsi_sysfs.h |    1 +
 usr/netlink.c     |   10 ++++++++++
 3 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index dd38379..39c8e9c 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -107,6 +107,22 @@ void free_transports(void)
        }
 }
 
+int free_transport_by_name(char *transport_name)
+{
+       struct iscsi_transport *t;
+
+       list_for_each_entry(t, &transports, list) {
+               if (t->handle && !strncmp(t->name, transport_name,
+                                         ISCSI_TRANSPORT_NAME_MAXLEN)) {
+                       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..7ebce4a 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_name(char *transport_name);
 
 extern struct list_head transports;
 extern int num_transports;
diff --git a/usr/netlink.c b/usr/netlink.c
index d6ebc86..eb715cb 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_name(ev->r.trans_error.name);
+               if (rc) {
+                       log_error("Could not release %s transport\n", 
ev->r.trans_error.name);
+               }
+               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