diff options
author | Kotresh HR <khiremat@redhat.com> | 2018-05-21 12:57:45 -0400 |
---|---|---|
committer | Kotresh HR <khiremat@redhat.com> | 2018-05-24 03:42:39 -0400 |
commit | 096983831d11901daca0cb33b87bc5c1471a1ebf (patch) | |
tree | 75286d04a4722e74f649a1385901ac1ab5c9850b /xlators | |
parent | 54f61abc7b1adffdf1e1cc3568e4df4d23da9a77 (diff) |
posix/ctime: Fix atime update for hardlink
With ctime feature enabled, atime is not
being updated for a hardlink when the file
is accessed.
e.g., touch -a <hardlink_file> fails to
update atime. This patch fixes the same.
Backport of:
> Patch: https://review.gluster.org/20051
> BUG: 1580529
> Change-Id: I2201c88d502d0070300a1f5023af1b36951284ec
> Signed-off-by: Kotresh HR <khiremat@redhat.com>
fixes: bz#1582072
Change-Id: I2201c88d502d0070300a1f5023af1b36951284ec
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/storage/posix/src/posix-metadata.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/xlators/storage/posix/src/posix-metadata.c b/xlators/storage/posix/src/posix-metadata.c index 07d49da6b82..1110435f4e0 100644 --- a/xlators/storage/posix/src/posix-metadata.c +++ b/xlators/storage/posix/src/posix-metadata.c @@ -498,6 +498,15 @@ posix_update_utime_in_mdata (xlator_t *this, const char *real_path, int fd, flag.ctime = 0; flag.mtime = 0; flag.atime = 1; + ret = posix_set_mdata_xattr (this, real_path, -1, inode, &tv, NULL, + &flag); + if (ret) { + gf_msg (this->name, GF_LOG_WARNING, errno, + P_MSG_SETMDATA_FAILED, + "posix set mdata atime failed on file:" + " %s gfid:%s", + real_path, uuid_utoa (inode->gfid)); + } } if ((valid & GF_SET_ATTR_MTIME) == GF_SET_ATTR_MTIME) { @@ -507,16 +516,18 @@ posix_update_utime_in_mdata (xlator_t *this, const char *real_path, int fd, flag.ctime = 1; flag.mtime = 1; flag.atime = 0; - } - ret = posix_set_mdata_xattr (this, real_path, -1, inode, &tv, NULL, - &flag); - if (ret) { - gf_msg (this->name, GF_LOG_WARNING, errno, - P_MSG_SETMDATA_FAILED, - "posix set mdata failed on file: %s gfid:%s", - real_path, uuid_utoa (inode->gfid)); + ret = posix_set_mdata_xattr (this, real_path, -1, inode, &tv, NULL, + &flag); + if (ret) { + gf_msg (this->name, GF_LOG_WARNING, errno, + P_MSG_SETMDATA_FAILED, + "posix set mdata mtime failed on file:" + " %s gfid:%s", + real_path, uuid_utoa (inode->gfid)); + } } + } else { gf_msg (this->name, GF_LOG_WARNING, errno, P_MSG_SETMDATA_FAILED, |