summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2018-04-02 08:31:25 -0400
committerAmar Tumballi <amarts@redhat.com>2018-05-06 07:09:08 +0530
commitf8fe0771f0b450713595a7d298ed5a758cf2ce3e (patch)
tree8066610f5d3343c5f71b52c9159a701e7450c7a3
parent9a854a98af69c1b7e06aa01dff7ea3271ebd574c (diff)
posix/ctime: posix hook to set ctime xattr in relevant fops
This patch uses the ctime posix APIs to set consistent time across replica on disk. It also stores the time attributes in the inode context. Credits: Rafi KC <rkavunga@redhat.com> Updates: #208 Change-Id: I1a8d74d1e251f1d6d142f066fc99258025c0bcdd Signed-off-by: Kotresh HR <khiremat@redhat.com>
-rw-r--r--libglusterfs/src/stack.h8
-rw-r--r--xlators/storage/posix/src/posix-entry-ops.c40
-rw-r--r--xlators/storage/posix/src/posix-helpers.c44
-rw-r--r--xlators/storage/posix/src/posix-inode-fd-ops.c55
-rw-r--r--xlators/storage/posix/src/posix-messages.h3
-rw-r--r--xlators/storage/posix/src/posix-metadata.c142
-rw-r--r--xlators/storage/posix/src/posix-metadata.h13
-rw-r--r--xlators/storage/posix/src/posix.h8
8 files changed, 279 insertions, 34 deletions
diff --git a/libglusterfs/src/stack.h b/libglusterfs/src/stack.h
index 87fbef9e3c9..18cbf39621a 100644
--- a/libglusterfs/src/stack.h
+++ b/libglusterfs/src/stack.h
@@ -134,6 +134,14 @@ struct _call_stack {
};
+/* call_stack flags field users */
+#define MDATA_CTIME (1<<0)
+#define MDATA_MTIME (1<<1)
+#define MDATA_ATIME (1<<2)
+#define MDATA_PAR_CTIME (1<<3)
+#define MDATA_PAR_MTIME (1<<4)
+#define MDATA_PAR_ATIME (1<<5)
+
#define frame_set_uid_gid(frm, u, g) \
do { \
if (frm) { \
diff --git a/xlators/storage/posix/src/posix-entry-ops.c b/xlators/storage/posix/src/posix-entry-ops.c
index d42a7f76e10..377fece5610 100644
--- a/xlators/storage/posix/src/posix-entry-ops.c
+++ b/xlators/storage/posix/src/posix-entry-ops.c
@@ -57,6 +57,7 @@
#include "posix-aio.h"
#include "glusterfs-acl.h"
#include "posix-messages.h"
+#include "posix-metadata.h"
#include "events.h"
#include "posix-gfid-path.h"
#include "compat-uuid.h"
@@ -492,6 +493,8 @@ ignore:
goto out;
}
+ posix_set_ctime (frame, this, real_path, -1, loc->inode, &stbuf);
+
op_ret = posix_pstat (this, loc->parent, loc->pargfid, par_path,
&postparent, _gf_false);
if (op_ret == -1) {
@@ -502,6 +505,9 @@ ignore:
goto out;
}
+ posix_set_parent_ctime (frame, this, par_path, -1, loc->parent,
+ &postparent);
+
op_ret = 0;
out:
@@ -808,6 +814,8 @@ posix_mkdir (call_frame_t *frame, xlator_t *this,
goto out;
}
+ posix_set_ctime (frame, this, real_path, -1, loc->inode, &stbuf);
+
op_ret = posix_pstat (this, loc->parent, loc->pargfid, par_path,
&postparent, _gf_false);
if (op_ret == -1) {
@@ -818,6 +826,9 @@ posix_mkdir (call_frame_t *frame, xlator_t *this,
goto out;
}
+ posix_set_parent_ctime (frame, this, par_path, -1, loc->parent,
+ &postparent);
+
op_ret = 0;
out:
@@ -1222,6 +1233,9 @@ posix_unlink (call_frame_t *frame, xlator_t *this,
goto out;
}
+ posix_set_parent_ctime (frame, this, par_path, -1, loc->parent,
+ &postparent);
+
unwind_dict = posix_dict_set_nlink (xdata, unwind_dict, stbuf.ia_nlink);
op_ret = 0;
out:
@@ -1355,6 +1369,9 @@ posix_rmdir (call_frame_t *frame, xlator_t *this,
goto out;
}
+ posix_set_parent_ctime (frame, this, par_path, -1, loc->parent,
+ &postparent);
+
out:
SET_TO_OLD_FS_ID ();
@@ -1432,6 +1449,8 @@ posix_symlink (call_frame_t *frame, xlator_t *this,
entry_created = _gf_true;
+ posix_set_ctime (frame, this, real_path, -1, loc->inode, &stbuf);
+
#ifndef HAVE_SET_FSID
op_ret = sys_lchown (real_path, frame->root->uid, gid);
if (op_ret == -1) {
@@ -1493,6 +1512,9 @@ ignore:
goto out;
}
+ posix_set_parent_ctime (frame, this, par_path, -1, loc->parent,
+ &postparent);
+
op_ret = 0;
out:
@@ -1778,6 +1800,8 @@ unlock:
goto out;
}
+ posix_set_ctime (frame, this, real_newpath, -1, newloc->inode, &stbuf);
+
op_ret = posix_pstat (this, oldloc->parent, oldloc->pargfid,
par_oldpath, &postoldparent, _gf_false);
if (op_ret == -1) {
@@ -1788,6 +1812,9 @@ unlock:
goto out;
}
+ posix_set_parent_ctime (frame, this, par_oldpath, -1, oldloc->parent,
+ &postoldparent);
+
op_ret = posix_pstat (this, newloc->parent, newloc->pargfid,
par_newpath, &postnewparent, _gf_false);
if (op_ret == -1) {
@@ -1798,6 +1825,9 @@ unlock:
goto out;
}
+ posix_set_parent_ctime (frame, this, par_newpath, -1, newloc->parent,
+ &postnewparent);
+
if (was_present)
unwind_dict = posix_dict_set_nlink (xdata, unwind_dict, nlink);
op_ret = 0;
@@ -1899,6 +1929,8 @@ posix_link (call_frame_t *frame, xlator_t *this,
goto out;
}
+ posix_set_ctime (frame, this, real_newpath, -1, newloc->inode, &stbuf);
+
op_ret = posix_pstat (this, newloc->parent, newloc->pargfid,
par_newpath, &postparent, _gf_false);
if (op_ret == -1) {
@@ -1908,6 +1940,9 @@ posix_link (call_frame_t *frame, xlator_t *this,
goto out;
}
+ posix_set_parent_ctime (frame, this, par_newpath, -1, newloc->parent,
+ &postparent);
+
if (priv->update_pgfid_nlinks) {
MAKE_PGFID_XATTR_KEY (pgfid_xattr_key, PGFID_XATTR_KEY_PREFIX,
newloc->pargfid);
@@ -2120,6 +2155,8 @@ fill_stat:
goto out;
}
+ posix_set_ctime (frame, this, real_path, -1, loc->inode, &stbuf);
+
op_ret = posix_pstat (this, loc->parent, loc->pargfid, par_path,
&postparent, _gf_false);
if (op_ret == -1) {
@@ -2130,6 +2167,9 @@ fill_stat:
goto out;
}
+ posix_set_parent_ctime (frame, this, par_path, -1, loc->parent,
+ &postparent);
+
op_ret = -1;
pfd = GF_CALLOC (1, sizeof (*pfd), gf_posix_mt_posix_fd);
if (!pfd) {
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
index 6a34e38cbbc..75fb045590b 100644
--- a/xlators/storage/posix/src/posix-helpers.c
+++ b/xlators/storage/posix/src/posix-helpers.c
@@ -104,6 +104,44 @@ out:
}
int
+posix_handle_mdata_xattr (call_frame_t *frame, const char *name, int *op_errno)
+{
+ int i = 0;
+ int ret = 0;
+ int pid = 1;
+ static const char * const internal_xattr[] = { GF_XATTR_MDATA_KEY,
+ NULL
+ };
+ if (frame && frame->root) {
+ pid = frame->root->pid;
+ }
+
+ if (!name || pid < GF_CLIENT_PID_MAX) {
+ /* No need to do anything here */
+ ret = 0;
+ goto out;
+ }
+
+ for (i = 0; internal_xattr[i]; i++) {
+ if (fnmatch (internal_xattr[i] , name, FNM_PERIOD) == 0) {
+ ret = -1;
+ if (op_errno) {
+ *op_errno = ENOATTR;
+ }
+
+ gf_msg_debug ("posix", ENOATTR,
+ "Ignoring the key %s as an internal "
+ "xattrs.", name);
+ goto out;
+ }
+ }
+
+ ret = 0;
+out:
+ return ret;
+}
+
+int
posix_handle_georep_xattrs (call_frame_t *frame, const char *name,
int *op_errno, gf_boolean_t is_getxattr)
{
@@ -1297,8 +1335,8 @@ out:
}
int
-posix_fhandle_pair (xlator_t *this, int fd,
- char *key, data_t *value, int flags, struct iatt *stbuf)
+posix_fhandle_pair (call_frame_t *frame, xlator_t *this, int fd, char *key,
+ data_t *value, int flags, struct iatt *stbuf, fd_t *_fd)
{
int sys_ret = -1;
int ret = 0;
@@ -1344,6 +1382,8 @@ posix_fhandle_pair (xlator_t *this, int fd,
}
goto out;
+ } else if (_fd) {
+ posix_set_ctime (frame, this, NULL, fd, _fd->inode, NULL);
}
out:
diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c
index c6145e880f4..2e5b7c5772a 100644
--- a/xlators/storage/posix/src/posix-inode-fd-ops.c
+++ b/xlators/storage/posix/src/posix-inode-fd-ops.c
@@ -57,6 +57,7 @@
#include "posix-aio.h"
#include "glusterfs-acl.h"
#include "posix-messages.h"
+#include "posix-metadata.h"
#include "events.h"
#include "posix-gfid-path.h"
#include "compat-uuid.h"
@@ -355,6 +356,8 @@ posix_setattr (call_frame_t *frame, xlator_t *this,
"failed", real_path);
goto out;
}
+ posix_update_utime_in_mdata (this, real_path, -1, loc->inode,
+ stbuf, valid);
}
if (valid & GF_SET_ATTR_CTIME) {
@@ -395,6 +398,8 @@ posix_setattr (call_frame_t *frame, xlator_t *this,
goto out;
}
+ posix_set_ctime (frame, this, real_path, -1, loc->inode, &statpost);
+
if (xdata)
xattr_rsp = posix_xattr_fill (this, real_path, loc, NULL, -1,
xdata, &statpost);
@@ -560,6 +565,8 @@ posix_fsetattr (call_frame_t *frame, xlator_t *this,
"failed fd=%p", fd);
goto out;
}
+ posix_update_utime_in_mdata (this, NULL, pfd->fd, fd->inode,
+ stbuf, valid);
}
if (!valid) {
@@ -583,6 +590,8 @@ posix_fsetattr (call_frame_t *frame, xlator_t *this,
goto out;
}
+ posix_set_ctime (frame, this, NULL, pfd->fd, fd->inode, &statpost);
+
if (xdata)
xattr_rsp = posix_xattr_fill (this, NULL, NULL, fd, pfd->fd,
xdata, &statpost);
@@ -686,6 +695,8 @@ posix_do_fallocate (call_frame_t *frame, xlator_t *this, fd_t *fd,
goto out;
}
+ posix_set_ctime (frame, this, NULL, pfd->fd, fd->inode, statpost);
+
out:
if (locked) {
pthread_mutex_unlock (&ctx->write_atomic_lock);
@@ -887,6 +898,8 @@ fsync:
goto out;
}
+ posix_set_ctime (frame, this, NULL, pfd->fd, fd->inode, statpost);
+
out:
if (locked) {
pthread_mutex_unlock (&ctx->write_atomic_lock);
@@ -1139,6 +1152,8 @@ posix_opendir (call_frame_t *frame, xlator_t *this,
P_MSG_FD_PATH_SETTING_FAILED, "failed to set the fd"
"context path=%s fd=%p", real_path, fd);
+ posix_set_ctime (frame, this, NULL, pfd->fd, fd->inode, NULL);
+
op_ret = 0;
out:
@@ -1236,6 +1251,8 @@ posix_readlink (call_frame_t *frame, xlator_t *this,
goto out;
}
+ posix_set_ctime (frame, this, real_path, -1, loc->inode, &stbuf);
+
dest[op_ret] = 0;
out:
SET_TO_OLD_FS_ID ();
@@ -1306,6 +1323,8 @@ posix_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset,
goto out;
}
+ posix_set_ctime (frame, this, real_path, -1, loc->inode, &postbuf);
+
op_ret = 0;
out:
SET_TO_OLD_FS_ID ();
@@ -1370,6 +1389,8 @@ posix_open (call_frame_t *frame, xlator_t *this,
goto out;
}
+ posix_set_ctime (frame, this, real_path, -1, loc->inode, &stbuf);
+
pfd = GF_CALLOC (1, sizeof (*pfd), gf_posix_mt_posix_fd);
if (!pfd) {
op_errno = errno;
@@ -1511,6 +1532,8 @@ posix_readv (call_frame_t *frame, xlator_t *this,
goto out;
}
+ posix_set_ctime (frame, this, NULL, pfd->fd, fd->inode, &stbuf);
+
/* Hack to notify higher layers of EOF. */
if (!stbuf.ia_size || (offset + vec.iov_len) >= stbuf.ia_size)
op_errno = ENOENT;
@@ -1808,6 +1831,8 @@ posix_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
goto out;
}
+ posix_set_ctime (frame, this, NULL, pfd->fd, fd->inode, &postop);
+
if (locked) {
pthread_mutex_unlock (&ctx->write_atomic_lock);
locked = _gf_false;
@@ -2893,6 +2918,13 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
goto out;
}
+ ret = posix_handle_mdata_xattr (frame, name, &op_errno);
+ if (ret == -1) {
+ op_ret = -1;
+ /* errno should be set from the above function*/
+ goto out;
+ }
+
if (name && posix_is_gfid2path_xattr (name)) {
op_ret = -1;
op_errno = ENOATTR;
@@ -3280,6 +3312,11 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
if (ret == -1)
goto ignore;
+ ret = posix_handle_mdata_xattr (frame, keybuffer, &op_errno);
+ if (ret == -1) {
+ goto ignore;
+ }
+
if (posix_is_gfid2path_xattr (keybuffer)) {
goto ignore;
}
@@ -3663,14 +3700,15 @@ out:
static int
_handle_fsetxattr_keyvalue_pair (dict_t *d, char *k, data_t *v,
- void *tmp)
+ void *tmp)
{
posix_xattr_filler_t *filler = NULL;
filler = tmp;
- return posix_fhandle_pair (filler->this, filler->fdnum, k, v,
- filler->flags, filler->stbuf);
+ return posix_fhandle_pair (filler->frame, filler->this, filler->fdnum,
+ k, v, filler->flags, filler->stbuf,
+ filler->fd);
}
int32_t
@@ -3720,7 +3758,9 @@ posix_fsetxattr (call_frame_t *frame, xlator_t *this,
filler.fdnum = _fd;
filler.this = this;
+ filler.frame = frame;
filler.stbuf = &stbuf;
+ filler.fd = fd;
#ifdef GF_DARWIN_HOST_OS
filler.flags = map_xattr_flags(flags);
#else
@@ -3926,6 +3966,12 @@ posix_common_removexattr (call_frame_t *frame, loc_t *loc, fd_t *fd,
}
}
+ if (loc) {
+ posix_set_ctime (frame, this, real_path, -1, inode, NULL);
+ } else {
+ posix_set_ctime (frame, this, NULL, _fd, inode, NULL);
+ }
+
if (xdata && dict_get (xdata, DHT_IATT_IN_XDATA_KEY)) {
if (loc)
ret = posix_pstat(this, inode, loc->gfid,
@@ -5287,6 +5333,9 @@ posix_rchecksum (call_frame_t *frame, xlator_t *this,
(unsigned char *)checksum);
}
op_ret = 0;
+
+ posix_set_ctime (frame, this, NULL, _fd, fd->inode, NULL);
+
out:
STACK_UNWIND_STRICT (rchecksum, frame, op_ret, op_errno,
weak_checksum, checksum, rsp_xdata);
diff --git a/xlators/storage/posix/src/posix-messages.h b/xlators/storage/posix/src/posix-messages.h
index b83a7b18809..2c23387f7e7 100644
--- a/xlators/storage/posix/src/posix-messages.h
+++ b/xlators/storage/posix/src/posix-messages.h
@@ -139,7 +139,8 @@ GLFS_MSGID(POSIX,
P_MSG_FALLOCATE_FAILED,
P_MSG_STOREMDATA_FAILED,
P_MSG_FETCHMDATA_FAILED,
- P_MSG_GETMDATA_FAILED
+ P_MSG_GETMDATA_FAILED,
+ P_MSG_SETMDATA_FAILED
);
#endif /* !_GLUSTERD_MESSAGES_H_ */
diff --git a/xlators/storage/posix/src/posix-metadata.c b/xlators/storage/posix/src/posix-metadata.c
index 57f32f9359c..90030ff28bd 100644
--- a/xlators/storage/posix/src/posix-metadata.c
+++ b/xlators/storage/posix/src/posix-metadata.c
@@ -345,10 +345,10 @@ posix_compare_timespec (struct timespec *first, struct timespec *second)
return first->tv_sec - second->tv_sec;
}
-/* posix_update_mdata_xattr updates the posix_mdata_t based on the flag
+/* posix_set_mdata_xattr updates the posix_mdata_t based on the flag
* in inode context and stores it on disk
*/
-int
+static int
posix_set_mdata_xattr (xlator_t *this, const char *real_path, int fd,
inode_t *inode, struct timespec *time,
struct iatt *stbuf, posix_mdata_flag_t *flag)
@@ -474,12 +474,12 @@ out:
/* posix_update_utime_in_mdata updates the posix_mdata_t when mtime/atime
* is modified using syscall
*/
-int
+void
posix_update_utime_in_mdata (xlator_t *this, const char *real_path, int fd,
inode_t *inode,
struct iatt *stbuf, int valid)
{
- int32_t ret = -1;
+ int32_t ret = 0;
#if defined(HAVE_UTIMENSAT)
struct timespec tv = {0, };
#else
@@ -487,26 +487,39 @@ posix_update_utime_in_mdata (xlator_t *this, const char *real_path, int fd,
#endif
posix_mdata_flag_t flag = {0, };
- if ((valid & GF_SET_ATTR_ATIME) == GF_SET_ATTR_ATIME) {
- tv.tv_sec = stbuf->ia_atime;
- SET_TIMESPEC_NSEC_OR_TIMEVAL_USEC(tv, stbuf->ia_atime_nsec);
+ if (inode && is_ctime_enabled()) {
+ if ((valid & GF_SET_ATTR_ATIME) == GF_SET_ATTR_ATIME) {
+ tv.tv_sec = stbuf->ia_atime;
+ SET_TIMESPEC_NSEC_OR_TIMEVAL_USEC(tv, stbuf->ia_atime_nsec);
- flag.ctime = 0;
- flag.mtime = 0;
- flag.atime = 1;
- }
+ flag.ctime = 0;
+ flag.mtime = 0;
+ flag.atime = 1;
+ }
- if ((valid & GF_SET_ATTR_MTIME) == GF_SET_ATTR_MTIME) {
- tv.tv_sec = stbuf->ia_mtime;
- SET_TIMESPEC_NSEC_OR_TIMEVAL_USEC(tv, stbuf->ia_mtime_nsec);
- flag.ctime = 1;
- flag.mtime = 1;
- flag.atime = 0;
- }
+ if ((valid & GF_SET_ATTR_MTIME) == GF_SET_ATTR_MTIME) {
+ tv.tv_sec = stbuf->ia_mtime;
+ SET_TIMESPEC_NSEC_OR_TIMEVAL_USEC(tv, stbuf->ia_mtime_nsec);
- ret = posix_set_mdata_xattr (this, real_path, -1, inode, &tv, NULL,
- &flag);
- return ret;
+ flag.ctime = 1;
+ flag.mtime = 1;
+ flag.atime = 0;
+ }
+
+ ret = posix_set_mdata_xattr (this, real_path, -1, inode, &tv, NULL,
+ &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));
+ }
+ } else {
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ P_MSG_SETMDATA_FAILED,
+ "posix utime set mdata failed on file");
+ }
+ return;
}
gf_boolean_t
@@ -516,3 +529,90 @@ is_ctime_enabled () {
* */
return _gf_false;
}
+
+static void
+posix_get_mdata_flag (uint64_t flags, posix_mdata_flag_t *flag)
+{
+ if (!flag)
+ return;
+
+ flag->ctime = 0;
+ flag->atime = 0;
+ flag->mtime = 0;
+
+ if (flags & MDATA_CTIME)
+ flag->ctime = 1;
+ if (flags & MDATA_MTIME)
+ flag->mtime = 1;
+ if (flags & MDATA_ATIME)
+ flag->atime = 1;
+}
+
+static void
+posix_get_parent_mdata_flag (uint64_t flags, posix_mdata_flag_t *flag)
+{
+ if (!flag)
+ return;
+
+ flag->ctime = 0;
+ flag->atime = 0;
+ flag->mtime = 0;
+
+ if (flags & MDATA_PAR_CTIME)
+ flag->ctime = 1;
+ if (flags & MDATA_PAR_MTIME)
+ flag->mtime = 1;
+ if (flags & MDATA_PAR_ATIME)
+ flag->atime = 1;
+}
+
+void
+posix_set_ctime (call_frame_t *frame, xlator_t *this, const char* real_path,
+ int fd, inode_t *inode, struct iatt *stbuf)
+{
+ posix_mdata_flag_t flag = {0,};
+ int ret = 0;
+
+ if (inode && is_ctime_enabled()) {
+ (void) posix_get_mdata_flag (frame->root->flags, &flag);
+ 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));
+ }
+ } else {
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ P_MSG_SETMDATA_FAILED,
+ "posix set mdata failed on file");
+ }
+ return;
+}
+
+void
+posix_set_parent_ctime (call_frame_t *frame, xlator_t *this,
+ const char* real_path, int fd, inode_t *inode,
+ struct iatt *stbuf)
+{
+ posix_mdata_flag_t flag = {0,};
+ int ret = 0;
+
+ if (inode && is_ctime_enabled()) {
+ (void) posix_get_parent_mdata_flag (frame->root->flags, &flag);
+ 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));
+ }
+ } else {
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ P_MSG_SETMDATA_FAILED,
+ "posix parent set mdata failed on file");
+ }
+ return;
+}
diff --git a/xlators/storage/posix/src/posix-metadata.h b/xlators/storage/posix/src/posix-metadata.h
index a6bde785abe..48744fd8186 100644
--- a/xlators/storage/posix/src/posix-metadata.h
+++ b/xlators/storage/posix/src/posix-metadata.h
@@ -38,13 +38,16 @@ posix_get_mdata_xattr (xlator_t *this, const char *real_path, int _fd,
int
__posix_get_mdata_xattr (xlator_t *this, const char *real_path, int _fd,
inode_t *inode, struct iatt *stbuf);
-int
-posix_set_mdata_xattr (xlator_t *this, const char *real_path, int fd,
- inode_t *inode, struct timespec *time,
- struct iatt *stbuf, posix_mdata_flag_t *flag);
-int
+void
posix_update_utime_in_mdata (xlator_t *this, const char *real_path, int fd,
inode_t *inode, struct iatt *stbuf, int valid);
+void
+posix_set_ctime (call_frame_t *frame, xlator_t *this, const char* real_path,
+ int fd, inode_t *inode, struct iatt *stbuf);
+void
+posix_set_parent_ctime (call_frame_t *frame, xlator_t *this,
+ const char* real_path, int fd, inode_t *inode,
+ struct iatt *stbuf);
gf_boolean_t
is_ctime_enabled();
diff --git a/xlators/storage/posix/src/posix.h b/xlators/storage/posix/src/posix.h
index 9712b675eb1..b5172a26c24 100644
--- a/xlators/storage/posix/src/posix.h
+++ b/xlators/storage/posix/src/posix.h
@@ -265,6 +265,7 @@ struct posix_private {
};
typedef struct {
+ call_frame_t *frame;
xlator_t *this;
const char *real_path;
dict_t *xattr;
@@ -337,8 +338,9 @@ dict_t *posix_xattr_fill (xlator_t *this, const char *path, loc_t *loc,
fd_t *fd, int fdnum, dict_t *xattr, struct iatt *buf);
int posix_handle_pair (xlator_t *this, const char *real_path, char *key,
data_t *value, int flags, struct iatt *stbuf);
-int posix_fhandle_pair (xlator_t *this, int fd, char *key, data_t *value,
- int flags, struct iatt *stbuf);
+int posix_fhandle_pair (call_frame_t *frame, xlator_t *this, int fd, char *key,
+ data_t *value, int flags, struct iatt *stbuf,
+ fd_t *_fd);
void posix_spawn_janitor_thread (xlator_t *this);
int posix_get_file_contents (xlator_t *this, uuid_t pargfid,
const char *name, char **contents);
@@ -368,6 +370,8 @@ posix_get_ancestry (xlator_t *this, inode_t *leaf_inode,
gf_dirent_t *head, char **path, int type, int32_t *op_errno,
dict_t *xdata);
int
+posix_handle_mdata_xattr (call_frame_t *frame, const char *name, int *op_errno);
+int
posix_handle_georep_xattrs (call_frame_t *, const char *, int *, gf_boolean_t);
int32_t
posix_resolve_dirgfid_to_path (const uuid_t dirgfid, const char *brick_path,