md-cluster: check the return value of process_recvd_msg
We don't need to run the full path of recv_daemon if process_recvd_msg doesn't return 0. Reviewed-by: NeilBrown <neilb@suse.com> Signed-off-by: Guoqing Jiang <gqjiang@suse.com> Signed-off-by: Shaohua Li <shli@fb.com>
This commit is contained in:
parent
51e453aecb
commit
1fa9a1ad0a
|
@ -520,11 +520,13 @@ static void process_readd_disk(struct mddev *mddev, struct cluster_msg *msg)
|
||||||
__func__, __LINE__, le32_to_cpu(msg->raid_slot));
|
__func__, __LINE__, le32_to_cpu(msg->raid_slot));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void process_recvd_msg(struct mddev *mddev, struct cluster_msg *msg)
|
static int process_recvd_msg(struct mddev *mddev, struct cluster_msg *msg)
|
||||||
{
|
{
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
if (WARN(mddev->cluster_info->slot_number - 1 == le32_to_cpu(msg->slot),
|
if (WARN(mddev->cluster_info->slot_number - 1 == le32_to_cpu(msg->slot),
|
||||||
"node %d received it's own msg\n", le32_to_cpu(msg->slot)))
|
"node %d received it's own msg\n", le32_to_cpu(msg->slot)))
|
||||||
return;
|
return -1;
|
||||||
switch (le32_to_cpu(msg->type)) {
|
switch (le32_to_cpu(msg->type)) {
|
||||||
case METADATA_UPDATED:
|
case METADATA_UPDATED:
|
||||||
process_metadata_update(mddev, msg);
|
process_metadata_update(mddev, msg);
|
||||||
|
@ -547,9 +549,11 @@ static void process_recvd_msg(struct mddev *mddev, struct cluster_msg *msg)
|
||||||
__recover_slot(mddev, le32_to_cpu(msg->slot));
|
__recover_slot(mddev, le32_to_cpu(msg->slot));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
ret = -1;
|
||||||
pr_warn("%s:%d Received unknown message from %d\n",
|
pr_warn("%s:%d Received unknown message from %d\n",
|
||||||
__func__, __LINE__, msg->slot);
|
__func__, __LINE__, msg->slot);
|
||||||
}
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -573,7 +577,9 @@ static void recv_daemon(struct md_thread *thread)
|
||||||
|
|
||||||
/* read lvb and wake up thread to process this message_lockres */
|
/* read lvb and wake up thread to process this message_lockres */
|
||||||
memcpy(&msg, message_lockres->lksb.sb_lvbptr, sizeof(struct cluster_msg));
|
memcpy(&msg, message_lockres->lksb.sb_lvbptr, sizeof(struct cluster_msg));
|
||||||
process_recvd_msg(thread->mddev, &msg);
|
ret = process_recvd_msg(thread->mddev, &msg);
|
||||||
|
if (ret)
|
||||||
|
goto out;
|
||||||
|
|
||||||
/*release CR on ack_lockres*/
|
/*release CR on ack_lockres*/
|
||||||
ret = dlm_unlock_sync(ack_lockres);
|
ret = dlm_unlock_sync(ack_lockres);
|
||||||
|
@ -587,6 +593,7 @@ static void recv_daemon(struct md_thread *thread)
|
||||||
ret = dlm_lock_sync(ack_lockres, DLM_LOCK_CR);
|
ret = dlm_lock_sync(ack_lockres, DLM_LOCK_CR);
|
||||||
if (unlikely(ret != 0))
|
if (unlikely(ret != 0))
|
||||||
pr_info("lock CR on ack failed return %d\n", ret);
|
pr_info("lock CR on ack failed return %d\n", ret);
|
||||||
|
out:
|
||||||
/*release CR on message_lockres*/
|
/*release CR on message_lockres*/
|
||||||
ret = dlm_unlock_sync(message_lockres);
|
ret = dlm_unlock_sync(message_lockres);
|
||||||
if (unlikely(ret != 0))
|
if (unlikely(ret != 0))
|
||||||
|
|
Loading…
Reference in New Issue