diff options
author | Sunil Mushran <sunil.mushran@oracle.com> | 2006-03-01 02:28:01 -0500 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2006-03-01 15:17:04 -0500 |
commit | b7668c72d2ae004363fb0588600bfa942e1b245c (patch) | |
tree | f35be6a2fa11afc4e7b2f2c295a8bf6fbf07cc9e /fs/ocfs2 | |
parent | 110ba90858a7f619ff26c6b9b43c27b3c0872335 (diff) |
[PATCH] ocfs2: added source addr to bind() in o2net_start_connect()
to prevent confusion when a virtual ip is created on the same interface
Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/cluster/tcp.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index d22d4cf08db1..0f60cc0d3985 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c | |||
@@ -1318,7 +1318,7 @@ static void o2net_start_connect(void *arg) | |||
1318 | { | 1318 | { |
1319 | struct o2net_node *nn = arg; | 1319 | struct o2net_node *nn = arg; |
1320 | struct o2net_sock_container *sc = NULL; | 1320 | struct o2net_sock_container *sc = NULL; |
1321 | struct o2nm_node *node = NULL; | 1321 | struct o2nm_node *node = NULL, *mynode = NULL; |
1322 | struct socket *sock = NULL; | 1322 | struct socket *sock = NULL; |
1323 | struct sockaddr_in myaddr = {0, }, remoteaddr = {0, }; | 1323 | struct sockaddr_in myaddr = {0, }, remoteaddr = {0, }; |
1324 | int ret = 0; | 1324 | int ret = 0; |
@@ -1334,6 +1334,12 @@ static void o2net_start_connect(void *arg) | |||
1334 | goto out; | 1334 | goto out; |
1335 | } | 1335 | } |
1336 | 1336 | ||
1337 | mynode = o2nm_get_node_by_num(o2nm_this_node()); | ||
1338 | if (mynode == NULL) { | ||
1339 | ret = 0; | ||
1340 | goto out; | ||
1341 | } | ||
1342 | |||
1337 | spin_lock(&nn->nn_lock); | 1343 | spin_lock(&nn->nn_lock); |
1338 | /* see if we already have one pending or have given up */ | 1344 | /* see if we already have one pending or have given up */ |
1339 | if (nn->nn_sc || nn->nn_persistent_error) | 1345 | if (nn->nn_sc || nn->nn_persistent_error) |
@@ -1361,12 +1367,14 @@ static void o2net_start_connect(void *arg) | |||
1361 | sock->sk->sk_allocation = GFP_ATOMIC; | 1367 | sock->sk->sk_allocation = GFP_ATOMIC; |
1362 | 1368 | ||
1363 | myaddr.sin_family = AF_INET; | 1369 | myaddr.sin_family = AF_INET; |
1370 | myaddr.sin_addr.s_addr = (__force u32)mynode->nd_ipv4_address; | ||
1364 | myaddr.sin_port = (__force u16)htons(0); /* any port */ | 1371 | myaddr.sin_port = (__force u16)htons(0); /* any port */ |
1365 | 1372 | ||
1366 | ret = sock->ops->bind(sock, (struct sockaddr *)&myaddr, | 1373 | ret = sock->ops->bind(sock, (struct sockaddr *)&myaddr, |
1367 | sizeof(myaddr)); | 1374 | sizeof(myaddr)); |
1368 | if (ret) { | 1375 | if (ret) { |
1369 | mlog(0, "bind failed: %d\n", ret); | 1376 | mlog(ML_ERROR, "bind failed with %d at address %u.%u.%u.%u\n", |
1377 | ret, NIPQUAD(mynode->nd_ipv4_address)); | ||
1370 | goto out; | 1378 | goto out; |
1371 | } | 1379 | } |
1372 | 1380 | ||
@@ -1407,6 +1415,8 @@ out: | |||
1407 | sc_put(sc); | 1415 | sc_put(sc); |
1408 | if (node) | 1416 | if (node) |
1409 | o2nm_node_put(node); | 1417 | o2nm_node_put(node); |
1418 | if (mynode) | ||
1419 | o2nm_node_put(mynode); | ||
1410 | 1420 | ||
1411 | return; | 1421 | return; |
1412 | } | 1422 | } |