hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rang...@apache.org
Subject svn commit: r644818 - in /hadoop/core/trunk: CHANGES.txt src/java/org/apache/hadoop/dfs/FSNamesystem.java src/test/org/apache/hadoop/security/TestPermission.java
Date Fri, 04 Apr 2008 18:47:27 GMT
Author: rangadi
Date: Fri Apr  4 11:47:09 2008
New Revision: 644818

URL: http://svn.apache.org/viewvc?rev=644818&view=rev
Log:
HADOOP-3138. DFS mkdirs() should not throw an exception if the directory already exists. (rangadi)

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java
    hadoop/core/trunk/src/test/org/apache/hadoop/security/TestPermission.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=644818&r1=644817&r2=644818&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Fri Apr  4 11:47:09 2008
@@ -485,6 +485,9 @@
     HADOOP-3165. -put/-copyFromLocal did not treat input file "-" as stdin.
     (Lohit Vijayarenu via rangadi)
 
+    HADOOP-3138. DFS mkdirs() should not throw an exception if the directory
+    already exists. (rangadi)
+
 Release 0.16.2 - 2008-04-02
 
   BUG FIXES

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java?rev=644818&r1=644817&r2=644818&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/dfs/FSNamesystem.java Fri Apr  4 11:47:09
2008
@@ -1605,6 +1605,14 @@
   private synchronized boolean mkdirsInternal(String src,
       PermissionStatus permissions) throws IOException {
     NameNode.stateChangeLog.debug("DIR* NameSystem.mkdirs: " + src);
+    if (isPermissionEnabled) {
+      checkTraverse(src);
+    }
+    if (dir.isDir(src)) {
+      // all the users of mkdirs() are used to expect 'true' even if
+      // a new directory is not created.
+      return true;
+    }
     if (isInSafeMode())
       throw new SafeModeException("Cannot create directory " + src, safeMode);
     if (!isValidName(src)) {

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/security/TestPermission.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/security/TestPermission.java?rev=644818&r1=644817&r2=644818&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/security/TestPermission.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/security/TestPermission.java Fri Apr  4 11:47:09
2008
@@ -161,6 +161,10 @@
           userGroupInfo.toString());
       fs = FileSystem.get(conf);
 
+      // make sure mkdir of a existing directory that is not owned by 
+      // this user does not throw an exception.
+      fs.mkdirs(CHILD_DIR1);
+      
       // illegal mkdir
       assertTrue(!canMkdirs(fs, CHILD_DIR2));
 



Mime
View raw message