hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomwh...@apache.org
Subject svn commit: r921617 - in /hadoop/hdfs/trunk: CHANGES.txt src/contrib/fuse-dfs/src/fuse_impls_open.c
Date Wed, 10 Mar 2010 23:09:49 GMT
Author: tomwhite
Date: Wed Mar 10 23:09:48 2010
New Revision: 921617

URL: http://svn.apache.org/viewvc?rev=921617&view=rev
Log:
HDFS-861. fuse-dfs does not support O_RDWR. Contributed by Brian Bockelman.

Modified:
    hadoop/hdfs/trunk/CHANGES.txt
    hadoop/hdfs/trunk/src/contrib/fuse-dfs/src/fuse_impls_open.c

Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=921617&r1=921616&r2=921617&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Wed Mar 10 23:09:48 2010
@@ -188,6 +188,8 @@ Trunk (unreleased changes)
     HDFS-859. fuse-dfs utime behavior causes issues with tar.
     (Brian Bockelman via tomwhite)
 
+    HDFS-861. fuse-dfs does not support O_RDWR. (Brian Bockelman via tomwhite)
+
 Release 0.21.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/hdfs/trunk/src/contrib/fuse-dfs/src/fuse_impls_open.c
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/contrib/fuse-dfs/src/fuse_impls_open.c?rev=921617&r1=921616&r2=921617&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/contrib/fuse-dfs/src/fuse_impls_open.c (original)
+++ hadoop/hdfs/trunk/src/contrib/fuse-dfs/src/fuse_impls_open.c Wed Mar 10 23:09:48 2010
@@ -50,6 +50,21 @@ int dfs_open(const char *path, struct fu
     return -EIO;
   }
 
+  if (flags & O_RDWR) {
+    hdfsFileInfo *info = hdfsGetPathInfo(dfs->fs,path);
+    if (info == NULL) {
+      // File does not exist (maybe?); interpret it as a O_WRONLY
+      // If the actual error was something else, we'll get it again when
+      // we try to open the file.
+      flags ^= O_RDWR;
+      flags |= O_WRONLY;
+    } else {
+      // File exists; open this as read only.
+      flags ^= O_RDWR;
+      flags |= O_RDONLY;
+    }
+  }
+
   if ((fh->hdfsFH = hdfsOpenFile(fh->fs, path, flags,  0, 0, 0)) == NULL) {
     syslog(LOG_ERR, "ERROR: could not connect open file %s:%d\n", __FILE__, __LINE__);
     syslog(LOG_ERR, "ERROR: errno %d\n", errno);



Mime
View raw message