From d10c5375b33520f36fd6acbd47b617d43f529ca2 Mon Sep 17 00:00:00 2001 From: Poornima G Date: Wed, 15 Feb 2017 11:18:31 +0530 Subject: libglusterfs: Fix a crash due to race between inode_ctx_set and inode_ref Issue: Currently inode ref count is guarded by inode_table->lock, and inode_ctx is guarded by inode->lock. With the new patch [1] inode_ref was modified to change the inode_ctx to track the ref count per xlator. Thus inode_ref performed under inode_table->lock is modifying inode_ctx which has to be modified only under inode->lock Solution: When a inode is created, inode_ctx holder is allocated for all the xlators. Hence in case of inode_ctx_set instead of using the first free index in inode ctx holder, we can have predecided index for every xlator in the graph. Credits Pranith K [1] http://review.gluster.org/13736 > Reviewed-on: https://review.gluster.org/16622 > Smoke: Gluster Build System > NetBSD-regression: NetBSD Build System > Reviewed-by: Niels de Vos > CentOS-regression: Gluster Build System > Reviewed-by: Pranith Kumar Karampuri Change-Id: I1bfe111c211fcc4fcd761bba01dc87c4c69b5170 BUG: 1423385 Signed-off-by: Poornima G Reviewed-on: https://review.gluster.org/16655 NetBSD-regression: NetBSD Build System Smoke: Gluster Build System CentOS-regression: Gluster Build System Reviewed-by: Shyamsundar Ranganathan --- libglusterfs/src/graph.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libglusterfs/src/graph.c') diff --git a/libglusterfs/src/graph.c b/libglusterfs/src/graph.c index 47f473a580f..0c7d6cf6101 100644 --- a/libglusterfs/src/graph.c +++ b/libglusterfs/src/graph.c @@ -111,6 +111,7 @@ glusterfs_graph_set_first (glusterfs_graph_t *graph, xlator_t *xl) graph->first = xl; graph->xl_count++; + xl->xl_id = graph->xl_count; } -- cgit