lock.c (8b0d8e03f847d9c1677b8a193cd124debbc54633) lock.c (eef7d739c218cb2546cf95686db77de0d76e4122)
1/******************************************************************************
2*******************************************************************************
3**
4** Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved.
5**
6** This copyrighted material is made available to anyone wishing to use,
7** modify, copy, or redistribute it subject to the terms and conditions
8** of the GNU General Public License v.2.

--- 3808 unchanged lines hidden (view full) ---

3817 _receive_message(ls, ms);
3818}
3819
3820/* This is called by the midcomms layer when something is received for
3821 the lockspace. It could be either a MSG (normal message sent as part of
3822 standard locking activity) or an RCOM (recovery message sent as part of
3823 lockspace recovery). */
3824
1/******************************************************************************
2*******************************************************************************
3**
4** Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved.
5**
6** This copyrighted material is made available to anyone wishing to use,
7** modify, copy, or redistribute it subject to the terms and conditions
8** of the GNU General Public License v.2.

--- 3808 unchanged lines hidden (view full) ---

3817 _receive_message(ls, ms);
3818}
3819
3820/* This is called by the midcomms layer when something is received for
3821 the lockspace. It could be either a MSG (normal message sent as part of
3822 standard locking activity) or an RCOM (recovery message sent as part of
3823 lockspace recovery). */
3824
3825void dlm_receive_buffer(struct dlm_header *hd, int nodeid)
3825void dlm_receive_buffer(union dlm_packet *p, int nodeid)
3826{
3826{
3827 struct dlm_message *ms = (struct dlm_message *) hd;
3828 struct dlm_rcom *rc = (struct dlm_rcom *) hd;
3827 struct dlm_header *hd = &p->header;
3829 struct dlm_ls *ls;
3830 int type = 0;
3831
3832 switch (hd->h_cmd) {
3833 case DLM_MSG:
3828 struct dlm_ls *ls;
3829 int type = 0;
3830
3831 switch (hd->h_cmd) {
3832 case DLM_MSG:
3834 dlm_message_in(ms);
3835 type = ms->m_type;
3833 dlm_message_in(&p->message);
3834 type = p->message.m_type;
3836 break;
3837 case DLM_RCOM:
3835 break;
3836 case DLM_RCOM:
3838 dlm_rcom_in(rc);
3839 type = rc->rc_type;
3837 dlm_rcom_in(&p->rcom);
3838 type = p->rcom.rc_type;
3840 break;
3841 default:
3842 log_print("invalid h_cmd %d from %u", hd->h_cmd, nodeid);
3843 return;
3844 }
3845
3846 if (hd->h_nodeid != nodeid) {
3847 log_print("invalid h_nodeid %d from %d lockspace %x",
3848 hd->h_nodeid, nodeid, hd->h_lockspace);
3849 return;
3850 }
3851
3852 ls = dlm_find_lockspace_global(hd->h_lockspace);
3853 if (!ls) {
3854 if (dlm_config.ci_log_debug)
3855 log_print("invalid lockspace %x from %d cmd %d type %d",
3856 hd->h_lockspace, nodeid, hd->h_cmd, type);
3857
3858 if (hd->h_cmd == DLM_RCOM && type == DLM_RCOM_STATUS)
3839 break;
3840 default:
3841 log_print("invalid h_cmd %d from %u", hd->h_cmd, nodeid);
3842 return;
3843 }
3844
3845 if (hd->h_nodeid != nodeid) {
3846 log_print("invalid h_nodeid %d from %d lockspace %x",
3847 hd->h_nodeid, nodeid, hd->h_lockspace);
3848 return;
3849 }
3850
3851 ls = dlm_find_lockspace_global(hd->h_lockspace);
3852 if (!ls) {
3853 if (dlm_config.ci_log_debug)
3854 log_print("invalid lockspace %x from %d cmd %d type %d",
3855 hd->h_lockspace, nodeid, hd->h_cmd, type);
3856
3857 if (hd->h_cmd == DLM_RCOM && type == DLM_RCOM_STATUS)
3859 dlm_send_ls_not_ready(nodeid, rc);
3858 dlm_send_ls_not_ready(nodeid, &p->rcom);
3860 return;
3861 }
3862
3863 /* this rwsem allows dlm_ls_stop() to wait for all dlm_recv threads to
3864 be inactive (in this ls) before transitioning to recovery mode */
3865
3866 down_read(&ls->ls_recv_active);
3867 if (hd->h_cmd == DLM_MSG)
3859 return;
3860 }
3861
3862 /* this rwsem allows dlm_ls_stop() to wait for all dlm_recv threads to
3863 be inactive (in this ls) before transitioning to recovery mode */
3864
3865 down_read(&ls->ls_recv_active);
3866 if (hd->h_cmd == DLM_MSG)
3868 dlm_receive_message(ls, ms, nodeid);
3867 dlm_receive_message(ls, &p->message, nodeid);
3869 else
3868 else
3870 dlm_receive_rcom(ls, rc, nodeid);
3869 dlm_receive_rcom(ls, &p->rcom, nodeid);
3871 up_read(&ls->ls_recv_active);
3872
3873 dlm_put_lockspace(ls);
3874}
3875
3876static void recover_convert_waiter(struct dlm_ls *ls, struct dlm_lkb *lkb)
3877{
3878 if (middle_conversion(lkb)) {

--- 1005 unchanged lines hidden ---
3870 up_read(&ls->ls_recv_active);
3871
3872 dlm_put_lockspace(ls);
3873}
3874
3875static void recover_convert_waiter(struct dlm_ls *ls, struct dlm_lkb *lkb)
3876{
3877 if (middle_conversion(lkb)) {

--- 1005 unchanged lines hidden ---