summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix-metadata.c
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2018-05-21 12:57:45 -0400
committerKotresh HR <khiremat@redhat.com>2018-05-24 06:06:32 +0000
commitab18f27bff1bbeeaad3cce8177175dbf6f4c7228 (patch)
tree101b93da671456c22f15b1d08cf196798427df4a /xlators/storage/posix/src/posix-metadata.c
parent52fe35609d99821ebab003c93ca6e63aae243f95 (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. fixes: bz#1580529 Change-Id: I2201c88d502d0070300a1f5023af1b36951284ec Signed-off-by: Kotresh HR <khiremat@redhat.com>
Diffstat (limited to 'xlators/storage/posix/src/posix-metadata.c')
-rw-r--r--xlators/storage/posix/src/posix-metadata.c27
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 07d49da..1110435 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,