From 8f60396bc8ce91dff57d64ae7ce56afb7f7626b1 Mon Sep 17 00:00:00 2001 From: Rajesh Joseph Date: Mon, 14 Nov 2016 15:40:32 +0530 Subject: libglusterfs:Now mempool is added to ctx pool list under a lock mempool is added to ctx pool list without any lock. This can cause undefined behaviour in case of multithreaded environment. Fix: modify the list only under ctx->lock > Reviewed-on: http://review.gluster.org/15842 > NetBSD-regression: NetBSD Build System > Smoke: Gluster Build System > CentOS-regression: Gluster Build System > Reviewed-by: Raghavendra Talur > Reviewed-by: Shyamsundar Ranganathan > Reviewed-by: Poornima G > Reviewed-by: Niels de Vos (cherry picked from commit 277008a3a8583ef10cec9e4182960792e56c5c10) Change-Id: I7bdbb3db48a899bb0e41427e149b13c0facaedba Signed-off-by: Rajesh Joseph BUG: 1397663 Reviewed-on: http://review.gluster.org/15909 Smoke: Gluster Build System Reviewed-by: Poornima G NetBSD-regression: NetBSD Build System Reviewed-by: Manikandan Selvaganesh CentOS-regression: Gluster Build System Reviewed-by: Raghavendra Talur --- api/src/glfs.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'api/src/glfs.c') diff --git a/api/src/glfs.c b/api/src/glfs.c index f7e271208ec..1c6ac75b694 100644 --- a/api/src/glfs.c +++ b/api/src/glfs.c @@ -149,8 +149,6 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx) LOCK_INIT (&pool->lock); ctx->pool = pool; - LOCK_INIT (&ctx->lock); - ret = 0; err: if (ret && pool) { -- cgit From 1d03b1b6b48e4ee9260852b35ec827f203e2287c Mon Sep 17 00:00:00 2001 From: Rajesh Joseph Date: Tue, 22 Nov 2016 22:25:42 +0530 Subject: gfapi: glfs_subvol_done should NOT wait for graph migration. In graph_setup function glfs_subvol_done is called which is executed in an epoll thread. glfs_lock waits on other thread to finish graph migration. This can lead to dead lock if we consume all the epoll threads. In general any call-back function executed in epoll thread should not call any blocking call which waits on a network reply either directly or indirectly, e.g. syncop functions should not be called in these threads. As a fix we should not wait for migration in the call-back path. > Reviewed-on: http://review.gluster.org/15913 > NetBSD-regression: NetBSD Build System > Smoke: Gluster Build System > Reviewed-by: Niels de Vos > CentOS-regression: Gluster Build System (cherry picked from commit 17d10b42fc4041442e6cd0bfda45944edea498c6) Change-Id: If96d0689fe1b4d74631e383048cdc30b01690dc2 BUG: 1399915 Signed-off-by: Rajesh Joseph Reviewed-on: http://review.gluster.org/15977 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Shyamsundar Ranganathan Reviewed-by: Niels de Vos --- api/src/glfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'api/src/glfs.c') diff --git a/api/src/glfs.c b/api/src/glfs.c index 1c6ac75b694..2ec319fe3e6 100644 --- a/api/src/glfs.c +++ b/api/src/glfs.c @@ -549,7 +549,7 @@ glfs_fd_destroy (void *data) glfd = (struct glfs_fd *)data; - glfs_lock (glfd->fs); + glfs_lock (glfd->fs, _gf_true); { list_del_init (&glfd->openfds); } @@ -592,7 +592,7 @@ glfs_fd_bind (struct glfs_fd *glfd) fs = glfd->fs; - glfs_lock (fs); + glfs_lock (fs, _gf_true); { list_add_tail (&glfd->openfds, &fs->openfds); } @@ -882,7 +882,7 @@ glfs_init_wait (struct glfs *fs) int ret = -1; /* Always a top-down call, use glfs_lock() */ - glfs_lock (fs); + glfs_lock (fs, _gf_true); { while (!fs->init) pthread_cond_wait (&fs->cond, @@ -1256,7 +1256,7 @@ pub_glfs_get_volfile (struct glfs *fs, void *buf, size_t len) DECLARE_OLD_THIS; __GLFS_ENTRY_VALIDATE_FS (fs, invalid_fs); - glfs_lock(fs); + glfs_lock(fs, _gf_true); if (len >= fs->oldvollen) { gf_msg_trace ("glfs", 0, "copying %zu to %p", len, buf); memcpy(buf,fs->oldvolfile,len); -- cgit