| @@ -1,101 +1,101 @@ | | | @@ -1,101 +1,101 @@ |
1 | $NetBSD: patch-bq,v 1.1 2011/06/06 15:53:14 manu Exp $ | | 1 | $NetBSD: patch-bq,v 1.2 2011/06/07 07:27:11 manu Exp $ |
2 | | | 2 | |
3 | Make sur glusterfsd uses the same address family as gluserd. | | 3 | Make sur glusterfsd uses the same address family as glusterd. |
4 | | | 4 | |
5 | glusterfsd uses getaddrinfo and picks the first entry for its | | 5 | glusterfsd uses getaddrinfo and picks the first entry for its |
6 | listening address. The first entru is of inet7 family on | | 6 | listening address. The first entry is of inet6 family on |
7 | NetBSD. Even if glusterd was started with option | | 7 | NetBSD. Even if glusterd was started with option |
8 | transport.address-family inet, we ended with glusterfsd | | 8 | transport.address-family inet, we ended with glusterfsd |
9 | started with inet6, and the client could not connect to it | | 9 | using inet6. Since the client assumes glusterd and glusterfsd |
10 | if the letwork lack IPv6 | | 10 | use the same address family, it could not reach glusterfsd. |
11 | | | 11 | |
12 | --- xlators/mgmt/glusterd/src/glusterd-utils.c.orig 2011-06-06 10:28:42.000000000 +0200 | | 12 | --- xlators/mgmt/glusterd/src/glusterd-utils.c.orig 2011-06-06 10:28:42.000000000 +0200 |
13 | +++ xlators/mgmt/glusterd/src/glusterd-utils.c 2011-06-06 16:17:30.000000000 +0200 | | 13 | +++ xlators/mgmt/glusterd/src/glusterd-utils.c 2011-06-06 16:17:30.000000000 +0200 |
14 | @@ -88,8 +88,52 @@ | | 14 | @@ -88,8 +88,52 @@ |
15 | //TODO: set timestamp | | 15 | //TODO: set timestamp |
16 | return 0; | | 16 | return 0; |
17 | } | | 17 | } |
18 | | | 18 | |
19 | +static const char * | | 19 | +static const char * |
20 | +glusterd_listener_family_name(void) | | 20 | +glusterd_listener_family_name(void) |
21 | +{ | | 21 | +{ |
22 | + xlator_t *this = NULL; | | 22 | + xlator_t *this = NULL; |
23 | + glusterd_conf_t *conf = NULL; | | 23 | + glusterd_conf_t *conf = NULL; |
24 | + rpcsvc_listener_t *listener = NULL; | | 24 | + rpcsvc_listener_t *listener = NULL; |
25 | + struct sockaddr_storage ss; | | 25 | + struct sockaddr_storage ss; |
26 | + | | 26 | + |
27 | + this = THIS; | | 27 | + this = THIS; |
28 | + GF_ASSERT (this); | | 28 | + GF_ASSERT (this); |
29 | + conf = this->private; | | 29 | + conf = this->private; |
30 | + GF_ASSERT (conf); | | 30 | + GF_ASSERT (conf); |
31 | + GF_ASSERT (conf->rpc); | | 31 | + GF_ASSERT (conf->rpc); |
32 | + | | 32 | + |
33 | + list_for_each_entry (listener, &conf->rpc->listeners, list) | | 33 | + list_for_each_entry (listener, &conf->rpc->listeners, list) |
34 | + break; /* grab first one */ | | 34 | + break; /* grab first one */ |
35 | + | | 35 | + |
36 | + GF_ASSERT (listener->trans); | | 36 | + GF_ASSERT (listener->trans); |
37 | + | | 37 | + |
38 | + if (rpc_transport_get_myaddr(listener->trans, NULL, 0, | | 38 | + if (rpc_transport_get_myaddr(listener->trans, NULL, 0, |
39 | + &ss, sizeof(ss)) != 0) { | | 39 | + &ss, sizeof(ss)) != 0) { |
40 | + gf_log ("glusterd", GF_LOG_ERROR, | | 40 | + gf_log ("glusterd", GF_LOG_ERROR, |
41 | + "rpc_transport_get_myname failed: %s", | | 41 | + "rpc_transport_get_myname failed: %s", |
42 | + strerror(errno)); | | 42 | + strerror(errno)); |
43 | + return NULL; | | 43 | + return NULL; |
44 | + } | | 44 | + } |
45 | + | | 45 | + |
46 | + switch (ss.ss_family) { | | 46 | + switch (ss.ss_family) { |
47 | + case AF_INET: | | 47 | + case AF_INET: |
48 | + return "inet"; | | 48 | + return "inet"; |
49 | + break; | | 49 | + break; |
50 | + case AF_INET6: | | 50 | + case AF_INET6: |
51 | + return "inet6"; | | 51 | + return "inet6"; |
52 | + break; | | 52 | + break; |
53 | + default: | | 53 | + default: |
54 | + gf_log ("glusterd", GF_LOG_ERROR, | | 54 | + gf_log ("glusterd", GF_LOG_ERROR, |
55 | + "unknown address family %d", | | 55 | + "unknown address family %d", |
56 | + ss.ss_family); | | 56 | + ss.ss_family); |
57 | + break; | | 57 | + break; |
58 | + } | | 58 | + } |
59 | + | | 59 | + |
60 | + return NULL; | | 60 | + return NULL; |
61 | +} | | 61 | +} |
62 | + | | 62 | + |
63 | gf_boolean_t | | 63 | gf_boolean_t |
64 | glusterd_is_loopback_localhost (const struct sockaddr *sa, char *hostname) | | 64 | glusterd_is_loopback_localhost (const struct sockaddr *sa, char *hostname) |
65 | { | | 65 | { |
66 | GF_ASSERT (sa); | | 66 | GF_ASSERT (sa); |
67 | @@ -1026,8 +1070,10 @@ | | 67 | @@ -1026,8 +1070,10 @@ |
68 | int port = 0; | | 68 | int port = 0; |
69 | FILE *file = NULL; | | 69 | FILE *file = NULL; |
70 | gf_boolean_t is_locked = _gf_false; | | 70 | gf_boolean_t is_locked = _gf_false; |
71 | char socketpath[PATH_MAX] = {0}; | | 71 | char socketpath[PATH_MAX] = {0}; |
72 | + const char *family_name; | | 72 | + const char *family_name; |
73 | + char *family_option[8192] = {0,}; | | 73 | + char *family_option[8192] = {0,}; |
74 | | | 74 | |
75 | GF_ASSERT (volinfo); | | 75 | GF_ASSERT (volinfo); |
76 | GF_ASSERT (brickinfo); | | 76 | GF_ASSERT (brickinfo); |
77 | | | 77 | |
78 | @@ -1106,14 +1152,19 @@ | | 78 | @@ -1106,14 +1152,19 @@ |
79 | port = brickinfo->port; | | 79 | port = brickinfo->port; |
80 | if (!port) | | 80 | if (!port) |
81 | port = pmap_registry_alloc (THIS); | | 81 | port = pmap_registry_alloc (THIS); |
82 | | | 82 | |
83 | + if ((family_name = glusterd_listener_family_name()) != NULL) | | 83 | + if ((family_name = glusterd_listener_family_name()) != NULL) |
84 | + snprintf (family_option, 8192, | | 84 | + snprintf (family_option, 8192, |
85 | + "--xlator-option %s-server.transport.address-family=%s ", | | 85 | + "--xlator-option %s-server.transport.address-family=%s ", |
86 | + volinfo->volname, family_name); | | 86 | + volinfo->volname, family_name); |
87 | + | | 87 | + |
88 | snprintf (cmd_str, 8192, | | 88 | snprintf (cmd_str, 8192, |
89 | "%s/sbin/glusterfsd --xlator-option %s-server.listen-port=%d " | | 89 | "%s/sbin/glusterfsd --xlator-option %s-server.listen-port=%d " |
90 | - "-s localhost --volfile-id %s -p %s -S %s --brick-name %s " | | 90 | - "-s localhost --volfile-id %s -p %s -S %s --brick-name %s " |
91 | - "--brick-port %d -l %s", GFS_PREFIX, volinfo->volname, | | 91 | - "--brick-port %d -l %s", GFS_PREFIX, volinfo->volname, |
92 | - port, volfile, pidfile, socketpath, brickinfo->path, port, | | 92 | - port, volfile, pidfile, socketpath, brickinfo->path, port, |
93 | - brickinfo->logfile); | | 93 | - brickinfo->logfile); |
94 | + "%s -s localhost --volfile-id %s -p %s -S %s --brick-name %s " | | 94 | + "%s -s localhost --volfile-id %s -p %s -S %s --brick-name %s " |
95 | + "--brick-port %d -l %s", GFS_PREFIX, volinfo->volname, port, | | 95 | + "--brick-port %d -l %s", GFS_PREFIX, volinfo->volname, port, |
96 | + family_option, volfile, pidfile, socketpath, brickinfo->path, | | 96 | + family_option, volfile, pidfile, socketpath, brickinfo->path, |
97 | + port, brickinfo->logfile); | | 97 | + port, brickinfo->logfile); |
98 | | | 98 | |
99 | gf_log ("",GF_LOG_DEBUG,"Starting GlusterFS Command Executed: \n %s \n", cmd_str); | | 99 | gf_log ("",GF_LOG_DEBUG,"Starting GlusterFS Command Executed: \n %s \n", cmd_str); |
100 | ret = gf_system (cmd_str); | | 100 | ret = gf_system (cmd_str); |
101 | | | 101 | |