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