|
|
12a457 |
From 068be8915dfec2c3062be3576bb1818ed4c2c17a Mon Sep 17 00:00:00 2001
|
|
|
12a457 |
From: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
|
|
|
12a457 |
Date: Mon, 4 Apr 2016 16:15:18 +0530
|
|
|
12a457 |
Subject: [PATCH 123/139] rpc: assign port only if it is unreserved
|
|
|
12a457 |
|
|
|
12a457 |
Current order:
|
|
|
12a457 |
assign port;
|
|
|
12a457 |
check for port;
|
|
|
12a457 |
if reserved {
|
|
|
12a457 |
port--;
|
|
|
12a457 |
continue to i;
|
|
|
12a457 |
}
|
|
|
12a457 |
bind();
|
|
|
12a457 |
|
|
|
12a457 |
basically, we are assigning port first then checking if it is reserved
|
|
|
12a457 |
|
|
|
12a457 |
Fix:
|
|
|
12a457 |
get unreserved port;
|
|
|
12a457 |
assign port;
|
|
|
12a457 |
bind();
|
|
|
12a457 |
|
|
|
12a457 |
from now, we get unreserved port first and then assign it
|
|
|
12a457 |
|
|
|
12a457 |
Backport of:
|
|
|
12a457 |
> Backport of:
|
|
|
12a457 |
>> Change-Id: I004580c5215e7c9cae3594af6405b20fcd9fa4ad
|
|
|
12a457 |
>> BUG: 1323659
|
|
|
12a457 |
>> Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
|
|
|
12a457 |
>> Reviewed-on: http://review.gluster.org/13900
|
|
|
12a457 |
>> Tested-by: Prasanna Kumar Kalever <pkalever@redhat.com>
|
|
|
12a457 |
>> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
12a457 |
>> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
|
|
|
12a457 |
>> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
|
|
|
12a457 |
>> Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
|
|
|
12a457 |
>> Smoke: Gluster Build System <jenkins@build.gluster.com>
|
|
|
12a457 |
>> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
|
|
|
12a457 |
>> Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
|
|
|
12a457 |
|
|
|
12a457 |
> Change-Id: I772c1323606f1853542e22d8ab4d80934871efcb
|
|
|
12a457 |
> BUG: 1332838
|
|
|
12a457 |
> Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
|
|
|
12a457 |
> Reviewed-on: http://review.gluster.org/14204
|
|
|
12a457 |
> Tested-by: Prasanna Kumar Kalever <pkalever@redhat.com>
|
|
|
12a457 |
> Smoke: Gluster Build System <jenkins@build.gluster.com>
|
|
|
12a457 |
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
12a457 |
> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
|
|
|
12a457 |
> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
|
|
|
12a457 |
|
|
|
12a457 |
Change-Id: I802fb5b210aae3e665aa66cac175906430db32cc
|
|
|
12a457 |
BUG: 1322306
|
|
|
12a457 |
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
|
|
|
12a457 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/73675
|
|
|
12a457 |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
12a457 |
---
|
|
|
12a457 |
rpc/rpc-transport/rdma/src/name.c | 4 +++-
|
|
|
12a457 |
rpc/rpc-transport/socket/src/name.c | 4 +++-
|
|
|
12a457 |
2 files changed, 6 insertions(+), 2 deletions(-)
|
|
|
12a457 |
|
|
|
12a457 |
diff --git a/rpc/rpc-transport/rdma/src/name.c b/rpc/rpc-transport/rdma/src/name.c
|
|
|
12a457 |
index 2f69975..d4502e7 100644
|
|
|
12a457 |
--- a/rpc/rpc-transport/rdma/src/name.c
|
|
|
12a457 |
+++ b/rpc/rpc-transport/rdma/src/name.c
|
|
|
12a457 |
@@ -61,12 +61,14 @@ af_inet_bind_to_port_lt_ceiling (struct rdma_cm_id *cm_id,
|
|
|
12a457 |
ret = gf_process_reserved_ports (ports, ceiling);
|
|
|
12a457 |
|
|
|
12a457 |
while (port) {
|
|
|
12a457 |
- _assign_port (sockaddr, port);
|
|
|
12a457 |
/* ignore the reserved ports */
|
|
|
12a457 |
if (ports[port] == _gf_true) {
|
|
|
12a457 |
port--;
|
|
|
12a457 |
continue;
|
|
|
12a457 |
}
|
|
|
12a457 |
+
|
|
|
12a457 |
+ _assign_port (sockaddr, port);
|
|
|
12a457 |
+
|
|
|
12a457 |
ret = rdma_bind_addr (cm_id, sockaddr);
|
|
|
12a457 |
|
|
|
12a457 |
if (ret == 0)
|
|
|
12a457 |
diff --git a/rpc/rpc-transport/socket/src/name.c b/rpc/rpc-transport/socket/src/name.c
|
|
|
12a457 |
index 642e99c..aa43006 100644
|
|
|
12a457 |
--- a/rpc/rpc-transport/socket/src/name.c
|
|
|
12a457 |
+++ b/rpc/rpc-transport/socket/src/name.c
|
|
|
12a457 |
@@ -50,12 +50,14 @@ af_inet_bind_to_port_lt_ceiling (int fd, struct sockaddr *sockaddr,
|
|
|
12a457 |
|
|
|
12a457 |
while (port)
|
|
|
12a457 |
{
|
|
|
12a457 |
- _assign_port (sockaddr, port);
|
|
|
12a457 |
/* ignore the reserved ports */
|
|
|
12a457 |
if (ports[port] == _gf_true) {
|
|
|
12a457 |
port--;
|
|
|
12a457 |
continue;
|
|
|
12a457 |
}
|
|
|
12a457 |
+
|
|
|
12a457 |
+ _assign_port (sockaddr, port);
|
|
|
12a457 |
+
|
|
|
12a457 |
ret = bind (fd, sockaddr, sockaddr_len);
|
|
|
12a457 |
|
|
|
12a457 |
if (ret == 0)
|
|
|
12a457 |
--
|
|
|
12a457 |
1.7.1
|
|
|
12a457 |
|