12522fe45SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 2e7fd4179SDavid Teigland /****************************************************************************** 3e7fd4179SDavid Teigland ******************************************************************************* 4e7fd4179SDavid Teigland ** 5e7fd4179SDavid Teigland ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 660f98d18SDavid Teigland ** Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. 7e7fd4179SDavid Teigland ** 8e7fd4179SDavid Teigland ** 9e7fd4179SDavid Teigland ******************************************************************************* 10e7fd4179SDavid Teigland ******************************************************************************/ 11e7fd4179SDavid Teigland 12e7fd4179SDavid Teigland #ifndef __DLM_INTERNAL_DOT_H__ 13e7fd4179SDavid Teigland #define __DLM_INTERNAL_DOT_H__ 14e7fd4179SDavid Teigland 15e7fd4179SDavid Teigland /* 16e7fd4179SDavid Teigland * This is the main header file to be included in each DLM source file. 17e7fd4179SDavid Teigland */ 18e7fd4179SDavid Teigland 19e7fd4179SDavid Teigland #include <linux/slab.h> 20e7fd4179SDavid Teigland #include <linux/sched.h> 21e7fd4179SDavid Teigland #include <linux/types.h> 22e7fd4179SDavid Teigland #include <linux/ctype.h> 23e7fd4179SDavid Teigland #include <linux/spinlock.h> 24e7fd4179SDavid Teigland #include <linux/vmalloc.h> 25e7fd4179SDavid Teigland #include <linux/list.h> 26e7fd4179SDavid Teigland #include <linux/errno.h> 27e7fd4179SDavid Teigland #include <linux/random.h> 28e7fd4179SDavid Teigland #include <linux/delay.h> 29e7fd4179SDavid Teigland #include <linux/socket.h> 30e7fd4179SDavid Teigland #include <linux/kthread.h> 31e7fd4179SDavid Teigland #include <linux/kobject.h> 32e7fd4179SDavid Teigland #include <linux/kref.h> 33e7fd4179SDavid Teigland #include <linux/kernel.h> 34e7fd4179SDavid Teigland #include <linux/jhash.h> 35597d0caeSDavid Teigland #include <linux/miscdevice.h> 3690135925SDavid Teigland #include <linux/mutex.h> 373d6aa675SDavid Teigland #include <linux/idr.h> 38d6e24788SDavid Teigland #include <linux/ratelimit.h> 397c0f6ba6SLinus Torvalds #include <linux/uaccess.h> 40e7fd4179SDavid Teigland 41e7fd4179SDavid Teigland #include <linux/dlm.h> 4299fc6487SDavid Teigland #include "config.h" 43e7fd4179SDavid Teigland 44e7fd4179SDavid Teigland /* Size of the temp buffer midcomms allocates on the stack. 45e7fd4179SDavid Teigland We try to make this large enough so most messages fit. 46e7fd4179SDavid Teigland FIXME: should sctp make this unnecessary? */ 47e7fd4179SDavid Teigland 48e7fd4179SDavid Teigland #define DLM_INBUF_LEN 148 49e7fd4179SDavid Teigland 50e7fd4179SDavid Teigland struct dlm_ls; 51e7fd4179SDavid Teigland struct dlm_lkb; 52e7fd4179SDavid Teigland struct dlm_rsb; 53e7fd4179SDavid Teigland struct dlm_member; 54e7fd4179SDavid Teigland struct dlm_rsbtable; 55e7fd4179SDavid Teigland struct dlm_recover; 56e7fd4179SDavid Teigland struct dlm_header; 57e7fd4179SDavid Teigland struct dlm_message; 58e7fd4179SDavid Teigland struct dlm_rcom; 59e7fd4179SDavid Teigland struct dlm_mhandle; 60e7fd4179SDavid Teigland 61e7fd4179SDavid Teigland #define log_print(fmt, args...) \ 62e7fd4179SDavid Teigland printk(KERN_ERR "dlm: "fmt"\n" , ##args) 63e7fd4179SDavid Teigland #define log_error(ls, fmt, args...) \ 64e7fd4179SDavid Teigland printk(KERN_ERR "dlm: %s: " fmt "\n", (ls)->ls_name , ##args) 65505ee528SZhilong Liu 66075f0177SDavid Teigland #define log_rinfo(ls, fmt, args...) \ 67505ee528SZhilong Liu do { \ 68505ee528SZhilong Liu if (dlm_config.ci_log_info) \ 69505ee528SZhilong Liu printk(KERN_INFO "dlm: %s: " fmt "\n", \ 70505ee528SZhilong Liu (ls)->ls_name, ##args); \ 71505ee528SZhilong Liu else if (dlm_config.ci_log_debug) \ 72505ee528SZhilong Liu printk(KERN_DEBUG "dlm: %s: " fmt "\n", \ 73505ee528SZhilong Liu (ls)->ls_name , ##args); \ 74505ee528SZhilong Liu } while (0) 75e7fd4179SDavid Teigland 7699fc6487SDavid Teigland #define log_debug(ls, fmt, args...) \ 7799fc6487SDavid Teigland do { \ 7899fc6487SDavid Teigland if (dlm_config.ci_log_debug) \ 7999fc6487SDavid Teigland printk(KERN_DEBUG "dlm: %s: " fmt "\n", \ 8099fc6487SDavid Teigland (ls)->ls_name , ##args); \ 8199fc6487SDavid Teigland } while (0) 82e7fd4179SDavid Teigland 83d6e24788SDavid Teigland #define log_limit(ls, fmt, args...) \ 84d6e24788SDavid Teigland do { \ 85d6e24788SDavid Teigland if (dlm_config.ci_log_debug) \ 86d6e24788SDavid Teigland printk_ratelimited(KERN_DEBUG "dlm: %s: " fmt "\n", \ 87d6e24788SDavid Teigland (ls)->ls_name , ##args); \ 88d6e24788SDavid Teigland } while (0) 89d6e24788SDavid Teigland 90e7fd4179SDavid Teigland #define DLM_ASSERT(x, do) \ 91e7fd4179SDavid Teigland { \ 92e7fd4179SDavid Teigland if (!(x)) \ 93e7fd4179SDavid Teigland { \ 94e7fd4179SDavid Teigland printk(KERN_ERR "\nDLM: Assertion failed on line %d of file %s\n" \ 95e7fd4179SDavid Teigland "DLM: assertion: \"%s\"\n" \ 96e7fd4179SDavid Teigland "DLM: time = %lu\n", \ 97e7fd4179SDavid Teigland __LINE__, __FILE__, #x, jiffies); \ 98e7fd4179SDavid Teigland {do} \ 99e7fd4179SDavid Teigland printk("\n"); \ 100e7fd4179SDavid Teigland BUG(); \ 101e7fd4179SDavid Teigland panic("DLM: Record message above and reboot.\n"); \ 102e7fd4179SDavid Teigland } \ 103e7fd4179SDavid Teigland } 104e7fd4179SDavid Teigland 105e7fd4179SDavid Teigland 106f1172283SDavid Teigland #define DLM_RTF_SHRINK 0x00000001 107f1172283SDavid Teigland 108e7fd4179SDavid Teigland struct dlm_rsbtable { 1099beb3bf5SBob Peterson struct rb_root keep; 1109beb3bf5SBob Peterson struct rb_root toss; 111c7be761aSDavid Teigland spinlock_t lock; 112f1172283SDavid Teigland uint32_t flags; 113e7fd4179SDavid Teigland }; 114e7fd4179SDavid Teigland 115e7fd4179SDavid Teigland 116e7fd4179SDavid Teigland /* 117e7fd4179SDavid Teigland * Lockspace member (per node in a ls) 118e7fd4179SDavid Teigland */ 119e7fd4179SDavid Teigland 120e7fd4179SDavid Teigland struct dlm_member { 121e7fd4179SDavid Teigland struct list_head list; 122e7fd4179SDavid Teigland int nodeid; 123e7fd4179SDavid Teigland int weight; 124757a4271SDavid Teigland int slot; 125757a4271SDavid Teigland int slot_prev; 12660f98d18SDavid Teigland int comm_seq; 127757a4271SDavid Teigland uint32_t generation; 128757a4271SDavid Teigland }; 129757a4271SDavid Teigland 130757a4271SDavid Teigland /* 131e7fd4179SDavid Teigland * Save and manage recovery state for a lockspace. 132e7fd4179SDavid Teigland */ 133e7fd4179SDavid Teigland 134e7fd4179SDavid Teigland struct dlm_recover { 135e7fd4179SDavid Teigland struct list_head list; 13660f98d18SDavid Teigland struct dlm_config_node *nodes; 13760f98d18SDavid Teigland int nodes_count; 138e7fd4179SDavid Teigland uint64_t seq; 139e7fd4179SDavid Teigland }; 140e7fd4179SDavid Teigland 141e7fd4179SDavid Teigland /* 142e7fd4179SDavid Teigland * Pass input args to second stage locking function. 143e7fd4179SDavid Teigland */ 144e7fd4179SDavid Teigland 145e7fd4179SDavid Teigland struct dlm_args { 146e7fd4179SDavid Teigland uint32_t flags; 147e5dae548SDavid Teigland void (*astfn) (void *astparam); 148e5dae548SDavid Teigland void *astparam; 149e5dae548SDavid Teigland void (*bastfn) (void *astparam, int mode); 150e7fd4179SDavid Teigland int mode; 151e7fd4179SDavid Teigland struct dlm_lksb *lksb; 152d7db923eSDavid Teigland unsigned long timeout; 153e7fd4179SDavid Teigland }; 154e7fd4179SDavid Teigland 155e7fd4179SDavid Teigland 156e7fd4179SDavid Teigland /* 157e7fd4179SDavid Teigland * Lock block 158e7fd4179SDavid Teigland * 159e7fd4179SDavid Teigland * A lock can be one of three types: 160e7fd4179SDavid Teigland * 161e7fd4179SDavid Teigland * local copy lock is mastered locally 162e7fd4179SDavid Teigland * (lkb_nodeid is zero and DLM_LKF_MSTCPY is not set) 163e7fd4179SDavid Teigland * process copy lock is mastered on a remote node 164e7fd4179SDavid Teigland * (lkb_nodeid is non-zero and DLM_LKF_MSTCPY is not set) 165e7fd4179SDavid Teigland * master copy master node's copy of a lock owned by remote node 166e7fd4179SDavid Teigland * (lkb_nodeid is non-zero and DLM_LKF_MSTCPY is set) 167e7fd4179SDavid Teigland * 168e7fd4179SDavid Teigland * lkb_exflags: a copy of the most recent flags arg provided to dlm_lock or 169e7fd4179SDavid Teigland * dlm_unlock. The dlm does not modify these or use any private flags in 170e7fd4179SDavid Teigland * this field; it only contains DLM_LKF_ flags from dlm.h. These flags 171e7fd4179SDavid Teigland * are sent as-is to the remote master when the lock is remote. 172e7fd4179SDavid Teigland * 173e7fd4179SDavid Teigland * lkb_flags: internal dlm flags (DLM_IFL_ prefix) from dlm_internal.h. 174e7fd4179SDavid Teigland * Some internal flags are shared between the master and process nodes; 175e7fd4179SDavid Teigland * these shared flags are kept in the lower two bytes. One of these 176e7fd4179SDavid Teigland * flags set on the master copy will be propagated to the process copy 177e7fd4179SDavid Teigland * and v.v. Other internal flags are private to the master or process 178e7fd4179SDavid Teigland * node (e.g. DLM_IFL_MSTCPY). These are kept in the high two bytes. 179e7fd4179SDavid Teigland * 180e7fd4179SDavid Teigland * lkb_sbflags: status block flags. These flags are copied directly into 181e7fd4179SDavid Teigland * the caller's lksb.sb_flags prior to the dlm_lock/dlm_unlock completion 182e7fd4179SDavid Teigland * ast. All defined in dlm.h with DLM_SBF_ prefix. 183e7fd4179SDavid Teigland * 184e7fd4179SDavid Teigland * lkb_status: the lock status indicates which rsb queue the lock is 185e7fd4179SDavid Teigland * on, grant, convert, or wait. DLM_LKSTS_ WAITING/GRANTED/CONVERT 186e7fd4179SDavid Teigland * 187e7fd4179SDavid Teigland * lkb_wait_type: the dlm message type (DLM_MSG_ prefix) for which a 188e7fd4179SDavid Teigland * reply is needed. Only set when the lkb is on the lockspace waiters 189e7fd4179SDavid Teigland * list awaiting a reply from a remote node. 190e7fd4179SDavid Teigland * 191e7fd4179SDavid Teigland * lkb_nodeid: when the lkb is a local copy, nodeid is 0; when the lkb 192e7fd4179SDavid Teigland * is a master copy, nodeid specifies the remote lock holder, when the 193e7fd4179SDavid Teigland * lkb is a process copy, the nodeid specifies the lock master. 194e7fd4179SDavid Teigland */ 195e7fd4179SDavid Teigland 196e7fd4179SDavid Teigland /* lkb_status */ 197e7fd4179SDavid Teigland 198e7fd4179SDavid Teigland #define DLM_LKSTS_WAITING 1 199e7fd4179SDavid Teigland #define DLM_LKSTS_GRANTED 2 200e7fd4179SDavid Teigland #define DLM_LKSTS_CONVERT 3 201e7fd4179SDavid Teigland 202e7fd4179SDavid Teigland /* lkb_flags */ 203e7fd4179SDavid Teigland 204e7fd4179SDavid Teigland #define DLM_IFL_MSTCPY 0x00010000 205e7fd4179SDavid Teigland #define DLM_IFL_RESEND 0x00020000 206597d0caeSDavid Teigland #define DLM_IFL_DEAD 0x00040000 207ef0c2bb0SDavid Teigland #define DLM_IFL_OVERLAP_UNLOCK 0x00080000 208ef0c2bb0SDavid Teigland #define DLM_IFL_OVERLAP_CANCEL 0x00100000 209ef0c2bb0SDavid Teigland #define DLM_IFL_ENDOFLIFE 0x00200000 2103ae1acf9SDavid Teigland #define DLM_IFL_WATCH_TIMEWARN 0x00400000 21184d8cd69SDavid Teigland #define DLM_IFL_TIMEOUT_CANCEL 0x00800000 2128b4021faSDavid Teigland #define DLM_IFL_DEADLOCK_CANCEL 0x01000000 2132a7ce0edSDavid Teigland #define DLM_IFL_STUB_MS 0x02000000 /* magic number for m_flags */ 214597d0caeSDavid Teigland #define DLM_IFL_USER 0x00000001 215597d0caeSDavid Teigland #define DLM_IFL_ORPHAN 0x00000002 216e7fd4179SDavid Teigland 2178304d6f2SDavid Teigland #define DLM_CALLBACKS_SIZE 6 2188304d6f2SDavid Teigland 2198304d6f2SDavid Teigland #define DLM_CB_CAST 0x00000001 2208304d6f2SDavid Teigland #define DLM_CB_BAST 0x00000002 2218304d6f2SDavid Teigland #define DLM_CB_SKIP 0x00000004 2228304d6f2SDavid Teigland 2238304d6f2SDavid Teigland struct dlm_callback { 2248304d6f2SDavid Teigland uint64_t seq; 2258304d6f2SDavid Teigland uint32_t flags; /* DLM_CBF_ */ 2268304d6f2SDavid Teigland int sb_status; /* copy to lksb status */ 2278304d6f2SDavid Teigland uint8_t sb_flags; /* copy to lksb flags */ 2288304d6f2SDavid Teigland int8_t mode; /* rq mode of bast, gr mode of cast */ 2298304d6f2SDavid Teigland }; 2308304d6f2SDavid Teigland 231e7fd4179SDavid Teigland struct dlm_lkb { 232e7fd4179SDavid Teigland struct dlm_rsb *lkb_resource; /* the rsb */ 233e7fd4179SDavid Teigland struct kref lkb_ref; 234e7fd4179SDavid Teigland int lkb_nodeid; /* copied from rsb */ 235e7fd4179SDavid Teigland int lkb_ownpid; /* pid of lock owner */ 236e7fd4179SDavid Teigland uint32_t lkb_id; /* our lock ID */ 237e7fd4179SDavid Teigland uint32_t lkb_remid; /* lock ID on remote partner */ 238e7fd4179SDavid Teigland uint32_t lkb_exflags; /* external flags from caller */ 239e7fd4179SDavid Teigland uint32_t lkb_sbflags; /* lksb flags */ 240e7fd4179SDavid Teigland uint32_t lkb_flags; /* internal flags */ 241e7fd4179SDavid Teigland uint32_t lkb_lvbseq; /* lvb sequence number */ 242e7fd4179SDavid Teigland 243e7fd4179SDavid Teigland int8_t lkb_status; /* granted, waiting, convert */ 244e7fd4179SDavid Teigland int8_t lkb_rqmode; /* requested lock mode */ 245e7fd4179SDavid Teigland int8_t lkb_grmode; /* granted lock mode */ 246e7fd4179SDavid Teigland int8_t lkb_highbast; /* highest mode bast sent for */ 2477fe2b319SDavid Teigland 248e7fd4179SDavid Teigland int8_t lkb_wait_type; /* type of reply waiting for */ 249ef0c2bb0SDavid Teigland int8_t lkb_wait_count; 250c6ff669bSDavid Teigland int lkb_wait_nodeid; /* for debugging */ 251e7fd4179SDavid Teigland 252e7fd4179SDavid Teigland struct list_head lkb_statequeue; /* rsb g/c/w list */ 253e7fd4179SDavid Teigland struct list_head lkb_rsb_lookup; /* waiting for rsb lookup */ 254e7fd4179SDavid Teigland struct list_head lkb_wait_reply; /* waiting for remote reply */ 255597d0caeSDavid Teigland struct list_head lkb_ownqueue; /* list of locks for a process */ 2563ae1acf9SDavid Teigland struct list_head lkb_time_list; 257eeda418dSDavid Teigland ktime_t lkb_timestamp; 258c6ff669bSDavid Teigland ktime_t lkb_wait_time; 2593ae1acf9SDavid Teigland unsigned long lkb_timeout_cs; 260e7fd4179SDavid Teigland 26123e8e1aaSDavid Teigland struct mutex lkb_cb_mutex; 26223e8e1aaSDavid Teigland struct work_struct lkb_cb_work; 26323e8e1aaSDavid Teigland struct list_head lkb_cb_list; /* for ls_cb_delay or proc->asts */ 2648304d6f2SDavid Teigland struct dlm_callback lkb_callbacks[DLM_CALLBACKS_SIZE]; 2658304d6f2SDavid Teigland struct dlm_callback lkb_last_cast; 2668304d6f2SDavid Teigland struct dlm_callback lkb_last_bast; 2678304d6f2SDavid Teigland ktime_t lkb_last_cast_time; /* for debugging */ 2688304d6f2SDavid Teigland ktime_t lkb_last_bast_time; /* for debugging */ 2698304d6f2SDavid Teigland 2704875647aSDavid Teigland uint64_t lkb_recover_seq; /* from ls_recover_seq */ 2714875647aSDavid Teigland 272e7fd4179SDavid Teigland char *lkb_lvbptr; 273e7fd4179SDavid Teigland struct dlm_lksb *lkb_lksb; /* caller's status block */ 274e5dae548SDavid Teigland void (*lkb_astfn) (void *astparam); 275e5dae548SDavid Teigland void (*lkb_bastfn) (void *astparam, int mode); 276d292c0ccSDavid Teigland union { 277e5dae548SDavid Teigland void *lkb_astparam; /* caller's ast arg */ 278d292c0ccSDavid Teigland struct dlm_user_args *lkb_ua; 279d292c0ccSDavid Teigland }; 280e7fd4179SDavid Teigland }; 281e7fd4179SDavid Teigland 282c04fecb4SDavid Teigland /* 283c04fecb4SDavid Teigland * res_master_nodeid is "normal": 0 is unset/invalid, non-zero is the real 284c04fecb4SDavid Teigland * nodeid, even when nodeid is our_nodeid. 285c04fecb4SDavid Teigland * 286c04fecb4SDavid Teigland * res_nodeid is "odd": -1 is unset/invalid, zero means our_nodeid, 287c04fecb4SDavid Teigland * greater than zero when another nodeid. 288c04fecb4SDavid Teigland * 289c04fecb4SDavid Teigland * (TODO: remove res_nodeid and only use res_master_nodeid) 290c04fecb4SDavid Teigland */ 291e7fd4179SDavid Teigland 292e7fd4179SDavid Teigland struct dlm_rsb { 293e7fd4179SDavid Teigland struct dlm_ls *res_ls; /* the lockspace */ 294e7fd4179SDavid Teigland struct kref res_ref; 29590135925SDavid Teigland struct mutex res_mutex; 296e7fd4179SDavid Teigland unsigned long res_flags; 297e7fd4179SDavid Teigland int res_length; /* length of rsb name */ 298e7fd4179SDavid Teigland int res_nodeid; 299c04fecb4SDavid Teigland int res_master_nodeid; 300c04fecb4SDavid Teigland int res_dir_nodeid; 3011d7c484eSDavid Teigland int res_id; /* for ls_recover_idr */ 302e7fd4179SDavid Teigland uint32_t res_lvbseq; 303e7fd4179SDavid Teigland uint32_t res_hash; 304e7fd4179SDavid Teigland uint32_t res_bucket; /* rsbtbl */ 305e7fd4179SDavid Teigland unsigned long res_toss_time; 306e7fd4179SDavid Teigland uint32_t res_first_lkid; 307e7fd4179SDavid Teigland struct list_head res_lookup; /* lkbs waiting on first */ 3089beb3bf5SBob Peterson union { 3099beb3bf5SBob Peterson struct list_head res_hashchain; 3109beb3bf5SBob Peterson struct rb_node res_hashnode; /* rsbtbl */ 3119beb3bf5SBob Peterson }; 312e7fd4179SDavid Teigland struct list_head res_grantqueue; 313e7fd4179SDavid Teigland struct list_head res_convertqueue; 314e7fd4179SDavid Teigland struct list_head res_waitqueue; 315e7fd4179SDavid Teigland 316e7fd4179SDavid Teigland struct list_head res_root_list; /* used for recovery */ 317e7fd4179SDavid Teigland struct list_head res_recover_list; /* used for recovery */ 318e7fd4179SDavid Teigland int res_recover_locks_count; 319e7fd4179SDavid Teigland 320e7fd4179SDavid Teigland char *res_lvbptr; 3213881ac04SDavid Teigland char res_name[DLM_RESNAME_MAXLEN+1]; 322e7fd4179SDavid Teigland }; 323e7fd4179SDavid Teigland 324c04fecb4SDavid Teigland /* dlm_master_lookup() flags */ 325c04fecb4SDavid Teigland 326c04fecb4SDavid Teigland #define DLM_LU_RECOVER_DIR 1 327c04fecb4SDavid Teigland #define DLM_LU_RECOVER_MASTER 2 328c04fecb4SDavid Teigland 329c04fecb4SDavid Teigland /* dlm_master_lookup() results */ 330c04fecb4SDavid Teigland 331c04fecb4SDavid Teigland #define DLM_LU_MATCH 1 332c04fecb4SDavid Teigland #define DLM_LU_ADD 2 333c04fecb4SDavid Teigland 334e7fd4179SDavid Teigland /* find_rsb() flags */ 335e7fd4179SDavid Teigland 336c04fecb4SDavid Teigland #define R_REQUEST 0x00000001 337c04fecb4SDavid Teigland #define R_RECEIVE_REQUEST 0x00000002 338c04fecb4SDavid Teigland #define R_RECEIVE_RECOVER 0x00000004 339e7fd4179SDavid Teigland 340e7fd4179SDavid Teigland /* rsb_flags */ 341e7fd4179SDavid Teigland 342e7fd4179SDavid Teigland enum rsb_flags { 343e7fd4179SDavid Teigland RSB_MASTER_UNCERTAIN, 344e7fd4179SDavid Teigland RSB_VALNOTVALID, 345e7fd4179SDavid Teigland RSB_VALNOTVALID_PREV, 346e7fd4179SDavid Teigland RSB_NEW_MASTER, 347e7fd4179SDavid Teigland RSB_NEW_MASTER2, 348e7fd4179SDavid Teigland RSB_RECOVER_CONVERT, 3494875647aSDavid Teigland RSB_RECOVER_GRANT, 350da8c6663SDavid Teigland RSB_RECOVER_LVB_INVAL, 351e7fd4179SDavid Teigland }; 352e7fd4179SDavid Teigland 353e7fd4179SDavid Teigland static inline void rsb_set_flag(struct dlm_rsb *r, enum rsb_flags flag) 354e7fd4179SDavid Teigland { 355e7fd4179SDavid Teigland __set_bit(flag, &r->res_flags); 356e7fd4179SDavid Teigland } 357e7fd4179SDavid Teigland 358e7fd4179SDavid Teigland static inline void rsb_clear_flag(struct dlm_rsb *r, enum rsb_flags flag) 359e7fd4179SDavid Teigland { 360e7fd4179SDavid Teigland __clear_bit(flag, &r->res_flags); 361e7fd4179SDavid Teigland } 362e7fd4179SDavid Teigland 363e7fd4179SDavid Teigland static inline int rsb_flag(struct dlm_rsb *r, enum rsb_flags flag) 364e7fd4179SDavid Teigland { 365e7fd4179SDavid Teigland return test_bit(flag, &r->res_flags); 366e7fd4179SDavid Teigland } 367e7fd4179SDavid Teigland 368e7fd4179SDavid Teigland 369e7fd4179SDavid Teigland /* dlm_header is first element of all structs sent between nodes */ 370e7fd4179SDavid Teigland 37138aa8b0cSDavid Teigland #define DLM_HEADER_MAJOR 0x00030000 372757a4271SDavid Teigland #define DLM_HEADER_MINOR 0x00000001 373757a4271SDavid Teigland 374757a4271SDavid Teigland #define DLM_HEADER_SLOTS 0x00000001 375e7fd4179SDavid Teigland 376e7fd4179SDavid Teigland #define DLM_MSG 1 377e7fd4179SDavid Teigland #define DLM_RCOM 2 378e7fd4179SDavid Teigland 379e7fd4179SDavid Teigland struct dlm_header { 380e7fd4179SDavid Teigland uint32_t h_version; 381e7fd4179SDavid Teigland uint32_t h_lockspace; 382e7fd4179SDavid Teigland uint32_t h_nodeid; /* nodeid of sender */ 383e7fd4179SDavid Teigland uint16_t h_length; 384e7fd4179SDavid Teigland uint8_t h_cmd; /* DLM_MSG, DLM_RCOM */ 385e7fd4179SDavid Teigland uint8_t h_pad; 386e7fd4179SDavid Teigland }; 387e7fd4179SDavid Teigland 388e7fd4179SDavid Teigland 389e7fd4179SDavid Teigland #define DLM_MSG_REQUEST 1 390e7fd4179SDavid Teigland #define DLM_MSG_CONVERT 2 391e7fd4179SDavid Teigland #define DLM_MSG_UNLOCK 3 392e7fd4179SDavid Teigland #define DLM_MSG_CANCEL 4 393e7fd4179SDavid Teigland #define DLM_MSG_REQUEST_REPLY 5 394e7fd4179SDavid Teigland #define DLM_MSG_CONVERT_REPLY 6 395e7fd4179SDavid Teigland #define DLM_MSG_UNLOCK_REPLY 7 396e7fd4179SDavid Teigland #define DLM_MSG_CANCEL_REPLY 8 397e7fd4179SDavid Teigland #define DLM_MSG_GRANT 9 398e7fd4179SDavid Teigland #define DLM_MSG_BAST 10 399e7fd4179SDavid Teigland #define DLM_MSG_LOOKUP 11 400e7fd4179SDavid Teigland #define DLM_MSG_REMOVE 12 401e7fd4179SDavid Teigland #define DLM_MSG_LOOKUP_REPLY 13 4028499137dSDavid Teigland #define DLM_MSG_PURGE 14 403e7fd4179SDavid Teigland 404e7fd4179SDavid Teigland struct dlm_message { 405e7fd4179SDavid Teigland struct dlm_header m_header; 406e7fd4179SDavid Teigland uint32_t m_type; /* DLM_MSG_ */ 407e7fd4179SDavid Teigland uint32_t m_nodeid; 408e7fd4179SDavid Teigland uint32_t m_pid; 409e7fd4179SDavid Teigland uint32_t m_lkid; /* lkid on sender */ 410e7fd4179SDavid Teigland uint32_t m_remid; /* lkid on receiver */ 411e7fd4179SDavid Teigland uint32_t m_parent_lkid; 412e7fd4179SDavid Teigland uint32_t m_parent_remid; 413e7fd4179SDavid Teigland uint32_t m_exflags; 414e7fd4179SDavid Teigland uint32_t m_sbflags; 415e7fd4179SDavid Teigland uint32_t m_flags; 416e7fd4179SDavid Teigland uint32_t m_lvbseq; 417e7fd4179SDavid Teigland uint32_t m_hash; 418e7fd4179SDavid Teigland int m_status; 419e7fd4179SDavid Teigland int m_grmode; 420e7fd4179SDavid Teigland int m_rqmode; 421e7fd4179SDavid Teigland int m_bastmode; 422e7fd4179SDavid Teigland int m_asts; 423e7fd4179SDavid Teigland int m_result; /* 0 or -EXXX */ 424e7fd4179SDavid Teigland char m_extra[0]; /* name or lvb */ 425e7fd4179SDavid Teigland }; 426e7fd4179SDavid Teigland 427e7fd4179SDavid Teigland 428e7fd4179SDavid Teigland #define DLM_RS_NODES 0x00000001 429e7fd4179SDavid Teigland #define DLM_RS_NODES_ALL 0x00000002 430e7fd4179SDavid Teigland #define DLM_RS_DIR 0x00000004 431e7fd4179SDavid Teigland #define DLM_RS_DIR_ALL 0x00000008 432e7fd4179SDavid Teigland #define DLM_RS_LOCKS 0x00000010 433e7fd4179SDavid Teigland #define DLM_RS_LOCKS_ALL 0x00000020 434e7fd4179SDavid Teigland #define DLM_RS_DONE 0x00000040 435e7fd4179SDavid Teigland #define DLM_RS_DONE_ALL 0x00000080 436e7fd4179SDavid Teigland 437e7fd4179SDavid Teigland #define DLM_RCOM_STATUS 1 438e7fd4179SDavid Teigland #define DLM_RCOM_NAMES 2 439e7fd4179SDavid Teigland #define DLM_RCOM_LOOKUP 3 440e7fd4179SDavid Teigland #define DLM_RCOM_LOCK 4 441e7fd4179SDavid Teigland #define DLM_RCOM_STATUS_REPLY 5 442e7fd4179SDavid Teigland #define DLM_RCOM_NAMES_REPLY 6 443e7fd4179SDavid Teigland #define DLM_RCOM_LOOKUP_REPLY 7 444e7fd4179SDavid Teigland #define DLM_RCOM_LOCK_REPLY 8 445e7fd4179SDavid Teigland 446e7fd4179SDavid Teigland struct dlm_rcom { 447e7fd4179SDavid Teigland struct dlm_header rc_header; 448e7fd4179SDavid Teigland uint32_t rc_type; /* DLM_RCOM_ */ 449e7fd4179SDavid Teigland int rc_result; /* multi-purpose */ 450e7fd4179SDavid Teigland uint64_t rc_id; /* match reply with request */ 45138aa8b0cSDavid Teigland uint64_t rc_seq; /* sender's ls_recover_seq */ 45238aa8b0cSDavid Teigland uint64_t rc_seq_reply; /* remote ls_recover_seq */ 453e7fd4179SDavid Teigland char rc_buf[0]; 454e7fd4179SDavid Teigland }; 455e7fd4179SDavid Teigland 456eef7d739SAl Viro union dlm_packet { 457eef7d739SAl Viro struct dlm_header header; /* common to other two */ 458eef7d739SAl Viro struct dlm_message message; 459eef7d739SAl Viro struct dlm_rcom rcom; 460eef7d739SAl Viro }; 461eef7d739SAl Viro 462757a4271SDavid Teigland #define DLM_RSF_NEED_SLOTS 0x00000001 463757a4271SDavid Teigland 464757a4271SDavid Teigland /* RCOM_STATUS data */ 465757a4271SDavid Teigland struct rcom_status { 466757a4271SDavid Teigland __le32 rs_flags; 467757a4271SDavid Teigland __le32 rs_unused1; 468757a4271SDavid Teigland __le64 rs_unused2; 469757a4271SDavid Teigland }; 470757a4271SDavid Teigland 471757a4271SDavid Teigland /* RCOM_STATUS_REPLY data */ 472e7fd4179SDavid Teigland struct rcom_config { 47393ff2971SAl Viro __le32 rf_lvblen; 47493ff2971SAl Viro __le32 rf_lsflags; 475757a4271SDavid Teigland 476757a4271SDavid Teigland /* DLM_HEADER_SLOTS adds: */ 477757a4271SDavid Teigland __le32 rf_flags; 478757a4271SDavid Teigland __le16 rf_our_slot; 479757a4271SDavid Teigland __le16 rf_num_slots; 480757a4271SDavid Teigland __le32 rf_generation; 481757a4271SDavid Teigland __le32 rf_unused1; 482757a4271SDavid Teigland __le64 rf_unused2; 483757a4271SDavid Teigland }; 484757a4271SDavid Teigland 485757a4271SDavid Teigland struct rcom_slot { 486757a4271SDavid Teigland __le32 ro_nodeid; 487757a4271SDavid Teigland __le16 ro_slot; 488757a4271SDavid Teigland __le16 ro_unused1; 489757a4271SDavid Teigland __le64 ro_unused2; 490e7fd4179SDavid Teigland }; 491e7fd4179SDavid Teigland 492e7fd4179SDavid Teigland struct rcom_lock { 493163a1859SAl Viro __le32 rl_ownpid; 494163a1859SAl Viro __le32 rl_lkid; 495163a1859SAl Viro __le32 rl_remid; 496163a1859SAl Viro __le32 rl_parent_lkid; 497163a1859SAl Viro __le32 rl_parent_remid; 498163a1859SAl Viro __le32 rl_exflags; 499163a1859SAl Viro __le32 rl_flags; 500163a1859SAl Viro __le32 rl_lvbseq; 501163a1859SAl Viro __le32 rl_result; 502e7fd4179SDavid Teigland int8_t rl_rqmode; 503e7fd4179SDavid Teigland int8_t rl_grmode; 504e7fd4179SDavid Teigland int8_t rl_status; 505e7fd4179SDavid Teigland int8_t rl_asts; 506163a1859SAl Viro __le16 rl_wait_type; 507163a1859SAl Viro __le16 rl_namelen; 508e7fd4179SDavid Teigland char rl_name[DLM_RESNAME_MAXLEN]; 509e7fd4179SDavid Teigland char rl_lvb[0]; 510e7fd4179SDavid Teigland }; 511e7fd4179SDavid Teigland 51205c32f47SDavid Teigland /* 51305c32f47SDavid Teigland * The max number of resources per rsbtbl bucket that shrink will attempt 51405c32f47SDavid Teigland * to remove in each iteration. 51505c32f47SDavid Teigland */ 51605c32f47SDavid Teigland 51705c32f47SDavid Teigland #define DLM_REMOVE_NAMES_MAX 8 51805c32f47SDavid Teigland 519e7fd4179SDavid Teigland struct dlm_ls { 520e7fd4179SDavid Teigland struct list_head ls_list; /* list of lockspaces */ 521597d0caeSDavid Teigland dlm_lockspace_t *ls_local_handle; 522e7fd4179SDavid Teigland uint32_t ls_global_id; /* global unique lockspace ID */ 523757a4271SDavid Teigland uint32_t ls_generation; 524e7fd4179SDavid Teigland uint32_t ls_exflags; 525e7fd4179SDavid Teigland int ls_lvblen; 5260f8e0d9aSDavid Teigland int ls_count; /* refcount of processes in 5270f8e0d9aSDavid Teigland the dlm using this ls */ 5280f8e0d9aSDavid Teigland int ls_create_count; /* create/release refcount */ 529e7fd4179SDavid Teigland unsigned long ls_flags; /* LSFL_ */ 530c1dcf65fSDavid Teigland unsigned long ls_scan_time; 531e7fd4179SDavid Teigland struct kobject ls_kobj; 532e7fd4179SDavid Teigland 5333d6aa675SDavid Teigland struct idr ls_lkbidr; 5343d6aa675SDavid Teigland spinlock_t ls_lkbidr_spin; 5353d6aa675SDavid Teigland 536e7fd4179SDavid Teigland struct dlm_rsbtable *ls_rsbtbl; 537e7fd4179SDavid Teigland uint32_t ls_rsbtbl_size; 538e7fd4179SDavid Teigland 53990135925SDavid Teigland struct mutex ls_waiters_mutex; 540e7fd4179SDavid Teigland struct list_head ls_waiters; /* lkbs needing a reply */ 541e7fd4179SDavid Teigland 542ef0c2bb0SDavid Teigland struct mutex ls_orphans_mutex; 543ef0c2bb0SDavid Teigland struct list_head ls_orphans; 544ef0c2bb0SDavid Teigland 5453ae1acf9SDavid Teigland struct mutex ls_timeout_mutex; 5463ae1acf9SDavid Teigland struct list_head ls_timeout; 5473ae1acf9SDavid Teigland 5483881ac04SDavid Teigland spinlock_t ls_new_rsb_spin; 5493881ac04SDavid Teigland int ls_new_rsb_count; 5503881ac04SDavid Teigland struct list_head ls_new_rsb; /* new rsb structs */ 5513881ac04SDavid Teigland 55205c32f47SDavid Teigland spinlock_t ls_remove_spin; 55305c32f47SDavid Teigland char ls_remove_name[DLM_RESNAME_MAXLEN+1]; 55405c32f47SDavid Teigland char *ls_remove_names[DLM_REMOVE_NAMES_MAX]; 55505c32f47SDavid Teigland int ls_remove_len; 55605c32f47SDavid Teigland int ls_remove_lens[DLM_REMOVE_NAMES_MAX]; 55705c32f47SDavid Teigland 558e7fd4179SDavid Teigland struct list_head ls_nodes; /* current nodes in ls */ 559e7fd4179SDavid Teigland struct list_head ls_nodes_gone; /* dead node list, recovery */ 560e7fd4179SDavid Teigland int ls_num_nodes; /* number of nodes in ls */ 561e7fd4179SDavid Teigland int ls_low_nodeid; 562e7fd4179SDavid Teigland int ls_total_weight; 563e7fd4179SDavid Teigland int *ls_node_array; 564e7fd4179SDavid Teigland 565757a4271SDavid Teigland int ls_slot; 566757a4271SDavid Teigland int ls_num_slots; 567757a4271SDavid Teigland int ls_slots_size; 568757a4271SDavid Teigland struct dlm_slot *ls_slots; 569757a4271SDavid Teigland 570e7fd4179SDavid Teigland struct dlm_rsb ls_stub_rsb; /* for returning errors */ 571e7fd4179SDavid Teigland struct dlm_lkb ls_stub_lkb; /* for returning errors */ 572e7fd4179SDavid Teigland struct dlm_message ls_stub_ms; /* for faking a reply */ 573e7fd4179SDavid Teigland 5745de6319bSDavid Teigland struct dentry *ls_debug_rsb_dentry; /* debugfs */ 5755de6319bSDavid Teigland struct dentry *ls_debug_waiters_dentry; /* debugfs */ 576ac90a255SDavid Teigland struct dentry *ls_debug_locks_dentry; /* debugfs */ 577d022509dSDavid Teigland struct dentry *ls_debug_all_dentry; /* debugfs */ 578c04fecb4SDavid Teigland struct dentry *ls_debug_toss_dentry; /* debugfs */ 579e7fd4179SDavid Teigland 580e7fd4179SDavid Teigland wait_queue_head_t ls_uevent_wait; /* user part of join/leave */ 581e7fd4179SDavid Teigland int ls_uevent_result; 5828b0e7b2cSDavid Teigland struct completion ls_members_done; 5838b0e7b2cSDavid Teigland int ls_members_result; 584e7fd4179SDavid Teigland 585597d0caeSDavid Teigland struct miscdevice ls_device; 586597d0caeSDavid Teigland 58723e8e1aaSDavid Teigland struct workqueue_struct *ls_callback_wq; 58823e8e1aaSDavid Teigland 589e7fd4179SDavid Teigland /* recovery related */ 590e7fd4179SDavid Teigland 59123e8e1aaSDavid Teigland struct mutex ls_cb_mutex; 59223e8e1aaSDavid Teigland struct list_head ls_cb_delay; /* save for queue_work later */ 593e7fd4179SDavid Teigland struct timer_list ls_timer; 594e7fd4179SDavid Teigland struct task_struct *ls_recoverd_task; 59590135925SDavid Teigland struct mutex ls_recoverd_active; 596e7fd4179SDavid Teigland spinlock_t ls_recover_lock; 5973ae1acf9SDavid Teigland unsigned long ls_recover_begin; /* jiffies timestamp */ 598e7fd4179SDavid Teigland uint32_t ls_recover_status; /* DLM_RS_ */ 599e7fd4179SDavid Teigland uint64_t ls_recover_seq; 600e7fd4179SDavid Teigland struct dlm_recover *ls_recover_args; 601e7fd4179SDavid Teigland struct rw_semaphore ls_in_recovery; /* block local requests */ 602c36258b5SDavid Teigland struct rw_semaphore ls_recv_active; /* block dlm_recv */ 603e7fd4179SDavid Teigland struct list_head ls_requestqueue;/* queue remote requests */ 60490135925SDavid Teigland struct mutex ls_requestqueue_mutex; 6054007685cSAl Viro struct dlm_rcom *ls_recover_buf; 606faa0f267SDavid Teigland int ls_recover_nodeid; /* for debugging */ 607c04fecb4SDavid Teigland unsigned int ls_recover_dir_sent_res; /* for log info */ 608c04fecb4SDavid Teigland unsigned int ls_recover_dir_sent_msg; /* for log info */ 6094875647aSDavid Teigland unsigned int ls_recover_locks_in; /* for log info */ 6104a99c3d9SDavid Teigland uint64_t ls_rcom_seq; 61198f176fbSDavid Teigland spinlock_t ls_rcom_spin; 612e7fd4179SDavid Teigland struct list_head ls_recover_list; 613e7fd4179SDavid Teigland spinlock_t ls_recover_list_lock; 614e7fd4179SDavid Teigland int ls_recover_list_count; 6151d7c484eSDavid Teigland struct idr ls_recover_idr; 6161d7c484eSDavid Teigland spinlock_t ls_recover_idr_lock; 617e7fd4179SDavid Teigland wait_queue_head_t ls_wait_general; 618475f230cSDavid Teigland wait_queue_head_t ls_recover_lock_wait; 619597d0caeSDavid Teigland struct mutex ls_clear_proc_locks; 620e7fd4179SDavid Teigland 621e7fd4179SDavid Teigland struct list_head ls_root_list; /* root resources */ 622e7fd4179SDavid Teigland struct rw_semaphore ls_root_sem; /* protect root_list */ 623e7fd4179SDavid Teigland 62460f98d18SDavid Teigland const struct dlm_lockspace_ops *ls_ops; 62560f98d18SDavid Teigland void *ls_ops_arg; 62660f98d18SDavid Teigland 627e7fd4179SDavid Teigland int ls_namelen; 628e7fd4179SDavid Teigland char ls_name[1]; 629e7fd4179SDavid Teigland }; 630e7fd4179SDavid Teigland 631475f230cSDavid Teigland /* 632475f230cSDavid Teigland * LSFL_RECOVER_STOP - dlm_ls_stop() sets this to tell dlm recovery routines 633475f230cSDavid Teigland * that they should abort what they're doing so new recovery can be started. 634475f230cSDavid Teigland * 635475f230cSDavid Teigland * LSFL_RECOVER_DOWN - dlm_ls_stop() sets this to tell dlm_recoverd that it 636475f230cSDavid Teigland * should do down_write() on the in_recovery rw_semaphore. (doing down_write 637475f230cSDavid Teigland * within dlm_ls_stop causes complaints about the lock acquired/released 638475f230cSDavid Teigland * in different contexts.) 639475f230cSDavid Teigland * 640475f230cSDavid Teigland * LSFL_RECOVER_LOCK - dlm_recoverd holds the in_recovery rw_semaphore. 641475f230cSDavid Teigland * It sets this after it is done with down_write() on the in_recovery 642475f230cSDavid Teigland * rw_semaphore and clears it after it has released the rw_semaphore. 643475f230cSDavid Teigland * 644475f230cSDavid Teigland * LSFL_RECOVER_WORK - dlm_ls_start() sets this to tell dlm_recoverd that it 645475f230cSDavid Teigland * should begin recovery of the lockspace. 646475f230cSDavid Teigland * 647475f230cSDavid Teigland * LSFL_RUNNING - set when normal locking activity is enabled. 648475f230cSDavid Teigland * dlm_ls_stop() clears this to tell dlm locking routines that they should 649475f230cSDavid Teigland * quit what they are doing so recovery can run. dlm_recoverd sets 650475f230cSDavid Teigland * this after recovery is finished. 651475f230cSDavid Teigland */ 652475f230cSDavid Teigland 653475f230cSDavid Teigland #define LSFL_RECOVER_STOP 0 654475f230cSDavid Teigland #define LSFL_RECOVER_DOWN 1 655475f230cSDavid Teigland #define LSFL_RECOVER_LOCK 2 656475f230cSDavid Teigland #define LSFL_RECOVER_WORK 3 657475f230cSDavid Teigland #define LSFL_RUNNING 4 658475f230cSDavid Teigland 659475f230cSDavid Teigland #define LSFL_RCOM_READY 5 660475f230cSDavid Teigland #define LSFL_RCOM_WAIT 6 661475f230cSDavid Teigland #define LSFL_UEVENT_WAIT 7 662475f230cSDavid Teigland #define LSFL_TIMEWARN 8 663475f230cSDavid Teigland #define LSFL_CB_DELAY 9 664475f230cSDavid Teigland #define LSFL_NODIR 10 665e7fd4179SDavid Teigland 666597d0caeSDavid Teigland /* much of this is just saving user space pointers associated with the 667597d0caeSDavid Teigland lock that we pass back to the user lib with an ast */ 668597d0caeSDavid Teigland 669597d0caeSDavid Teigland struct dlm_user_args { 670597d0caeSDavid Teigland struct dlm_user_proc *proc; /* each process that opens the lockspace 671597d0caeSDavid Teigland device has private data 672597d0caeSDavid Teigland (dlm_user_proc) on the struct file, 673597d0caeSDavid Teigland the process's locks point back to it*/ 674597d0caeSDavid Teigland struct dlm_lksb lksb; 675597d0caeSDavid Teigland struct dlm_lksb __user *user_lksb; 676597d0caeSDavid Teigland void __user *castparam; 677597d0caeSDavid Teigland void __user *castaddr; 678597d0caeSDavid Teigland void __user *bastparam; 679597d0caeSDavid Teigland void __user *bastaddr; 680d7db923eSDavid Teigland uint64_t xid; 681597d0caeSDavid Teigland }; 682597d0caeSDavid Teigland 683597d0caeSDavid Teigland #define DLM_PROC_FLAGS_CLOSING 1 684597d0caeSDavid Teigland #define DLM_PROC_FLAGS_COMPAT 2 685597d0caeSDavid Teigland 686597d0caeSDavid Teigland /* locks list is kept so we can remove all a process's locks when it 687597d0caeSDavid Teigland exits (or orphan those that are persistent) */ 688597d0caeSDavid Teigland 689597d0caeSDavid Teigland struct dlm_user_proc { 690597d0caeSDavid Teigland dlm_lockspace_t *lockspace; 691597d0caeSDavid Teigland unsigned long flags; /* DLM_PROC_FLAGS */ 692597d0caeSDavid Teigland struct list_head asts; 693597d0caeSDavid Teigland spinlock_t asts_spin; 694597d0caeSDavid Teigland struct list_head locks; 695597d0caeSDavid Teigland spinlock_t locks_spin; 696a1bc86e6SDavid Teigland struct list_head unlocking; 697597d0caeSDavid Teigland wait_queue_head_t wait; 698597d0caeSDavid Teigland }; 699597d0caeSDavid Teigland 700e7fd4179SDavid Teigland static inline int dlm_locking_stopped(struct dlm_ls *ls) 701e7fd4179SDavid Teigland { 702e7fd4179SDavid Teigland return !test_bit(LSFL_RUNNING, &ls->ls_flags); 703e7fd4179SDavid Teigland } 704e7fd4179SDavid Teigland 705e7fd4179SDavid Teigland static inline int dlm_recovery_stopped(struct dlm_ls *ls) 706e7fd4179SDavid Teigland { 707475f230cSDavid Teigland return test_bit(LSFL_RECOVER_STOP, &ls->ls_flags); 708e7fd4179SDavid Teigland } 709e7fd4179SDavid Teigland 710e7fd4179SDavid Teigland static inline int dlm_no_directory(struct dlm_ls *ls) 711e7fd4179SDavid Teigland { 7124875647aSDavid Teigland return test_bit(LSFL_NODIR, &ls->ls_flags); 713e7fd4179SDavid Teigland } 714e7fd4179SDavid Teigland 715e028398dSAdrian Bunk int dlm_netlink_init(void); 716e028398dSAdrian Bunk void dlm_netlink_exit(void); 717e028398dSAdrian Bunk void dlm_timeout_warn(struct dlm_lkb *lkb); 7182402211aSDavid Teigland int dlm_plock_init(void); 7192402211aSDavid Teigland void dlm_plock_exit(void); 720e028398dSAdrian Bunk 721e028398dSAdrian Bunk #ifdef CONFIG_DLM_DEBUG 722*a48f9721SGreg Kroah-Hartman void dlm_register_debugfs(void); 723e028398dSAdrian Bunk void dlm_unregister_debugfs(void); 724*a48f9721SGreg Kroah-Hartman void dlm_create_debug_file(struct dlm_ls *ls); 725e028398dSAdrian Bunk void dlm_delete_debug_file(struct dlm_ls *ls); 726e028398dSAdrian Bunk #else 727*a48f9721SGreg Kroah-Hartman static inline void dlm_register_debugfs(void) { } 728e028398dSAdrian Bunk static inline void dlm_unregister_debugfs(void) { } 729*a48f9721SGreg Kroah-Hartman static inline void dlm_create_debug_file(struct dlm_ls *ls) { } 730e028398dSAdrian Bunk static inline void dlm_delete_debug_file(struct dlm_ls *ls) { } 731e028398dSAdrian Bunk #endif 732e028398dSAdrian Bunk 733e7fd4179SDavid Teigland #endif /* __DLM_INTERNAL_DOT_H__ */ 734e7fd4179SDavid Teigland 735