|
|
d1681e |
From 897f0604f34760afe585a28d9787c6ff39d3addc Mon Sep 17 00:00:00 2001
|
|
|
d1681e |
From: Poornima G <pgurusid@redhat.com>
|
|
|
d1681e |
Date: Tue, 9 Jan 2018 10:32:16 +0530
|
|
|
d1681e |
Subject: [PATCH 133/139] upcall: Allow md-cache to specify invalidations on
|
|
|
d1681e |
xattr with wildcard
|
|
|
d1681e |
|
|
|
d1681e |
Currently, md-cache sends a list of xattrs, it is inttrested in recieving
|
|
|
d1681e |
invalidations for. But, it cannot specify any wildcard in the xattr names
|
|
|
d1681e |
Eg: user.* - invalidate on updating any xattr with user. prefix.
|
|
|
d1681e |
|
|
|
d1681e |
This patch, enable upcall to honor wildcard in the xattr key names
|
|
|
d1681e |
|
|
|
d1681e |
Updates: #297
|
|
|
d1681e |
|
|
|
d1681e |
> Signed-off-by: Poornima G <pgurusid@redhat.com>
|
|
|
d1681e |
> Change-Id: I98caf0ed72f11ef10770bf2067d4428880e0a03a
|
|
|
d1681e |
> Reviewed-on: https://review.gluster.org/19171
|
|
|
d1681e |
> Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
d1681e |
> Reviewed-by: Amar Tumballi
|
|
|
d1681e |
> Tested-by: Poornima G <pgurusid@redhat.com>
|
|
|
d1681e |
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
d1681e |
> (cherry picked from commit efc30e60e233164bd4fe7fc903a7c5f718b0448b)
|
|
|
d1681e |
|
|
|
d1681e |
Change-Id: I98caf0ed72f11ef10770bf2067d4428880e0a03a
|
|
|
d1681e |
BUG: 1446125
|
|
|
d1681e |
Signed-off-by: Poornima G <pgurusid@redhat.com>
|
|
|
d1681e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/128481
|
|
|
d1681e |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
d1681e |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
d1681e |
---
|
|
|
d1681e |
tests/bugs/md-cache/bug-1211863.t | 0
|
|
|
d1681e |
xlators/features/upcall/src/upcall-internal.c | 25 +++++++++++++++++++++----
|
|
|
d1681e |
2 files changed, 21 insertions(+), 4 deletions(-)
|
|
|
d1681e |
mode change 100644 => 100755 tests/bugs/md-cache/bug-1211863.t
|
|
|
d1681e |
|
|
|
d1681e |
diff --git a/tests/bugs/md-cache/bug-1211863.t b/tests/bugs/md-cache/bug-1211863.t
|
|
|
d1681e |
old mode 100644
|
|
|
d1681e |
new mode 100755
|
|
|
d1681e |
diff --git a/xlators/features/upcall/src/upcall-internal.c b/xlators/features/upcall/src/upcall-internal.c
|
|
|
d1681e |
index 8b15dfc..7813940 100644
|
|
|
d1681e |
--- a/xlators/features/upcall/src/upcall-internal.c
|
|
|
d1681e |
+++ b/xlators/features/upcall/src/upcall-internal.c
|
|
|
d1681e |
@@ -466,11 +466,29 @@ up_filter_afr_xattr (dict_t *xattrs, char *xattr, data_t *v)
|
|
|
d1681e |
}
|
|
|
d1681e |
|
|
|
d1681e |
|
|
|
d1681e |
-static int
|
|
|
d1681e |
+static gf_boolean_t
|
|
|
d1681e |
+up_key_is_regd_xattr (dict_t *regd_xattrs, char *regd_xattr, data_t *v,
|
|
|
d1681e |
+ void *xattr)
|
|
|
d1681e |
+{
|
|
|
d1681e |
+ int ret = _gf_false;
|
|
|
d1681e |
+ char *key = xattr;
|
|
|
d1681e |
+
|
|
|
d1681e |
+ if (fnmatch (regd_xattr, key, 0) == 0)
|
|
|
d1681e |
+ ret = _gf_true;
|
|
|
d1681e |
+
|
|
|
d1681e |
+ return ret;
|
|
|
d1681e |
+}
|
|
|
d1681e |
+
|
|
|
d1681e |
+
|
|
|
d1681e |
+int
|
|
|
d1681e |
up_filter_unregd_xattr (dict_t *xattrs, char *xattr, data_t *v,
|
|
|
d1681e |
void *regd_xattrs)
|
|
|
d1681e |
{
|
|
|
d1681e |
- if (dict_get ((dict_t *)regd_xattrs, xattr) == NULL) {
|
|
|
d1681e |
+ int ret = 0;
|
|
|
d1681e |
+
|
|
|
d1681e |
+ ret = dict_foreach_match (regd_xattrs, up_key_is_regd_xattr, xattr,
|
|
|
d1681e |
+ dict_null_foreach_fn, NULL);
|
|
|
d1681e |
+ if (ret == 0) {
|
|
|
d1681e |
/* xattr was not found in the registered xattr, hence do not
|
|
|
d1681e |
* send notification for its change
|
|
|
d1681e |
*/
|
|
|
d1681e |
@@ -488,9 +506,8 @@ up_filter_xattr (dict_t *xattr, dict_t *regd_xattrs)
|
|
|
d1681e |
{
|
|
|
d1681e |
int ret = 0;
|
|
|
d1681e |
|
|
|
d1681e |
- /* Remove the xattrs from the dict, if they are not registered for
|
|
|
d1681e |
- * cache invalidation */
|
|
|
d1681e |
ret = dict_foreach (xattr, up_filter_unregd_xattr, regd_xattrs);
|
|
|
d1681e |
+
|
|
|
d1681e |
return ret;
|
|
|
d1681e |
}
|
|
|
d1681e |
|
|
|
d1681e |
--
|
|
|
d1681e |
1.8.3.1
|
|
|
d1681e |
|