hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmcc...@apache.org
Subject hadoop git commit: HADOOP-11349. RawLocalFileSystem leaks file descriptor while creating a file if creat succeeds but chmod fails. (Varun Saxena via Colin P. McCabe) (cherry picked from commit 03867eb1bb173c66b5eb3bebf2fe03a1188635b5)
Date Tue, 09 Dec 2014 22:32:32 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 1986ea8dd -> 3637bc8cd


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


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

Branch: refs/heads/branch-2
Commit: 3637bc8cd9b7f2b81b5de555f212f37561fd82fb
Parents: 1986ea8
Author: Colin Patrick Mccabe <cmccabe@cloudera.com>
Authored: Tue Dec 9 14:31:44 2014 -0800
Committer: Colin Patrick Mccabe <cmccabe@cloudera.com>
Committed: Tue Dec 9 14:32:25 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/3637bc8c/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 1cf5bd7..a5cb164 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -186,6 +186,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/3637bc8c/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 ca815a3..be32031 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


Mime
View raw message