Commit 400cb454 authored by Guoqing Jiang's avatar Guoqing Jiang Committed by Shaohua Li

md-cluster: use FORCEUNLOCK in lockres_free

For dlm_unlock, we need to pass flag to dlm_unlock as the
third parameter instead of set res->flags.

Also, DLM_LKF_FORCEUNLOCK is more suitable for dlm_unlock
since it works even the lock is on waiting or convert queue.
Acked-by: default avatarNeilBrown <neilb@suse.com>
Signed-off-by: default avatarGuoqing Jiang <gqjiang@suse.com>
Signed-off-by: default avatarShaohua Li <shli@fb.com>
parent e566aef1
...@@ -194,25 +194,21 @@ static struct dlm_lock_resource *lockres_init(struct mddev *mddev, ...@@ -194,25 +194,21 @@ static struct dlm_lock_resource *lockres_init(struct mddev *mddev,
static void lockres_free(struct dlm_lock_resource *res) static void lockres_free(struct dlm_lock_resource *res)
{ {
int ret; int ret = 0;
if (!res) if (!res)
return; return;
/* cancel a lock request or a conversion request that is blocked */ /*
res->flags |= DLM_LKF_CANCEL; * use FORCEUNLOCK flag, so we can unlock even the lock is on the
retry: * waiting or convert queue
ret = dlm_unlock(res->ls, res->lksb.sb_lkid, 0, &res->lksb, res); */
if (unlikely(ret != 0)) { ret = dlm_unlock(res->ls, res->lksb.sb_lkid, DLM_LKF_FORCEUNLOCK,
pr_info("%s: failed to unlock %s return %d\n", __func__, res->name, ret); &res->lksb, res);
if (unlikely(ret != 0))
/* if a lock conversion is cancelled, then the lock is put pr_err("failed to unlock %s return %d\n", res->name, ret);
* back to grant queue, need to ensure it is unlocked */ else
if (ret == -DLM_ECANCEL) wait_for_completion(&res->completion);
goto retry;
}
res->flags &= ~DLM_LKF_CANCEL;
wait_for_completion(&res->completion);
kfree(res->name); kfree(res->name);
kfree(res->lksb.sb_lvbptr); kfree(res->lksb.sb_lvbptr);
......
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