On Wed, 2007-12-26 at 16:15 -0600, James Richardson wrote:
> Dec 26 16:00:02 myhost automount[3060]: add_host_addrs:885:
> gethostbyname_r large-rr
> 
> Dec 26 16:00:02 myhost automount[3060]: add_host_addrs:901: add host
> address ÀTm·ÈTm·ÐTm·ØTm·àTm·èTm·ðTm·øTm·

I obviously have a mistake in the patch but I still need to know what's
going on so could you try again with this patch please.

---
diff --git a/include/rpc_subs.h b/include/rpc_subs.h
index 3292e01..14b459f 100644
--- a/include/rpc_subs.h
+++ b/include/rpc_subs.h
@@ -46,6 +46,7 @@
 
 struct conn_info {
        const char *host;
+       const char *addr;
        unsigned short port;
        unsigned long program;
        unsigned long version;
@@ -61,7 +62,7 @@ int rpc_udp_getclient(struct conn_info *, unsigned int, 
unsigned int);
 void rpc_destroy_udp_client(struct conn_info *);
 int rpc_tcp_getclient(struct conn_info *, unsigned int, unsigned int);
 void rpc_destroy_tcp_client(struct conn_info *);
-int rpc_portmap_getclient(struct conn_info *, const char *, const char *, 
unsigned int);
+int rpc_portmap_getclient(struct conn_info *, const char *, const char *, 
const char *, unsigned int);
 unsigned short rpc_portmap_getport(struct conn_info *, struct pmap *);
 int rpc_ping_proto(struct conn_info *);
 int rpc_ping(const char *, long, long, unsigned int);
diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
index 5797639..cc632a4 100644
--- a/lib/rpc_subs.c
+++ b/lib/rpc_subs.c
@@ -66,6 +66,7 @@ static CLIENT *create_udp_client(struct conn_info *info)
        struct hostent *php = &hp;
        struct hostent *result;
        char buf[HOST_ENT_BUF_SIZE];
+       const char *haddr;
        size_t len;
 
        if (info->proto->p_proto != IPPROTO_UDP)
@@ -86,11 +87,13 @@ static CLIENT *create_udp_client(struct conn_info *info)
        memset(&raddr, 0, sizeof(raddr));
 
        raddr.sin_family = AF_INET;
-       if (inet_aton(info->host, &raddr.sin_addr))
+       haddr = info->addr ? info->addr : info->host;
+       if (inet_aton(haddr, &raddr.sin_addr))
                goto got_addr;
 
        memset(&hp, 0, sizeof(struct hostent));
 
+       logerr("gethostbyname_r %s", info->host);
        ret = gethostbyname_r(info->host, php,
                        buf, HOST_ENT_BUF_SIZE, &result, &ghn_errno);
        if (ret || !result) {
@@ -276,6 +279,7 @@ static CLIENT *create_tcp_client(struct conn_info *info)
        struct hostent *php = &hp;
        struct hostent *result;
        char buf[HOST_ENT_BUF_SIZE];
+       const char *haddr;
        int ret;
 
        if (info->proto->p_proto != IPPROTO_TCP)
@@ -295,11 +299,13 @@ static CLIENT *create_tcp_client(struct conn_info *info)
        memset(&addr, 0, sizeof(addr));
 
        addr.sin_family = AF_INET;
-       if (inet_aton(info->host, &addr.sin_addr))
+       haddr = info->addr ? info->addr : info->host;
+       if (inet_aton(haddr, &addr.sin_addr))
                goto got_addr;
 
        memset(&hp, 0, sizeof(struct hostent));
 
+       logerr("gethostbyname_r %s", info->host);
        ret = gethostbyname_r(info->host, php,
                        buf, HOST_ENT_BUF_SIZE, &result, &ghn_errno);
        if (ret || !result) {
@@ -407,7 +413,7 @@ void rpc_destroy_tcp_client(struct conn_info *info)
 }
 
 int rpc_portmap_getclient(struct conn_info *info,
-                         const char *host, const char *proto,
+                         const char *host, const char *addr, const char *proto,
                          unsigned int option)
 {
        struct protoent *pe_proto;
@@ -418,6 +424,7 @@ int rpc_portmap_getclient(struct conn_info *info,
                return 0;
 
        info->host = host;
+       info->addr = addr;
        info->program = PMAPPROG;
        info->port = PMAPPORT;
        info->version = PMAPVERS;
@@ -462,6 +469,7 @@ unsigned short rpc_portmap_getport(struct conn_info *info, 
struct pmap *parms)
                client = info->client;
        else {
                pmap_info.host = info->host;
+               pmap_info.addr = info->addr;
                pmap_info.port = PMAPPORT;
                pmap_info.program = PMAPPROG;
                pmap_info.version = PMAPVERS;
@@ -589,6 +597,7 @@ static unsigned int __rpc_ping(const char *host,
        struct pmap parms;
 
        info.host = host;
+       info.addr = NULL;
        info.program = NFS_PROGRAM;
        info.version = version;
        info.send_sz = 0;
@@ -769,6 +778,7 @@ exports rpc_get_exports(const char *host, long seconds, 
long micros, unsigned in
        int status;
 
        info.host = host;
+       info.addr = NULL;
        info.program = MOUNTPROG;
        info.version = MOUNTVERS;
        info.send_sz = 0;
diff --git a/modules/replicated.c b/modules/replicated.c
index 90b2925..daa4531 100644
--- a/modules/replicated.c
+++ b/modules/replicated.c
@@ -437,7 +437,7 @@ static unsigned int get_nfs_info(unsigned logopt, struct 
host *host,
 v3_ver:
        if (!have_port_opt) {
                status = rpc_portmap_getclient(pm_info,
-                                host->name, proto, RPC_CLOSE_DEFAULT);
+                                host->name, host->addr, proto, 
RPC_CLOSE_DEFAULT);
                if (!status)
                        goto done_ver;
        }
@@ -551,6 +551,7 @@ static int get_vers_and_cost(unsigned logopt, struct host 
*host,
                timeout = RPC_TIMEOUT * 8;
 
        rpc_info.host = host->name;
+       rpc_info.addr = host->addr;
        rpc_info.program = NFS_PROGRAM;
        rpc_info.timeout.tv_sec = timeout;
        rpc_info.close_option = RPC_CLOSE_DEFAULT;
@@ -606,6 +607,7 @@ static int get_supported_ver_and_cost(unsigned logopt, 
struct host *host,
                timeout = RPC_TIMEOUT * 8;
 
        rpc_info.host = host->name;
+       rpc_info.addr = host->addr;
        rpc_info.program = NFS_PROGRAM;
        rpc_info.timeout.tv_sec = timeout;
        rpc_info.close_option = RPC_CLOSE_DEFAULT;
@@ -652,7 +654,7 @@ static int get_supported_ver_and_cost(unsigned logopt, 
struct host *host,
                        return 0;
        } else {
                int ret = rpc_portmap_getclient(&pm_info,
-                                host->name, proto, RPC_CLOSE_DEFAULT);
+                                host->name, host->addr, proto, 
RPC_CLOSE_DEFAULT);
                if (!ret)
                        return 0;
 
@@ -880,6 +882,7 @@ static int add_host_addrs(struct host **list, const char 
*host, unsigned int wei
        memset(buf, 0, MAX_IFC_BUF);
        memset(&he, 0, sizeof(struct hostent));
 
+       logerr("gethostbyname_r %s", host);
        ret = gethostbyname_r(host, phe,
                        buf, MAX_IFC_BUF, &result, &ghn_errno);
        if (ret || !result) {
@@ -895,6 +898,7 @@ static int add_host_addrs(struct host **list, const char 
*host, unsigned int wei
                if (prx == PROXIMITY_ERROR)
                        return 0;
 
+               logerr("add host %s address %s", host, *haddr);
                if (!(new = new_host(host, *haddr, prx, weight)))
                        return 0;
 



_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

Reply via email to