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