Repository: hadoop
Updated Branches:
  refs/heads/trunk a2e07a545 -> 03867eb1b


HADOOP-11349. RawLocalFileSystem leaks file descriptor while creating a file if 
creat succeeds but chmod fails. (Varun Saxena via Colin P.  McCabe)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/03867eb1
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/03867eb1
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/03867eb1

Branch: refs/heads/trunk
Commit: 03867eb1bb173c66b5eb3bebf2fe03a1188635b5
Parents: a2e07a5
Author: Colin Patrick Mccabe <cmcc...@cloudera.com>
Authored: Tue Dec 9 14:31:44 2014 -0800
Committer: Colin Patrick Mccabe <cmcc...@cloudera.com>
Committed: Tue Dec 9 14:31:44 2014 -0800

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt |  4 ++++
 .../apache/hadoop/fs/RawLocalFileSystem.java    | 25 ++++++++++++++++----
 2 files changed, 25 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/03867eb1/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt 
b/hadoop-common-project/hadoop-common/CHANGES.txt
index 40aab85..0019b3a 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -552,6 +552,10 @@ Release 2.7.0 - UNRELEASED
 
     HADOOP-11378. Fix new findbugs warnings in hadoop-kms. (Li Lu via wheat9)
 
+    HADOOP-11349. RawLocalFileSystem leaks file descriptor while creating a
+    file if creat succeeds but chmod fails. (Varun Saxena via Colin P. McCabe)
+
+
 Release 2.6.0 - 2014-11-18
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/03867eb1/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
----------------------------------------------------------------------
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
index b6b6f59..858789e 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
@@ -41,6 +41,7 @@ import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.permission.FsPermission;
+import org.apache.hadoop.io.IOUtils;
 import org.apache.hadoop.io.nativeio.NativeIO;
 import org.apache.hadoop.util.Progressable;
 import org.apache.hadoop.util.Shell;
@@ -295,8 +296,16 @@ public class RawLocalFileSystem extends FileSystem {
 
     FSDataOutputStream out = create(f,
         overwrite, bufferSize, replication, blockSize, progress);
-    setPermission(f, permission);
-    return out;
+    boolean success = false;
+    try {
+      setPermission(f, permission);
+      success = true;
+      return out;
+    } finally {
+      if (!success) {
+        IOUtils.cleanup(LOG, out);
+      }
+    }
   }
 
   @Override
@@ -306,8 +315,16 @@ public class RawLocalFileSystem extends FileSystem {
       Progressable progress) throws IOException {
     FSDataOutputStream out = create(f,
         overwrite, false, bufferSize, replication, blockSize, progress);
-    setPermission(f, permission);
-    return out;
+    boolean success = false;
+    try {
+      setPermission(f, permission);
+      success = true;
+      return out;
+    } finally {
+      if (!success) {
+        IOUtils.cleanup(LOG, out);
+      } 
+    }
   }
 
   @Override

Reply via email to