lock.c (92e95733307e7b6dd352c12fa174089ed51e7208) lock.c (61bed0baa4dba17dd06cdfe20481a580718d6c7c)
1// SPDX-License-Identifier: GPL-2.0-only
2/******************************************************************************
3*******************************************************************************
4**
5** Copyright (C) 2005-2010 Red Hat, Inc. All rights reserved.
6**
7**
8*******************************************************************************

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

1204{
1205 struct dlm_lkb *lkb;
1206 int rv;
1207
1208 lkb = dlm_allocate_lkb(ls);
1209 if (!lkb)
1210 return -ENOMEM;
1211
1// SPDX-License-Identifier: GPL-2.0-only
2/******************************************************************************
3*******************************************************************************
4**
5** Copyright (C) 2005-2010 Red Hat, Inc. All rights reserved.
6**
7**
8*******************************************************************************

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

1204{
1205 struct dlm_lkb *lkb;
1206 int rv;
1207
1208 lkb = dlm_allocate_lkb(ls);
1209 if (!lkb)
1210 return -ENOMEM;
1211
1212 lkb->lkb_last_bast_mode = -1;
1212 lkb->lkb_nodeid = -1;
1213 lkb->lkb_grmode = DLM_LOCK_IV;
1214 kref_init(&lkb->lkb_ref);
1215 INIT_LIST_HEAD(&lkb->lkb_ownqueue);
1216 INIT_LIST_HEAD(&lkb->lkb_rsb_lookup);
1217#ifdef CONFIG_DLM_DEPRECATED_API
1218 INIT_LIST_HEAD(&lkb->lkb_time_list);
1219#endif
1220 INIT_LIST_HEAD(&lkb->lkb_cb_list);
1213 lkb->lkb_nodeid = -1;
1214 lkb->lkb_grmode = DLM_LOCK_IV;
1215 kref_init(&lkb->lkb_ref);
1216 INIT_LIST_HEAD(&lkb->lkb_ownqueue);
1217 INIT_LIST_HEAD(&lkb->lkb_rsb_lookup);
1218#ifdef CONFIG_DLM_DEPRECATED_API
1219 INIT_LIST_HEAD(&lkb->lkb_time_list);
1220#endif
1221 INIT_LIST_HEAD(&lkb->lkb_cb_list);
1222 INIT_LIST_HEAD(&lkb->lkb_callbacks);
1221 spin_lock_init(&lkb->lkb_cb_lock);
1222 INIT_WORK(&lkb->lkb_cb_work, dlm_callback_work);
1223
1224 idr_preload(GFP_NOFS);
1225 spin_lock(&ls->ls_lkbidr_spin);
1226 rv = idr_alloc(&ls->ls_lkbidr, lkb, start, end, GFP_NOWAIT);
1227 if (rv >= 0)
1228 lkb->lkb_id = rv;

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

6216 /* in-progress unlocks */
6217 list_for_each_entry_safe(lkb, safe, &proc->unlocking, lkb_ownqueue) {
6218 list_del_init(&lkb->lkb_ownqueue);
6219 lkb->lkb_flags |= DLM_IFL_DEAD;
6220 dlm_put_lkb(lkb);
6221 }
6222
6223 list_for_each_entry_safe(lkb, safe, &proc->asts, lkb_cb_list) {
1223 spin_lock_init(&lkb->lkb_cb_lock);
1224 INIT_WORK(&lkb->lkb_cb_work, dlm_callback_work);
1225
1226 idr_preload(GFP_NOFS);
1227 spin_lock(&ls->ls_lkbidr_spin);
1228 rv = idr_alloc(&ls->ls_lkbidr, lkb, start, end, GFP_NOWAIT);
1229 if (rv >= 0)
1230 lkb->lkb_id = rv;

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

6218 /* in-progress unlocks */
6219 list_for_each_entry_safe(lkb, safe, &proc->unlocking, lkb_ownqueue) {
6220 list_del_init(&lkb->lkb_ownqueue);
6221 lkb->lkb_flags |= DLM_IFL_DEAD;
6222 dlm_put_lkb(lkb);
6223 }
6224
6225 list_for_each_entry_safe(lkb, safe, &proc->asts, lkb_cb_list) {
6224 memset(&lkb->lkb_callbacks, 0,
6225 sizeof(struct dlm_callback) * DLM_CALLBACKS_SIZE);
6226 dlm_purge_lkb_callbacks(lkb);
6226 list_del_init(&lkb->lkb_cb_list);
6227 dlm_put_lkb(lkb);
6228 }
6229
6230 spin_unlock(&ls->ls_clear_proc_locks);
6231 dlm_unlock_recovery(ls);
6232}
6233

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

6258 list_del_init(&lkb->lkb_ownqueue);
6259 lkb->lkb_flags |= DLM_IFL_DEAD;
6260 dlm_put_lkb(lkb);
6261 }
6262 spin_unlock(&proc->locks_spin);
6263
6264 spin_lock(&proc->asts_spin);
6265 list_for_each_entry_safe(lkb, safe, &proc->asts, lkb_cb_list) {
6227 list_del_init(&lkb->lkb_cb_list);
6228 dlm_put_lkb(lkb);
6229 }
6230
6231 spin_unlock(&ls->ls_clear_proc_locks);
6232 dlm_unlock_recovery(ls);
6233}
6234

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

6259 list_del_init(&lkb->lkb_ownqueue);
6260 lkb->lkb_flags |= DLM_IFL_DEAD;
6261 dlm_put_lkb(lkb);
6262 }
6263 spin_unlock(&proc->locks_spin);
6264
6265 spin_lock(&proc->asts_spin);
6266 list_for_each_entry_safe(lkb, safe, &proc->asts, lkb_cb_list) {
6266 memset(&lkb->lkb_callbacks, 0,
6267 sizeof(struct dlm_callback) * DLM_CALLBACKS_SIZE);
6267 dlm_purge_lkb_callbacks(lkb);
6268 list_del_init(&lkb->lkb_cb_list);
6269 dlm_put_lkb(lkb);
6270 }
6271 spin_unlock(&proc->asts_spin);
6272}
6273
6274/* pid of 0 means purge all orphans */
6275

--- 110 unchanged lines hidden ---
6268 list_del_init(&lkb->lkb_cb_list);
6269 dlm_put_lkb(lkb);
6270 }
6271 spin_unlock(&proc->asts_spin);
6272}
6273
6274/* pid of 0 means purge all orphans */
6275

--- 110 unchanged lines hidden ---