* @{ */
int LNetGetId(unsigned int index, struct lnet_processid *id);
int LNetDist(lnet_nid_t nid, lnet_nid_t *srcnid, __u32 *order);
-lnet_nid_t LNetPrimaryNID(lnet_nid_t nid);
+void LNetPrimaryNID(struct lnet_nid *nid);
bool LNetIsPeerLocal(lnet_nid_t nid);
/** @} lnet_addr */
}
EXPORT_SYMBOL(LNetAddPeer);
-/* FIXME support large-addr nid */
-lnet_nid_t
-LNetPrimaryNID(lnet_nid_t nid)
+void LNetPrimaryNID(struct lnet_nid *nid)
{
struct lnet_peer *lp;
struct lnet_peer_ni *lpni;
- lnet_nid_t primary_nid = nid;
+ struct lnet_nid orig;
int rc = 0;
int cpt;
- if (nid == LNET_NID_LO_0)
- return LNET_NID_LO_0;
+ if (!nid || nid_is_lo0(nid))
+ return;
+ orig = *nid;
cpt = lnet_net_lock_current();
- lpni = lnet_nid2peerni_locked(nid, LNET_NID_ANY, cpt);
+ lpni = lnet_peerni_by_nid_locked(nid, NULL, cpt);
if (IS_ERR(lpni)) {
rc = PTR_ERR(lpni);
goto out_unlock;
* and lookup the lpni again
*/
lnet_peer_ni_decref_locked(lpni);
- lpni = lnet_find_peer_ni_locked(nid);
+ lpni = lnet_peer_ni_find_locked(nid);
if (!lpni) {
rc = -ENOENT;
goto out_unlock;
if (lnet_is_discovery_disabled(lp))
break;
}
- primary_nid = lnet_nid_to_nid4(&lp->lp_primary_nid);
+ *nid = lp->lp_primary_nid;
out_decref:
lnet_peer_ni_decref_locked(lpni);
out_unlock:
lnet_net_unlock(cpt);
- CDEBUG(D_NET, "NID %s primary NID %s rc %d\n", libcfs_nid2str(nid),
- libcfs_nid2str(primary_nid), rc);
- return primary_nid;
+ CDEBUG(D_NET, "NID %s primary NID %s rc %d\n", libcfs_nidstr(&orig),
+ libcfs_nidstr(nid), rc);
}
EXPORT_SYMBOL(LNetPrimaryNID);
struct lnet_processid peer;
ENTRY;
- peer4.nid = LNetPrimaryNID(peer4.nid);
lnet_pid4_to_pid(peer4, &peer);
+ LNetPrimaryNID(&peer.nid);
conn = rhashtable_lookup_fast(&conn_hash, &peer, conn_hash_params);
if (conn) {
ptlrpc_connection_addref(conn);
const char *sec_part_flags = "";
char svc_flag = '-';
pid_t caller_pid;
+ struct lnet_nid primary;
ENTRY;
LASSERT(imp != NULL);
/* Do not switch namespace in gss keyring upcall. */
caller_pid = 0;
}
+ primary = imp->imp_connection->c_self;
+ LNetPrimaryNID(&primary);
+
+ /* FIXME !! Needs to support larger NIDs */
snprintf(coinfo, coinfo_size, "%d:%s:%u:%u:%s:%c:%d:%#llx:%s:%#llx:%d",
sec->ps_id, sec2gsec(sec)->gs_mech->gm_name,
vcred->vc_uid, vcred->vc_gid,
sec_part_flags, svc_flag, import_to_gss_svc(imp),
lnet_nid_to_nid4(&imp->imp_connection->c_peer.nid),
imp->imp_obd->obd_name,
- LNetPrimaryNID(lnet_nid_to_nid4(&imp->imp_connection->c_self)),
+ lnet_nid_to_nid4(&primary),
caller_pid);
CDEBUG(D_SEC, "requesting key for %s\n", desc);
struct rsi {
struct cache_head h;
__u32 lustre_svc;
- __u64 nid;
+ lnet_nid_t nid4; /* FIXME Support larger NID */
char nm_name[LUSTRE_NODEMAP_NAME_LENGTH + 1];
wait_queue_head_t waitq;
rawobj_t in_handle, in_token;
qword_addhex(bpp, blen, (char *) &rsi->lustre_svc,
sizeof(rsi->lustre_svc));
- qword_addhex(bpp, blen, (char *) &rsi->nid, sizeof(rsi->nid));
+ qword_addhex(bpp, blen, (char *) &rsi->nid4, sizeof(rsi->nid4));
qword_addhex(bpp, blen, (char *) &index, sizeof(index));
qword_addhex(bpp, blen, (char *) rsi->nm_name,
strlen(rsi->nm_name) + 1);
item->in_token = RAWOBJ_EMPTY;
new->lustre_svc = item->lustre_svc;
- new->nid = item->nid;
+ new->nid4 = item->nid4;
memcpy(new->nm_name, item->nm_name, sizeof(item->nm_name));
init_waitqueue_head(&new->waitq);
}
struct gss_rep_header *rephdr;
int first_check = 1;
int rc = SECSVC_DROP;
+ struct lnet_nid primary;
ENTRY;
memset(&rsikey, 0, sizeof(rsikey));
* but primary NID of peer.
* So we need LNetPrimaryNID(rq_source) to match what the clients uses.
*/
- rsikey.nid = (__u64)LNetPrimaryNID(req->rq_source.nid);
+ lnet_nid4_to_nid(req->rq_source.nid, &primary);
+ LNetPrimaryNID(&primary);
+ rsikey.nid4 = lnet_nid_to_nid4(&primary);
nodemap_test_nid(req->rq_peer.nid, rsikey.nm_name,
sizeof(rsikey.nm_name));