74b1de
From 7f5658a299081cec4c77d3cca4e70099cd59b1fc Mon Sep 17 00:00:00 2001
74b1de
From: Kinglong Mee <kinglongmee@gmail.com>
74b1de
Date: Mon, 5 Aug 2019 11:08:02 +0800
74b1de
Subject: [PATCH 276/276] features/utime: always update ctime at setattr
74b1de
74b1de
For the nfs EXCLUSIVE mode create may sets a later time
74b1de
to mtime (at verifier), it should not set to ctime for
74b1de
storage.ctime does not allowed set ctime to a earlier time.
74b1de
74b1de
 /* Earlier, mdata was updated only if the existing time is less
74b1de
  * than the time to be updated. This would fail the scenarios
74b1de
  * where mtime can be set to any time using the syscall. Hence
74b1de
  * just updating without comparison. But the ctime is not
74b1de
  * allowed to changed to older date.
74b1de
  */
74b1de
74b1de
According to kernel's setattr, always set ctime at setattr,
74b1de
and doesnot set ctime from mtime at storage.ctime.
74b1de
74b1de
>Change-Id: I5cfde6cb7f8939da9617506e3dc80bd840e0d749
74b1de
>fixes: bz#1737288
74b1de
>Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
74b1de
Upstream Patch: https://review.gluster.org/#/c/glusterfs/+/23154/
74b1de
74b1de
BUG: 1737705
74b1de
Change-Id: I5cfde6cb7f8939da9617506e3dc80bd840e0d749
74b1de
Signed-off-by: Sunil Kumar Acharya <sheggodu@redhat.com>
74b1de
Reviewed-on: https://code.engineering.redhat.com/gerrit/178225
74b1de
Tested-by: RHGS Build Bot <nigelb@redhat.com>
74b1de
---
74b1de
 xlators/features/utime/src/utime-gen-fops-c.py | 13 +------------
74b1de
 xlators/storage/posix/src/posix-metadata.c     |  2 +-
74b1de
 2 files changed, 2 insertions(+), 13 deletions(-)
74b1de
74b1de
diff --git a/xlators/features/utime/src/utime-gen-fops-c.py b/xlators/features/utime/src/utime-gen-fops-c.py
74b1de
index 8730a51..a8637ff 100755
74b1de
--- a/xlators/features/utime/src/utime-gen-fops-c.py
74b1de
+++ b/xlators/features/utime/src/utime-gen-fops-c.py
74b1de
@@ -82,18 +82,7 @@ gf_utime_@NAME@ (call_frame_t *frame, xlator_t *this,
74b1de
              @LONG_ARGS@)
74b1de
 {
74b1de
         gl_timespec_get(&frame->root->ctime);
74b1de
-
74b1de
-        if (!valid) {
74b1de
-                frame->root->flags |= MDATA_CTIME;
74b1de
-        }
74b1de
-
74b1de
-        if (valid & (GF_SET_ATTR_UID | GF_SET_ATTR_GID)) {
74b1de
-                frame->root->flags |= MDATA_CTIME;
74b1de
-        }
74b1de
-
74b1de
-        if (valid & GF_SET_ATTR_MODE) {
74b1de
-                frame->root->flags |= MDATA_CTIME;
74b1de
-        }
74b1de
+        frame->root->flags |= MDATA_CTIME;
74b1de
 
74b1de
         STACK_WIND (frame, gf_utime_@NAME@_cbk, FIRST_CHILD(this),
74b1de
                     FIRST_CHILD(this)->fops->@NAME@, @SHORT_ARGS@);
74b1de
diff --git a/xlators/storage/posix/src/posix-metadata.c b/xlators/storage/posix/src/posix-metadata.c
74b1de
index 57791fa..5cbdc98 100644
74b1de
--- a/xlators/storage/posix/src/posix-metadata.c
74b1de
+++ b/xlators/storage/posix/src/posix-metadata.c
74b1de
@@ -631,7 +631,7 @@ posix_update_utime_in_mdata(xlator_t *this, const char *real_path, int fd,
74b1de
             tv.tv_sec = stbuf->ia_mtime;
74b1de
             SET_TIMESPEC_NSEC_OR_TIMEVAL_USEC(tv, stbuf->ia_mtime_nsec);
74b1de
 
74b1de
-            flag.ctime = 1;
74b1de
+            flag.ctime = 0;
74b1de
             flag.mtime = 1;
74b1de
             flag.atime = 0;
74b1de
 
74b1de
-- 
74b1de
1.8.3.1
74b1de