|
@@ -501,7 +501,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean {
|
|
|
* Dump all metadata into specified file
|
|
|
*/
|
|
|
synchronized void metaSave(String filename) throws IOException {
|
|
|
- checkAccess();
|
|
|
+ checkSuperuserPrivilege();
|
|
|
File file = new File(System.getProperty("hadoop.log.dir"),
|
|
|
filename);
|
|
|
PrintWriter out = new PrintWriter(new BufferedWriter(
|
|
@@ -606,7 +606,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean {
|
|
|
*/
|
|
|
synchronized BlocksWithLocations getBlocks(DatanodeID datanode, long size)
|
|
|
throws IOException {
|
|
|
- checkAccess();
|
|
|
+ checkSuperuserPrivilege();
|
|
|
|
|
|
DatanodeDescriptor node = getDatanode(datanode);
|
|
|
if (node == null) {
|
|
@@ -1788,7 +1788,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean {
|
|
|
*/
|
|
|
void setQuota(String path, long nsQuota, long dsQuota) throws IOException {
|
|
|
if (isPermissionEnabled) {
|
|
|
- checkAccess();
|
|
|
+ checkSuperuserPrivilege();
|
|
|
}
|
|
|
|
|
|
dir.setQuota(path, nsQuota, dsQuota);
|
|
@@ -3410,7 +3410,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean {
|
|
|
}
|
|
|
|
|
|
long[] getStats() throws IOException {
|
|
|
- checkAccess();
|
|
|
+ checkSuperuserPrivilege();
|
|
|
synchronized(heartbeats) {
|
|
|
return new long[] {this.capacityTotal, this.capacityUsed,
|
|
|
this.capacityRemaining,
|
|
@@ -3550,7 +3550,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean {
|
|
|
|
|
|
public synchronized DatanodeInfo[] datanodeReport( DatanodeReportType type
|
|
|
) throws AccessControlException {
|
|
|
- checkAccess();
|
|
|
+ checkSuperuserPrivilege();
|
|
|
|
|
|
ArrayList<DatanodeDescriptor> results = getDatanodeListForReport(type);
|
|
|
DatanodeInfo[] arr = new DatanodeInfo[results.size()];
|
|
@@ -3569,7 +3569,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean {
|
|
|
* @throws IOException if
|
|
|
*/
|
|
|
synchronized void saveNamespace() throws AccessControlException, IOException {
|
|
|
- checkAccess();
|
|
|
+ checkSuperuserPrivilege();
|
|
|
if(!isInSafeMode()) {
|
|
|
throw new IOException("Safe mode should be turned ON " +
|
|
|
"in order to create namespace image.");
|
|
@@ -3825,7 +3825,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean {
|
|
|
* 4. Removed from exclude --> stop decommission.
|
|
|
*/
|
|
|
public void refreshNodes(Configuration conf) throws IOException {
|
|
|
- checkAccess();
|
|
|
+ checkSuperuserPrivilege();
|
|
|
// Reread the config to get dfs.hosts and dfs.hosts.exclude filenames.
|
|
|
// Update the file names and refresh internal includes and excludes list
|
|
|
if (conf == null)
|
|
@@ -3859,7 +3859,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean {
|
|
|
}
|
|
|
|
|
|
void finalizeUpgrade() throws IOException {
|
|
|
- checkAccess();
|
|
|
+ checkSuperuserPrivilege();
|
|
|
getFSImage().finalizeUpgrade();
|
|
|
}
|
|
|
|
|
@@ -4302,7 +4302,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean {
|
|
|
|
|
|
boolean setSafeMode(SafeModeAction action) throws IOException {
|
|
|
if (action != SafeModeAction.SAFEMODE_GET) {
|
|
|
- checkAccess();
|
|
|
+ checkSuperuserPrivilege();
|
|
|
switch(action) {
|
|
|
case SAFEMODE_LEAVE: // leave safe mode
|
|
|
leaveSafeMode(false);
|
|
@@ -4484,7 +4484,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean {
|
|
|
return checkPermission(path, false, null, null, null, null);
|
|
|
}
|
|
|
|
|
|
- private void checkAccess() throws AccessControlException {
|
|
|
+ private void checkSuperuserPrivilege() throws AccessControlException {
|
|
|
if (isPermissionEnabled) {
|
|
|
PermissionChecker.checkSuperuserPrivilege(fsOwner, supergroup);
|
|
|
}
|