示例#1
0
文件: rcom.c 项目: daodaoliang/miwifi
void dlm_receive_rcom(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid)
{
    int lock_size = sizeof(struct dlm_rcom) + sizeof(struct rcom_lock);

    if (dlm_recovery_stopped(ls) && (rc->rc_type != DLM_RCOM_STATUS)) {
        log_debug(ls, "ignoring recovery message %x from %d",
                  rc->rc_type, nodeid);
        goto out;
    }

    if (is_old_reply(ls, rc))
        goto out;

    switch (rc->rc_type) {
    case DLM_RCOM_STATUS:
        receive_rcom_status(ls, rc);
        break;

    case DLM_RCOM_NAMES:
        receive_rcom_names(ls, rc);
        break;

    case DLM_RCOM_LOOKUP:
        receive_rcom_lookup(ls, rc);
        break;

    case DLM_RCOM_LOCK:
        if (rc->rc_header.h_length < lock_size)
            goto Eshort;
        receive_rcom_lock(ls, rc);
        break;

    case DLM_RCOM_STATUS_REPLY:
        receive_sync_reply(ls, rc);
        break;

    case DLM_RCOM_NAMES_REPLY:
        receive_sync_reply(ls, rc);
        break;

    case DLM_RCOM_LOOKUP_REPLY:
        receive_rcom_lookup_reply(ls, rc);
        break;

    case DLM_RCOM_LOCK_REPLY:
        if (rc->rc_header.h_length < lock_size)
            goto Eshort;
        dlm_recover_process_copy(ls, rc);
        break;

    default:
        log_error(ls, "receive_rcom bad type %d", rc->rc_type);
    }
out:
    return;
Eshort:
    log_error(ls, "recovery message %x from %d is too short",
              rc->rc_type, nodeid);
}
示例#2
0
void dlm_receive_rcom(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid)
{
    if (dlm_recovery_stopped(ls) && (rc->rc_type != DLM_RCOM_STATUS)) {
        log_debug(ls, "ignoring recovery message %x from %d",
                  rc->rc_type, nodeid);
        goto out;
    }

    if (is_old_reply(ls, rc))
        goto out;

    switch (rc->rc_type) {
    case DLM_RCOM_STATUS:
        receive_rcom_status(ls, rc);
        break;

    case DLM_RCOM_NAMES:
        receive_rcom_names(ls, rc);
        break;

    case DLM_RCOM_LOOKUP:
        receive_rcom_lookup(ls, rc);
        break;

    case DLM_RCOM_LOCK:
        receive_rcom_lock(ls, rc);
        break;

    case DLM_RCOM_STATUS_REPLY:
        receive_rcom_status_reply(ls, rc);
        break;

    case DLM_RCOM_NAMES_REPLY:
        receive_rcom_names_reply(ls, rc);
        break;

    case DLM_RCOM_LOOKUP_REPLY:
        receive_rcom_lookup_reply(ls, rc);
        break;

    case DLM_RCOM_LOCK_REPLY:
        receive_rcom_lock_reply(ls, rc);
        break;

    default:
        DLM_ASSERT(0, printk("rc_type=%x\n", rc->rc_type););
    }
示例#3
0
void dlm_receive_rcom(struct dlm_header *hd, int nodeid)
{
	struct dlm_rcom *rc = (struct dlm_rcom *) hd;
	struct dlm_ls *ls;

	dlm_rcom_in(rc);

	/* If the lockspace doesn't exist then still send a status message
	   back; it's possible that it just doesn't have its global_id yet. */

	ls = dlm_find_lockspace_global(hd->h_lockspace);
	if (!ls) {
		log_print("lockspace %x from %d type %x not found",
			  hd->h_lockspace, nodeid, rc->rc_type);
		if (rc->rc_type == DLM_RCOM_STATUS)
			send_ls_not_ready(nodeid, rc);
		return;
	}

	if (dlm_recovery_stopped(ls) && (rc->rc_type != DLM_RCOM_STATUS)) {
		log_debug(ls, "ignoring recovery message %x from %d",
			  rc->rc_type, nodeid);
		goto out;
	}

	if (is_old_reply(ls, rc))
		goto out;

	if (nodeid != rc->rc_header.h_nodeid) {
		log_error(ls, "bad rcom nodeid %d from %d",
			  rc->rc_header.h_nodeid, nodeid);
		goto out;
	}

	switch (rc->rc_type) {
	case DLM_RCOM_STATUS:
		receive_rcom_status(ls, rc);
		break;

	case DLM_RCOM_NAMES:
		receive_rcom_names(ls, rc);
		break;

	case DLM_RCOM_LOOKUP:
		receive_rcom_lookup(ls, rc);
		break;

	case DLM_RCOM_LOCK:
		receive_rcom_lock(ls, rc);
		break;

	case DLM_RCOM_STATUS_REPLY:
		receive_rcom_status_reply(ls, rc);
		break;

	case DLM_RCOM_NAMES_REPLY:
		receive_rcom_names_reply(ls, rc);
		break;

	case DLM_RCOM_LOOKUP_REPLY:
		receive_rcom_lookup_reply(ls, rc);
		break;

	case DLM_RCOM_LOCK_REPLY:
		receive_rcom_lock_reply(ls, rc);
		break;

	default:
		DLM_ASSERT(0, printk("rc_type=%x\n", rc->rc_type););
	}