HDFS-12339. NFS Gateway on Shutdown Gives Unregistration Failure. Does Not Unregister with rpcbind Portmapper. Contributed by Mukul Kumar Singh.
This commit is contained in:
parent
40ef9fa171
commit
ecc85620e8
@ -109,6 +109,17 @@ public void start(boolean register) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void stop() {
|
||||||
|
if (udpBoundPort > 0) {
|
||||||
|
rpcProgram.unregister(PortmapMapping.TRANSPORT_UDP, udpBoundPort);
|
||||||
|
udpBoundPort = 0;
|
||||||
|
}
|
||||||
|
if (tcpBoundPort > 0) {
|
||||||
|
rpcProgram.unregister(PortmapMapping.TRANSPORT_TCP, tcpBoundPort);
|
||||||
|
tcpBoundPort = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Priority of the mountd shutdown hook.
|
* Priority of the mountd shutdown hook.
|
||||||
*/
|
*/
|
||||||
@ -117,8 +128,7 @@ public void start(boolean register) {
|
|||||||
private class Unregister implements Runnable {
|
private class Unregister implements Runnable {
|
||||||
@Override
|
@Override
|
||||||
public synchronized void run() {
|
public synchronized void run() {
|
||||||
rpcProgram.unregister(PortmapMapping.TRANSPORT_UDP, udpBoundPort);
|
stop();
|
||||||
rpcProgram.unregister(PortmapMapping.TRANSPORT_TCP, tcpBoundPort);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,6 +78,13 @@ private void startTCPServer() {
|
|||||||
nfsBoundPort = tcpServer.getBoundPort();
|
nfsBoundPort = tcpServer.getBoundPort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void stop() {
|
||||||
|
if (nfsBoundPort > 0) {
|
||||||
|
rpcProgram.unregister(PortmapMapping.TRANSPORT_TCP, nfsBoundPort);
|
||||||
|
nfsBoundPort = 0;
|
||||||
|
}
|
||||||
|
rpcProgram.stopDaemons();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Priority of the nfsd shutdown hook.
|
* Priority of the nfsd shutdown hook.
|
||||||
*/
|
*/
|
||||||
@ -86,8 +93,7 @@ private void startTCPServer() {
|
|||||||
private class NfsShutdownHook implements Runnable {
|
private class NfsShutdownHook implements Runnable {
|
||||||
@Override
|
@Override
|
||||||
public synchronized void run() {
|
public synchronized void run() {
|
||||||
rpcProgram.unregister(PortmapMapping.TRANSPORT_TCP, nfsBoundPort);
|
stop();
|
||||||
rpcProgram.stopDaemons();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ public void startServiceInternal(boolean register) throws IOException {
|
|||||||
start(register);
|
start(register);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void startService(String[] args,
|
static Nfs3 startService(String[] args,
|
||||||
DatagramSocket registrationSocket) throws IOException {
|
DatagramSocket registrationSocket) throws IOException {
|
||||||
StringUtils.startupShutdownMessage(Nfs3.class, args, LOG);
|
StringUtils.startupShutdownMessage(Nfs3.class, args, LOG);
|
||||||
NfsConfiguration conf = new NfsConfiguration();
|
NfsConfiguration conf = new NfsConfiguration();
|
||||||
@ -67,6 +67,12 @@ static void startService(String[] args,
|
|||||||
final Nfs3 nfsServer = new Nfs3(conf, registrationSocket,
|
final Nfs3 nfsServer = new Nfs3(conf, registrationSocket,
|
||||||
allowInsecurePorts);
|
allowInsecurePorts);
|
||||||
nfsServer.startServiceInternal(true);
|
nfsServer.startServiceInternal(true);
|
||||||
|
return nfsServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stop() {
|
||||||
|
super.stop();
|
||||||
|
mountd.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
|
@ -40,6 +40,7 @@ public class PrivilegedNfsGatewayStarter implements Daemon {
|
|||||||
static final Log LOG = LogFactory.getLog(PrivilegedNfsGatewayStarter.class);
|
static final Log LOG = LogFactory.getLog(PrivilegedNfsGatewayStarter.class);
|
||||||
private String[] args = null;
|
private String[] args = null;
|
||||||
private DatagramSocket registrationSocket = null;
|
private DatagramSocket registrationSocket = null;
|
||||||
|
private Nfs3 nfs3Server = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(DaemonContext context) throws Exception {
|
public void init(DaemonContext context) throws Exception {
|
||||||
@ -68,12 +69,14 @@ public void init(DaemonContext context) throws Exception {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start() throws Exception {
|
public void start() throws Exception {
|
||||||
Nfs3.startService(args, registrationSocket);
|
nfs3Server = Nfs3.startService(args, registrationSocket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stop() throws Exception {
|
public void stop() throws Exception {
|
||||||
// Nothing to do.
|
if (nfs3Server != null) {
|
||||||
|
nfs3Server.stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user