2019-05-29 00:57:20 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2006-01-18 17:30:29 +08:00
|
|
|
/******************************************************************************
|
|
|
|
*******************************************************************************
|
|
|
|
**
|
2007-05-18 21:59:31 +08:00
|
|
|
** Copyright (C) 2005-2007 Red Hat, Inc. All rights reserved.
|
2006-01-18 17:30:29 +08:00
|
|
|
**
|
|
|
|
**
|
|
|
|
*******************************************************************************
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __LOCK_DOT_H__
|
|
|
|
#define __LOCK_DOT_H__
|
|
|
|
|
2006-08-19 00:54:25 +08:00
|
|
|
void dlm_dump_rsb(struct dlm_rsb *r);
|
2012-05-10 23:18:07 +08:00
|
|
|
void dlm_dump_rsb_name(struct dlm_ls *ls, char *name, int len);
|
2006-07-13 05:44:04 +08:00
|
|
|
void dlm_print_lkb(struct dlm_lkb *lkb);
|
2012-04-24 05:36:01 +08:00
|
|
|
void dlm_receive_message_saved(struct dlm_ls *ls, struct dlm_message *ms,
|
|
|
|
uint32_t saved_seq);
|
2008-01-25 13:58:46 +08:00
|
|
|
void dlm_receive_buffer(union dlm_packet *p, int nodeid);
|
2006-01-18 17:30:29 +08:00
|
|
|
int dlm_modes_compat(int mode1, int mode2);
|
|
|
|
void dlm_put_rsb(struct dlm_rsb *r);
|
|
|
|
void dlm_hold_rsb(struct dlm_rsb *r);
|
|
|
|
int dlm_put_lkb(struct dlm_lkb *lkb);
|
|
|
|
void dlm_scan_rsbs(struct dlm_ls *ls);
|
2007-05-18 21:58:15 +08:00
|
|
|
int dlm_lock_recovery_try(struct dlm_ls *ls);
|
|
|
|
void dlm_unlock_recovery(struct dlm_ls *ls);
|
2022-06-23 02:45:23 +08:00
|
|
|
|
2012-05-10 23:18:07 +08:00
|
|
|
int dlm_master_lookup(struct dlm_ls *ls, int nodeid, char *name, int len,
|
|
|
|
unsigned int flags, int *r_nodeid, int *result);
|
2006-01-18 17:30:29 +08:00
|
|
|
|
2022-08-16 03:43:27 +08:00
|
|
|
int dlm_search_rsb_tree(struct rb_root *tree, const void *name, int len,
|
2012-05-10 23:18:07 +08:00
|
|
|
struct dlm_rsb **r_ret);
|
2012-03-09 02:37:12 +08:00
|
|
|
|
dlm: fixes for nodir mode
The "nodir" mode (statically assign master nodes instead
of using the resource directory) has always been highly
experimental, and never seriously used. This commit
fixes a number of problems, making nodir much more usable.
- Major change to recovery: recover all locks and restart
all in-progress operations after recovery. In some
cases it's not possible to know which in-progess locks
to recover, so recover all. (Most require recovery
in nodir mode anyway since rehashing changes most
master nodes.)
- Change the way nodir mode is enabled, from a command
line mount arg passed through gfs2, into a sysfs
file managed by dlm_controld, consistent with the
other config settings.
- Allow recovering MSTCPY locks on an rsb that has not
yet been turned into a master copy.
- Ignore RCOM_LOCK and RCOM_LOCK_REPLY recovery messages
from a previous, aborted recovery cycle. Base this
on the local recovery status not being in the state
where any nodes should be sending LOCK messages for the
current recovery cycle.
- Hold rsb lock around dlm_purge_mstcpy_locks() because it
may run concurrently with dlm_recover_master_copy().
- Maintain highbast on process-copy lkb's (in addition to
the master as is usual), because the lkb can switch
back and forth between being a master and being a
process copy as the master node changes in recovery.
- When recovering MSTCPY locks, flag rsb's that have
non-empty convert or waiting queues for granting
at the end of recovery. (Rename flag from LOCKS_PURGED
to RECOVER_GRANT and similar for the recovery function,
because it's not only resources with purged locks
that need grant a grant attempt.)
- Replace a couple of unnecessary assertion panics with
error messages.
Signed-off-by: David Teigland <teigland@redhat.com>
2012-04-27 04:54:29 +08:00
|
|
|
void dlm_recover_purge(struct dlm_ls *ls);
|
2006-01-18 17:30:29 +08:00
|
|
|
void dlm_purge_mstcpy_locks(struct dlm_rsb *r);
|
dlm: fixes for nodir mode
The "nodir" mode (statically assign master nodes instead
of using the resource directory) has always been highly
experimental, and never seriously used. This commit
fixes a number of problems, making nodir much more usable.
- Major change to recovery: recover all locks and restart
all in-progress operations after recovery. In some
cases it's not possible to know which in-progess locks
to recover, so recover all. (Most require recovery
in nodir mode anyway since rehashing changes most
master nodes.)
- Change the way nodir mode is enabled, from a command
line mount arg passed through gfs2, into a sysfs
file managed by dlm_controld, consistent with the
other config settings.
- Allow recovering MSTCPY locks on an rsb that has not
yet been turned into a master copy.
- Ignore RCOM_LOCK and RCOM_LOCK_REPLY recovery messages
from a previous, aborted recovery cycle. Base this
on the local recovery status not being in the state
where any nodes should be sending LOCK messages for the
current recovery cycle.
- Hold rsb lock around dlm_purge_mstcpy_locks() because it
may run concurrently with dlm_recover_master_copy().
- Maintain highbast on process-copy lkb's (in addition to
the master as is usual), because the lkb can switch
back and forth between being a master and being a
process copy as the master node changes in recovery.
- When recovering MSTCPY locks, flag rsb's that have
non-empty convert or waiting queues for granting
at the end of recovery. (Rename flag from LOCKS_PURGED
to RECOVER_GRANT and similar for the recovery function,
because it's not only resources with purged locks
that need grant a grant attempt.)
- Replace a couple of unnecessary assertion panics with
error messages.
Signed-off-by: David Teigland <teigland@redhat.com>
2012-04-27 04:54:29 +08:00
|
|
|
void dlm_recover_grant(struct dlm_ls *ls);
|
2006-01-18 17:30:29 +08:00
|
|
|
int dlm_recover_waiters_post(struct dlm_ls *ls);
|
|
|
|
void dlm_recover_waiters_pre(struct dlm_ls *ls);
|
|
|
|
int dlm_recover_master_copy(struct dlm_ls *ls, struct dlm_rcom *rc);
|
|
|
|
int dlm_recover_process_copy(struct dlm_ls *ls, struct dlm_rcom *rc);
|
|
|
|
|
2022-06-23 02:45:23 +08:00
|
|
|
int dlm_user_request(struct dlm_ls *ls, struct dlm_user_args *ua, int mode,
|
|
|
|
uint32_t flags, void *name, unsigned int namelen);
|
|
|
|
int dlm_user_convert(struct dlm_ls *ls, struct dlm_user_args *ua_tmp,
|
|
|
|
int mode, uint32_t flags, uint32_t lkid, char *lvb_in);
|
2014-10-18 00:05:50 +08:00
|
|
|
int dlm_user_adopt_orphan(struct dlm_ls *ls, struct dlm_user_args *ua_tmp,
|
|
|
|
int mode, uint32_t flags, void *name, unsigned int namelen,
|
2022-06-23 02:45:21 +08:00
|
|
|
uint32_t *lkid);
|
2006-07-13 05:44:04 +08:00
|
|
|
int dlm_user_unlock(struct dlm_ls *ls, struct dlm_user_args *ua_tmp,
|
|
|
|
uint32_t flags, uint32_t lkid, char *lvb_in);
|
|
|
|
int dlm_user_cancel(struct dlm_ls *ls, struct dlm_user_args *ua_tmp,
|
|
|
|
uint32_t flags, uint32_t lkid);
|
2007-03-31 04:06:16 +08:00
|
|
|
int dlm_user_purge(struct dlm_ls *ls, struct dlm_user_proc *proc,
|
|
|
|
int nodeid, int pid);
|
2007-05-29 21:46:00 +08:00
|
|
|
int dlm_user_deadlock(struct dlm_ls *ls, uint32_t flags, uint32_t lkid);
|
2006-07-13 05:44:04 +08:00
|
|
|
void dlm_clear_proc_locks(struct dlm_ls *ls, struct dlm_user_proc *proc);
|
2021-11-03 03:17:22 +08:00
|
|
|
int dlm_debug_add_lkb(struct dlm_ls *ls, uint32_t lkb_id, char *name, int len,
|
|
|
|
int lkb_nodeid, unsigned int lkb_flags, int lkb_status);
|
2021-11-03 03:17:23 +08:00
|
|
|
int dlm_debug_add_lkb_to_waiters(struct dlm_ls *ls, uint32_t lkb_id,
|
|
|
|
int mstype, int to_nodeid);
|
2006-07-13 05:44:04 +08:00
|
|
|
|
2006-01-18 17:30:29 +08:00
|
|
|
static inline int is_master(struct dlm_rsb *r)
|
|
|
|
{
|
|
|
|
return !r->res_nodeid;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void lock_rsb(struct dlm_rsb *r)
|
|
|
|
{
|
2006-01-20 16:47:07 +08:00
|
|
|
mutex_lock(&r->res_mutex);
|
2006-01-18 17:30:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void unlock_rsb(struct dlm_rsb *r)
|
|
|
|
{
|
2006-01-20 16:47:07 +08:00
|
|
|
mutex_unlock(&r->res_mutex);
|
2006-01-18 17:30:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|