summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorRaghavendra G <rgowdapp@redhat.com>2018-06-27 14:51:37 +0530
committerRaghavendra G <rgowdapp@redhat.com>2018-07-28 15:42:34 +0000
commit4d3c62e71f3250f10aa0344085a5ec2d45458d5c (patch)
treebd5dda8ae916cfca4936520495276c355041d211 /libglusterfs
parent379d4279601f694465cc7eaffcb737410d5d9e31 (diff)
performance/write-behind: better invalidation in readdirp
Current invalidation of stats in wb_readdirp_cbk is prone to races. As the deleted comment explains, <snip> We cannot guarantee integrity of entry->d_stat as there are cached writes. The stat is most likely stale as it doesn't account the cached writes. However, checking for non-empty liability list here is not a fool-proof solution as there can be races like, 1. readdirp is successful on posix 2. sync of cached write is successful on posix 3. write-behind received sync response and removed the request from liability queue 4. readdirp response is processed at write-behind. In the above scenario, stat for the file is sent back in readdirp response but it is stale. </snip> Change-Id: I6ce170985cc6ce3df2382ec038dd5415beefded5 Signed-off-by: Raghavendra G <rgowdapp@redhat.com> Updates: bz#1512691
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/inode.c7
-rw-r--r--libglusterfs/src/inode.h2
2 files changed, 8 insertions, 1 deletions
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index 6b29749e933..b8f1539b2f4 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -132,6 +132,7 @@ __dentry_unset (dentry_t *dentry)
__dentry_unhash (dentry);
list_del_init (&dentry->inode_list);
+ list_del_init (&dentry->parent_list);
GF_FREE (dentry->name);
dentry->name = NULL;
@@ -141,6 +142,7 @@ __dentry_unset (dentry_t *dentry)
dentry->parent = NULL;
}
+ dentry->inode = NULL;
mem_put (dentry);
}
@@ -604,6 +606,7 @@ __dentry_create (inode_t *inode, inode_t *parent, const char *name)
INIT_LIST_HEAD (&newd->inode_list);
INIT_LIST_HEAD (&newd->hash);
+ INIT_LIST_HEAD (&newd->parent_list);
newd->name = gf_strdup (name);
if (newd->name == NULL) {
@@ -616,8 +619,9 @@ __dentry_create (inode_t *inode, inode_t *parent, const char *name)
newd->parent = __inode_ref (parent);
list_add (&newd->inode_list, &inode->dentry_list);
- newd->inode = inode;
+ list_add (&newd->parent_list, &parent->children);
+ newd->inode = inode;
out:
return newd;
}
@@ -648,6 +652,7 @@ __inode_create (inode_table_t *table)
INIT_LIST_HEAD (&newi->list);
INIT_LIST_HEAD (&newi->hash);
INIT_LIST_HEAD (&newi->dentry_list);
+ INIT_LIST_HEAD (&newi->children);
newi->_ctx = GF_CALLOC (1,
(sizeof (struct _inode_ctx) * table->ctxcount),
diff --git a/libglusterfs/src/inode.h b/libglusterfs/src/inode.h
index 658477700c0..96f67c05629 100644
--- a/libglusterfs/src/inode.h
+++ b/libglusterfs/src/inode.h
@@ -60,6 +60,7 @@ struct _inode_table {
struct _dentry {
struct list_head inode_list; /* list of dentries of inode */
struct list_head hash; /* hash table pointers */
+ struct list_head parent_list; /* list of parent's children */
inode_t *inode; /* inode of this directory entry */
char *name; /* name of the directory entry */
inode_t *parent; /* directory of the entry */
@@ -99,6 +100,7 @@ struct _inode {
struct list_head dentry_list; /* list of directory entries for this inode */
struct list_head hash; /* hash table pointers */
struct list_head list; /* active/lru/purge */
+ struct list_head children; /* list of children */
struct _inode_ctx *_ctx; /* replacement for dict_t *(inode->ctx) */
};