HDFS-6462. NFS: fsstat request fails with the secure hdfs. Contributed by Brandon Li

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1598405 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brandon Li 2014-05-29 21:16:04 +00:00
parent 1d5e564998
commit c55947343e
2 changed files with 3 additions and 11 deletions

View File

@ -44,7 +44,6 @@ import org.apache.hadoop.hdfs.client.HdfsDataOutputStream;
import org.apache.hadoop.hdfs.protocol.DirectoryListing; import org.apache.hadoop.hdfs.protocol.DirectoryListing;
import org.apache.hadoop.hdfs.protocol.HdfsConstants; import org.apache.hadoop.hdfs.protocol.HdfsConstants;
import org.apache.hadoop.hdfs.protocol.HdfsFileStatus; import org.apache.hadoop.hdfs.protocol.HdfsFileStatus;
import org.apache.hadoop.hdfs.server.namenode.NameNode;
import org.apache.hadoop.ipc.RemoteException; import org.apache.hadoop.ipc.RemoteException;
import org.apache.hadoop.nfs.AccessPrivilege; import org.apache.hadoop.nfs.AccessPrivilege;
import org.apache.hadoop.nfs.NfsExports; import org.apache.hadoop.nfs.NfsExports;
@ -152,13 +151,6 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
private final NfsExports exports; private final NfsExports exports;
/**
* superUserClient should always impersonate HDFS file system owner to send
* requests which requires supergroup privilege. This requires the same user
* to start HDFS and NFS.
*/
private final DFSClient superUserClient;
private final short replication; private final short replication;
private final long blockSize; private final long blockSize;
private final int bufferSize; private final int bufferSize;
@ -180,7 +172,6 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
exports = NfsExports.getInstance(config); exports = NfsExports.getInstance(config);
writeManager = new WriteManager(iug, config); writeManager = new WriteManager(iug, config);
clientCache = new DFSClientCache(config); clientCache = new DFSClientCache(config);
superUserClient = new DFSClient(NameNode.getAddress(config), config);
replication = (short) config.getInt(DFSConfigKeys.DFS_REPLICATION_KEY, replication = (short) config.getInt(DFSConfigKeys.DFS_REPLICATION_KEY,
DFSConfigKeys.DFS_REPLICATION_DEFAULT); DFSConfigKeys.DFS_REPLICATION_DEFAULT);
blockSize = config.getLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, blockSize = config.getLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY,
@ -1681,8 +1672,7 @@ public class RpcProgramNfs3 extends RpcProgram implements Nfs3Interface {
} }
try { try {
// Use superUserClient to get file system status FsStatus fsStatus = dfsClient.getDiskStatus();
FsStatus fsStatus = superUserClient.getDiskStatus();
long totalBytes = fsStatus.getCapacity(); long totalBytes = fsStatus.getCapacity();
long freeBytes = fsStatus.getRemaining(); long freeBytes = fsStatus.getRemaining();

View File

@ -610,6 +610,8 @@ Release 2.5.0 - UNRELEASED
HDFS-6461. Use Time#monotonicNow to compute duration in DataNode#shutDown. HDFS-6461. Use Time#monotonicNow to compute duration in DataNode#shutDown.
(James Thomas via wang) (James Thomas via wang)
HDFS-6462. NFS: fsstat request fails with the secure hdfs (brandonli)
Release 2.4.1 - UNRELEASED Release 2.4.1 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES