Commit 2dffdc07 authored by Guoqing Jiang's avatar Guoqing Jiang Committed by Shaohua Li

md-cluster: fix potential lock issue in add_new_disk

The add_new_disk returns with communication locked if
__sendmsg returns failure, fix it with call unlock_comm
before return.
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
CC: Goldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: default avatarGuoqing Jiang <gqjiang@suse.com>
Signed-off-by: default avatarShaohua Li <shli@fb.com>
parent 08332893
...@@ -1311,8 +1311,10 @@ static int add_new_disk(struct mddev *mddev, struct md_rdev *rdev) ...@@ -1311,8 +1311,10 @@ static int add_new_disk(struct mddev *mddev, struct md_rdev *rdev)
cmsg.raid_slot = cpu_to_le32(rdev->desc_nr); cmsg.raid_slot = cpu_to_le32(rdev->desc_nr);
lock_comm(cinfo, 1); lock_comm(cinfo, 1);
ret = __sendmsg(cinfo, &cmsg); ret = __sendmsg(cinfo, &cmsg);
if (ret) if (ret) {
unlock_comm(cinfo);
return ret; return ret;
}
cinfo->no_new_dev_lockres->flags |= DLM_LKF_NOQUEUE; cinfo->no_new_dev_lockres->flags |= DLM_LKF_NOQUEUE;
ret = dlm_lock_sync(cinfo->no_new_dev_lockres, DLM_LOCK_EX); ret = dlm_lock_sync(cinfo->no_new_dev_lockres, DLM_LOCK_EX);
cinfo->no_new_dev_lockres->flags &= ~DLM_LKF_NOQUEUE; cinfo->no_new_dev_lockres->flags &= ~DLM_LKF_NOQUEUE;
......
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