You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-commits@hadoop.apache.org by to...@apache.org on 2010/03/10 23:28:45 UTC

svn commit: r921598 - in /hadoop/hdfs/trunk: CHANGES.txt src/contrib/fuse-dfs/src/fuse_impls_utimens.c

Author: tomwhite
Date: Wed Mar 10 22:28:44 2010
New Revision: 921598

URL: http://svn.apache.org/viewvc?rev=921598&view=rev
Log:
HDFS-859. fuse-dfs utime behavior causes issues with tar. Contributed by Brian Bockelman.

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

Modified: hadoop/hdfs/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/CHANGES.txt?rev=921598&r1=921597&r2=921598&view=diff
==============================================================================
--- hadoop/hdfs/trunk/CHANGES.txt (original)
+++ hadoop/hdfs/trunk/CHANGES.txt Wed Mar 10 22:28:44 2010
@@ -185,6 +185,9 @@ Trunk (unreleased changes)
     HDFS-858. Incorrect return codes for fuse-dfs. (Brian Bockelman via
     tomwhite)
 
+    HDFS-859. fuse-dfs utime behavior causes issues with tar.
+    (Brian Bockelman via tomwhite)
+
 Release 0.21.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/hdfs/trunk/src/contrib/fuse-dfs/src/fuse_impls_utimens.c
URL: http://svn.apache.org/viewvc/hadoop/hdfs/trunk/src/contrib/fuse-dfs/src/fuse_impls_utimens.c?rev=921598&r1=921597&r2=921598&view=diff
==============================================================================
--- hadoop/hdfs/trunk/src/contrib/fuse-dfs/src/fuse_impls_utimens.c (original)
+++ hadoop/hdfs/trunk/src/contrib/fuse-dfs/src/fuse_impls_utimens.c Wed Mar 10 22:28:44 2010
@@ -20,7 +20,7 @@
 #include "fuse_impls.h"
 #include "fuse_connect.h"
 
- int dfs_utimens(const char *path, const struct timespec ts[2])
+int dfs_utimens(const char *path, const struct timespec ts[2])
 {
   TRACE1("utimens", path)
 #if PERMS
@@ -38,14 +38,22 @@
   hdfsFS userFS;
   // if not connected, try to connect and fail out if we can't.
   if ((userFS = doConnectAsUser(dfs->nn_hostname,dfs->nn_port))== NULL) {
-    syslog(LOG_ERR, "ERROR: could not connect to dfs %s:%d\n", __FILE__, __LINE__);
+    syslog(LOG_ERR, "ERROR: could not connect to dfs %s:%d\n",
+           __FILE__, __LINE__);
     return -EIO;
   }
 
   if (hdfsUtime(userFS, path, mTime, aTime)) {
-    syslog(LOG_ERR,"ERROR: hdfs trying to utime %s to %ld/%ld",path, (long)mTime, (long)aTime);
-    fprintf(stderr,"ERROR: could not set utime for path %s\n",path);
-    return -EIO;
+    hdfsFileInfo *info = hdfsGetPathInfo(dfs->fs,path);
+    if (info == NULL) {
+      return -EIO;
+    }
+    // Silently ignore utimens failure for directories, otherwise 
+    // some programs like tar will fail.
+    if (info->mKind == kObjectKindDirectory) {
+      return 0;
+    }
+    return -errno;
   }
 #endif  
   return 0;