Commit b83d51c0 authored by Guoqing Jiang's avatar Guoqing Jiang Committed by NeilBrown

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: default avatarGoldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: default avatarGuoqing Jiang <gqjiang@suse.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.com>
parent 66099bb0
...@@ -100,7 +100,6 @@ static int dlm_lock_sync(struct dlm_lock_resource *res, int mode) ...@@ -100,7 +100,6 @@ static int dlm_lock_sync(struct dlm_lock_resource *res, int mode)
{ {
int ret = 0; int ret = 0;
init_completion(&res->completion);
ret = dlm_lock(res->ls, mode, &res->lksb, ret = dlm_lock(res->ls, mode, &res->lksb,
res->flags, res->name, strlen(res->name), res->flags, res->name, strlen(res->name),
0, sync_ast, res, res->bast); 0, sync_ast, res, res->bast);
...@@ -125,6 +124,7 @@ static struct dlm_lock_resource *lockres_init(struct mddev *mddev, ...@@ -125,6 +124,7 @@ static struct dlm_lock_resource *lockres_init(struct mddev *mddev,
res = kzalloc(sizeof(struct dlm_lock_resource), GFP_KERNEL); res = kzalloc(sizeof(struct dlm_lock_resource), GFP_KERNEL);
if (!res) if (!res)
return NULL; return NULL;
init_completion(&res->completion);
res->ls = cinfo->lockspace; res->ls = cinfo->lockspace;
res->mddev = mddev; res->mddev = mddev;
namelen = strlen(name); namelen = strlen(name);
...@@ -169,7 +169,6 @@ static void lockres_free(struct dlm_lock_resource *res) ...@@ -169,7 +169,6 @@ static void lockres_free(struct dlm_lock_resource *res)
if (!res) if (!res)
return; return;
init_completion(&res->completion);
dlm_unlock(res->ls, res->lksb.sb_lkid, 0, &res->lksb, res); dlm_unlock(res->ls, res->lksb.sb_lkid, 0, &res->lksb, res);
wait_for_completion(&res->completion); wait_for_completion(&res->completion);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment