diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 48a3c68d8ec..93897373e80 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -274,6 +274,9 @@ Release 2.0.1-alpha - UNRELEASED HDFS-3603. Decouple TestHDFSTrash from TestTrash. (Jason Lowe via eli) + HDFS-711. hdfsUtime does not handle atime = 0 or mtime = 0 correctly. + (Colin Patrick McCabe via eli) + BREAKDOWN OF HDFS-3042 SUBTASKS HDFS-2185. HDFS portion of ZK-based FailoverController (todd) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/native/hdfs.c b/hadoop-hdfs-project/hadoop-hdfs/src/main/native/hdfs.c index 946b31252ab..5f627d38bc4 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/native/hdfs.c +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/native/hdfs.c @@ -1710,8 +1710,9 @@ int hdfsUtime(hdfsFS fs, const char* path, tTime mtime, tTime atime) return -2; } - jlong jmtime = mtime * (jlong)1000; - jlong jatime = atime * (jlong)1000; + const tTime NO_CHANGE = -1; + jlong jmtime = (mtime == NO_CHANGE) ? -1 : (mtime * (jlong)1000); + jlong jatime = (atime == NO_CHANGE) ? -1 : (atime * (jlong)1000); int ret = 0; jthrowable jExc = NULL; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/native/hdfs.h b/hadoop-hdfs-project/hadoop-hdfs/src/main/native/hdfs.h index 67bd288e1bb..bd29e83e7c1 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/native/hdfs.h +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/native/hdfs.h @@ -468,8 +468,8 @@ extern "C" { * hdfsUtime * @param fs The configured filesystem handle. * @param path the path to the file or directory - * @param mtime new modification time or 0 for only set access time in seconds - * @param atime new access time or 0 for only set modification time in seconds + * @param mtime new modification time or -1 for no change + * @param atime new access time or -1 for no change * @return 0 on success else -1 */ int hdfsUtime(hdfsFS fs, const char* path, tTime mtime, tTime atime);