“7c9f8861e6c9c839f913e49b98c3854daca18f27”上不存在“include/uapi/linux/magic.h”
提交 0f6187db 编写于 作者: W Wei Yongjun 提交者: Shaohua Li

md-cluster: fix error return code in join()

Fix to return error code -ENOMEM from the lockres_init() error
handling case instead of 0, as done elsewhere in this function.
Signed-off-by: NWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: NShaohua Li <shli@fb.com>
上级 486b0f7b
...@@ -834,8 +834,10 @@ static int join(struct mddev *mddev, int nodes) ...@@ -834,8 +834,10 @@ static int join(struct mddev *mddev, int nodes)
goto err; goto err;
} }
cinfo->ack_lockres = lockres_init(mddev, "ack", ack_bast, 0); cinfo->ack_lockres = lockres_init(mddev, "ack", ack_bast, 0);
if (!cinfo->ack_lockres) if (!cinfo->ack_lockres) {
ret = -ENOMEM;
goto err; goto err;
}
/* get sync CR lock on ACK. */ /* get sync CR lock on ACK. */
if (dlm_lock_sync(cinfo->ack_lockres, DLM_LOCK_CR)) if (dlm_lock_sync(cinfo->ack_lockres, DLM_LOCK_CR))
pr_err("md-cluster: failed to get a sync CR lock on ACK!(%d)\n", pr_err("md-cluster: failed to get a sync CR lock on ACK!(%d)\n",
...@@ -849,8 +851,10 @@ static int join(struct mddev *mddev, int nodes) ...@@ -849,8 +851,10 @@ static int join(struct mddev *mddev, int nodes)
pr_info("md-cluster: Joined cluster %s slot %d\n", str, cinfo->slot_number); pr_info("md-cluster: Joined cluster %s slot %d\n", str, cinfo->slot_number);
snprintf(str, 64, "bitmap%04d", cinfo->slot_number - 1); snprintf(str, 64, "bitmap%04d", cinfo->slot_number - 1);
cinfo->bitmap_lockres = lockres_init(mddev, str, NULL, 1); cinfo->bitmap_lockres = lockres_init(mddev, str, NULL, 1);
if (!cinfo->bitmap_lockres) if (!cinfo->bitmap_lockres) {
ret = -ENOMEM;
goto err; goto err;
}
if (dlm_lock_sync(cinfo->bitmap_lockres, DLM_LOCK_PW)) { if (dlm_lock_sync(cinfo->bitmap_lockres, DLM_LOCK_PW)) {
pr_err("Failed to get bitmap lock\n"); pr_err("Failed to get bitmap lock\n");
ret = -EINVAL; ret = -EINVAL;
...@@ -858,8 +862,10 @@ static int join(struct mddev *mddev, int nodes) ...@@ -858,8 +862,10 @@ static int join(struct mddev *mddev, int nodes)
} }
cinfo->resync_lockres = lockres_init(mddev, "resync", NULL, 0); cinfo->resync_lockres = lockres_init(mddev, "resync", NULL, 0);
if (!cinfo->resync_lockres) if (!cinfo->resync_lockres) {
ret = -ENOMEM;
goto err; goto err;
}
return 0; return 0;
err: err:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册