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