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

NAME

6       dlm_unlock - unlock a DLM lock
7

SYNOPSIS

9       #include <libdlm.h>
10
11       int dlm_unlock(uint32_t lkid,
12                      uint32_t flags, struct dlm_lksb *lksb, void *astarg);
13
14       int dlm_unlock_wait(uint32_t lkid,
15                           uint32_t flags, struct dlm_lksb *lksb);
16
17

DESCRIPTION

19       dlm_unlock()  unlocks  a  lock  previously acquired by dlm_lock and its
20       variants.
21
22       Unless dlm_unlock_wait() is used unlocks are also asynchronous. The AST
23       routine  is  called  when  the  resource  is successfully unlocked (see
24       below).
25
26       lkid Lock ID as returned in the lksb
27
28       flags flags affecting the unlock operation:
29         LKF_CANCEL       Cancel a pending lock or conversion.
30                          This returns the lock to it's previously
31                          granted mode (in case of a conversion) or
32                          unlocks it (in case of a waiting lock).
33         LKF_IVVALBLK     Invalidate value block
34         LKF_FORCEUNLOCK  Unlock the lock even if it's waiting.
35
36       lksb LKSB to return status and value block information.
37
38       astarg New parameter to be passed to the completion AST.   The  compleā€
39       tion  AST  routine  is  the  last completion AST routine specified in a
40       dlm_lock call.  If dlm_lock_wait() was the  last  routine  to  issue  a
41       lock, dlm_unlock_wait() must be used to release the lock. If dlm_lock()
42       was the last routine to  issue  a  lock  then  either  dlm_unlock()  or
43       dlm_unlock_wait() may be called.
44
45   Return values
46       0  is  returned  if  the  call  completed  successfully.  If not, -1 is
47       returned and errno is set to one of the following:
48
49       EINVAL          An invalid parameter was passed to the call (eg bad
50                       lock mode or flag)
51       EINPROGRESS     The lock is already being unlocked
52       EBUSY           The lock is currently being locked or converted
53       ENOTEMPTY       An attempt to made to unlock a parent lock that still has
54                       child locks.
55       ECANCEL         A lock conversion was successfully cancelled
56       EUNLOCK         An unlock operation completed successfully
57                       (sb_status only)
58       EFAULT          The userland buffer could not be read/written by the
59                       kernel
60       If an error is returned in the AST, then lksb.sb_status is set  to  the
61       one of the above numbers instead of zero.
62

EXAMPLE

64       int status;
65       struct dlm_lksb lksb;
66
67       status = dlm_lock_wait(LKM_EXMODE,
68                              &lksb,
69                              LKF_NOQUEUE,
70                              "MyLock",
71                              strlen("MyLock"),
72                              0,     // Parent,
73                              NULL,  // bast arg
74                              NULL,  // bast routine,
75                              NULL); // Range
76
77       if (status == 0)
78            dlm_unlock_wait(lksb.sb_lkid, 0, &lksb);
79
80
81

SEE ALSO

83       libdlm(3), dlm_lock(3), dlm_open_lockspace(3), dlm_create_lockspace(3),
84       dlm_close_lockspace(3), dlm_release_lockspace(3)
85
86
87
88libdlm functions                 July 5, 2007                    DLM_UNLOCK(3)
Impressum