From b2c6983d0c9eb980024743d8f9825bb4dcd44b6a Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Fri, 19 Apr 2019 11:34:37 +0530 Subject: ctime: Fix log repeated logging during open The log "posix set mdata failed, No ctime" logged repeatedly after the fix [1]. Those could be internal fops. This patch fixes the same. [1] https://review.gluster.org/22540 Backport of: > Patch: https://review.gluster.org/#/c/glusterfs/+/22591/ > BUG:1701457 > Change-Id: I42799a90b976982cedb0ca11fa224d555eb05650 > Signed-off-by: Kotresh HR (cherry picked from commit 2d39572821306496c96797f4d122f8200aae4585) fixes: bz#1702734 Change-Id: I42799a90b976982cedb0ca11fa224d555eb05650 Signed-off-by: Kotresh HR --- xlators/storage/posix/src/posix-metadata.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'xlators/storage/posix') diff --git a/xlators/storage/posix/src/posix-metadata.c b/xlators/storage/posix/src/posix-metadata.c index 7ff522519d8..e96f222cff4 100644 --- a/xlators/storage/posix/src/posix-metadata.c +++ b/xlators/storage/posix/src/posix-metadata.c @@ -429,11 +429,6 @@ posix_set_mdata_xattr(xlator_t *this, const char *real_path, int fd, } } - if ((flag->ctime == 0) && (flag->mtime == 0) && (flag->atime == 0)) { - ret = 0; - goto unlock; - } - /* Earlier, mdata was updated only if the existing time is less * than the time to be updated. This would fail the scenarios * where mtime can be set to any time using the syscall. Hence @@ -621,13 +616,9 @@ posix_set_ctime(call_frame_t *frame, xlator_t *this, const char *real_path, if (priv->ctime) { (void)posix_get_mdata_flag(frame->root->flags, &flag); - if (frame->root->ctime.tv_sec == 0) { - gf_msg(this->name, GF_LOG_WARNING, errno, P_MSG_SETMDATA_FAILED, - "posix set mdata failed, No ctime : %s gfid:%s", real_path, - inode ? uuid_utoa(inode->gfid) : "No inode"); + if ((flag.ctime == 0) && (flag.mtime == 0) && (flag.atime == 0)) { goto out; } - ret = posix_set_mdata_xattr(this, real_path, fd, inode, &frame->root->ctime, stbuf, &flag, _gf_false); @@ -656,6 +647,9 @@ posix_set_parent_ctime(call_frame_t *frame, xlator_t *this, if (inode && priv->ctime) { (void)posix_get_parent_mdata_flag(frame->root->flags, &flag); + if ((flag.ctime == 0) && (flag.mtime == 0) && (flag.atime == 0)) { + goto out; + } ret = posix_set_mdata_xattr(this, real_path, fd, inode, &frame->root->ctime, stbuf, &flag, _gf_false); @@ -665,6 +659,7 @@ posix_set_parent_ctime(call_frame_t *frame, xlator_t *this, uuid_utoa(inode->gfid)); } } +out: return; } -- cgit