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