summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/dht/src/dht-common.c8
-rw-r--r--xlators/performance/md-cache/src/md-cache.c51
2 files changed, 58 insertions, 1 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 4e3d7026c4a..af3b7a24838 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -9054,7 +9054,13 @@ unlock:
* notify all the md-cache clients to invalidate the existing
* stat cache and send the lookup next time*/
if (up_ci->dict && dict_get (up_ci->dict, conf->xattr_name))
- ret = dict_set_int8 (up_ci->dict, MDC_INVALIDATE_IATT , 0);
+ up_ci->flags |= UP_EXPLICIT_LOOKUP;
+
+ /* TODO: Instead of invalidating iatt, update the new
+ * hashed/cached subvolume in dht inode_ctx */
+ if (IS_DHT_LINKFILE_MODE (&up_ci->stat))
+ up_ci->flags |= UP_EXPLICIT_LOOKUP;
+
propagate = 1;
break;
default:
diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c
index aa1c22ade51..9edbdf4aebe 100644
--- a/xlators/performance/md-cache/src/md-cache.c
+++ b/xlators/performance/md-cache/src/md-cache.c
@@ -40,6 +40,8 @@ struct mdc_statistics {
sent to bricks */
uint64_t stat_invals; /* No. of invalidates recieved from upcall*/
uint64_t xattr_invals; /* No. of invalidates recieved from upcall*/
+ uint64_t need_lookup; /* No. of lookups issued, because other xlators
+ * requested for explicit lookup */
gf_lock_t lock;
};
@@ -153,6 +155,7 @@ struct md_cache {
char *linkname;
time_t ia_time;
time_t xa_time;
+ gf_boolean_t need_lookup;
gf_lock_t lock;
};
@@ -791,6 +794,43 @@ out:
return ret;
}
+gf_boolean_t
+mdc_inode_reset_need_lookup (xlator_t *this, inode_t *inode)
+{
+ struct md_cache *mdc = NULL;
+ gf_boolean_t need = _gf_false;
+
+ if (mdc_inode_ctx_get (this, inode, &mdc) != 0)
+ goto out;
+
+ LOCK (&mdc->lock);
+ {
+ need = mdc->need_lookup;
+ mdc->need_lookup = _gf_false;
+ }
+ UNLOCK (&mdc->lock);
+
+out:
+ return need;
+}
+
+void
+mdc_inode_set_need_lookup (xlator_t *this, inode_t *inode, gf_boolean_t need)
+{
+ struct md_cache *mdc = NULL;
+
+ if (mdc_inode_ctx_get (this, inode, &mdc) != 0)
+ goto out;
+
+ LOCK (&mdc->lock);
+ {
+ mdc->need_lookup = need;
+ }
+ UNLOCK (&mdc->lock);
+
+out:
+ return;
+}
void
mdc_inode_iatt_invalidate (xlator_t *this, inode_t *inode)
@@ -1034,6 +1074,12 @@ mdc_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc,
goto uncached;
}
+ if (mdc_inode_reset_need_lookup (this, loc->inode)) {
+ INCREMENT_ATOMIC (conf->mdc_counter.lock,
+ conf->mdc_counter.need_lookup);
+ goto uncached;
+ }
+
ret = mdc_inode_iatt_get (this, loc->inode, &stbuf);
if (ret != 0) {
INCREMENT_ATOMIC (conf->mdc_counter.lock,
@@ -2593,6 +2639,11 @@ mdc_invalidate (xlator_t *this, void *data)
mdc_update_gfid_stat (this, &up_ci->oldp_stat);
}
+ if (up_ci->flags & UP_EXPLICIT_LOOKUP) {
+ mdc_inode_set_need_lookup (this, inode, _gf_true);
+ goto out;
+ }
+
if ((up_ci->flags & (UP_NLINK | UP_RENAME_FLAGS | UP_FORGET)) ||
(up_ci->dict && dict_get (up_ci->dict, MDC_INVALIDATE_IATT))) {
mdc_inode_iatt_invalidate (this, inode);