Mike Christie wrote:
> Erez Zilber wrote:
>> The following series of patches fixes a bug in iscsid: if a transport is
>> unloaded and then reloaded, the transport entry in iscsid is still the old
>> one.
>>
>
> I think I am going to revert this. I think we can do this in userspace
> without any help from the kernel. To setup the userspace transport we
> basically poll userspace, so we can just update the transport in that
> same code path. You should revert the original patch
> b67cfc18c70b4cfd903d1f6e0dea6caaa0a74a2b then apply this one.
>
Here is the correct patch.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"open-iscsi" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~----------~----~----~----~------~----~------~--~---
diff -aurp open-iscsi/usr/iscsi_sysfs.c open-iscsi.work/usr/iscsi_sysfs.c
--- open-iscsi/usr/iscsi_sysfs.c 2008-05-06 00:02:26.000000000 -0500
+++ open-iscsi.work/usr/iscsi_sysfs.c 2008-05-06 00:05:50.000000000 -0500
@@ -118,7 +118,7 @@ static int read_transports(void)
{
struct dirent **namelist;
char filename[64];
- int i, n, found, err = 0;
+ int i, n, err = 0;
struct iscsi_transport *t;
log_debug(7, "in %s", __FUNCTION__);
@@ -131,18 +131,11 @@ static int read_transports(void)
}
for (i = 0; i < n; i++) {
- found = 0;
-
list_for_each_entry(t, &transports, list) {
- if (!strcmp(t->name, namelist[i]->d_name)) {
- found = 1;
- break;
- }
+ if (!strcmp(t->name, namelist[i]->d_name))
+ goto update_transport;
}
- if (found)
- continue;
-
/* copy new transport */
t = malloc(sizeof(*t));
if (!t)
@@ -154,15 +147,16 @@ static int read_transports(void)
strncpy(t->name, namelist[i]->d_name,
ISCSI_TRANSPORT_NAME_MAXLEN);
+update_transport:
sprintf(filename, ISCSI_TRANSPORT_DIR"/%s/handle", t->name);
err = read_sysfs_file(filename, &t->handle, "%llu\n");
if (err)
- continue;
+ goto fail;
sprintf(filename, ISCSI_TRANSPORT_DIR"/%s/caps", t->name);
err = read_sysfs_file(filename, &t->caps, "0x%x");
if (err)
- continue;
+ goto fail;
/*
* tmp hack for qla4xx compat
@@ -172,7 +166,13 @@ static int read_transports(void)
t->caps |= CAP_FW_DB;
}
- list_add_tail(&t->list, &transports);
+ if (list_empty(&t->list))
+ list_add_tail(&t->list, &transports);
+ continue;
+fail:
+ /* only free on errors if this is a new transport */
+ if (list_empty(&t->list))
+ free(t);
}
for (i = 0; i < n; i++)