diff options
author | dengquan <dqdq1023@hotmail.com> | 2017-09-06 08:59:08 +0200 |
---|---|---|
committer | dengquan <dqdq1023@hotmail.com> | 2017-09-06 08:59:08 +0200 |
commit | 048d0c25db76817d6cd64f8bb043d9f5baab0cc5 (patch) | |
tree | 5a4b8af5732fc5c6ffde945fa8f5226d669ffe2e /src/java/native | |
parent | Merge pull request #15705 from xiexingguo/wip-fix-blob-tracker-check (diff) | |
download | ceph-048d0c25db76817d6cd64f8bb043d9f5baab0cc5.tar.xz ceph-048d0c25db76817d6cd64f8bb043d9f5baab0cc5.zip |
java/native: Fix: misuse milliseconds to seconds when set mtime or attime in java
Signed-off-by: dengquan <dqdq1023@hotmail.com>
Diffstat (limited to 'src/java/native')
-rw-r--r-- | src/java/native/libcephfs_jni.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/java/native/libcephfs_jni.cc b/src/java/native/libcephfs_jni.cc index 080ec3cbda4..d7ba303d4e0 100644 --- a/src/java/native/libcephfs_jni.cc +++ b/src/java/native/libcephfs_jni.cc @@ -1368,9 +1368,13 @@ JNIEXPORT jint JNICALL Java_com_ceph_fs_CephMount_native_1ceph_1setattr stx.stx_mode = env->GetIntField(j_cephstat, cephstat_mode_fid); stx.stx_uid = env->GetIntField(j_cephstat, cephstat_uid_fid); stx.stx_gid = env->GetIntField(j_cephstat, cephstat_gid_fid); - stx.stx_mtime.tv_sec = env->GetLongField(j_cephstat, cephstat_m_time_fid); - stx.stx_atime.tv_sec = env->GetLongField(j_cephstat, cephstat_a_time_fid); - + long mtime_msec = env->GetLongField(j_cephstat, cephstat_m_time_fid); + long atime_msec = env->GetLongField(j_cephstat, cephstat_a_time_fid); + stx.stx_mtime.tv_sec = mtime_msec / 1000; + stx.stx_mtime.tv_nsec = (mtime_msec % 1000) * 1000000; + stx.stx_atime.tv_sec = atime_msec / 1000; + stx.stx_atime.tv_nsec = (atime_msec % 1000) * 1000000; + ldout(cct, 10) << "jni: setattr: path " << c_path << " mask " << mask << dendl; ret = ceph_setattrx(cmount, c_path, &stx, mask, 0); |