summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src
diff options
context:
space:
mode:
authorMohammed Rafi KC <rkavunga@redhat.com>2016-01-12 12:54:42 +0530
committerDan Lambright <dlambrig@redhat.com>2016-02-22 06:45:32 -0800
commitad715122329d06d73a215c97ceb6221c31c09f7c (patch)
tree96ee95e0a2aaeeb309b6313f0367ea0ca97960c4 /libglusterfs/src
parentebe15f0d4371fa957d1342dd125443898cb14376 (diff)
fuse: send lookup if inode_ctx is not set
During resolving of an entry or inode, if inode ctx was not set, we will send a lookup. This patch also make sure that inode_ctx will be created after every inode_link Back port of> >Change-Id: I4211533ca96a51b89d9f010fc57133470e52dc11 >BUG: 1297311 >Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> >Reviewed-on: http://review.gluster.org/13225 >Reviewed-by: Dan Lambright <dlambrig@redhat.com> Change-Id: I53d7f77b5b9a9e095aeeccdd3605dcce7eade0b2 BUG: 1306131 Tested-by: Dan Lambright <dlambrig@redhat.com> Reviewed-on: http://review.gluster.org/13416 Smoke: Gluster Build System <jenkins@build.gluster.com> Tested-by: mohammed rafi kc <rkavunga@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'libglusterfs/src')
-rw-r--r--libglusterfs/src/inode.c18
-rw-r--r--libglusterfs/src/inode.h3
2 files changed, 17 insertions, 4 deletions
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index 7f717535f39..6c3d6e13093 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -1850,7 +1850,7 @@ out:
void
inode_set_need_lookup (inode_t *inode, xlator_t *this)
{
- uint64_t need_lookup = 1;
+ uint64_t need_lookup = LOOKUP_NEEDED;
if (!inode | !this)
return;
@@ -1860,19 +1860,29 @@ inode_set_need_lookup (inode_t *inode, xlator_t *this)
return;
}
+/* Function behaviour:
+ * Function return true if inode_ctx is not present,
+ * or value stored in inode_ctx is LOOKUP_NEEDED.
+ * If inode_ctx value is LOOKUP_NOT_NEEDED, which means
+ * inode_ctx is present for xlator this, but no lookup
+ * needed.
+ */
gf_boolean_t
inode_needs_lookup (inode_t *inode, xlator_t *this)
{
uint64_t need_lookup = 0;
gf_boolean_t ret = _gf_false;
+ int op_ret = -1;
if (!inode || !this)
return ret;
- inode_ctx_get (inode, this, &need_lookup);
- if (need_lookup) {
+ op_ret = inode_ctx_get (inode, this, &need_lookup);
+ if (op_ret == -1) {
+ ret = _gf_true;
+ } else if (need_lookup == LOOKUP_NEEDED) {
ret = _gf_true;
- need_lookup = 0;
+ need_lookup = LOOKUP_NOT_NEEDED;
inode_ctx_set (inode, this, &need_lookup);
}
diff --git a/libglusterfs/src/inode.h b/libglusterfs/src/inode.h
index 96025b9ec43..1a714c64ce5 100644
--- a/libglusterfs/src/inode.h
+++ b/libglusterfs/src/inode.h
@@ -19,6 +19,9 @@
#include <stdint.h>
#include <sys/types.h>
+#define LOOKUP_NEEDED 1
+#define LOOKUP_NOT_NEEDED 2
+
#define DEFAULT_INODE_MEMPOOL_ENTRIES 32 * 1024
#define INODE_PATH_FMT "<gfid:%s>"
struct _inode_table;