"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xlators/performance/md-cache/src/md-cache.c" between
glusterfs-7.5.tar.gz and glusterfs-7.6.tar.gz

About: GlusterFS is a network/cluster filesystem. The storage server (or each in a cluster) runs glusterfsd and the clients use mount command or glusterfs client to mount the exported filesystem. Release series 7.x (latest version).

md-cache.c  (glusterfs-7.5):md-cache.c  (glusterfs-7.6)
skipping to change at line 135 skipping to change at line 135
}; };
struct mdc_local { struct mdc_local {
loc_t loc; loc_t loc;
loc_t loc2; loc_t loc2;
fd_t *fd; fd_t *fd;
char *linkname; char *linkname;
char *key; char *key;
dict_t *xattr; dict_t *xattr;
uint64_t incident_time; uint64_t incident_time;
bool update_cache;
}; };
int int
__mdc_inode_ctx_get(xlator_t *this, inode_t *inode, struct md_cache **mdc_p) __mdc_inode_ctx_get(xlator_t *this, inode_t *inode, struct md_cache **mdc_p)
{ {
int ret = 0; int ret = 0;
struct md_cache *mdc = NULL; struct md_cache *mdc = NULL;
uint64_t mdc_int = 0; uint64_t mdc_int = 0;
ret = __inode_ctx_get(inode, this, &mdc_int); ret = __inode_ctx_get(inode, this, &mdc_int);
skipping to change at line 988 skipping to change at line 989
if (!inode) { if (!inode) {
ret = -1; ret = -1;
goto out; goto out;
} }
ret = mdc_inode_iatt_set_validate(this, inode, NULL, iatt, _gf_true, ret = mdc_inode_iatt_set_validate(this, inode, NULL, iatt, _gf_true,
mdc_inc_generation(this, inode)); mdc_inc_generation(this, inode));
out: out:
return ret; return ret;
} }
void static bool
mdc_load_reqs(xlator_t *this, dict_t *dict) mdc_load_reqs(xlator_t *this, dict_t *dict)
{ {
struct mdc_conf *conf = this->private; struct mdc_conf *conf = this->private;
char *pattern = NULL; char *pattern = NULL;
char *mdc_xattr_str = NULL; char *mdc_xattr_str = NULL;
char *tmp = NULL; char *tmp = NULL;
char *tmp1 = NULL; char *tmp1 = NULL;
int ret = 0; int ret = 0;
bool loaded = false;
tmp1 = conf->mdc_xattr_str; tmp1 = conf->mdc_xattr_str;
if (!tmp1) if (!tmp1)
goto out; goto out;
mdc_xattr_str = gf_strdup(tmp1); mdc_xattr_str = gf_strdup(tmp1);
if (!mdc_xattr_str) if (!mdc_xattr_str)
goto out; goto out;
pattern = strtok_r(mdc_xattr_str, ",", &tmp); pattern = strtok_r(mdc_xattr_str, ",", &tmp);
while (pattern) { while (pattern) {
gf_strTrim(&pattern); gf_strTrim(&pattern);
ret = dict_set_int8(dict, pattern, 0); ret = dict_set_int8(dict, pattern, 0);
if (ret) { if (ret) {
conf->mdc_xattr_str = NULL; conf->mdc_xattr_str = NULL;
gf_msg("md-cache", GF_LOG_ERROR, 0, MD_CACHE_MSG_NO_XATTR_CACHE, gf_msg("md-cache", GF_LOG_ERROR, 0, MD_CACHE_MSG_NO_XATTR_CACHE,
"Disabled cache for xattrs, dict_set failed"); "Disabled cache for xattrs, dict_set failed");
goto out;
} }
pattern = strtok_r(NULL, ",", &tmp); pattern = strtok_r(NULL, ",", &tmp);
} }
GF_FREE(mdc_xattr_str); loaded = true;
out: out:
return; GF_FREE(mdc_xattr_str);
return loaded;
} }
struct checkpair { struct checkpair {
int ret; int ret;
dict_t *rsp; dict_t *rsp;
}; };
static int static int
checkfn(dict_t *this, char *key, data_t *value, void *data) checkfn(dict_t *this, char *key, data_t *value, void *data)
{ {
skipping to change at line 1110 skipping to change at line 1116
} }
*buf = &conf->statfs_cache.buf; *buf = &conf->statfs_cache.buf;
} }
unlock: unlock:
pthread_mutex_unlock(&conf->statfs_cache.lock); pthread_mutex_unlock(&conf->statfs_cache.lock);
err: err:
return ret; return ret;
} }
static dict_t *
mdc_prepare_request(xlator_t *this, mdc_local_t *local, dict_t *xdata)
{
if (xdata != NULL) {
dict_ref(xdata);
}
if (local == NULL) {
return xdata;
}
if (xdata == NULL) {
xdata = dict_new();
if (xdata == NULL) {
local->update_cache = false;
return NULL;
}
}
local->update_cache = mdc_load_reqs(this, xdata);
return xdata;
}
int int
mdc_statfs_cbk(call_frame_t *frame, void *cookie, xlator_t *this, mdc_statfs_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct statvfs *buf, int32_t op_ret, int32_t op_errno, struct statvfs *buf,
dict_t *xdata) dict_t *xdata)
{ {
struct mdc_conf *conf = this->private; struct mdc_conf *conf = this->private;
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
local = frame->local; local = frame->local;
if (!local) if (!local)
skipping to change at line 1192 skipping to change at line 1223
int int
mdc_lookup_cbk(call_frame_t *frame, void *cookie, xlator_t *this, mdc_lookup_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, inode_t *inode, int32_t op_ret, int32_t op_errno, inode_t *inode,
struct iatt *stbuf, dict_t *dict, struct iatt *postparent) struct iatt *stbuf, dict_t *dict, struct iatt *postparent)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
struct mdc_conf *conf = this->private; struct mdc_conf *conf = this->private;
local = frame->local; local = frame->local;
if (!local)
goto out;
if (op_ret != 0) { if (op_ret != 0) {
if (op_errno == ENOENT) if (op_errno == ENOENT)
GF_ATOMIC_INC(conf->mdc_counter.negative_lookup); GF_ATOMIC_INC(conf->mdc_counter.negative_lookup);
if (op_errno == ESTALE) { if (op_errno == ESTALE) {
/* if op_errno is ENOENT, fuse-bridge will unlink the /* if op_errno is ENOENT, fuse-bridge will unlink the
* dentry * dentry
*/ */
if (local->loc.parent) if (local->loc.parent)
mdc_inode_iatt_invalidate(this, local->loc.parent); mdc_inode_iatt_invalidate(this, local->loc.parent);
else else
mdc_inode_iatt_invalidate(this, local->loc.inode); mdc_inode_iatt_invalidate(this, local->loc.inode);
} }
goto out; goto out;
} }
if (!local)
goto out;
if (local->loc.parent) { if (local->loc.parent) {
mdc_inode_iatt_set(this, local->loc.parent, postparent, mdc_inode_iatt_set(this, local->loc.parent, postparent,
local->incident_time); local->incident_time);
} }
if (local->loc.inode) { if (local->loc.inode) {
mdc_inode_iatt_set(this, local->loc.inode, stbuf, local->incident_time); mdc_inode_iatt_set(this, local->loc.inode, stbuf, local->incident_time);
mdc_inode_xatt_set(this, local->loc.inode, dict); if (local->update_cache) {
mdc_inode_xatt_set(this, local->loc.inode, dict);
}
} }
out: out:
MDC_STACK_UNWIND(lookup, frame, op_ret, op_errno, inode, stbuf, dict, MDC_STACK_UNWIND(lookup, frame, op_ret, op_errno, inode, stbuf, dict,
postparent); postparent);
return 0; return 0;
} }
int int
mdc_lookup(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) mdc_lookup(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
{ {
int ret = 0; int ret = 0;
struct iatt stbuf = { struct iatt stbuf = {
0, 0,
}; };
struct iatt postparent = { struct iatt postparent = {
0, 0,
}; };
dict_t *xattr_rsp = NULL; dict_t *xattr_rsp = NULL;
dict_t *xattr_alloc = NULL;
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
struct mdc_conf *conf = this->private; struct mdc_conf *conf = this->private;
local = mdc_local_get(frame, loc->inode); local = mdc_local_get(frame, loc->inode);
if (!local) { if (!local) {
GF_ATOMIC_INC(conf->mdc_counter.stat_miss); GF_ATOMIC_INC(conf->mdc_counter.stat_miss);
goto uncached; goto uncached;
} }
loc_copy(&local->loc, loc); loc_copy(&local->loc, loc);
skipping to change at line 1289 skipping to change at line 1321
GF_ATOMIC_INC(conf->mdc_counter.stat_hit); GF_ATOMIC_INC(conf->mdc_counter.stat_hit);
MDC_STACK_UNWIND(lookup, frame, 0, 0, loc->inode, &stbuf, xattr_rsp, MDC_STACK_UNWIND(lookup, frame, 0, 0, loc->inode, &stbuf, xattr_rsp,
&postparent); &postparent);
if (xattr_rsp) if (xattr_rsp)
dict_unref(xattr_rsp); dict_unref(xattr_rsp);
return 0; return 0;
uncached: uncached:
if (!xdata) xdata = mdc_prepare_request(this, local, xdata);
xdata = xattr_alloc = dict_new();
if (xdata)
mdc_load_reqs(this, xdata);
STACK_WIND(frame, mdc_lookup_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_lookup_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->lookup, loc, xdata); FIRST_CHILD(this)->fops->lookup, loc, xdata);
if (xattr_rsp) if (xattr_rsp)
dict_unref(xattr_rsp); dict_unref(xattr_rsp);
if (xattr_alloc)
dict_unref(xattr_alloc); if (xdata != NULL) {
dict_unref(xdata);
}
return 0; return 0;
} }
int int
mdc_stat_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, mdc_stat_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, struct iatt *buf, dict_t *xdata) int32_t op_errno, struct iatt *buf, dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
local = frame->local; local = frame->local;
skipping to change at line 1323 skipping to change at line 1355
if (op_ret != 0) { if (op_ret != 0) {
if ((op_errno == ESTALE) || (op_errno == ENOENT)) { if ((op_errno == ESTALE) || (op_errno == ENOENT)) {
mdc_inode_iatt_invalidate(this, local->loc.inode); mdc_inode_iatt_invalidate(this, local->loc.inode);
} }
goto out; goto out;
} }
mdc_inode_iatt_set(this, local->loc.inode, buf, local->incident_time); mdc_inode_iatt_set(this, local->loc.inode, buf, local->incident_time);
mdc_inode_xatt_set(this, local->loc.inode, xdata); if (local->update_cache) {
mdc_inode_xatt_set(this, local->loc.inode, xdata);
}
out: out:
MDC_STACK_UNWIND(stat, frame, op_ret, op_errno, buf, xdata); MDC_STACK_UNWIND(stat, frame, op_ret, op_errno, buf, xdata);
return 0; return 0;
} }
int int
mdc_stat(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) mdc_stat(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
{ {
int ret; int ret;
struct iatt stbuf; struct iatt stbuf;
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
dict_t *xattr_alloc = NULL;
struct mdc_conf *conf = this->private; struct mdc_conf *conf = this->private;
local = mdc_local_get(frame, loc->inode); local = mdc_local_get(frame, loc->inode);
if (!local) if (!local)
goto uncached; goto uncached;
loc_copy(&local->loc, loc); loc_copy(&local->loc, loc);
if (!inode_is_linked(loc->inode)) { if (!inode_is_linked(loc->inode)) {
GF_ATOMIC_INC(conf->mdc_counter.stat_miss); GF_ATOMIC_INC(conf->mdc_counter.stat_miss);
skipping to change at line 1361 skipping to change at line 1394
ret = mdc_inode_iatt_get(this, loc->inode, &stbuf); ret = mdc_inode_iatt_get(this, loc->inode, &stbuf);
if (ret != 0) if (ret != 0)
goto uncached; goto uncached;
GF_ATOMIC_INC(conf->mdc_counter.stat_hit); GF_ATOMIC_INC(conf->mdc_counter.stat_hit);
MDC_STACK_UNWIND(stat, frame, 0, 0, &stbuf, xdata); MDC_STACK_UNWIND(stat, frame, 0, 0, &stbuf, xdata);
return 0; return 0;
uncached: uncached:
if (!xdata) xdata = mdc_prepare_request(this, local, xdata);
xdata = xattr_alloc = dict_new();
if (xdata)
mdc_load_reqs(this, xdata);
GF_ATOMIC_INC(conf->mdc_counter.stat_miss); GF_ATOMIC_INC(conf->mdc_counter.stat_miss);
STACK_WIND(frame, mdc_stat_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_stat_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->stat, loc, xdata); FIRST_CHILD(this)->fops->stat, loc, xdata);
if (xattr_alloc) if (xdata != NULL) {
dict_unref(xattr_alloc); dict_unref(xdata);
}
return 0; return 0;
} }
int int
mdc_fstat_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, mdc_fstat_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, struct iatt *buf, dict_t *xdata) int32_t op_errno, struct iatt *buf, dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
local = frame->local; local = frame->local;
skipping to change at line 1394 skipping to change at line 1426
if (op_ret != 0) { if (op_ret != 0) {
if ((op_errno == ENOENT) || (op_errno == ESTALE)) { if ((op_errno == ENOENT) || (op_errno == ESTALE)) {
mdc_inode_iatt_invalidate(this, local->fd->inode); mdc_inode_iatt_invalidate(this, local->fd->inode);
} }
goto out; goto out;
} }
mdc_inode_iatt_set(this, local->fd->inode, buf, local->incident_time); mdc_inode_iatt_set(this, local->fd->inode, buf, local->incident_time);
mdc_inode_xatt_set(this, local->fd->inode, xdata); if (local->update_cache) {
mdc_inode_xatt_set(this, local->fd->inode, xdata);
}
out: out:
MDC_STACK_UNWIND(fstat, frame, op_ret, op_errno, buf, xdata); MDC_STACK_UNWIND(fstat, frame, op_ret, op_errno, buf, xdata);
return 0; return 0;
} }
int int
mdc_fstat(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) mdc_fstat(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
{ {
int ret; int ret;
struct iatt stbuf; struct iatt stbuf;
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
dict_t *xattr_alloc = NULL;
struct mdc_conf *conf = this->private; struct mdc_conf *conf = this->private;
local = mdc_local_get(frame, fd->inode); local = mdc_local_get(frame, fd->inode);
if (!local) if (!local)
goto uncached; goto uncached;
local->fd = fd_ref(fd); local->fd = __fd_ref(fd);
ret = mdc_inode_iatt_get(this, fd->inode, &stbuf); ret = mdc_inode_iatt_get(this, fd->inode, &stbuf);
if (ret != 0) if (ret != 0)
goto uncached; goto uncached;
GF_ATOMIC_INC(conf->mdc_counter.stat_hit); GF_ATOMIC_INC(conf->mdc_counter.stat_hit);
MDC_STACK_UNWIND(fstat, frame, 0, 0, &stbuf, xdata); MDC_STACK_UNWIND(fstat, frame, 0, 0, &stbuf, xdata);
return 0; return 0;
uncached: uncached:
if (!xdata) xdata = mdc_prepare_request(this, local, xdata);
xdata = xattr_alloc = dict_new();
if (xdata)
mdc_load_reqs(this, xdata);
GF_ATOMIC_INC(conf->mdc_counter.stat_miss); GF_ATOMIC_INC(conf->mdc_counter.stat_miss);
STACK_WIND(frame, mdc_fstat_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_fstat_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fstat, fd, xdata); FIRST_CHILD(this)->fops->fstat, fd, xdata);
if (xattr_alloc) if (xdata != NULL) {
dict_unref(xattr_alloc); dict_unref(xdata);
}
return 0; return 0;
} }
int int
mdc_truncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this, mdc_truncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf, int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata) struct iatt *postbuf, dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
skipping to change at line 1476 skipping to change at line 1508
return 0; return 0;
} }
int int
mdc_truncate(call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset, mdc_truncate(call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset,
dict_t *xdata) dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
local = mdc_local_get(frame, loc->inode); local = mdc_local_get(frame, loc->inode);
if (local != NULL) {
local->loc.inode = inode_ref(loc->inode); local->loc.inode = inode_ref(loc->inode);
}
STACK_WIND(frame, mdc_truncate_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_truncate_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->truncate, loc, offset, xdata); FIRST_CHILD(this)->fops->truncate, loc, offset, xdata);
return 0; return 0;
} }
int int
mdc_ftruncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this, mdc_ftruncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf, int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata) struct iatt *postbuf, dict_t *xdata)
skipping to change at line 1520 skipping to change at line 1553
return 0; return 0;
} }
int int
mdc_ftruncate(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, mdc_ftruncate(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
dict_t *xdata) dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
local = mdc_local_get(frame, fd->inode); local = mdc_local_get(frame, fd->inode);
if (local != NULL) {
local->fd = fd_ref(fd); local->fd = __fd_ref(fd);
}
STACK_WIND(frame, mdc_ftruncate_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_ftruncate_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->ftruncate, fd, offset, xdata); FIRST_CHILD(this)->fops->ftruncate, fd, offset, xdata);
return 0; return 0;
} }
int int
mdc_mknod_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, mdc_mknod_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, inode_t *inode, struct iatt *buf, int32_t op_errno, inode_t *inode, struct iatt *buf,
struct iatt *preparent, struct iatt *postparent, dict_t *xdata) struct iatt *preparent, struct iatt *postparent, dict_t *xdata)
skipping to change at line 1569 skipping to change at line 1603
return 0; return 0;
} }
int int
mdc_mknod(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, mdc_mknod(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
dev_t rdev, mode_t umask, dict_t *xdata) dev_t rdev, mode_t umask, dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
local = mdc_local_get(frame, loc->inode); local = mdc_local_get(frame, loc->inode);
if (local != NULL) {
loc_copy(&local->loc, loc); loc_copy(&local->loc, loc);
local->xattr = dict_ref(xdata); local->xattr = dict_ref(xdata);
}
STACK_WIND(frame, mdc_mknod_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_mknod_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->mknod, loc, mode, rdev, umask, xdata); FIRST_CHILD(this)->fops->mknod, loc, mode, rdev, umask, xdata);
return 0; return 0;
} }
int int
mdc_mkdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, mdc_mkdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, inode_t *inode, struct iatt *buf, int32_t op_errno, inode_t *inode, struct iatt *buf,
struct iatt *preparent, struct iatt *postparent, dict_t *xdata) struct iatt *preparent, struct iatt *postparent, dict_t *xdata)
skipping to change at line 1619 skipping to change at line 1654
return 0; return 0;
} }
int int
mdc_mkdir(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, mdc_mkdir(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
mode_t umask, dict_t *xdata) mode_t umask, dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
local = mdc_local_get(frame, loc->inode); local = mdc_local_get(frame, loc->inode);
if (local != NULL) {
loc_copy(&local->loc, loc); loc_copy(&local->loc, loc);
local->xattr = dict_ref(xdata); local->xattr = dict_ref(xdata);
}
STACK_WIND(frame, mdc_mkdir_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_mkdir_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->mkdir, loc, mode, umask, xdata); FIRST_CHILD(this)->fops->mkdir, loc, mode, umask, xdata);
return 0; return 0;
} }
int int
mdc_unlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this, mdc_unlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *preparent, int32_t op_ret, int32_t op_errno, struct iatt *preparent,
struct iatt *postparent, dict_t *xdata) struct iatt *postparent, dict_t *xdata)
skipping to change at line 1678 skipping to change at line 1714
return 0; return 0;
} }
int int
mdc_unlink(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t xflag, mdc_unlink(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t xflag,
dict_t *xdata) dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
local = mdc_local_get(frame, loc->inode); local = mdc_local_get(frame, loc->inode);
if (local != NULL) {
loc_copy(&local->loc, loc); loc_copy(&local->loc, loc);
}
STACK_WIND(frame, mdc_unlink_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_unlink_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->unlink, loc, xflag, xdata); FIRST_CHILD(this)->fops->unlink, loc, xflag, xdata);
return 0; return 0;
} }
int int
mdc_rmdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, mdc_rmdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, struct iatt *preparent, struct iatt *postparent, int32_t op_errno, struct iatt *preparent, struct iatt *postparent,
dict_t *xdata) dict_t *xdata)
skipping to change at line 1732 skipping to change at line 1769
return 0; return 0;
} }
int int
mdc_rmdir(call_frame_t *frame, xlator_t *this, loc_t *loc, int flag, mdc_rmdir(call_frame_t *frame, xlator_t *this, loc_t *loc, int flag,
dict_t *xdata) dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
local = mdc_local_get(frame, loc->inode); local = mdc_local_get(frame, loc->inode);
if (local != NULL) {
loc_copy(&local->loc, loc); loc_copy(&local->loc, loc);
}
STACK_WIND(frame, mdc_rmdir_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_rmdir_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->rmdir, loc, flag, xdata); FIRST_CHILD(this)->fops->rmdir, loc, flag, xdata);
return 0; return 0;
} }
int int
mdc_symlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this, mdc_symlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, inode_t *inode, int32_t op_ret, int32_t op_errno, inode_t *inode,
struct iatt *buf, struct iatt *preparent, struct iatt *buf, struct iatt *preparent,
skipping to change at line 1780 skipping to change at line 1818
MDC_STACK_UNWIND(symlink, frame, op_ret, op_errno, inode, buf, preparent, MDC_STACK_UNWIND(symlink, frame, op_ret, op_errno, inode, buf, preparent,
postparent, xdata); postparent, xdata);
return 0; return 0;
} }
int int
mdc_symlink(call_frame_t *frame, xlator_t *this, const char *linkname, mdc_symlink(call_frame_t *frame, xlator_t *this, const char *linkname,
loc_t *loc, mode_t umask, dict_t *xdata) loc_t *loc, mode_t umask, dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
char *name;
name = gf_strdup(linkname);
if (name == NULL) {
goto wind;
}
local = mdc_local_get(frame, loc->inode); local = mdc_local_get(frame, loc->inode);
if (local == NULL) {
GF_FREE(name);
goto wind;
}
loc_copy(&local->loc, loc); loc_copy(&local->loc, loc);
local->linkname = name;
local->linkname = gf_strdup(linkname); wind:
STACK_WIND(frame, mdc_symlink_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_symlink_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->symlink, linkname, loc, umask, xdata); FIRST_CHILD(this)->fops->symlink, linkname, loc, umask, xdata);
return 0; return 0;
} }
int int
mdc_rename_cbk(call_frame_t *frame, void *cookie, xlator_t *this, mdc_rename_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *buf, int32_t op_ret, int32_t op_errno, struct iatt *buf,
struct iatt *preoldparent, struct iatt *postoldparent, struct iatt *preoldparent, struct iatt *postoldparent,
struct iatt *prenewparent, struct iatt *postnewparent, struct iatt *prenewparent, struct iatt *postnewparent,
skipping to change at line 1844 skipping to change at line 1891
return 0; return 0;
} }
int int
mdc_rename(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, mdc_rename(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
dict_t *xdata) dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
local = mdc_local_get(frame, oldloc->inode); local = mdc_local_get(frame, oldloc->inode);
if (local != NULL) {
loc_copy(&local->loc, oldloc); loc_copy(&local->loc, oldloc);
loc_copy(&local->loc2, newloc); loc_copy(&local->loc2, newloc);
}
STACK_WIND(frame, mdc_rename_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_rename_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->rename, oldloc, newloc, xdata); FIRST_CHILD(this)->fops->rename, oldloc, newloc, xdata);
return 0; return 0;
} }
int int
mdc_link_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, mdc_link_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, inode_t *inode, struct iatt *buf, int32_t op_errno, inode_t *inode, struct iatt *buf,
struct iatt *preparent, struct iatt *postparent, dict_t *xdata) struct iatt *preparent, struct iatt *postparent, dict_t *xdata)
skipping to change at line 1895 skipping to change at line 1943
return 0; return 0;
} }
int int
mdc_link(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, mdc_link(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
dict_t *xdata) dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
local = mdc_local_get(frame, oldloc->inode); local = mdc_local_get(frame, oldloc->inode);
if (local != NULL) {
loc_copy(&local->loc, oldloc); loc_copy(&local->loc, oldloc);
loc_copy(&local->loc2, newloc); loc_copy(&local->loc2, newloc);
}
STACK_WIND(frame, mdc_link_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_link_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->link, oldloc, newloc, xdata); FIRST_CHILD(this)->fops->link, oldloc, newloc, xdata);
return 0; return 0;
} }
int int
mdc_create_cbk(call_frame_t *frame, void *cookie, xlator_t *this, mdc_create_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode, int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode,
struct iatt *buf, struct iatt *preparent, struct iatt *buf, struct iatt *preparent,
skipping to change at line 1946 skipping to change at line 1995
return 0; return 0;
} }
int int
mdc_create(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, mdc_create(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
mode_t mode, mode_t umask, fd_t *fd, dict_t *xdata) mode_t mode, mode_t umask, fd_t *fd, dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
local = mdc_local_get(frame, loc->inode); local = mdc_local_get(frame, loc->inode);
if (local != NULL) {
loc_copy(&local->loc, loc); loc_copy(&local->loc, loc);
local->xattr = dict_ref(xdata); local->xattr = dict_ref(xdata);
}
STACK_WIND(frame, mdc_create_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_create_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->create, loc, flags, mode, umask, fd, FIRST_CHILD(this)->fops->create, loc, flags, mode, umask, fd,
xdata); xdata);
return 0; return 0;
} }
static int static int
mdc_open_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, mdc_open_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, fd_t *fd, dict_t *xdata) int32_t op_errno, fd_t *fd, dict_t *xdata)
skipping to change at line 1995 skipping to change at line 2045
mdc_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, fd_t *fd, mdc_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, fd_t *fd,
dict_t *xdata) dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
if (!fd || !IA_ISREG(fd->inode->ia_type) || !(fd->flags & O_TRUNC)) { if (!fd || !IA_ISREG(fd->inode->ia_type) || !(fd->flags & O_TRUNC)) {
goto out; goto out;
} }
local = mdc_local_get(frame, loc->inode); local = mdc_local_get(frame, loc->inode);
if (local != NULL) {
local->fd = fd_ref(fd); local->fd = __fd_ref(fd);
}
out: out:
STACK_WIND(frame, mdc_open_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_open_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->open, loc, flags, fd, xdata); FIRST_CHILD(this)->fops->open, loc, flags, fd, xdata);
return 0; return 0;
} }
int int
mdc_readv_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, mdc_readv_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
int32_t op_errno, struct iovec *vector, int32_t count, int32_t op_errno, struct iovec *vector, int32_t count,
skipping to change at line 2037 skipping to change at line 2088
return 0; return 0;
} }
int int
mdc_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, mdc_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
off_t offset, uint32_t flags, dict_t *xdata) off_t offset, uint32_t flags, dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
local = mdc_local_get(frame, fd->inode); local = mdc_local_get(frame, fd->inode);
if (local != NULL) {
local->fd = fd_ref(fd); local->fd = __fd_ref(fd);
}
STACK_WIND(frame, mdc_readv_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_readv_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->readv, fd, size, offset, flags, xdata); FIRST_CHILD(this)->fops->readv, fd, size, offset, flags, xdata);
return 0; return 0;
} }
int int
mdc_writev_cbk(call_frame_t *frame, void *cookie, xlator_t *this, mdc_writev_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf, int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata) struct iatt *postbuf, dict_t *xdata)
skipping to change at line 2079 skipping to change at line 2131
} }
int int
mdc_writev(call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector, mdc_writev(call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector,
int count, off_t offset, uint32_t flags, struct iobref *iobref, int count, off_t offset, uint32_t flags, struct iobref *iobref,
dict_t *xdata) dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
local = mdc_local_get(frame, fd->inode); local = mdc_local_get(frame, fd->inode);
if (local != NULL) {
local->fd = fd_ref(fd); local->fd = __fd_ref(fd);
}
STACK_WIND(frame, mdc_writev_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_writev_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->writev, fd, vector, count, offset, FIRST_CHILD(this)->fops->writev, fd, vector, count, offset,
flags, iobref, xdata); flags, iobref, xdata);
return 0; return 0;
} }
int int
mdc_setattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this, mdc_setattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf, int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata) struct iatt *postbuf, dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
local = frame->local; local = frame->local;
if (!local)
goto out;
if (op_ret != 0) { if (op_ret != 0) {
mdc_inode_iatt_set(this, local->loc.inode, NULL, local->incident_time); mdc_inode_iatt_set(this, local->loc.inode, NULL, local->incident_time);
goto out; goto out;
} }
if (!local)
goto out;
mdc_inode_iatt_set_validate(this, local->loc.inode, prebuf, postbuf, mdc_inode_iatt_set_validate(this, local->loc.inode, prebuf, postbuf,
_gf_true, local->incident_time); _gf_true, local->incident_time);
mdc_inode_xatt_update(this, local->loc.inode, xdata); mdc_inode_xatt_update(this, local->loc.inode, xdata);
out: out:
MDC_STACK_UNWIND(setattr, frame, op_ret, op_errno, prebuf, postbuf, xdata); MDC_STACK_UNWIND(setattr, frame, op_ret, op_errno, prebuf, postbuf, xdata);
return 0; return 0;
} }
int int
mdc_setattr(call_frame_t *frame, xlator_t *this, loc_t *loc, struct iatt *stbuf, mdc_setattr(call_frame_t *frame, xlator_t *this, loc_t *loc, struct iatt *stbuf,
int valid, dict_t *xdata) int valid, dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
dict_t *xattr_alloc = NULL; dict_t *xattr_alloc = NULL;
int ret = 0; int ret = 0;
struct mdc_conf *conf = this->private; struct mdc_conf *conf = this->private;
local = mdc_local_get(frame, loc->inode); local = mdc_local_get(frame, loc->inode);
if (local == NULL) {
goto wind;
}
loc_copy(&local->loc, loc); loc_copy(&local->loc, loc);
if ((valid & GF_SET_ATTR_MODE) && conf->cache_glusterfs_acl) { if ((valid & GF_SET_ATTR_MODE) && conf->cache_glusterfs_acl) {
if (!xdata) if (!xdata)
xdata = xattr_alloc = dict_new(); xdata = xattr_alloc = dict_new();
if (xdata) { if (xdata) {
ret = dict_set_int8(xdata, GF_POSIX_ACL_ACCESS, 0); ret = dict_set_int8(xdata, GF_POSIX_ACL_ACCESS, 0);
if (!ret) if (!ret)
ret = dict_set_int8(xdata, GF_POSIX_ACL_DEFAULT, 0); ret = dict_set_int8(xdata, GF_POSIX_ACL_DEFAULT, 0);
skipping to change at line 2152 skipping to change at line 2207
xdata = xattr_alloc = dict_new(); xdata = xattr_alloc = dict_new();
if (xdata) { if (xdata) {
ret = dict_set_int8(xdata, POSIX_ACL_ACCESS_XATTR, 0); ret = dict_set_int8(xdata, POSIX_ACL_ACCESS_XATTR, 0);
if (!ret) if (!ret)
ret = dict_set_int8(xdata, POSIX_ACL_DEFAULT_XATTR, 0); ret = dict_set_int8(xdata, POSIX_ACL_DEFAULT_XATTR, 0);
if (ret) if (ret)
mdc_inode_xatt_invalidate(this, local->loc.inode); mdc_inode_xatt_invalidate(this, local->loc.inode);
} }
} }
wind:
STACK_WIND(frame, mdc_setattr_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_setattr_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->setattr, loc, stbuf, valid, xdata); FIRST_CHILD(this)->fops->setattr, loc, stbuf, valid, xdata);
if (xattr_alloc) if (xattr_alloc)
dict_unref(xattr_alloc); dict_unref(xattr_alloc);
return 0; return 0;
} }
int int
mdc_fsetattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this, mdc_fsetattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
skipping to change at line 2197 skipping to change at line 2253
int int
mdc_fsetattr(call_frame_t *frame, xlator_t *this, fd_t *fd, struct iatt *stbuf, mdc_fsetattr(call_frame_t *frame, xlator_t *this, fd_t *fd, struct iatt *stbuf,
int valid, dict_t *xdata) int valid, dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
dict_t *xattr_alloc = NULL; dict_t *xattr_alloc = NULL;
int ret = 0; int ret = 0;
struct mdc_conf *conf = this->private; struct mdc_conf *conf = this->private;
local = mdc_local_get(frame, fd->inode); local = mdc_local_get(frame, fd->inode);
if (local == NULL) {
goto wind;
}
local->fd = fd_ref(fd); local->fd = __fd_ref(fd);
if ((valid & GF_SET_ATTR_MODE) && conf->cache_glusterfs_acl) { if ((valid & GF_SET_ATTR_MODE) && conf->cache_glusterfs_acl) {
if (!xdata) if (!xdata)
xdata = xattr_alloc = dict_new(); xdata = xattr_alloc = dict_new();
if (xdata) { if (xdata) {
ret = dict_set_int8(xdata, GF_POSIX_ACL_ACCESS, 0); ret = dict_set_int8(xdata, GF_POSIX_ACL_ACCESS, 0);
if (!ret) if (!ret)
ret = dict_set_int8(xdata, GF_POSIX_ACL_DEFAULT, 0); ret = dict_set_int8(xdata, GF_POSIX_ACL_DEFAULT, 0);
if (ret) if (ret)
mdc_inode_xatt_invalidate(this, local->fd->inode); mdc_inode_xatt_invalidate(this, local->fd->inode);
skipping to change at line 2224 skipping to change at line 2283
xdata = xattr_alloc = dict_new(); xdata = xattr_alloc = dict_new();
if (xdata) { if (xdata) {
ret = dict_set_int8(xdata, POSIX_ACL_ACCESS_XATTR, 0); ret = dict_set_int8(xdata, POSIX_ACL_ACCESS_XATTR, 0);
if (!ret) if (!ret)
ret = dict_set_int8(xdata, POSIX_ACL_DEFAULT_XATTR, 0); ret = dict_set_int8(xdata, POSIX_ACL_DEFAULT_XATTR, 0);
if (ret) if (ret)
mdc_inode_xatt_invalidate(this, local->fd->inode); mdc_inode_xatt_invalidate(this, local->fd->inode);
} }
} }
wind:
STACK_WIND(frame, mdc_fsetattr_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_fsetattr_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fsetattr, fd, stbuf, valid, xdata); FIRST_CHILD(this)->fops->fsetattr, fd, stbuf, valid, xdata);
if (xattr_alloc) if (xattr_alloc)
dict_unref(xattr_alloc); dict_unref(xattr_alloc);
return 0; return 0;
} }
int int
mdc_fsync_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, mdc_fsync_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
skipping to change at line 2265 skipping to change at line 2325
return 0; return 0;
} }
int int
mdc_fsync(call_frame_t *frame, xlator_t *this, fd_t *fd, int datasync, mdc_fsync(call_frame_t *frame, xlator_t *this, fd_t *fd, int datasync,
dict_t *xdata) dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
local = mdc_local_get(frame, fd->inode); local = mdc_local_get(frame, fd->inode);
if (local != NULL) {
local->fd = fd_ref(fd); local->fd = __fd_ref(fd);
}
STACK_WIND(frame, mdc_fsync_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_fsync_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fsync, fd, datasync, xdata); FIRST_CHILD(this)->fops->fsync, fd, datasync, xdata);
return 0; return 0;
} }
int int
mdc_setxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this, mdc_setxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata) int32_t op_ret, int32_t op_errno, dict_t *xdata)
{ {
skipping to change at line 2321 skipping to change at line 2382
return 0; return 0;
} }
int int
mdc_setxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr, mdc_setxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr,
int flags, dict_t *xdata) int flags, dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
local = mdc_local_get(frame, loc->inode); local = mdc_local_get(frame, loc->inode);
if (local != NULL) {
loc_copy(&local->loc, loc); loc_copy(&local->loc, loc);
local->xattr = dict_ref(xattr); local->xattr = dict_ref(xattr);
}
STACK_WIND(frame, mdc_setxattr_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_setxattr_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->setxattr, loc, xattr, flags, xdata); FIRST_CHILD(this)->fops->setxattr, loc, xattr, flags, xdata);
return 0; return 0;
} }
int int
mdc_fsetxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this, mdc_fsetxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata) int32_t op_ret, int32_t op_errno, dict_t *xdata)
skipping to change at line 2379 skipping to change at line 2441
return 0; return 0;
} }
int int
mdc_fsetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xattr, mdc_fsetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xattr,
int flags, dict_t *xdata) int flags, dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
local = mdc_local_get(frame, fd->inode); local = mdc_local_get(frame, fd->inode);
if (local != NULL) {
local->fd = fd_ref(fd); local->fd = __fd_ref(fd);
local->xattr = dict_ref(xattr); local->xattr = dict_ref(xattr);
}
STACK_WIND(frame, mdc_fsetxattr_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_fsetxattr_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fsetxattr, fd, xattr, flags, xdata); FIRST_CHILD(this)->fops->fsetxattr, fd, xattr, flags, xdata);
return 0; return 0;
} }
int int
mdc_getxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this, mdc_getxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xattr, dict_t *xdata) int32_t op_ret, int32_t op_errno, dict_t *xattr, dict_t *xdata)
skipping to change at line 2411 skipping to change at line 2474
mdc_inode_iatt_invalidate(this, local->loc.inode); mdc_inode_iatt_invalidate(this, local->loc.inode);
goto out; goto out;
} }
if (dict_get(xattr, "glusterfs.skip-cache")) { if (dict_get(xattr, "glusterfs.skip-cache")) {
gf_msg(this->name, GF_LOG_DEBUG, 0, 0, gf_msg(this->name, GF_LOG_DEBUG, 0, 0,
"Skipping xattr update due to empty value"); "Skipping xattr update due to empty value");
goto out; goto out;
} }
mdc_inode_xatt_set(this, local->loc.inode, xdata); if (local->update_cache) {
mdc_inode_xatt_set(this, local->loc.inode, xdata);
}
out: out:
MDC_STACK_UNWIND(getxattr, frame, op_ret, op_errno, xattr, xdata); MDC_STACK_UNWIND(getxattr, frame, op_ret, op_errno, xattr, xdata);
return 0; return 0;
} }
int int
mdc_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, const char *key, mdc_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, const char *key,
dict_t *xdata) dict_t *xdata)
{ {
int ret; int ret;
int op_errno = ENODATA; int op_errno = ENODATA;
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
dict_t *xattr = NULL; dict_t *xattr = NULL;
struct mdc_conf *conf = this->private; struct mdc_conf *conf = this->private;
dict_t *xattr_alloc = NULL; gf_boolean_t key_satisfied = _gf_false;
gf_boolean_t key_satisfied = _gf_true;
local = mdc_local_get(frame, loc->inode); local = mdc_local_get(frame, loc->inode);
if (!local) if (!local) {
goto uncached; goto uncached;
}
loc_copy(&local->loc, loc); loc_copy(&local->loc, loc);
if (!is_mdc_key_satisfied(this, key)) { if (!is_mdc_key_satisfied(this, key)) {
key_satisfied = _gf_false;
goto uncached; goto uncached;
} }
key_satisfied = _gf_true;
ret = mdc_inode_xatt_get(this, loc->inode, &xattr); ret = mdc_inode_xatt_get(this, loc->inode, &xattr);
if (ret != 0) if (ret != 0)
goto uncached; goto uncached;
if (!xattr || !dict_get(xattr, (char *)key)) { if (!xattr || !dict_get(xattr, (char *)key)) {
ret = -1; ret = -1;
op_errno = ENODATA; op_errno = ENODATA;
} }
GF_ATOMIC_INC(conf->mdc_counter.xattr_hit); GF_ATOMIC_INC(conf->mdc_counter.xattr_hit);
MDC_STACK_UNWIND(getxattr, frame, ret, op_errno, xattr, xdata); MDC_STACK_UNWIND(getxattr, frame, ret, op_errno, xattr, xdata);
if (xattr) if (xattr)
dict_unref(xattr); dict_unref(xattr);
return 0; return 0;
uncached: uncached:
if (key_satisfied) { if (key_satisfied) {
if (!xdata) xdata = mdc_prepare_request(this, local, xdata);
xdata = xattr_alloc = dict_new();
if (xdata)
mdc_load_reqs(this, xdata);
} }
GF_ATOMIC_INC(conf->mdc_counter.xattr_miss); GF_ATOMIC_INC(conf->mdc_counter.xattr_miss);
STACK_WIND(frame, mdc_getxattr_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_getxattr_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->getxattr, loc, key, xdata); FIRST_CHILD(this)->fops->getxattr, loc, key, xdata);
if (xattr_alloc) if (key_satisfied && (xdata != NULL)) {
dict_unref(xattr_alloc); dict_unref(xdata);
}
return 0; return 0;
} }
int int
mdc_fgetxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this, mdc_fgetxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xattr, int32_t op_ret, int32_t op_errno, dict_t *xattr,
dict_t *xdata) dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
skipping to change at line 2499 skipping to change at line 2563
mdc_inode_iatt_invalidate(this, local->fd->inode); mdc_inode_iatt_invalidate(this, local->fd->inode);
goto out; goto out;
} }
if (dict_get(xattr, "glusterfs.skip-cache")) { if (dict_get(xattr, "glusterfs.skip-cache")) {
gf_msg(this->name, GF_LOG_DEBUG, 0, 0, gf_msg(this->name, GF_LOG_DEBUG, 0, 0,
"Skipping xattr update due to empty value"); "Skipping xattr update due to empty value");
goto out; goto out;
} }
mdc_inode_xatt_set(this, local->fd->inode, xdata); if (local->update_cache) {
mdc_inode_xatt_set(this, local->fd->inode, xdata);
}
out: out:
MDC_STACK_UNWIND(fgetxattr, frame, op_ret, op_errno, xattr, xdata); MDC_STACK_UNWIND(fgetxattr, frame, op_ret, op_errno, xattr, xdata);
return 0; return 0;
} }
int int
mdc_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, const char *key, mdc_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, const char *key,
dict_t *xdata) dict_t *xdata)
{ {
int ret; int ret;
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
dict_t *xattr = NULL; dict_t *xattr = NULL;
int op_errno = ENODATA; int op_errno = ENODATA;
struct mdc_conf *conf = this->private; struct mdc_conf *conf = this->private;
dict_t *xattr_alloc = NULL;
gf_boolean_t key_satisfied = _gf_true; gf_boolean_t key_satisfied = _gf_true;
local = mdc_local_get(frame, fd->inode); local = mdc_local_get(frame, fd->inode);
if (!local) if (!local)
goto uncached; goto uncached;
local->fd = fd_ref(fd); local->fd = __fd_ref(fd);
if (!is_mdc_key_satisfied(this, key)) { if (!is_mdc_key_satisfied(this, key)) {
key_satisfied = _gf_false; key_satisfied = _gf_false;
goto uncached; goto uncached;
} }
ret = mdc_inode_xatt_get(this, fd->inode, &xattr); ret = mdc_inode_xatt_get(this, fd->inode, &xattr);
if (ret != 0) if (ret != 0)
goto uncached; goto uncached;
skipping to change at line 2549 skipping to change at line 2614
GF_ATOMIC_INC(conf->mdc_counter.xattr_hit); GF_ATOMIC_INC(conf->mdc_counter.xattr_hit);
MDC_STACK_UNWIND(fgetxattr, frame, ret, op_errno, xattr, xdata); MDC_STACK_UNWIND(fgetxattr, frame, ret, op_errno, xattr, xdata);
if (xattr) if (xattr)
dict_unref(xattr); dict_unref(xattr);
return 0; return 0;
uncached: uncached:
if (key_satisfied) { if (key_satisfied) {
if (!xdata) xdata = mdc_prepare_request(this, local, xdata);
xdata = xattr_alloc = dict_new();
if (xdata)
mdc_load_reqs(this, xdata);
} }
GF_ATOMIC_INC(conf->mdc_counter.xattr_miss); GF_ATOMIC_INC(conf->mdc_counter.xattr_miss);
STACK_WIND(frame, mdc_fgetxattr_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_fgetxattr_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fgetxattr, fd, key, xdata); FIRST_CHILD(this)->fops->fgetxattr, fd, key, xdata);
if (xattr_alloc) if (key_satisfied && (xdata != NULL)) {
dict_unref(xattr_alloc); dict_unref(xdata);
}
return 0; return 0;
} }
int int
mdc_removexattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this, mdc_removexattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, dict_t *xdata) int32_t op_ret, int32_t op_errno, dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
struct iatt prestat = { struct iatt prestat = {
0, 0,
skipping to change at line 2616 skipping to change at line 2680
int int
mdc_removexattr(call_frame_t *frame, xlator_t *this, loc_t *loc, mdc_removexattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
const char *name, dict_t *xdata) const char *name, dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
int op_errno = ENODATA; int op_errno = ENODATA;
int ret = 0; int ret = 0;
dict_t *xattr = NULL; dict_t *xattr = NULL;
struct mdc_conf *conf = this->private; struct mdc_conf *conf = this->private;
char *name2;
name2 = gf_strdup(name);
if (name2 == NULL) {
goto uncached;
}
local = mdc_local_get(frame, loc->inode); local = mdc_local_get(frame, loc->inode);
if (local == NULL) {
GF_FREE(name2);
goto uncached;
}
loc_copy(&local->loc, loc); loc_copy(&local->loc, loc);
local->key = name2;
local->key = gf_strdup(name);
if (!is_mdc_key_satisfied(this, name)) if (!is_mdc_key_satisfied(this, name))
goto uncached; goto uncached;
ret = mdc_inode_xatt_get(this, loc->inode, &xattr); ret = mdc_inode_xatt_get(this, loc->inode, &xattr);
if (ret != 0) if (ret != 0)
goto uncached; goto uncached;
GF_ATOMIC_INC(conf->mdc_counter.xattr_hit); GF_ATOMIC_INC(conf->mdc_counter.xattr_hit);
skipping to change at line 2707 skipping to change at line 2780
int int
mdc_fremovexattr(call_frame_t *frame, xlator_t *this, fd_t *fd, mdc_fremovexattr(call_frame_t *frame, xlator_t *this, fd_t *fd,
const char *name, dict_t *xdata) const char *name, dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
int op_errno = ENODATA; int op_errno = ENODATA;
int ret = 0; int ret = 0;
dict_t *xattr = NULL; dict_t *xattr = NULL;
struct mdc_conf *conf = this->private; struct mdc_conf *conf = this->private;
char *name2;
local = mdc_local_get(frame, fd->inode); name2 = gf_strdup(name);
if (name2 == NULL) {
goto uncached;
}
local->fd = fd_ref(fd); local = mdc_local_get(frame, fd->inode);
if (local == NULL) {
GF_FREE(name2);
goto uncached;
}
local->key = gf_strdup(name); local->fd = __fd_ref(fd);
local->key = name2;
if (!is_mdc_key_satisfied(this, name)) if (!is_mdc_key_satisfied(this, name))
goto uncached; goto uncached;
ret = mdc_inode_xatt_get(this, fd->inode, &xattr); ret = mdc_inode_xatt_get(this, fd->inode, &xattr);
if (ret != 0) if (ret != 0)
goto uncached; goto uncached;
GF_ATOMIC_INC(conf->mdc_counter.xattr_hit); GF_ATOMIC_INC(conf->mdc_counter.xattr_hit);
skipping to change at line 2770 skipping to change at line 2852
out: out:
MDC_STACK_UNWIND(opendir, frame, op_ret, op_errno, fd, xdata); MDC_STACK_UNWIND(opendir, frame, op_ret, op_errno, fd, xdata);
return 0; return 0;
} }
int int
mdc_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, mdc_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
dict_t *xdata) dict_t *xdata)
{ {
dict_t *xattr_alloc = NULL;
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
local = mdc_local_get(frame, loc->inode); local = mdc_local_get(frame, loc->inode);
if (local != NULL) {
loc_copy(&local->loc, loc); loc_copy(&local->loc, loc);
if (!xdata)
xdata = xattr_alloc = dict_new();
if (xdata) {
/* Tell readdir-ahead to include these keys in xdata when it
* internally issues readdirp() in it's opendir_cbk */
mdc_load_reqs(this, xdata);
} }
/* Tell readdir-ahead to include these keys in xdata when it
* internally issues readdirp() in it's opendir_cbk */
xdata = mdc_prepare_request(this, local, xdata);
STACK_WIND(frame, mdc_opendir_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_opendir_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->opendir, loc, fd, xdata); FIRST_CHILD(this)->fops->opendir, loc, fd, xdata);
if (xattr_alloc) if (xdata != NULL) {
dict_unref(xattr_alloc); dict_unref(xdata);
}
return 0; return 0;
} }
int int
mdc_readdirp_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, mdc_readdirp_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
int op_errno, gf_dirent_t *entries, dict_t *xdata) int op_errno, gf_dirent_t *entries, dict_t *xdata)
{ {
gf_dirent_t *entry = NULL; gf_dirent_t *entry = NULL;
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
skipping to change at line 2818 skipping to change at line 2896
mdc_inode_iatt_invalidate(this, local->fd->inode); mdc_inode_iatt_invalidate(this, local->fd->inode);
goto unwind; goto unwind;
} }
list_for_each_entry(entry, &entries->list, list) list_for_each_entry(entry, &entries->list, list)
{ {
if (!entry->inode) if (!entry->inode)
continue; continue;
mdc_inode_iatt_set(this, entry->inode, &entry->d_stat, mdc_inode_iatt_set(this, entry->inode, &entry->d_stat,
local->incident_time); local->incident_time);
mdc_inode_xatt_set(this, entry->inode, entry->dict); if (local->update_cache) {
mdc_inode_xatt_set(this, entry->inode, entry->dict);
}
} }
unwind: unwind:
MDC_STACK_UNWIND(readdirp, frame, op_ret, op_errno, entries, xdata); MDC_STACK_UNWIND(readdirp, frame, op_ret, op_errno, entries, xdata);
return 0; return 0;
} }
int int
mdc_readdirp(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, mdc_readdirp(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
off_t offset, dict_t *xdata) off_t offset, dict_t *xdata)
{ {
dict_t *xattr_alloc = NULL;
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
local = mdc_local_get(frame, fd->inode); local = mdc_local_get(frame, fd->inode);
if (!local) if (!local)
goto out; goto out;
local->fd = fd_ref(fd); local->fd = __fd_ref(fd);
if (!xdata) xdata = mdc_prepare_request(this, local, xdata);
xdata = xattr_alloc = dict_new();
if (xdata)
mdc_load_reqs(this, xdata);
STACK_WIND(frame, mdc_readdirp_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_readdirp_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->readdirp, fd, size, offset, xdata); FIRST_CHILD(this)->fops->readdirp, fd, size, offset, xdata);
if (xattr_alloc)
dict_unref(xattr_alloc); if (xdata != NULL) {
dict_unref(xdata);
}
return 0; return 0;
out: out:
MDC_STACK_UNWIND(readdirp, frame, -1, ENOMEM, NULL, NULL); MDC_STACK_UNWIND(readdirp, frame, -1, ENOMEM, NULL, NULL);
return 0; return 0;
} }
int int
mdc_readdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret, mdc_readdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
int op_errno, gf_dirent_t *entries, dict_t *xdata) int op_errno, gf_dirent_t *entries, dict_t *xdata)
{ {
skipping to change at line 2878 skipping to change at line 2957
mdc_inode_iatt_invalidate(this, local->fd->inode); mdc_inode_iatt_invalidate(this, local->fd->inode);
out: out:
MDC_STACK_UNWIND(readdir, frame, op_ret, op_errno, entries, xdata); MDC_STACK_UNWIND(readdir, frame, op_ret, op_errno, entries, xdata);
return 0; return 0;
} }
int int
mdc_readdir(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, mdc_readdir(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
off_t offset, dict_t *xdata) off_t offset, dict_t *xdata)
{ {
int need_unref = 0;
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
struct mdc_conf *conf = this->private; struct mdc_conf *conf = this->private;
local = mdc_local_get(frame, fd->inode); local = mdc_local_get(frame, fd->inode);
if (!local) if (!local)
goto unwind; goto unwind;
local->fd = fd_ref(fd); local->fd = __fd_ref(fd);
if (!conf->force_readdirp) { if (!conf->force_readdirp) {
STACK_WIND(frame, mdc_readdir_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_readdir_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->readdir, fd, size, offset, xdata); FIRST_CHILD(this)->fops->readdir, fd, size, offset, xdata);
return 0; return 0;
} }
if (!xdata) { xdata = mdc_prepare_request(this, local, xdata);
xdata = dict_new();
need_unref = 1;
}
if (xdata)
mdc_load_reqs(this, xdata);
STACK_WIND(frame, mdc_readdirp_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_readdirp_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->readdirp, fd, size, offset, xdata); FIRST_CHILD(this)->fops->readdirp, fd, size, offset, xdata);
if (need_unref && xdata) if (xdata != NULL) {
dict_unref(xdata); dict_unref(xdata);
}
return 0; return 0;
unwind: unwind:
MDC_STACK_UNWIND(readdir, frame, -1, ENOMEM, NULL, NULL); MDC_STACK_UNWIND(readdir, frame, -1, ENOMEM, NULL, NULL);
return 0; return 0;
} }
int int
mdc_fallocate_cbk(call_frame_t *frame, void *cookie, xlator_t *this, mdc_fallocate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf, int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
skipping to change at line 2948 skipping to change at line 3021
return 0; return 0;
} }
int int
mdc_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode, mdc_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode,
off_t offset, size_t len, dict_t *xdata) off_t offset, size_t len, dict_t *xdata)
{ {
mdc_local_t *local; mdc_local_t *local;
local = mdc_local_get(frame, fd->inode); local = mdc_local_get(frame, fd->inode);
local->fd = fd_ref(fd); if (local != NULL) {
local->fd = __fd_ref(fd);
}
STACK_WIND(frame, mdc_fallocate_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_fallocate_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fallocate, fd, mode, offset, len, FIRST_CHILD(this)->fops->fallocate, fd, mode, offset, len,
xdata); xdata);
return 0; return 0;
} }
int int
mdc_discard_cbk(call_frame_t *frame, void *cookie, xlator_t *this, mdc_discard_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
skipping to change at line 2990 skipping to change at line 3065
return 0; return 0;
} }
int int
mdc_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, mdc_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
size_t len, dict_t *xdata) size_t len, dict_t *xdata)
{ {
mdc_local_t *local; mdc_local_t *local;
local = mdc_local_get(frame, fd->inode); local = mdc_local_get(frame, fd->inode);
local->fd = fd_ref(fd); if (local != NULL) {
local->fd = __fd_ref(fd);
}
STACK_WIND(frame, mdc_discard_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_discard_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->discard, fd, offset, len, xdata); FIRST_CHILD(this)->fops->discard, fd, offset, len, xdata);
return 0; return 0;
} }
int int
mdc_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this, mdc_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf, int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
skipping to change at line 3031 skipping to change at line 3108
return 0; return 0;
} }
int int
mdc_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, mdc_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
off_t len, dict_t *xdata) off_t len, dict_t *xdata)
{ {
mdc_local_t *local; mdc_local_t *local;
local = mdc_local_get(frame, fd->inode); local = mdc_local_get(frame, fd->inode);
local->fd = fd_ref(fd); if (local != NULL) {
local->fd = __fd_ref(fd);
}
STACK_WIND(frame, mdc_zerofill_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_zerofill_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->zerofill, fd, offset, len, xdata); FIRST_CHILD(this)->fops->zerofill, fd, offset, len, xdata);
return 0; return 0;
} }
int32_t int32_t
mdc_readlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this, mdc_readlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, const char *path, int32_t op_ret, int32_t op_errno, const char *path,
skipping to change at line 3113 skipping to change at line 3192
int32_t int32_t
mdc_fsyncdir(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, mdc_fsyncdir(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags,
dict_t *xdata) dict_t *xdata)
{ {
mdc_local_t *local = NULL; mdc_local_t *local = NULL;
local = mdc_local_get(frame, fd->inode); local = mdc_local_get(frame, fd->inode);
if (!local) if (!local)
goto unwind; goto unwind;
local->fd = fd_ref(fd); local->fd = __fd_ref(fd);
STACK_WIND(frame, mdc_fsyncdir_cbk, FIRST_CHILD(this), STACK_WIND(frame, mdc_fsyncdir_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fsyncdir, fd, flags, xdata); FIRST_CHILD(this)->fops->fsyncdir, fd, flags, xdata);
return 0; return 0;
unwind: unwind:
MDC_STACK_UNWIND(fsyncdir, frame, -1, ENOMEM, NULL); MDC_STACK_UNWIND(fsyncdir, frame, -1, ENOMEM, NULL);
return 0; return 0;
} }
skipping to change at line 3486 skipping to change at line 3565
UNLOCK(&conf->lock); UNLOCK(&conf->lock);
xattr = dict_new(); xattr = dict_new();
if (!xattr) { if (!xattr) {
gf_msg(this->name, GF_LOG_WARNING, ENOMEM, MD_CACHE_MSG_NO_MEMORY, gf_msg(this->name, GF_LOG_WARNING, ENOMEM, MD_CACHE_MSG_NO_MEMORY,
"dict_new failed"); "dict_new failed");
ret = -1; ret = -1;
goto out; goto out;
} }
mdc_load_reqs(this, xattr); if (!mdc_load_reqs(this, xattr)) {
gf_msg(this->name, GF_LOG_WARNING, ENOMEM, MD_CACHE_MSG_NO_MEMORY,
"failed to populate cache entries");
ret = -1;
goto out;
}
frame = create_frame(this, this->ctx->pool); frame = create_frame(this, this->ctx->pool);
if (!frame) { if (!frame) {
gf_msg(this->name, GF_LOG_ERROR, ENOMEM, MD_CACHE_MSG_NO_MEMORY, gf_msg(this->name, GF_LOG_ERROR, ENOMEM, MD_CACHE_MSG_NO_MEMORY,
"failed to create the frame"); "failed to create the frame");
ret = -1; ret = -1;
goto out; goto out;
} }
data = GF_CALLOC(1, sizeof(struct mdc_ipc), gf_mdc_mt_mdc_ipc); data = GF_CALLOC(1, sizeof(struct mdc_ipc), gf_mdc_mt_mdc_ipc);
 End of changes. 88 change blocks. 
136 lines changed or deleted 220 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)