|
|
21ab4e |
From 6703faca9af788e7ad087c8433d6a4dd65a3fa04 Mon Sep 17 00:00:00 2001
|
|
|
21ab4e |
From: Poornima G <pgurusid@redhat.com>
|
|
|
21ab4e |
Date: Tue, 16 May 2017 19:25:20 +0530
|
|
|
21ab4e |
Subject: [PATCH 465/473] nl-cache: In case of nameless operations do not cache
|
|
|
21ab4e |
|
|
|
21ab4e |
Issue:
|
|
|
21ab4e |
In nameless lookup/other fops, parent inode will be NULL, when we try
|
|
|
21ab4e |
to add the cache to the NULL inode, it causes a crash.
|
|
|
21ab4e |
|
|
|
21ab4e |
Hence handle the scenario of nameless fops, and do not cache/serve
|
|
|
21ab4e |
the nameless fops.
|
|
|
21ab4e |
|
|
|
21ab4e |
>Reviewed-on: https://review.gluster.org/17316
|
|
|
21ab4e |
>Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
>Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
|
|
|
21ab4e |
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
>(cherry picked from commit 284cd8851bfe60984d2f11b5c52fe3204ff43b06)
|
|
|
21ab4e |
|
|
|
21ab4e |
Change-Id: I3b90f882ac89e6aaf3419db89e6f890797f37700
|
|
|
21ab4e |
BUG: 1450904
|
|
|
21ab4e |
Signed-off-by: Poornima G <pgurusid@redhat.com>
|
|
|
21ab4e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/106935
|
|
|
21ab4e |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
21ab4e |
---
|
|
|
21ab4e |
libglusterfs/src/xlator.c | 15 +++++++++++++++
|
|
|
21ab4e |
libglusterfs/src/xlator.h | 1 +
|
|
|
21ab4e |
tests/bugs/nl-cache/bug-1451588.t | 25 +++++++++++++++++++++++++
|
|
|
21ab4e |
xlators/performance/nl-cache/src/nl-cache.c | 11 +++++++----
|
|
|
21ab4e |
4 files changed, 48 insertions(+), 4 deletions(-)
|
|
|
21ab4e |
create mode 100755 tests/bugs/nl-cache/bug-1451588.t
|
|
|
21ab4e |
|
|
|
21ab4e |
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
|
|
|
21ab4e |
index 6e3ff51..dc5cfaa 100644
|
|
|
21ab4e |
--- a/libglusterfs/src/xlator.c
|
|
|
21ab4e |
+++ b/libglusterfs/src/xlator.c
|
|
|
21ab4e |
@@ -1011,6 +1011,21 @@ out:
|
|
|
21ab4e |
return ret;
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+gf_boolean_t
|
|
|
21ab4e |
+loc_is_nameless (loc_t *loc)
|
|
|
21ab4e |
+{
|
|
|
21ab4e |
+ gf_boolean_t ret = _gf_false;
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ GF_VALIDATE_OR_GOTO ("xlator", loc, out);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ if ((!loc->parent && gf_uuid_is_null (loc->pargfid)) || !loc->name)
|
|
|
21ab4e |
+ ret = _gf_true;
|
|
|
21ab4e |
+out:
|
|
|
21ab4e |
+ return ret;
|
|
|
21ab4e |
+}
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+
|
|
|
21ab4e |
int
|
|
|
21ab4e |
xlator_destroy (xlator_t *xl)
|
|
|
21ab4e |
{
|
|
|
21ab4e |
diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h
|
|
|
21ab4e |
index c5b0516..508146f 100644
|
|
|
21ab4e |
--- a/libglusterfs/src/xlator.h
|
|
|
21ab4e |
+++ b/libglusterfs/src/xlator.h
|
|
|
21ab4e |
@@ -1026,6 +1026,7 @@ void loc_pargfid (loc_t *loc, uuid_t pargfid);
|
|
|
21ab4e |
char* loc_gfid_utoa (loc_t *loc);
|
|
|
21ab4e |
gf_boolean_t loc_is_root (loc_t *loc);
|
|
|
21ab4e |
int32_t loc_build_child (loc_t *child, loc_t *parent, char *name);
|
|
|
21ab4e |
+gf_boolean_t loc_is_nameless (loc_t *loc);
|
|
|
21ab4e |
int xlator_mem_acct_init (xlator_t *xl, int num_types);
|
|
|
21ab4e |
int is_gf_log_command (xlator_t *trans, const char *name, char *value);
|
|
|
21ab4e |
int glusterd_check_log_level (const char *value);
|
|
|
21ab4e |
diff --git a/tests/bugs/nl-cache/bug-1451588.t b/tests/bugs/nl-cache/bug-1451588.t
|
|
|
21ab4e |
new file mode 100755
|
|
|
21ab4e |
index 0000000..cf07d04
|
|
|
21ab4e |
--- /dev/null
|
|
|
21ab4e |
+++ b/tests/bugs/nl-cache/bug-1451588.t
|
|
|
21ab4e |
@@ -0,0 +1,25 @@
|
|
|
21ab4e |
+#!/bin/bash
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+. $(dirname $0)/../../include.rc
|
|
|
21ab4e |
+. $(dirname $0)/../../volume.rc
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+cleanup;
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+TEST glusterd
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+TEST $CLI volume create $V0 $H0:$B0/${V0}{0..4}
|
|
|
21ab4e |
+EXPECT 'Created' volinfo_field $V0 'Status'
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+TEST $CLI volume set $V0 performance.nl-cache on
|
|
|
21ab4e |
+TEST $CLI volume set $V0 features.cache-invalidation on
|
|
|
21ab4e |
+TEST $CLI volume set $V0 features.cache-invalidation-timeout 600
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+TEST $CLI volume start $V0;
|
|
|
21ab4e |
+EXPECT 'Started' volinfo_field $V0 'Status';
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+TEST glusterfs --volfile-id=/$V0 --aux-gfid-mount --volfile-server=$H0 $M0
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+TEST ! stat $M0/.gfid/1901b1a0-c612-46ee-b45a-e8345d5a0b48
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+cleanup;
|
|
|
21ab4e |
+G_TESTDEF_TEST_STATUS_NETBSD7=BAD_TEST,BUG=000000
|
|
|
21ab4e |
diff --git a/xlators/performance/nl-cache/src/nl-cache.c b/xlators/performance/nl-cache/src/nl-cache.c
|
|
|
21ab4e |
index 26c09d7..8a130dc 100644
|
|
|
21ab4e |
--- a/xlators/performance/nl-cache/src/nl-cache.c
|
|
|
21ab4e |
+++ b/xlators/performance/nl-cache/src/nl-cache.c
|
|
|
21ab4e |
@@ -198,6 +198,8 @@ nlc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
21ab4e |
local = frame->local;
|
|
|
21ab4e |
conf = this->private;
|
|
|
21ab4e |
|
|
|
21ab4e |
+ GF_VALIDATE_OR_GOTO (this->name, local, out);
|
|
|
21ab4e |
+
|
|
|
21ab4e |
/* Donot add to pe, this may lead to duplicate entry and
|
|
|
21ab4e |
* requires search before adding if list of strings */
|
|
|
21ab4e |
if (op_ret < 0 && op_errno == ENOENT) {
|
|
|
21ab4e |
@@ -205,8 +207,9 @@ nlc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
21ab4e |
GF_ATOMIC_INC (conf->nlc_counter.nlc_miss);
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
+out:
|
|
|
21ab4e |
NLC_STACK_UNWIND (lookup, frame, op_ret, op_errno, inode, buf, xdata,
|
|
|
21ab4e |
- postparent);
|
|
|
21ab4e |
+ postparent);
|
|
|
21ab4e |
return 0;
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
@@ -218,15 +221,15 @@ nlc_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
|
|
|
21ab4e |
nlc_conf_t *conf = NULL;
|
|
|
21ab4e |
inode_t *inode = NULL;
|
|
|
21ab4e |
|
|
|
21ab4e |
+ if (loc_is_nameless (loc))
|
|
|
21ab4e |
+ goto wind;
|
|
|
21ab4e |
+
|
|
|
21ab4e |
local = nlc_local_init (frame, this, GF_FOP_LOOKUP, loc, NULL);
|
|
|
21ab4e |
if (!local)
|
|
|
21ab4e |
goto err;
|
|
|
21ab4e |
|
|
|
21ab4e |
conf = this->private;
|
|
|
21ab4e |
|
|
|
21ab4e |
- if ((!loc->parent && gf_uuid_is_null (loc->pargfid)) || !loc->name)
|
|
|
21ab4e |
- goto wind;
|
|
|
21ab4e |
-
|
|
|
21ab4e |
inode = inode_grep (loc->inode->table, loc->parent, loc->name);
|
|
|
21ab4e |
if (inode) {
|
|
|
21ab4e |
inode_unref (inode);
|
|
|
21ab4e |
--
|
|
|
21ab4e |
1.8.3.1
|
|
|
21ab4e |
|