summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorGuoqing Jiang <gqjiang@suse.com>2015-07-10 11:01:16 +0200
committerNeilBrown <neilb@suse.com>2015-08-31 19:41:50 +0200
commitb83d51c0785c34d552111f38fbecbe00cd58b913 (patch)
tree5566c39f667a1b87db1b22a16aa0ed3d0dec16ca /drivers/md
parentmd-cluster: fix deadlock issue on message lock (diff)
downloadlinux-b83d51c0785c34d552111f38fbecbe00cd58b913.tar.xz
linux-b83d51c0785c34d552111f38fbecbe00cd58b913.zip
md-cluster: init completion within lockres_init
We should init completion within lockres_init, otherwise completion could be initialized more than one time during it's life cycle. Reviewed-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: NeilBrown <neilb@suse.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md-cluster.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index 85b7836fb4b5..2a57f193b103 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -100,7 +100,6 @@ static int dlm_lock_sync(struct dlm_lock_resource *res, int mode)
{
int ret = 0;
- init_completion(&res->completion);
ret = dlm_lock(res->ls, mode, &res->lksb,
res->flags, res->name, strlen(res->name),
0, sync_ast, res, res->bast);
@@ -125,6 +124,7 @@ static struct dlm_lock_resource *lockres_init(struct mddev *mddev,
res = kzalloc(sizeof(struct dlm_lock_resource), GFP_KERNEL);
if (!res)
return NULL;
+ init_completion(&res->completion);
res->ls = cinfo->lockspace;
res->mddev = mddev;
namelen = strlen(name);
@@ -169,7 +169,6 @@ static void lockres_free(struct dlm_lock_resource *res)
if (!res)
return;
- init_completion(&res->completion);
dlm_unlock(res->ls, res->lksb.sb_lkid, 0, &res->lksb, res);
wait_for_completion(&res->completion);