|
|
3604df |
From a0027df9745677df3be816dab4f160a5f682a20c Mon Sep 17 00:00:00 2001
|
|
|
3604df |
From: Poornima G <pgurusid@redhat.com>
|
|
|
3604df |
Date: Thu, 25 Aug 2016 15:43:29 +0530
|
|
|
3604df |
Subject: [PATCH 129/141] md-cache: Process all the cache invalidation flags
|
|
|
3604df |
|
|
|
3604df |
Currently, md-cache only processes IATT_UPDATE_FLAGS, UP_XATTR and
|
|
|
3604df |
UP_XATTR_RM. We also need to process UP_RENAME_FLAGS, UP_FORGET,
|
|
|
3604df |
UP_PARENT_DENTRY_FLAGS and UP_NLINK_FLAGS. Otherwise the files
|
|
|
3604df |
unlinked or renamed will not be reflected on other mounts.
|
|
|
3604df |
|
|
|
3604df |
Change-Id: Icb8b03da51482c3fc2e2a7292d16d56e11a341d9
|
|
|
3604df |
BUG: 1284873
|
|
|
3604df |
Signed-off-by: Poornima G <pgurusid@redhat.com>
|
|
|
3604df |
Reviewed-on: http://review.gluster.org/15324
|
|
|
3604df |
Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
3604df |
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
|
|
|
3604df |
Reviewed-on: https://code.engineering.redhat.com/gerrit/87042
|
|
|
3604df |
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
|
|
|
3604df |
Tested-by: Rajesh Joseph <rjoseph@redhat.com>
|
|
|
3604df |
---
|
|
|
3604df |
tests/bugs/md-cache/bug-1211863_unlink.t | 45 +++++++++++++++++++++++++++
|
|
|
3604df |
tests/include.rc | 1 +
|
|
|
3604df |
xlators/performance/md-cache/src/md-cache.c | 43 ++++++++++++++++++++++---
|
|
|
3604df |
3 files changed, 84 insertions(+), 5 deletions(-)
|
|
|
3604df |
create mode 100755 tests/bugs/md-cache/bug-1211863_unlink.t
|
|
|
3604df |
|
|
|
3604df |
diff --git a/tests/bugs/md-cache/bug-1211863_unlink.t b/tests/bugs/md-cache/bug-1211863_unlink.t
|
|
|
3604df |
new file mode 100755
|
|
|
3604df |
index 0000000..f83d3d7
|
|
|
3604df |
--- /dev/null
|
|
|
3604df |
+++ b/tests/bugs/md-cache/bug-1211863_unlink.t
|
|
|
3604df |
@@ -0,0 +1,45 @@
|
|
|
3604df |
+#!/bin/bash
|
|
|
3604df |
+
|
|
|
3604df |
+. $(dirname $0)/../../include.rc
|
|
|
3604df |
+. $(dirname $0)/../../volume.rc
|
|
|
3604df |
+
|
|
|
3604df |
+cleanup;
|
|
|
3604df |
+
|
|
|
3604df |
+## Start glusterd
|
|
|
3604df |
+TEST glusterd;
|
|
|
3604df |
+
|
|
|
3604df |
+## Lets create volume
|
|
|
3604df |
+TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2,3};
|
|
|
3604df |
+
|
|
|
3604df |
+## Start the volume
|
|
|
3604df |
+TEST $CLI volume start $V0
|
|
|
3604df |
+
|
|
|
3604df |
+## Enable the upcall xlator, and increase the md-cache timeout to max
|
|
|
3604df |
+TEST $CLI volume set $V0 features.cache-invalidation on
|
|
|
3604df |
+TEST $CLI volume set $V0 features.cache-invalidation-timeout 600
|
|
|
3604df |
+TEST $CLI volume set $V0 performance.cache-invalidation on
|
|
|
3604df |
+TEST $CLI volume set $V0 performance.md-cache-timeout 600
|
|
|
3604df |
+TEST $CLI volume set $V0 performance.cache-samba-metadata on
|
|
|
3604df |
+
|
|
|
3604df |
+## Create two gluster mounts
|
|
|
3604df |
+TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0
|
|
|
3604df |
+TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M1
|
|
|
3604df |
+
|
|
|
3604df |
+## Create files and directories from M0
|
|
|
3604df |
+TEST mkdir $M0/dir1
|
|
|
3604df |
+TEST touch $M0/dir1/file{1..5}
|
|
|
3604df |
+
|
|
|
3604df |
+## Lookup few files from M1, so that md-cache cahces
|
|
|
3604df |
+TEST ls -l $M1/dir1/file2
|
|
|
3604df |
+TEST ls -l $M1/dir1/file3
|
|
|
3604df |
+
|
|
|
3604df |
+## Remove the looked up file from M0
|
|
|
3604df |
+TEST rm $M0/dir1/file2
|
|
|
3604df |
+TEST mv $M0/dir1/file3 $M0/dir1/file6
|
|
|
3604df |
+
|
|
|
3604df |
+## Check if the files are not visible from M0
|
|
|
3604df |
+EXPECT_WITHIN $MDC_TIMEOUT "N" path_exists $M0/dir1/file2
|
|
|
3604df |
+EXPECT_WITHIN $MDC_TIMEOUT "N" path_exists $M0/dir1/file3
|
|
|
3604df |
+EXPECT_WITHIN $MDC_TIMEOUT "Y" path_exists $M0/dir1/file6
|
|
|
3604df |
+
|
|
|
3604df |
+cleanup;
|
|
|
3604df |
diff --git a/tests/include.rc b/tests/include.rc
|
|
|
3604df |
index e122a0e..44f5798 100644
|
|
|
3604df |
--- a/tests/include.rc
|
|
|
3604df |
+++ b/tests/include.rc
|
|
|
3604df |
@@ -75,6 +75,7 @@ CONFIG_UPDATE_TIMEOUT=5
|
|
|
3604df |
AUTH_REFRESH_INTERVAL=10
|
|
|
3604df |
GRAPH_SWITCH_TIMEOUT=10
|
|
|
3604df |
UNLINK_TIMEOUT=5
|
|
|
3604df |
+MDC_TIMEOUT=5
|
|
|
3604df |
|
|
|
3604df |
LOGDIR=$(gluster --print-logdir)
|
|
|
3604df |
|
|
|
3604df |
diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c
|
|
|
3604df |
index c5d99ba..763428c 100644
|
|
|
3604df |
--- a/xlators/performance/md-cache/src/md-cache.c
|
|
|
3604df |
+++ b/xlators/performance/md-cache/src/md-cache.c
|
|
|
3604df |
@@ -847,6 +847,26 @@ out:
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
|
|
|
3604df |
+static int
|
|
|
3604df |
+mdc_update_gfid_stat (xlator_t *this, struct iatt *iatt)
|
|
|
3604df |
+{
|
|
|
3604df |
+ int ret = 0;
|
|
|
3604df |
+ inode_table_t *itable = NULL;
|
|
|
3604df |
+ inode_t *inode = NULL;
|
|
|
3604df |
+
|
|
|
3604df |
+ itable = ((xlator_t *)this->graph->top)->itable;
|
|
|
3604df |
+ inode = inode_find (itable, iatt->ia_gfid);
|
|
|
3604df |
+ if (!inode) {
|
|
|
3604df |
+ ret = -1;
|
|
|
3604df |
+ goto out;
|
|
|
3604df |
+ }
|
|
|
3604df |
+ ret = mdc_inode_iatt_set_validate (this, inode, NULL,
|
|
|
3604df |
+ iatt);
|
|
|
3604df |
+out:
|
|
|
3604df |
+ return ret;
|
|
|
3604df |
+}
|
|
|
3604df |
+
|
|
|
3604df |
+
|
|
|
3604df |
void
|
|
|
3604df |
mdc_load_reqs (xlator_t *this, dict_t *dict)
|
|
|
3604df |
{
|
|
|
3604df |
@@ -2537,12 +2557,24 @@ mdc_invalidate (xlator_t *this, void *data)
|
|
|
3604df |
goto out;
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
+ if (up_ci->flags & UP_PARENT_DENTRY_FLAGS) {
|
|
|
3604df |
+ mdc_update_gfid_stat (this, &up_ci->p_stat);
|
|
|
3604df |
+ if (up_ci->flags & UP_RENAME_FLAGS)
|
|
|
3604df |
+ mdc_update_gfid_stat (this, &up_ci->oldp_stat);
|
|
|
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 |
+ mdc_inode_iatt_invalidate (this, inode);
|
|
|
3604df |
+ mdc_inode_xatt_invalidate (this, inode);
|
|
|
3604df |
+ INCREMENT_ATOMIC (conf->mdc_counter.lock,
|
|
|
3604df |
+ conf->mdc_counter.stat_invals);
|
|
|
3604df |
+ goto out;
|
|
|
3604df |
+ }
|
|
|
3604df |
+
|
|
|
3604df |
if (up_ci->flags & IATT_UPDATE_FLAGS) {
|
|
|
3604df |
- if (up_ci->dict && dict_get (up_ci->dict, MDC_INVALIDATE_IATT))
|
|
|
3604df |
- mdc_inode_iatt_invalidate (this, inode);
|
|
|
3604df |
- else
|
|
|
3604df |
- ret = mdc_inode_iatt_set_validate (this, inode, NULL,
|
|
|
3604df |
- &up_ci->stat);
|
|
|
3604df |
+ ret = mdc_inode_iatt_set_validate (this, inode, NULL,
|
|
|
3604df |
+ &up_ci->stat);
|
|
|
3604df |
/* one of the scenarios where ret < 0 is when this invalidate
|
|
|
3604df |
* is older than the current stat, in that case do not
|
|
|
3604df |
* update the xattrs as well
|
|
|
3604df |
@@ -2552,6 +2584,7 @@ mdc_invalidate (xlator_t *this, void *data)
|
|
|
3604df |
INCREMENT_ATOMIC (conf->mdc_counter.lock,
|
|
|
3604df |
conf->mdc_counter.stat_invals);
|
|
|
3604df |
}
|
|
|
3604df |
+
|
|
|
3604df |
if (up_ci->flags & UP_XATTR) {
|
|
|
3604df |
if (up_ci->dict)
|
|
|
3604df |
ret = mdc_inode_xatt_update (this, inode, up_ci->dict);
|
|
|
3604df |
--
|
|
|
3604df |
1.7.1
|
|
|
3604df |
|