requestqueue.c (75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37) | requestqueue.c (164d88abd7608e869b7617d5ff8893344fdda759) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/****************************************************************************** 3******************************************************************************* 4** 5** Copyright (C) 2005-2007 Red Hat, Inc. All rights reserved. 6** 7** 8******************************************************************************* --- 30 unchanged lines hidden (view full) --- 39 log_print("dlm_add_requestqueue: out of memory len %d", length); 40 return; 41 } 42 43 e->recover_seq = ls->ls_recover_seq & 0xFFFFFFFF; 44 e->nodeid = nodeid; 45 memcpy(&e->request, ms, ms->m_header.h_length); 46 | 1// SPDX-License-Identifier: GPL-2.0-only 2/****************************************************************************** 3******************************************************************************* 4** 5** Copyright (C) 2005-2007 Red Hat, Inc. All rights reserved. 6** 7** 8******************************************************************************* --- 30 unchanged lines hidden (view full) --- 39 log_print("dlm_add_requestqueue: out of memory len %d", length); 40 return; 41 } 42 43 e->recover_seq = ls->ls_recover_seq & 0xFFFFFFFF; 44 e->nodeid = nodeid; 45 memcpy(&e->request, ms, ms->m_header.h_length); 46 |
47 atomic_inc(&ls->ls_requestqueue_cnt); |
|
47 mutex_lock(&ls->ls_requestqueue_mutex); 48 list_add_tail(&e->list, &ls->ls_requestqueue); 49 mutex_unlock(&ls->ls_requestqueue_mutex); 50} 51 52/* 53 * Called by dlm_recoverd to process normal messages saved while recovery was 54 * happening. Normal locking has been enabled before this is called. dlm_recv --- 29 unchanged lines hidden (view full) --- 84 ms->m_type, ms->m_header.h_nodeid, 85 ms->m_lkid, ms->m_remid, ms->m_result, 86 e->recover_seq); 87 88 dlm_receive_message_saved(ls, &e->request, e->recover_seq); 89 90 mutex_lock(&ls->ls_requestqueue_mutex); 91 list_del(&e->list); | 48 mutex_lock(&ls->ls_requestqueue_mutex); 49 list_add_tail(&e->list, &ls->ls_requestqueue); 50 mutex_unlock(&ls->ls_requestqueue_mutex); 51} 52 53/* 54 * Called by dlm_recoverd to process normal messages saved while recovery was 55 * happening. Normal locking has been enabled before this is called. dlm_recv --- 29 unchanged lines hidden (view full) --- 85 ms->m_type, ms->m_header.h_nodeid, 86 ms->m_lkid, ms->m_remid, ms->m_result, 87 e->recover_seq); 88 89 dlm_receive_message_saved(ls, &e->request, e->recover_seq); 90 91 mutex_lock(&ls->ls_requestqueue_mutex); 92 list_del(&e->list); |
93 if (atomic_dec_and_test(&ls->ls_requestqueue_cnt)) 94 wake_up(&ls->ls_requestqueue_wait); |
|
92 kfree(e); 93 94 if (dlm_locking_stopped(ls)) { 95 log_debug(ls, "process_requestqueue abort running"); 96 mutex_unlock(&ls->ls_requestqueue_mutex); 97 error = -EINTR; 98 break; 99 } --- 10 unchanged lines hidden (view full) --- 110 * We want to delay dlm_recv processing new requests until dlm_recoverd has 111 * finished processing the old saved requests. We don't check for locking 112 * stopped here because dlm_ls_stop won't stop locking until it's suspended us 113 * (dlm_recv). 114 */ 115 116void dlm_wait_requestqueue(struct dlm_ls *ls) 117{ | 95 kfree(e); 96 97 if (dlm_locking_stopped(ls)) { 98 log_debug(ls, "process_requestqueue abort running"); 99 mutex_unlock(&ls->ls_requestqueue_mutex); 100 error = -EINTR; 101 break; 102 } --- 10 unchanged lines hidden (view full) --- 113 * We want to delay dlm_recv processing new requests until dlm_recoverd has 114 * finished processing the old saved requests. We don't check for locking 115 * stopped here because dlm_ls_stop won't stop locking until it's suspended us 116 * (dlm_recv). 117 */ 118 119void dlm_wait_requestqueue(struct dlm_ls *ls) 120{ |
118 for (;;) { 119 mutex_lock(&ls->ls_requestqueue_mutex); 120 if (list_empty(&ls->ls_requestqueue)) 121 break; 122 mutex_unlock(&ls->ls_requestqueue_mutex); 123 schedule(); 124 } 125 mutex_unlock(&ls->ls_requestqueue_mutex); | 121 wait_event(ls->ls_requestqueue_wait, 122 atomic_read(&ls->ls_requestqueue_cnt) == 0); |
126} 127 128static int purge_request(struct dlm_ls *ls, struct dlm_message *ms, int nodeid) 129{ 130 uint32_t type = ms->m_type; 131 132 /* the ls is being cleaned up and freed by release_lockspace */ 133 if (!ls->ls_count) --- 22 unchanged lines hidden (view full) --- 156 struct rq_entry *e, *safe; 157 158 mutex_lock(&ls->ls_requestqueue_mutex); 159 list_for_each_entry_safe(e, safe, &ls->ls_requestqueue, list) { 160 ms = &e->request; 161 162 if (purge_request(ls, ms, e->nodeid)) { 163 list_del(&e->list); | 123} 124 125static int purge_request(struct dlm_ls *ls, struct dlm_message *ms, int nodeid) 126{ 127 uint32_t type = ms->m_type; 128 129 /* the ls is being cleaned up and freed by release_lockspace */ 130 if (!ls->ls_count) --- 22 unchanged lines hidden (view full) --- 153 struct rq_entry *e, *safe; 154 155 mutex_lock(&ls->ls_requestqueue_mutex); 156 list_for_each_entry_safe(e, safe, &ls->ls_requestqueue, list) { 157 ms = &e->request; 158 159 if (purge_request(ls, ms, e->nodeid)) { 160 list_del(&e->list); |
161 if (atomic_dec_and_test(&ls->ls_requestqueue_cnt)) 162 wake_up(&ls->ls_requestqueue_wait); |
|
164 kfree(e); 165 } 166 } 167 mutex_unlock(&ls->ls_requestqueue_mutex); 168} 169 | 163 kfree(e); 164 } 165 } 166 mutex_unlock(&ls->ls_requestqueue_mutex); 167} 168 |