@@ -173,9 +173,10 @@ int client_import_add_nids_to_conn(struct obd_import *imp, lnet_nid_t *nids,
list_for_each_entry(conn, &imp->imp_conn_list, oic_item) {
if (class_check_uuid(&conn->oic_uuid, nids[0])) {
*uuid = conn->oic_uuid;
+ spin_unlock(&imp->imp_lock);
rc = class_add_nids_to_uuid(&conn->oic_uuid, nids,
nid_count);
- break;
+ return rc;
}
}
spin_unlock(&imp->imp_lock);
@@ -81,6 +81,7 @@ int class_add_uuid(const char *uuid, u64 nid)
{
struct uuid_nid_data *data, *entry;
int found = 0;
+ int rc;
LASSERT(nid != 0); /* valid newconfig NID is never zero */
@@ -119,9 +120,15 @@ int class_add_uuid(const char *uuid, u64 nid)
if (found) {
CDEBUG(D_INFO, "found uuid %s %s cnt=%d\n", uuid,
libcfs_nid2str(nid), entry->un_nid_count);
+ rc = LNetAddPeer(entry->un_nids, entry->un_nid_count);
+ CDEBUG(D_INFO, "Add peer %s rc = %d\n",
+ libcfs_nid2str(data->un_nids[0]), rc);
kfree(data);
} else {
CDEBUG(D_INFO, "add uuid %s %s\n", uuid, libcfs_nid2str(nid));
+ rc = LNetAddPeer(data->un_nids, data->un_nid_count);
+ CDEBUG(D_INFO, "Add peer %s rc = %d\n",
+ libcfs_nid2str(data->un_nids[0]), rc);
}
return 0;
}
@@ -173,7 +180,8 @@ int class_add_nids_to_uuid(struct obd_uuid *uuid, lnet_nid_t *nids,
int nid_count)
{
struct uuid_nid_data *entry;
- int i;
+ int i, rc;
+ bool matched = false;
if (nid_count >= MTI_NIDS_MAX) {
CDEBUG(D_NET, "too many NIDs (%d) for UUID '%s'\n",
@@ -188,6 +196,8 @@ int class_add_nids_to_uuid(struct obd_uuid *uuid, lnet_nid_t *nids,
if (!obd_uuid_equals(&entry->un_uuid, uuid))
continue;
+
+ matched = true;
CDEBUG(D_NET, "Updating UUID '%s'\n", obd_uuid2str(uuid));
for (i = 0; i < nid_count; i++)
entry->un_nids[i] = nids[i];
@@ -195,6 +205,12 @@ int class_add_nids_to_uuid(struct obd_uuid *uuid, lnet_nid_t *nids,
break;
}
spin_unlock(&g_uuid_lock);
+ if (matched) {
+ rc = LNetAddPeer(entry->un_nids, entry->un_nid_count);
+ CDEBUG(D_INFO, "Add peer %s rc = %d\n",
+ libcfs_nid2str(entry->un_nids[0]), rc);
+ }
+
return 0;
}
EXPORT_SYMBOL(class_add_nids_to_uuid);