diff options
author | Kotresh HR <khiremat@redhat.com> | 2018-05-15 13:33:16 -0400 |
---|---|---|
committer | Kotresh HR <khiremat@redhat.com> | 2018-05-24 03:42:39 -0400 |
commit | 54f61abc7b1adffdf1e1cc3568e4df4d23da9a77 (patch) | |
tree | d95bf920fdf2c664ff70a7a68ff8e21ad6b19858 /xlators/storage/posix/src/posix-metadata.c | |
parent | 58ceafd9329784fbe0ab73ba97db19acceecfa1d (diff) |
ctime: Fix updating ctime in rename and unlink
1. Successful rename was not updating ctime.
Fixed the same.
2. Successful unlink when link count is more than 1
was not updating ctime. Fixed the same.
3. Copy ctime and flags during frame copy.
Backport of:
> Patch: https://review.gluster.org/20039
> BUG: 1580020
> Change-Id: Ied47275a36aea60254b2add7a59128a9c83b3645
fixes: bz#1582068
Change-Id: Ied47275a36aea60254b2add7a59128a9c83b3645
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Diffstat (limited to 'xlators/storage/posix/src/posix-metadata.c')
-rw-r--r-- | xlators/storage/posix/src/posix-metadata.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/xlators/storage/posix/src/posix-metadata.c b/xlators/storage/posix/src/posix-metadata.c index fda8fb5eaec..07d49da6b82 100644 --- a/xlators/storage/posix/src/posix-metadata.c +++ b/xlators/storage/posix/src/posix-metadata.c @@ -358,7 +358,6 @@ posix_set_mdata_xattr (xlator_t *this, const char *real_path, int fd, GF_VALIDATE_OR_GOTO ("posix", this, out); GF_VALIDATE_OR_GOTO (this->name, inode, out); - GF_VALIDATE_OR_GOTO (this->name, inode->gfid, out); LOCK (&inode->lock); { @@ -572,21 +571,28 @@ posix_set_ctime (call_frame_t *frame, xlator_t *this, const char* real_path, priv = this->private; - if (inode && priv->ctime) { + if (priv->ctime) { (void) posix_get_mdata_flag (frame->root->flags, &flag); + if (frame->root->ctime.tv_sec == 0) { + gf_msg (this->name, GF_LOG_WARNING, errno, + P_MSG_SETMDATA_FAILED, + "posix set mdata failed, No ctime : %s gfid:%s", + real_path, + inode ? uuid_utoa (inode->gfid) : "No inode"); + goto out; + } + ret = posix_set_mdata_xattr (this, real_path, fd, inode, &frame->root->ctime, stbuf, &flag); if (ret) { gf_msg (this->name, GF_LOG_WARNING, errno, P_MSG_SETMDATA_FAILED, "posix set mdata failed on file: %s gfid:%s", - real_path, uuid_utoa (inode->gfid)); + real_path, + inode ? uuid_utoa (inode->gfid) : "No inode"); } - } else { - gf_msg (this->name, GF_LOG_WARNING, errno, - P_MSG_SETMDATA_FAILED, - "posix set mdata failed on file"); } + out: return; } |