Browse Source

HADOOP-3572. SetQuotas usage interface has some minor bugs. Contributed by Hairong Kuang.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@672925 13f79535-47bb-0310-9956-ffa450edef68
Hairong Kuang 17 years ago
parent
commit
60c0e126ac
2 changed files with 5 additions and 1 deletions
  1. 2 0
      CHANGES.txt
  2. 3 1
      src/hdfs/org/apache/hadoop/dfs/FSDirectory.java

+ 2 - 0
CHANGES.txt

@@ -718,6 +718,8 @@ Release 0.18.0 - Unreleased
     HADOOP-3539. Exception when closing DFSClient while multiple files are
     open. (Benjamin Gufler via hairong)
 
+    HADOOP-3572. SetQuotas usage interface has some minor bugs. (hairong)
+
 Release 0.17.1 - Unreleased
 
   INCOMPATIBLE CHANGES

+ 3 - 1
src/hdfs/org/apache/hadoop/dfs/FSDirectory.java

@@ -981,8 +981,10 @@ class FSDirectory implements FSConstants, Closeable {
     synchronized (rootDir) {
       rootDir.getExistingPathINodes(components, inodes);
       INode targetNode = inodes[inodes.length-1];
-      if (targetNode == null || !targetNode.isDirectory()) {
+      if (targetNode == null) {
         throw new FileNotFoundException("Directory does not exist: " + srcs);
+      } else if (!targetNode.isDirectory()) {
+        throw new FileNotFoundException("Cannot set quota on a file: " + srcs);  
       } else { // a directory inode
         INodeDirectory dirNode = (INodeDirectory)targetNode;
         if (dirNode instanceof INodeDirectoryWithQuota) {