HDFS-6455. Merging change r1612947 from trunk
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1612949 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ecc0a2879e
commit
4a8ac21841
|
@ -53,7 +53,12 @@ public class NfsExports {
|
||||||
long expirationPeriodNano = conf.getLong(
|
long expirationPeriodNano = conf.getLong(
|
||||||
Nfs3Constant.NFS_EXPORTS_CACHE_EXPIRYTIME_MILLIS_KEY,
|
Nfs3Constant.NFS_EXPORTS_CACHE_EXPIRYTIME_MILLIS_KEY,
|
||||||
Nfs3Constant.NFS_EXPORTS_CACHE_EXPIRYTIME_MILLIS_DEFAULT) * 1000 * 1000;
|
Nfs3Constant.NFS_EXPORTS_CACHE_EXPIRYTIME_MILLIS_DEFAULT) * 1000 * 1000;
|
||||||
|
try {
|
||||||
exports = new NfsExports(cacheSize, expirationPeriodNano, matchHosts);
|
exports = new NfsExports(cacheSize, expirationPeriodNano, matchHosts);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
LOG.error("Invalid NFS Exports provided: ", e);
|
||||||
|
return exports;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return exports;
|
return exports;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,6 +104,10 @@ public class RpcProgramMountd extends RpcProgram implements MountInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public XDR mnt(XDR xdr, XDR out, int xid, InetAddress client) {
|
public XDR mnt(XDR xdr, XDR out, int xid, InetAddress client) {
|
||||||
|
if (hostsMatcher == null) {
|
||||||
|
return MountResponse.writeMNTResponse(Nfs3Status.NFS3ERR_ACCES, out, xid,
|
||||||
|
null);
|
||||||
|
}
|
||||||
AccessPrivilege accessPrivilege = hostsMatcher.getAccessPrivilege(client);
|
AccessPrivilege accessPrivilege = hostsMatcher.getAccessPrivilege(client);
|
||||||
if (accessPrivilege == AccessPrivilege.NONE) {
|
if (accessPrivilege == AccessPrivilege.NONE) {
|
||||||
return MountResponse.writeMNTResponse(Nfs3Status.NFS3ERR_ACCES, out, xid,
|
return MountResponse.writeMNTResponse(Nfs3Status.NFS3ERR_ACCES, out, xid,
|
||||||
|
@ -210,8 +214,15 @@ public class RpcProgramMountd extends RpcProgram implements MountInterface {
|
||||||
} else if (mntproc == MNTPROC.EXPORT) {
|
} else if (mntproc == MNTPROC.EXPORT) {
|
||||||
// Currently only support one NFS export
|
// Currently only support one NFS export
|
||||||
List<NfsExports> hostsMatchers = new ArrayList<NfsExports>();
|
List<NfsExports> hostsMatchers = new ArrayList<NfsExports>();
|
||||||
|
if (hostsMatcher != null) {
|
||||||
hostsMatchers.add(hostsMatcher);
|
hostsMatchers.add(hostsMatcher);
|
||||||
out = MountResponse.writeExportList(out, xid, exports, hostsMatchers);
|
out = MountResponse.writeExportList(out, xid, exports, hostsMatchers);
|
||||||
|
} else {
|
||||||
|
// This means there are no valid exports provided.
|
||||||
|
RpcAcceptedReply.getInstance(xid,
|
||||||
|
RpcAcceptedReply.AcceptState.PROC_UNAVAIL, new VerifierNone()).write(
|
||||||
|
out);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Invalid procedure
|
// Invalid procedure
|
||||||
RpcAcceptedReply.getInstance(xid,
|
RpcAcceptedReply.getInstance(xid,
|
||||||
|
|
|
@ -2125,6 +2125,9 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check export table
|
// Check export table
|
||||||
|
if (exports == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
InetAddress client = ((InetSocketAddress) remoteAddress).getAddress();
|
InetAddress client = ((InetSocketAddress) remoteAddress).getAddress();
|
||||||
AccessPrivilege access = exports.getAccessPrivilege(client);
|
AccessPrivilege access = exports.getAccessPrivilege(client);
|
||||||
if (access == AccessPrivilege.NONE) {
|
if (access == AccessPrivilege.NONE) {
|
||||||
|
|
|
@ -109,6 +109,9 @@ Release 2.6.0 - UNRELEASED
|
||||||
continuously leading to huge size of dncp_block_verification.log.curr
|
continuously leading to huge size of dncp_block_verification.log.curr
|
||||||
(vinayakumarb via cmccabe)
|
(vinayakumarb via cmccabe)
|
||||||
|
|
||||||
|
HDFS-6455. NFS: Exception should be added in NFS log for invalid separator in
|
||||||
|
nfs.exports.allowed.hosts. (Abhiraj Butala via brandonli)
|
||||||
|
|
||||||
Release 2.5.0 - UNRELEASED
|
Release 2.5.0 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
Loading…
Reference in New Issue