1DLM_CREATE_LOCKSPACE(3)    Library Functions Manual    DLM_CREATE_LOCKSPACE(3)
2
3
4

NAME

6       dlm_create_lockspace,      dlm_open_lockspace,     dlm_close_lockspace,
7       dlm_release_lockspace - manipulate DLM lockspaces
8

SYNOPSIS

10        #include <libdlm.h>
11
12       dlm_lshandle_t dlm_create_lockspace(const char *name, mode_t mode);
13       dlm_lshandle_t dlm_new_lockspace(const char *name, mode_t mode,
14                                        uint32_t flags);
15       dlm_lshandle_t dlm_open_lockspace(const char *name);
16       int dlm_close_lockspace(dlm_lshandle_t ls);
17       int dlm_release_lockspace(const char *name, dlm_lshandle_t ls,
18                                 int force);
19
20

DESCRIPTION

22       The DLM allows locks to be partitioned into "lockspaces", and these can
23       be  manipulated  by  userspace calls. It is possible (though not recom‐
24       mended) for an application to have  multiple  lockspaces  open  at  one
25       time.
26
27       Many  of the DLM calls work on the "default" lockspace, which should be
28       fine for most users. The calls with _ls_ in them allow you  to  isolate
29       your  application  from  all  others  running in the cluster. Remember,
30       lockspaces are a cluster-wide resource, so if you  create  a  lockspace
31       called "myls" it will share locks with a lockspace called "myls" on all
32       nodes. These calls allow users to create & remove lockspaces, and users
33       to connect to existing lockspace to store their locks there.
34
35   dlm_lshandle_t dlm_create_lockspace(const char *name, mode_t mode);
36       This creates a lockspace called <name> and the mode of the file user to
37       access it will be <mode> (subject to umask  as  usual).  The  lockspace
38       must not already exist on this node, if it does -1 will be returned and
39       errno will be set to EEXIST. If you really want to use  this  lockspace
40       you  can then use dlm_open_lockspace() below. The name is the name of a
41       misc device that will be created in /dev/misc.
42       On success a handle to the lockspace is returned, which can be used  to
43       pass  into  subsequent dlm_ls_lock/unlock calls. Make no assumptions as
44       to the content of this handle as it's content may change in future.
45       The caller must have CAP_SYSADMIN privileges to do this operation.
46
47       Return codes: 0 is returned if the call completed successfully. If not,
48       -1 is returned and errno is set to one of the following:
49       EINVAL          An invalid parameter was passed to the call
50       ENOMEM          A (kernel) memory allocation failed
51       EEXIST          The lockspace already exists
52       EPERM           Process does not have capability to create lockspaces
53       ENOSYS          A fatal error occurred initializing the DLM
54       Any error returned by the open() system call
55
56   int dlm_new_lockspace(const char *name, mode_t mode, uint32_t flags)
57       Performs  the same function as dlm_create_lockspace() above, but passes
58       some creation flags to the call that affect the  lockspace  being  cre‐
59       ated. Currently supported flags are:
60       DLM_LSFL_TIMEWARN the dlm should emit warnings over netlink when locks
61                         have been waiting too long; required for deadlock
62                         detection
63
64   int dlm_release_lockspace(const char *name, dlm_lshandle_t ls, int force)
65       Deletes  a  lockspace.  If the lockspace still has active locks then -1
66       will be returned and errno set to  EBUSY.  Both  the  lockspace  handle
67       /and/  the  name must be specified. This call also closes the lockspace
68       and stops the thread associated with the lockspace, if any.
69       Note that other nodes in the cluster may still have locks open on  this
70       lockspace.  This call only removes the lockspace from the current node.
71       If the force flag is set then the lockspace will  be  removed  even  if
72       another  user  on this node has active locks in it. Existing users will
73       NOT be notified if you do this, so be careful.
74       The caller must have CAP_SYSADMIN privileges to do this operation.
75
76       Return codes: 0 is returned if the call completed successfully. If not,
77       -1 is returned and errno is set to one of the following:
78       EINVAL          An invalid parameter was passed to the call
79       EPERM           Process does not have capability to release lockspaces
80       EBUSY           The lockspace could not be freed because it still
81                       contains locks and force was not set.
82
83
84   dlm_lshandle_t dlm_open_lockspace(const char *name)
85       Opens an already existing lockspace and returns a handle to it.
86
87       Return codes: 0 is returned if the call completed successfully. If not,
88       -1 is returned and errno is set to an error returned by the open() sys‐
89       tem call
90
91   int dlm_close_lockspace(dlm_lshandle_t ls)
92       Close the lockspace. Any locks held by this process will be freed. If a
93       thread is associated with this lockspace then it will be stopped.
94
95       Return codes: 0 is returned if the call completed successfully. If not,
96       -1 is returned and errno is set to one of the following:
97       EINVAL         lockspace was not a valid lockspace handle
98
99
100

SEE ALSO

102       libdlm(3), dlm_unlock(3), dlm_lock(3),
103
104
105
106libdlm functions                 July 5, 2007          DLM_CREATE_LOCKSPACE(3)
Impressum