|
|
74096c |
From 7ad8c03a28fca67150972cda964ebe9233766b54 Mon Sep 17 00:00:00 2001
|
|
|
74096c |
From: Xavi Hernandez <xhernandez@redhat.com>
|
|
|
74096c |
Date: Mon, 30 Mar 2020 11:09:39 +0200
|
|
|
74096c |
Subject: [PATCH 418/449] md-cache: avoid clearing cache when not necessary
|
|
|
74096c |
|
|
|
74096c |
mdc_inode_xatt_set() blindly cleared current cache when dict was not
|
|
|
74096c |
NULL, even if there was no xattr requested.
|
|
|
74096c |
|
|
|
74096c |
This patch fixes this by only calling mdc_inode_xatt_set() when we have
|
|
|
74096c |
explicitly requested something to cache.
|
|
|
74096c |
|
|
|
74096c |
Backport of:
|
|
|
74096c |
> Upstream-patch-link: https://review.gluster.org/24267
|
|
|
74096c |
> Change-Id: Idc91a4693f1ff39f7059acde26682ccc361b947d
|
|
|
74096c |
> Fixes: #1140
|
|
|
74096c |
> Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
|
|
|
74096c |
|
|
|
74096c |
BUG: 1815434
|
|
|
74096c |
Change-Id: Idc91a4693f1ff39f7059acde26682ccc361b947d
|
|
|
74096c |
Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
|
|
|
74096c |
Reviewed-on: https://code.engineering.redhat.com/gerrit/202487
|
|
|
74096c |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
74096c |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
74096c |
---
|
|
|
74096c |
xlators/performance/md-cache/src/md-cache.c | 165 ++++++++++++++++------------
|
|
|
74096c |
1 file changed, 93 insertions(+), 72 deletions(-)
|
|
|
74096c |
|
|
|
74096c |
diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c
|
|
|
74096c |
index a6b363f..bbbee3b 100644
|
|
|
74096c |
--- a/xlators/performance/md-cache/src/md-cache.c
|
|
|
74096c |
+++ b/xlators/performance/md-cache/src/md-cache.c
|
|
|
74096c |
@@ -133,6 +133,7 @@ struct mdc_local {
|
|
|
74096c |
char *key;
|
|
|
74096c |
dict_t *xattr;
|
|
|
74096c |
uint64_t incident_time;
|
|
|
74096c |
+ bool update_cache;
|
|
|
74096c |
};
|
|
|
74096c |
|
|
|
74096c |
int
|
|
|
74096c |
@@ -969,7 +970,7 @@ out:
|
|
|
74096c |
return ret;
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
-void
|
|
|
74096c |
+static bool
|
|
|
74096c |
mdc_load_reqs(xlator_t *this, dict_t *dict)
|
|
|
74096c |
{
|
|
|
74096c |
struct mdc_conf *conf = this->private;
|
|
|
74096c |
@@ -978,6 +979,7 @@ mdc_load_reqs(xlator_t *this, dict_t *dict)
|
|
|
74096c |
char *tmp = NULL;
|
|
|
74096c |
char *tmp1 = NULL;
|
|
|
74096c |
int ret = 0;
|
|
|
74096c |
+ bool loaded = false;
|
|
|
74096c |
|
|
|
74096c |
tmp1 = conf->mdc_xattr_str;
|
|
|
74096c |
if (!tmp1)
|
|
|
74096c |
@@ -995,13 +997,17 @@ mdc_load_reqs(xlator_t *this, dict_t *dict)
|
|
|
74096c |
conf->mdc_xattr_str = NULL;
|
|
|
74096c |
gf_msg("md-cache", GF_LOG_ERROR, 0, MD_CACHE_MSG_NO_XATTR_CACHE,
|
|
|
74096c |
"Disabled cache for xattrs, dict_set failed");
|
|
|
74096c |
+ goto out;
|
|
|
74096c |
}
|
|
|
74096c |
pattern = strtok_r(NULL, ",", &tmp);
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
- GF_FREE(mdc_xattr_str);
|
|
|
74096c |
+ loaded = true;
|
|
|
74096c |
+
|
|
|
74096c |
out:
|
|
|
74096c |
- return;
|
|
|
74096c |
+ GF_FREE(mdc_xattr_str);
|
|
|
74096c |
+
|
|
|
74096c |
+ return loaded;
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
struct checkpair {
|
|
|
74096c |
@@ -1092,6 +1098,25 @@ err:
|
|
|
74096c |
return ret;
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
+static dict_t *
|
|
|
74096c |
+mdc_prepare_request(xlator_t *this, mdc_local_t *local, dict_t *xdata)
|
|
|
74096c |
+{
|
|
|
74096c |
+ if (xdata == NULL) {
|
|
|
74096c |
+ xdata = dict_new();
|
|
|
74096c |
+ if (xdata == NULL) {
|
|
|
74096c |
+ local->update_cache = false;
|
|
|
74096c |
+
|
|
|
74096c |
+ return NULL;
|
|
|
74096c |
+ }
|
|
|
74096c |
+ } else {
|
|
|
74096c |
+ dict_ref(xdata);
|
|
|
74096c |
+ }
|
|
|
74096c |
+
|
|
|
74096c |
+ local->update_cache = mdc_load_reqs(this, xdata);
|
|
|
74096c |
+
|
|
|
74096c |
+ return xdata;
|
|
|
74096c |
+}
|
|
|
74096c |
+
|
|
|
74096c |
int
|
|
|
74096c |
mdc_statfs_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
74096c |
int32_t op_ret, int32_t op_errno, struct statvfs *buf,
|
|
|
74096c |
@@ -1201,7 +1226,9 @@ mdc_lookup_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
74096c |
|
|
|
74096c |
if (local->loc.inode) {
|
|
|
74096c |
mdc_inode_iatt_set(this, local->loc.inode, stbuf, local->incident_time);
|
|
|
74096c |
- mdc_inode_xatt_set(this, local->loc.inode, dict);
|
|
|
74096c |
+ if (local->update_cache) {
|
|
|
74096c |
+ mdc_inode_xatt_set(this, local->loc.inode, dict);
|
|
|
74096c |
+ }
|
|
|
74096c |
}
|
|
|
74096c |
out:
|
|
|
74096c |
MDC_STACK_UNWIND(lookup, frame, op_ret, op_errno, inode, stbuf, dict,
|
|
|
74096c |
@@ -1220,7 +1247,6 @@ mdc_lookup(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
|
|
|
74096c |
0,
|
|
|
74096c |
};
|
|
|
74096c |
dict_t *xattr_rsp = NULL;
|
|
|
74096c |
- dict_t *xattr_alloc = NULL;
|
|
|
74096c |
mdc_local_t *local = NULL;
|
|
|
74096c |
struct mdc_conf *conf = this->private;
|
|
|
74096c |
|
|
|
74096c |
@@ -1271,18 +1297,18 @@ mdc_lookup(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
|
|
|
74096c |
return 0;
|
|
|
74096c |
|
|
|
74096c |
uncached:
|
|
|
74096c |
- if (!xdata)
|
|
|
74096c |
- xdata = xattr_alloc = dict_new();
|
|
|
74096c |
- if (xdata)
|
|
|
74096c |
- mdc_load_reqs(this, xdata);
|
|
|
74096c |
+ xdata = mdc_prepare_request(this, local, xdata);
|
|
|
74096c |
|
|
|
74096c |
STACK_WIND(frame, mdc_lookup_cbk, FIRST_CHILD(this),
|
|
|
74096c |
FIRST_CHILD(this)->fops->lookup, loc, xdata);
|
|
|
74096c |
|
|
|
74096c |
if (xattr_rsp)
|
|
|
74096c |
dict_unref(xattr_rsp);
|
|
|
74096c |
- if (xattr_alloc)
|
|
|
74096c |
- dict_unref(xattr_alloc);
|
|
|
74096c |
+
|
|
|
74096c |
+ if (xdata != NULL) {
|
|
|
74096c |
+ dict_unref(xdata);
|
|
|
74096c |
+ }
|
|
|
74096c |
+
|
|
|
74096c |
return 0;
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
@@ -1305,7 +1331,9 @@ mdc_stat_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
mdc_inode_iatt_set(this, local->loc.inode, buf, local->incident_time);
|
|
|
74096c |
- mdc_inode_xatt_set(this, local->loc.inode, xdata);
|
|
|
74096c |
+ if (local->update_cache) {
|
|
|
74096c |
+ mdc_inode_xatt_set(this, local->loc.inode, xdata);
|
|
|
74096c |
+ }
|
|
|
74096c |
|
|
|
74096c |
out:
|
|
|
74096c |
MDC_STACK_UNWIND(stat, frame, op_ret, op_errno, buf, xdata);
|
|
|
74096c |
@@ -1319,7 +1347,6 @@ mdc_stat(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
|
|
|
74096c |
int ret;
|
|
|
74096c |
struct iatt stbuf;
|
|
|
74096c |
mdc_local_t *local = NULL;
|
|
|
74096c |
- dict_t *xattr_alloc = NULL;
|
|
|
74096c |
struct mdc_conf *conf = this->private;
|
|
|
74096c |
|
|
|
74096c |
local = mdc_local_get(frame, loc->inode);
|
|
|
74096c |
@@ -1343,17 +1370,16 @@ mdc_stat(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
|
|
|
74096c |
return 0;
|
|
|
74096c |
|
|
|
74096c |
uncached:
|
|
|
74096c |
- if (!xdata)
|
|
|
74096c |
- xdata = xattr_alloc = dict_new();
|
|
|
74096c |
- if (xdata)
|
|
|
74096c |
- mdc_load_reqs(this, xdata);
|
|
|
74096c |
+ xdata = mdc_prepare_request(this, local, xdata);
|
|
|
74096c |
|
|
|
74096c |
GF_ATOMIC_INC(conf->mdc_counter.stat_miss);
|
|
|
74096c |
STACK_WIND(frame, mdc_stat_cbk, FIRST_CHILD(this),
|
|
|
74096c |
FIRST_CHILD(this)->fops->stat, loc, xdata);
|
|
|
74096c |
|
|
|
74096c |
- if (xattr_alloc)
|
|
|
74096c |
- dict_unref(xattr_alloc);
|
|
|
74096c |
+ if (xdata != NULL) {
|
|
|
74096c |
+ dict_unref(xdata);
|
|
|
74096c |
+ }
|
|
|
74096c |
+
|
|
|
74096c |
return 0;
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
@@ -1376,7 +1402,9 @@ mdc_fstat_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
mdc_inode_iatt_set(this, local->fd->inode, buf, local->incident_time);
|
|
|
74096c |
- mdc_inode_xatt_set(this, local->fd->inode, xdata);
|
|
|
74096c |
+ if (local->update_cache) {
|
|
|
74096c |
+ mdc_inode_xatt_set(this, local->fd->inode, xdata);
|
|
|
74096c |
+ }
|
|
|
74096c |
|
|
|
74096c |
out:
|
|
|
74096c |
MDC_STACK_UNWIND(fstat, frame, op_ret, op_errno, buf, xdata);
|
|
|
74096c |
@@ -1390,7 +1418,6 @@ mdc_fstat(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
|
|
|
74096c |
int ret;
|
|
|
74096c |
struct iatt stbuf;
|
|
|
74096c |
mdc_local_t *local = NULL;
|
|
|
74096c |
- dict_t *xattr_alloc = NULL;
|
|
|
74096c |
struct mdc_conf *conf = this->private;
|
|
|
74096c |
|
|
|
74096c |
local = mdc_local_get(frame, fd->inode);
|
|
|
74096c |
@@ -1409,17 +1436,16 @@ mdc_fstat(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
|
|
|
74096c |
return 0;
|
|
|
74096c |
|
|
|
74096c |
uncached:
|
|
|
74096c |
- if (!xdata)
|
|
|
74096c |
- xdata = xattr_alloc = dict_new();
|
|
|
74096c |
- if (xdata)
|
|
|
74096c |
- mdc_load_reqs(this, xdata);
|
|
|
74096c |
+ xdata = mdc_prepare_request(this, local, xdata);
|
|
|
74096c |
|
|
|
74096c |
GF_ATOMIC_INC(conf->mdc_counter.stat_miss);
|
|
|
74096c |
STACK_WIND(frame, mdc_fstat_cbk, FIRST_CHILD(this),
|
|
|
74096c |
FIRST_CHILD(this)->fops->fstat, fd, xdata);
|
|
|
74096c |
|
|
|
74096c |
- if (xattr_alloc)
|
|
|
74096c |
- dict_unref(xattr_alloc);
|
|
|
74096c |
+ if (xdata != NULL) {
|
|
|
74096c |
+ dict_unref(xdata);
|
|
|
74096c |
+ }
|
|
|
74096c |
+
|
|
|
74096c |
return 0;
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
@@ -2393,7 +2419,9 @@ mdc_getxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
74096c |
goto out;
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
- mdc_inode_xatt_set(this, local->loc.inode, xdata);
|
|
|
74096c |
+ if (local->update_cache) {
|
|
|
74096c |
+ mdc_inode_xatt_set(this, local->loc.inode, xdata);
|
|
|
74096c |
+ }
|
|
|
74096c |
|
|
|
74096c |
out:
|
|
|
74096c |
MDC_STACK_UNWIND(getxattr, frame, op_ret, op_errno, xattr, xdata);
|
|
|
74096c |
@@ -2410,7 +2438,6 @@ mdc_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, const char *key,
|
|
|
74096c |
mdc_local_t *local = NULL;
|
|
|
74096c |
dict_t *xattr = NULL;
|
|
|
74096c |
struct mdc_conf *conf = this->private;
|
|
|
74096c |
- dict_t *xattr_alloc = NULL;
|
|
|
74096c |
gf_boolean_t key_satisfied = _gf_true;
|
|
|
74096c |
|
|
|
74096c |
local = mdc_local_get(frame, loc->inode);
|
|
|
74096c |
@@ -2443,18 +2470,17 @@ mdc_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, const char *key,
|
|
|
74096c |
|
|
|
74096c |
uncached:
|
|
|
74096c |
if (key_satisfied) {
|
|
|
74096c |
- if (!xdata)
|
|
|
74096c |
- xdata = xattr_alloc = dict_new();
|
|
|
74096c |
- if (xdata)
|
|
|
74096c |
- mdc_load_reqs(this, xdata);
|
|
|
74096c |
+ xdata = mdc_prepare_request(this, local, xdata);
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
GF_ATOMIC_INC(conf->mdc_counter.xattr_miss);
|
|
|
74096c |
STACK_WIND(frame, mdc_getxattr_cbk, FIRST_CHILD(this),
|
|
|
74096c |
FIRST_CHILD(this)->fops->getxattr, loc, key, xdata);
|
|
|
74096c |
|
|
|
74096c |
- if (xattr_alloc)
|
|
|
74096c |
- dict_unref(xattr_alloc);
|
|
|
74096c |
+ if (key_satisfied && (xdata != NULL)) {
|
|
|
74096c |
+ dict_unref(xdata);
|
|
|
74096c |
+ }
|
|
|
74096c |
+
|
|
|
74096c |
return 0;
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
@@ -2481,7 +2507,9 @@ mdc_fgetxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
74096c |
goto out;
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
- mdc_inode_xatt_set(this, local->fd->inode, xdata);
|
|
|
74096c |
+ if (local->update_cache) {
|
|
|
74096c |
+ mdc_inode_xatt_set(this, local->fd->inode, xdata);
|
|
|
74096c |
+ }
|
|
|
74096c |
|
|
|
74096c |
out:
|
|
|
74096c |
MDC_STACK_UNWIND(fgetxattr, frame, op_ret, op_errno, xattr, xdata);
|
|
|
74096c |
@@ -2498,7 +2526,6 @@ mdc_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, const char *key,
|
|
|
74096c |
dict_t *xattr = NULL;
|
|
|
74096c |
int op_errno = ENODATA;
|
|
|
74096c |
struct mdc_conf *conf = this->private;
|
|
|
74096c |
- dict_t *xattr_alloc = NULL;
|
|
|
74096c |
gf_boolean_t key_satisfied = _gf_true;
|
|
|
74096c |
|
|
|
74096c |
local = mdc_local_get(frame, fd->inode);
|
|
|
74096c |
@@ -2531,18 +2558,17 @@ mdc_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, const char *key,
|
|
|
74096c |
|
|
|
74096c |
uncached:
|
|
|
74096c |
if (key_satisfied) {
|
|
|
74096c |
- if (!xdata)
|
|
|
74096c |
- xdata = xattr_alloc = dict_new();
|
|
|
74096c |
- if (xdata)
|
|
|
74096c |
- mdc_load_reqs(this, xdata);
|
|
|
74096c |
+ xdata = mdc_prepare_request(this, local, xdata);
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
GF_ATOMIC_INC(conf->mdc_counter.xattr_miss);
|
|
|
74096c |
STACK_WIND(frame, mdc_fgetxattr_cbk, FIRST_CHILD(this),
|
|
|
74096c |
FIRST_CHILD(this)->fops->fgetxattr, fd, key, xdata);
|
|
|
74096c |
|
|
|
74096c |
- if (xattr_alloc)
|
|
|
74096c |
- dict_unref(xattr_alloc);
|
|
|
74096c |
+ if (key_satisfied && (xdata != NULL)) {
|
|
|
74096c |
+ dict_unref(xdata);
|
|
|
74096c |
+ }
|
|
|
74096c |
+
|
|
|
74096c |
return 0;
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
@@ -2752,27 +2778,22 @@ int
|
|
|
74096c |
mdc_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
|
|
|
74096c |
dict_t *xdata)
|
|
|
74096c |
{
|
|
|
74096c |
- dict_t *xattr_alloc = NULL;
|
|
|
74096c |
mdc_local_t *local = NULL;
|
|
|
74096c |
|
|
|
74096c |
local = mdc_local_get(frame, loc->inode);
|
|
|
74096c |
|
|
|
74096c |
loc_copy(&local->loc, loc);
|
|
|
74096c |
|
|
|
74096c |
- if (!xdata)
|
|
|
74096c |
- xdata = xattr_alloc = dict_new();
|
|
|
74096c |
-
|
|
|
74096c |
- if (xdata) {
|
|
|
74096c |
- /* Tell readdir-ahead to include these keys in xdata when it
|
|
|
74096c |
- * internally issues readdirp() in it's opendir_cbk */
|
|
|
74096c |
- mdc_load_reqs(this, xdata);
|
|
|
74096c |
- }
|
|
|
74096c |
+ /* Tell readdir-ahead to include these keys in xdata when it
|
|
|
74096c |
+ * internally issues readdirp() in it's opendir_cbk */
|
|
|
74096c |
+ xdata = mdc_prepare_request(this, local, xdata);
|
|
|
74096c |
|
|
|
74096c |
STACK_WIND(frame, mdc_opendir_cbk, FIRST_CHILD(this),
|
|
|
74096c |
FIRST_CHILD(this)->fops->opendir, loc, fd, xdata);
|
|
|
74096c |
|
|
|
74096c |
- if (xattr_alloc)
|
|
|
74096c |
- dict_unref(xattr_alloc);
|
|
|
74096c |
+ if (xdata != NULL) {
|
|
|
74096c |
+ dict_unref(xdata);
|
|
|
74096c |
+ }
|
|
|
74096c |
|
|
|
74096c |
return 0;
|
|
|
74096c |
}
|
|
|
74096c |
@@ -2800,7 +2821,9 @@ mdc_readdirp_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
|
|
|
74096c |
continue;
|
|
|
74096c |
mdc_inode_iatt_set(this, entry->inode, &entry->d_stat,
|
|
|
74096c |
local->incident_time);
|
|
|
74096c |
- mdc_inode_xatt_set(this, entry->inode, entry->dict);
|
|
|
74096c |
+ if (local->update_cache) {
|
|
|
74096c |
+ mdc_inode_xatt_set(this, entry->inode, entry->dict);
|
|
|
74096c |
+ }
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
unwind:
|
|
|
74096c |
@@ -2812,7 +2835,6 @@ int
|
|
|
74096c |
mdc_readdirp(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
|
|
|
74096c |
off_t offset, dict_t *xdata)
|
|
|
74096c |
{
|
|
|
74096c |
- dict_t *xattr_alloc = NULL;
|
|
|
74096c |
mdc_local_t *local = NULL;
|
|
|
74096c |
|
|
|
74096c |
local = mdc_local_get(frame, fd->inode);
|
|
|
74096c |
@@ -2821,15 +2843,15 @@ mdc_readdirp(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
|
|
|
74096c |
|
|
|
74096c |
local->fd = fd_ref(fd);
|
|
|
74096c |
|
|
|
74096c |
- if (!xdata)
|
|
|
74096c |
- xdata = xattr_alloc = dict_new();
|
|
|
74096c |
- if (xdata)
|
|
|
74096c |
- mdc_load_reqs(this, xdata);
|
|
|
74096c |
+ xdata = mdc_prepare_request(this, local, xdata);
|
|
|
74096c |
|
|
|
74096c |
STACK_WIND(frame, mdc_readdirp_cbk, FIRST_CHILD(this),
|
|
|
74096c |
FIRST_CHILD(this)->fops->readdirp, fd, size, offset, xdata);
|
|
|
74096c |
- if (xattr_alloc)
|
|
|
74096c |
- dict_unref(xattr_alloc);
|
|
|
74096c |
+
|
|
|
74096c |
+ if (xdata != NULL) {
|
|
|
74096c |
+ dict_unref(xdata);
|
|
|
74096c |
+ }
|
|
|
74096c |
+
|
|
|
74096c |
return 0;
|
|
|
74096c |
out:
|
|
|
74096c |
MDC_STACK_UNWIND(readdirp, frame, -1, ENOMEM, NULL, NULL);
|
|
|
74096c |
@@ -2860,7 +2882,6 @@ int
|
|
|
74096c |
mdc_readdir(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
|
|
|
74096c |
off_t offset, dict_t *xdata)
|
|
|
74096c |
{
|
|
|
74096c |
- int need_unref = 0;
|
|
|
74096c |
mdc_local_t *local = NULL;
|
|
|
74096c |
struct mdc_conf *conf = this->private;
|
|
|
74096c |
|
|
|
74096c |
@@ -2876,19 +2897,14 @@ mdc_readdir(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
|
|
|
74096c |
return 0;
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
- if (!xdata) {
|
|
|
74096c |
- xdata = dict_new();
|
|
|
74096c |
- need_unref = 1;
|
|
|
74096c |
- }
|
|
|
74096c |
-
|
|
|
74096c |
- if (xdata)
|
|
|
74096c |
- mdc_load_reqs(this, xdata);
|
|
|
74096c |
+ xdata = mdc_prepare_request(this, local, xdata);
|
|
|
74096c |
|
|
|
74096c |
STACK_WIND(frame, mdc_readdirp_cbk, FIRST_CHILD(this),
|
|
|
74096c |
FIRST_CHILD(this)->fops->readdirp, fd, size, offset, xdata);
|
|
|
74096c |
|
|
|
74096c |
- if (need_unref && xdata)
|
|
|
74096c |
+ if (xdata != NULL) {
|
|
|
74096c |
dict_unref(xdata);
|
|
|
74096c |
+ }
|
|
|
74096c |
|
|
|
74096c |
return 0;
|
|
|
74096c |
unwind:
|
|
|
74096c |
@@ -3468,7 +3484,12 @@ mdc_register_xattr_inval(xlator_t *this)
|
|
|
74096c |
goto out;
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
- mdc_load_reqs(this, xattr);
|
|
|
74096c |
+ if (!mdc_load_reqs(this, xattr)) {
|
|
|
74096c |
+ gf_msg(this->name, GF_LOG_WARNING, ENOMEM, MD_CACHE_MSG_NO_MEMORY,
|
|
|
74096c |
+ "failed to populate cache entries");
|
|
|
74096c |
+ ret = -1;
|
|
|
74096c |
+ goto out;
|
|
|
74096c |
+ }
|
|
|
74096c |
|
|
|
74096c |
frame = create_frame(this, this->ctx->pool);
|
|
|
74096c |
if (!frame) {
|
|
|
74096c |
--
|
|
|
74096c |
1.8.3.1
|
|
|
74096c |
|