summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2019-02-09 13:13:47 +0530
committerAmar Tumballi <amarts@redhat.com>2019-02-11 14:59:52 +0530
commit59ce06a73f15897acf5c712ac5073650c1b505bf (patch)
tree63870c5b4a5564a590c85ee02ad2f99448f9553e /libglusterfs
parent261147620a43aa415b7e8f11d51a89557846b1c4 (diff)
inode: create inode outside locked region
Only linking of inode to the table, and inserting it in a list needs to be in locked region. Updates: bz#1670031 Change-Id: I6ea7e956b80cf2765c2233d761909c4bf9c7253c Signed-off-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/inode.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index 87f74e09f1d..418ebb74577 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -705,6 +705,7 @@ __dentry_create(inode_t *inode, inode_t *parent, const char *name)
newd->parent = __inode_ref(parent, false);
list_add(&newd->inode_list, &inode->dentry_list);
+
newd->inode = inode;
out:
@@ -712,7 +713,7 @@ out:
}
static inode_t *
-__inode_create(inode_table_t *table)
+inode_create(inode_table_t *table)
{
inode_t *newi = NULL;
@@ -747,11 +748,7 @@ __inode_create(inode_table_t *table)
goto out;
}
- list_add(&newi->list, &table->lru);
- table->lru_size++;
-
out:
-
return newi;
}
@@ -768,14 +765,16 @@ inode_new(inode_table_t *table)
return NULL;
}
- pthread_mutex_lock(&table->lock);
- {
- inode = __inode_create(table);
- if (inode != NULL) {
+ inode = inode_create(table);
+ if (inode) {
+ pthread_mutex_lock(&table->lock);
+ {
+ list_add(&inode->list, &table->lru);
+ table->lru_size++;
__inode_ref(inode, false);
}
+ pthread_mutex_unlock(&table->lock);
}
- pthread_mutex_unlock(&table->lock);
return inode;
}
@@ -1695,7 +1694,10 @@ __inode_table_init_root(inode_table_t *table)
if (!table)
return;
- root = __inode_create(table);
+ root = inode_create(table);
+
+ list_add(&root->list, &table->lru);
+ table->lru_size++;
iatt.ia_gfid[15] = 1;
iatt.ia_ino = 1;