From 4bc728d3bd51fe32eebe602aab1079c52831d3a8 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 6 Dec 2010 23:24:18 -0500 Subject: [PATCH] modify FindIndex to compare uuids If FindIndex is provided a server address and entry has a valid uuid, obtain the uuid for 'server' and use that search for a matching entry. This modification is necessary in order to permit operations against multi-homed servers in split horizon DNS configurations. Reviewed-on: http://gerrit.openafs.org/3468 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear (cherry picked from commit 9aad0979e9ff0601c249eb66a6ecfb3e76264702) Change-Id: If819975bd24e29da1142531c3f0eb27755e65afb Reviewed-on: http://gerrit.openafs.org/3489 --- src/volser/lockprocs.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/volser/lockprocs.c b/src/volser/lockprocs.c index cc93a5238..d98d1baff 100644 --- a/src/volser/lockprocs.c +++ b/src/volser/lockprocs.c @@ -31,6 +31,7 @@ #include #include #include +#include #include "volint.h" #include "volser.h" #include "lockdata.h" @@ -38,6 +39,8 @@ #include "vsutils_prototypes.h" #include "lockprocs_prototypes.h" +struct ubik_client *cstruct; + /* Finds an index in VLDB entry that matches the volume type, server, and partition. * If type is zero, will match first index of ANY type (RW, BK, or RO). * If server is zero, will match first index of ANY server and partition @@ -48,13 +51,34 @@ FindIndex(struct uvldbentry *entry, afs_uint32 server, afs_int32 part, afs_int32 { int e; afs_int32 error = 0; + afsUUID m_uuid; + int uuid_valid = 0; + + if (server && !afs_uuid_is_nil(&entry->serverNumber[0])) { + afs_int32 vcode, m_uniq=0; + bulkaddrs m_addrs; + ListAddrByAttributes m_attrs; + afs_int32 m_nentries; + + m_attrs.Mask = VLADDR_IPADDR; + m_attrs.ipaddr = htonl(server); + m_nentries = 0; + m_addrs.bulkaddrs_val = 0; + m_addrs.bulkaddrs_len = 0; + vcode = + ubik_VL_GetAddrsU( cstruct, 0, &m_attrs, + &m_uuid, + &m_uniq, &m_nentries, + &m_addrs); + uuid_valid = (vcode == 0); + } for (e = 0; (e < entry->nServers) && !error; e++) { if (!type || (entry->serverFlags[e] & type)) { if ((!server || (entry->serverPartition[e] == part)) && (!server - || VLDB_IsSameAddrs(entry->serverUnique[e], server, - &error))) + || (uuid_valid && afs_uuid_equal(&m_uuid, &entry->serverNumber[e])) + || VLDB_IsSameAddrs(entry->serverUnique[e], server, &error))) break; if (type == ITSRWVOL) return -1; /* quit when we are looking for RW entry (there's only 1) */ -- 2.39.5