diff options
author | Krishnan Parthasarathi <kparthas@redhat.com> | 2013-04-15 22:07:21 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2013-04-16 10:42:51 -0700 |
commit | dcebed550ebfc878b0b3bd02ab7fe15db6764f81 (patch) | |
tree | 2387f207399a9d3b430a492fdce173d17b92d714 | |
parent | 9eb8fc771b32c0601969537ad7135edd89e49cf9 (diff) |
glusterd: Avoided deadlock in single node cluster, glusterd restart
In a single node cluster, it is possible to deadlock on the "big
lock", while restarting bricks. In glusterd_restart_bricks, we perform a
glusterd_brick_connect, where we release the big lock in anticipation
that glusterd_brick_rpc_notify could run in the same C stack (and
deadlocking). So, in the restart code path, we could unlock before we
have performed a lock on the big lock.
To fix this, we need to take the big lock in the
glusterd_launch_synctask 'thread' as well.
Change-Id: I1abea1ca82b55c784b8a810a8194f254b32b1dcc
BUG: 948686
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/4837
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
-rw-r--r-- | tests/bugs/bug-948686.t | 10 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.c | 3 |
2 files changed, 13 insertions, 0 deletions
diff --git a/tests/bugs/bug-948686.t b/tests/bugs/bug-948686.t index 63c099a79bc..db9c198a96f 100644 --- a/tests/bugs/bug-948686.t +++ b/tests/bugs/bug-948686.t @@ -34,3 +34,13 @@ TEST $CLI_2 volume stop $V0; TEST $CLI_2 volume delete $V0; cleanup; + +TEST glusterd; +TEST $CLI volume create $V0 $H0:$B0/$V0 +TEST $CLI volume start $V0 +pkill glusterd; +pkill glusterfsd; +TEST glusterd +TEST $CLI volume status $V0 + +cleanup; diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index cb5daf4bb3d..41a1cb368f8 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -873,6 +873,8 @@ _install_mount_spec (dict_t *opts, char *key, data_t *value, void *data) static int gd_default_synctask_cbk (int ret, call_frame_t *frame, void *opaque) { + glusterd_conf_t *priv = THIS->private; + synclock_unlock (&priv->big_lock); return ret; } @@ -886,6 +888,7 @@ glusterd_launch_synctask (synctask_fn_t fn, void *opaque) this = THIS; priv = this->private; + synclock_lock (&priv->big_lock); ret = synctask_new (this->ctx->env, fn, gd_default_synctask_cbk, NULL, opaque); if (ret) |