diff options
author | Kinglong Mee <kinglongmee@gmail.com> | 2019-08-05 11:08:02 +0800 |
---|---|---|
committer | Rinku Kothiya <rkothiya@redhat.com> | 2019-08-19 11:27:14 +0000 |
commit | 87745b612ae3a5a12fbac8162920d12b0dce0a66 (patch) | |
tree | a91c1f0062e483638b06e22b50bd294e2ad38bd3 /xlators | |
parent | 207ca452f14760a59ec1f1cf728980e7bd3a9123 (diff) | |
download | glusterfs-87745b612ae3a5a12fbac8162920d12b0dce0a66.tar.gz glusterfs-87745b612ae3a5a12fbac8162920d12b0dce0a66.tar.xz glusterfs-87745b612ae3a5a12fbac8162920d12b0dce0a66.zip |
features/utime: always update ctime at setattr
For the nfs EXCLUSIVE mode create may sets a later time
to mtime (at verifier), it should not set to ctime for
storage.ctime does not allowed set ctime to a earlier time.
/* Earlier, mdata was updated only if the existing time is less
* than the time to be updated. This would fail the scenarios
* where mtime can be set to any time using the syscall. Hence
* just updating without comparison. But the ctime is not
* allowed to changed to older date.
*/
According to kernel's setattr, always set ctime at setattr,
and doesnot set ctime from mtime at storage.ctime.
Backport of:
> Patch: https://review.gluster.org/23154
> Change-Id: I5cfde6cb7f8939da9617506e3dc80bd840e0d749
> BUG: 1737288
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Change-Id: I5cfde6cb7f8939da9617506e3dc80bd840e0d749
fixes: bz#1739437
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Diffstat (limited to 'xlators')
-rwxr-xr-x | xlators/features/utime/src/utime-gen-fops-c.py | 13 | ||||
-rw-r--r-- | xlators/storage/posix/src/posix-metadata.c | 2 |
2 files changed, 2 insertions, 13 deletions
diff --git a/xlators/features/utime/src/utime-gen-fops-c.py b/xlators/features/utime/src/utime-gen-fops-c.py index 8730a51d13..a8637ffe6f 100755 --- a/xlators/features/utime/src/utime-gen-fops-c.py +++ b/xlators/features/utime/src/utime-gen-fops-c.py @@ -82,18 +82,7 @@ gf_utime_@NAME@ (call_frame_t *frame, xlator_t *this, @LONG_ARGS@) { gl_timespec_get(&frame->root->ctime); - - if (!valid) { - frame->root->flags |= MDATA_CTIME; - } - - if (valid & (GF_SET_ATTR_UID | GF_SET_ATTR_GID)) { - frame->root->flags |= MDATA_CTIME; - } - - if (valid & GF_SET_ATTR_MODE) { - frame->root->flags |= MDATA_CTIME; - } + frame->root->flags |= MDATA_CTIME; STACK_WIND (frame, gf_utime_@NAME@_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->@NAME@, @SHORT_ARGS@); diff --git a/xlators/storage/posix/src/posix-metadata.c b/xlators/storage/posix/src/posix-metadata.c index 57791fa953..5cbdc988fb 100644 --- a/xlators/storage/posix/src/posix-metadata.c +++ b/xlators/storage/posix/src/posix-metadata.c @@ -631,7 +631,7 @@ posix_update_utime_in_mdata(xlator_t *this, const char *real_path, int fd, tv.tv_sec = stbuf->ia_mtime; SET_TIMESPEC_NSEC_OR_TIMEVAL_USEC(tv, stbuf->ia_mtime_nsec); - flag.ctime = 1; + flag.ctime = 0; flag.mtime = 1; flag.atime = 0; |