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