diff --git a/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/PrivilegedNfsGatewayStarter.java b/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/PrivilegedNfsGatewayStarter.java index 695cbc3a3ab..9456cafa890 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/PrivilegedNfsGatewayStarter.java +++ b/hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/PrivilegedNfsGatewayStarter.java @@ -54,9 +54,11 @@ public class PrivilegedNfsGatewayStarter implements Daemon { } try { - registrationSocket = new DatagramSocket( - new InetSocketAddress("localhost", clientPort)); + InetSocketAddress socketAddress = + new InetSocketAddress("localhost", clientPort); + registrationSocket = new DatagramSocket(null); registrationSocket.setReuseAddress(true); + registrationSocket.bind(socketAddress); } catch (SocketException e) { LOG.error("Init failed for port=" + clientPort, e); throw e;