~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/dlm.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /******************************************************************************
  3 *******************************************************************************
  4 **
  5 **  Copyright (C) Sistina Software, Inc.  1997-2003  All rights reserved.
  6 **  Copyright (C) 2004-2011 Red Hat, Inc.  All rights reserved.
  7 **
  8 **
  9 *******************************************************************************
 10 ******************************************************************************/
 11 #ifndef __DLM_DOT_H__
 12 #define __DLM_DOT_H__
 13 
 14 #include <uapi/linux/dlm.h>
 15 
 16 
 17 struct dlm_slot {
 18         int nodeid; /* 1 to MAX_INT */
 19         int slot;   /* 1 to MAX_INT */
 20 };
 21 
 22 /*
 23  * recover_prep: called before the dlm begins lock recovery.
 24  *   Notfies lockspace user that locks from failed members will be granted.
 25  * recover_slot: called after recover_prep and before recover_done.
 26  *   Identifies a failed lockspace member.
 27  * recover_done: called after the dlm completes lock recovery.
 28  *   Identifies lockspace members and lockspace generation number.
 29  */
 30 
 31 struct dlm_lockspace_ops {
 32         void (*recover_prep) (void *ops_arg);
 33         void (*recover_slot) (void *ops_arg, struct dlm_slot *slot);
 34         void (*recover_done) (void *ops_arg, struct dlm_slot *slots,
 35                               int num_slots, int our_slot, uint32_t generation);
 36 };
 37 
 38 /* only relevant for kernel lockspaces, will be removed in future */
 39 #define DLM_LSFL_SOFTIRQ __DLM_LSFL_RESERVED0
 40 
 41 /*
 42  * dlm_new_lockspace
 43  *
 44  * Create/join a lockspace.
 45  *
 46  * name: lockspace name, null terminated, up to DLM_LOCKSPACE_LEN (not
 47  *   including terminating null).
 48  *
 49  * cluster: cluster name, null terminated, up to DLM_LOCKSPACE_LEN (not
 50  *   including terminating null).  Optional.  When cluster is null, it
 51  *   is not used.  When set, dlm_new_lockspace() returns -EBADR if cluster
 52  *   is not equal to the dlm cluster name.
 53  *
 54  * flags:
 55  * DLM_LSFL_NODIR
 56  *   The dlm should not use a resource directory, but statically assign
 57  *   resource mastery to nodes based on the name hash that is otherwise
 58  *   used to select the directory node.  Must be the same on all nodes.
 59  * DLM_LSFL_NEWEXCL
 60  *   dlm_new_lockspace() should return -EEXIST if the lockspace exists.
 61  * DLM_LSFL_SOFTIRQ
 62  *   dlm request callbacks (ast, bast) are softirq safe. Flag should be
 63  *   preferred by users. Will be default in some future. If set the
 64  *   strongest context for ast, bast callback is softirq as it avoids
 65  *   an additional context switch.
 66  *
 67  * lvblen: length of lvb in bytes.  Must be multiple of 8.
 68  *   dlm_new_lockspace() returns an error if this does not match
 69  *   what other nodes are using.
 70  *
 71  * ops: callbacks that indicate lockspace recovery points so the
 72  *   caller can coordinate its recovery and know lockspace members.
 73  *   This is only used by the initial dlm_new_lockspace() call.
 74  *   Optional.
 75  *
 76  * ops_arg: arg for ops callbacks.
 77  *
 78  * ops_result: tells caller if the ops callbacks (if provided) will
 79  *   be used or not.  0: will be used, -EXXX will not be used.
 80  *   -EOPNOTSUPP: the dlm does not have recovery_callbacks enabled.
 81  *
 82  * lockspace: handle for dlm functions
 83  */
 84 
 85 int dlm_new_lockspace(const char *name, const char *cluster,
 86                       uint32_t flags, int lvblen,
 87                       const struct dlm_lockspace_ops *ops, void *ops_arg,
 88                       int *ops_result, dlm_lockspace_t **lockspace);
 89 
 90 /*
 91  * dlm_release_lockspace
 92  *
 93  * Stop a lockspace.
 94  */
 95 
 96 int dlm_release_lockspace(dlm_lockspace_t *lockspace, int force);
 97 
 98 /*
 99  * dlm_lock
100  *
101  * Make an asynchronous request to acquire or convert a lock on a named
102  * resource.
103  *
104  * lockspace: context for the request
105  * mode: the requested mode of the lock (DLM_LOCK_)
106  * lksb: lock status block for input and async return values
107  * flags: input flags (DLM_LKF_)
108  * name: name of the resource to lock, can be binary
109  * namelen: the length in bytes of the resource name (MAX_RESNAME_LEN)
110  * parent: the lock ID of a parent lock or 0 if none
111  * lockast: function DLM executes when it completes processing the request
112  * astarg: argument passed to lockast and bast functions
113  * bast: function DLM executes when this lock later blocks another request
114  *
115  * Returns:
116  * 0 if request is successfully queued for processing
117  * -EINVAL if any input parameters are invalid
118  * -EAGAIN if request would block and is flagged DLM_LKF_NOQUEUE
119  * -ENOMEM if there is no memory to process request
120  * -ENOTCONN if there is a communication error
121  *
122  * If the call to dlm_lock returns an error then the operation has failed and
123  * the AST routine will not be called.  If dlm_lock returns 0 it is still
124  * possible that the lock operation will fail. The AST routine will be called
125  * when the locking is complete and the status is returned in the lksb.
126  *
127  * If the AST routines or parameter are passed to a conversion operation then
128  * they will overwrite those values that were passed to a previous dlm_lock
129  * call.
130  *
131  * AST routines should not block (at least not for long), but may make
132  * any locking calls they please. If DLM_LSFL_SOFTIRQ for kernel
133  * users of dlm_new_lockspace() is passed the ast and bast callbacks
134  * can be processed in softirq context. Also some of the callback
135  * contexts are in the same context as the DLM lock request API, users
136  * must not hold locks while calling dlm lock request API and trying
137  * to acquire this lock in the callback again, this will end in a
138  * lock recursion. For newer implementation the DLM_LSFL_SOFTIRQ
139  * should be used.
140  */
141 
142 int dlm_lock(dlm_lockspace_t *lockspace,
143              int mode,
144              struct dlm_lksb *lksb,
145              uint32_t flags,
146              const void *name,
147              unsigned int namelen,
148              uint32_t parent_lkid,
149              void (*lockast) (void *astarg),
150              void *astarg,
151              void (*bast) (void *astarg, int mode));
152 
153 /*
154  * dlm_unlock
155  *
156  * Asynchronously release a lock on a resource.  The AST routine is called
157  * when the resource is successfully unlocked.
158  *
159  * lockspace: context for the request
160  * lkid: the lock ID as returned in the lksb
161  * flags: input flags (DLM_LKF_)
162  * lksb: if NULL the lksb parameter passed to last lock request is used
163  * astarg: the arg used with the completion ast for the unlock
164  *
165  * Returns:
166  * 0 if request is successfully queued for processing
167  * -EINVAL if any input parameters are invalid
168  * -ENOTEMPTY if the lock still has sublocks
169  * -EBUSY if the lock is waiting for a remote lock operation
170  * -ENOTCONN if there is a communication error
171  */
172 
173 int dlm_unlock(dlm_lockspace_t *lockspace,
174                uint32_t lkid,
175                uint32_t flags,
176                struct dlm_lksb *lksb,
177                void *astarg);
178 
179 #endif                          /* __DLM_DOT_H__ */
180 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php