HDFS-13586. Fsync fails on directories on Windows. Contributed by Lukas 
Majercack.

(cherry picked from commit 8783613696674aba4ae1739c6e8f48cda0d1c386)


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

Branch: refs/heads/branch-2.9
Commit: 8e5b5a108b57c9c147eb93abefa7d7076bda4064
Parents: 905c377
Author: Inigo Goiri <inigo...@apache.org>
Authored: Thu May 17 19:26:44 2018 -0700
Committer: Inigo Goiri <inigo...@apache.org>
Committed: Thu May 17 19:28:44 2018 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/hadoop/io/IOUtils.java           | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/8e5b5a10/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/IOUtils.java
----------------------------------------------------------------------
diff --git 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/IOUtils.java
 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/IOUtils.java
index 03c488c..547a5b4 100644
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/IOUtils.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/IOUtils.java
@@ -398,6 +398,13 @@ public class IOUtils {
           "File/Directory " + fileToSync.getAbsolutePath() + " does not 
exist");
     }
     boolean isDir = fileToSync.isDirectory();
+
+    // HDFS-13586, FileChannel.open fails with AccessDeniedException
+    // for any directory, ignore.
+    if (isDir && Shell.WINDOWS) {
+      return;
+    }
+
     // If the file is a directory we have to open read-only, for regular files
     // we must open r/w for the fsync to have an effect. See
     // http://blog.httrack.com/blog/2013/11/15/


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to