From 7ed6da0460cbe466cf5297a009b6a9afd14eaeb0 Mon Sep 17 00:00:00 2001 From: Poornima G Date: Thu, 5 Jan 2017 15:36:02 +0530 Subject: [PATCH 263/267] ec: Invalidations in disperse volume should not update the stat Issue: In disperse volume, the file is present across bricks, hence the stat from one brick doesn't carry the valid size of the file. Therefore the upcall from one brick updating the md-cache results in wrong size being updated. Fix: If the notification is cache invalidation then, indicate md-cache that the attributes is invalid. >Reviewed-on: http://review.gluster.org/16329 >Smoke: Gluster Build System >NetBSD-regression: NetBSD Build System >Reviewed-by: Xavier Hernandez >CentOS-regression: Gluster Build System >Reviewed-by: Pranith Kumar Karampuri >Signed-off-by: Poornima G BUG: 1409808 Change-Id: Id89d2283478e70b62b435a8891fffc86d2be8cb2 Signed-off-by: Poornima G Reviewed-on: https://code.engineering.redhat.com/gerrit/94317 Reviewed-by: Atin Mukherjee --- libglusterfs/src/glusterfs.h | 4 ---- libglusterfs/src/upcall-utils.h | 2 ++ xlators/cluster/afr/src/afr-common.c | 3 +-- xlators/cluster/ec/src/ec.c | 13 +++++++++++++ xlators/performance/md-cache/src/md-cache.c | 4 ++-- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h index b5ae685..b268773 100644 --- a/libglusterfs/src/glusterfs.h +++ b/libglusterfs/src/glusterfs.h @@ -286,10 +286,6 @@ #define GF_LK_ADVISORY 0 #define GF_LK_MANDATORY 1 -/* md-cache keys */ -#define MDC_INVALIDATE_IATT "mdc.invalidate.iatt" -#define MDC_INVALIDATE_XATT "mdc.invalidate.xatt" - const char *fop_enum_to_pri_string (glusterfs_fop_t fop); const char *fop_enum_to_string (glusterfs_fop_t fop); diff --git a/libglusterfs/src/upcall-utils.h b/libglusterfs/src/upcall-utils.h index 47049fd..3b5dce3 100644 --- a/libglusterfs/src/upcall-utils.h +++ b/libglusterfs/src/upcall-utils.h @@ -35,6 +35,8 @@ #define UP_EXPLICIT_LOOKUP 0x00001000 /* Request an explicit lookup */ +#define UP_INVAL_ATTR 0x00002000 /* Request to invalidate iatt and xatt */ + /* for fops - open, read, lk, */ #define UP_UPDATE_CLIENT (UP_ATIME) diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 6f1ceb1..d16ddec 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -4710,8 +4710,7 @@ afr_notify (xlator_t *this, int32_t event, break; for (i = 0; i < priv->child_count; i++) { if (dict_get (up_ci->dict, priv->pending_key[i])) { - ret = dict_set_int8 (up_ci->dict, - MDC_INVALIDATE_IATT, 0); + up_ci->flags |= UP_INVAL_ATTR; itable = ((xlator_t *)this->graph->top)->itable; /*Internal processes may not have itable for top xlator*/ if (itable) diff --git a/xlators/cluster/ec/src/ec.c b/xlators/cluster/ec/src/ec.c index 61a28ed..bcdb9fa 100644 --- a/xlators/cluster/ec/src/ec.c +++ b/xlators/cluster/ec/src/ec.c @@ -11,6 +11,7 @@ #include "defaults.h" #include "statedump.h" #include "compat-errno.h" +#include "upcall-utils.h" #include "ec-mem-types.h" #include "ec-helpers.h" @@ -455,10 +456,21 @@ ec_notify (xlator_t *this, int32_t event, void *data, void *data2) dict_t *output = NULL; gf_boolean_t propagate = _gf_true; int32_t orig_event = event; + struct gf_upcall *up_data = NULL; + struct gf_upcall_cache_invalidation *up_ci = NULL; gf_msg_trace (this->name, 0, "NOTIFY(%d): %p, %p", event, data, data2); + if (event == GF_EVENT_UPCALL) { + up_data = (struct gf_upcall *)data; + if (up_data->event_type == GF_UPCALL_CACHE_INVALIDATION) { + up_ci = (struct gf_upcall_cache_invalidation *)up_data->data; + up_ci->flags |= UP_INVAL_ATTR; + } + goto done; + } + if (event == GF_EVENT_TRANSLATOR_OP) { if (!ec->up) { error = -1; @@ -525,6 +537,7 @@ ec_notify (xlator_t *this, int32_t event, void *data, void *data2) unlock: UNLOCK (&ec->lock); +done: if (propagate) { error = default_notify (this, event, data); } diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c index 8187570..cbda6b2 100644 --- a/xlators/performance/md-cache/src/md-cache.c +++ b/xlators/performance/md-cache/src/md-cache.c @@ -2661,8 +2661,8 @@ mdc_invalidate (xlator_t *this, void *data) goto out; } - if ((up_ci->flags & (UP_NLINK | UP_RENAME_FLAGS | UP_FORGET)) || - (up_ci->dict && dict_get (up_ci->dict, MDC_INVALIDATE_IATT))) { + if (up_ci->flags & + (UP_NLINK | UP_RENAME_FLAGS | UP_FORGET | UP_INVAL_ATTR)) { mdc_inode_iatt_invalidate (this, inode); mdc_inode_xatt_invalidate (this, inode); INCREMENT_ATOMIC (conf->mdc_counter.lock, -- 2.9.3