diff options
author | David Teigland <teigland@redhat.com> | 2011-11-02 15:30:58 -0400 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2012-01-04 09:56:31 -0500 |
commit | 60f98d1839376d30e13f3e452dce2433fad3060e (patch) | |
tree | b8b43859ad26519bd75a40920f6d1ca46f2d44a5 /include/linux/dlm.h | |
parent | 757a42719635495779462514458bbfbf12a37dac (diff) |
dlm: add recovery callbacks
These new callbacks notify the dlm user about lock recovery.
GFS2, and possibly others, need to be aware of when the dlm
will be doing lock recovery for a failed lockspace member.
In the past, this coordination has been done between dlm and
file system daemons in userspace, which then direct their
kernel counterparts. These callbacks allow the same
coordination directly, and more simply.
Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'include/linux/dlm.h')
-rw-r--r-- | include/linux/dlm.h | 71 |
1 files changed, 66 insertions, 5 deletions
diff --git a/include/linux/dlm.h b/include/linux/dlm.h index d4e02f5353a0..6c7f6e9546c7 100644 --- a/include/linux/dlm.h +++ b/include/linux/dlm.h | |||
@@ -2,7 +2,7 @@ | |||
2 | ******************************************************************************* | 2 | ******************************************************************************* |
3 | ** | 3 | ** |
4 | ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. | 4 | ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. |
5 | ** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. | 5 | ** Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. |
6 | ** | 6 | ** |
7 | ** This copyrighted material is made available to anyone wishing to use, | 7 | ** This copyrighted material is made available to anyone wishing to use, |
8 | ** modify, copy, or redistribute it subject to the terms and conditions | 8 | ** modify, copy, or redistribute it subject to the terms and conditions |
@@ -74,15 +74,76 @@ struct dlm_lksb { | |||
74 | 74 | ||
75 | #ifdef __KERNEL__ | 75 | #ifdef __KERNEL__ |
76 | 76 | ||
77 | struct dlm_slot { | ||
78 | int nodeid; /* 1 to MAX_INT */ | ||
79 | int slot; /* 1 to MAX_INT */ | ||
80 | }; | ||
81 | |||
82 | /* | ||
83 | * recover_prep: called before the dlm begins lock recovery. | ||
84 | * Notfies lockspace user that locks from failed members will be granted. | ||
85 | * recover_slot: called after recover_prep and before recover_done. | ||
86 | * Identifies a failed lockspace member. | ||
87 | * recover_done: called after the dlm completes lock recovery. | ||
88 | * Identifies lockspace members and lockspace generation number. | ||
89 | */ | ||
90 | |||
91 | struct dlm_lockspace_ops { | ||
92 | void (*recover_prep) (void *ops_arg); | ||
93 | void (*recover_slot) (void *ops_arg, struct dlm_slot *slot); | ||
94 | void (*recover_done) (void *ops_arg, struct dlm_slot *slots, | ||
95 | int num_slots, int our_slot, uint32_t generation); | ||
96 | }; | ||
97 | |||
77 | /* | 98 | /* |
78 | * dlm_new_lockspace | 99 | * dlm_new_lockspace |
79 | * | 100 | * |
80 | * Starts a lockspace with the given name. If the named lockspace exists in | 101 | * Create/join a lockspace. |
81 | * the cluster, the calling node joins it. | 102 | * |
103 | * name: lockspace name, null terminated, up to DLM_LOCKSPACE_LEN (not | ||
104 | * including terminating null). | ||
105 | * | ||
106 | * cluster: cluster name, null terminated, up to DLM_LOCKSPACE_LEN (not | ||
107 | * including terminating null). Optional. When cluster is null, it | ||
108 | * is not used. When set, dlm_new_lockspace() returns -EBADR if cluster | ||
109 | * is not equal to the dlm cluster name. | ||
110 | * | ||
111 | * flags: | ||
112 | * DLM_LSFL_NODIR | ||
113 | * The dlm should not use a resource directory, but statically assign | ||
114 | * resource mastery to nodes based on the name hash that is otherwise | ||
115 | * used to select the directory node. Must be the same on all nodes. | ||
116 | * DLM_LSFL_TIMEWARN | ||
117 | * The dlm should emit netlink messages if locks have been waiting | ||
118 | * for a configurable amount of time. (Unused.) | ||
119 | * DLM_LSFL_FS | ||
120 | * The lockspace user is in the kernel (i.e. filesystem). Enables | ||
121 | * direct bast/cast callbacks. | ||
122 | * DLM_LSFL_NEWEXCL | ||
123 | * dlm_new_lockspace() should return -EEXIST if the lockspace exists. | ||
124 | * | ||
125 | * lvblen: length of lvb in bytes. Must be multiple of 8. | ||
126 | * dlm_new_lockspace() returns an error if this does not match | ||
127 | * what other nodes are using. | ||
128 | * | ||
129 | * ops: callbacks that indicate lockspace recovery points so the | ||
130 | * caller can coordinate its recovery and know lockspace members. | ||
131 | * This is only used by the initial dlm_new_lockspace() call. | ||
132 | * Optional. | ||
133 | * | ||
134 | * ops_arg: arg for ops callbacks. | ||
135 | * | ||
136 | * ops_result: tells caller if the ops callbacks (if provided) will | ||
137 | * be used or not. 0: will be used, -EXXX will not be used. | ||
138 | * -EOPNOTSUPP: the dlm does not have recovery_callbacks enabled. | ||
139 | * | ||
140 | * lockspace: handle for dlm functions | ||
82 | */ | 141 | */ |
83 | 142 | ||
84 | int dlm_new_lockspace(const char *name, int namelen, | 143 | int dlm_new_lockspace(const char *name, const char *cluster, |
85 | dlm_lockspace_t **lockspace, uint32_t flags, int lvblen); | 144 | uint32_t flags, int lvblen, |
145 | const struct dlm_lockspace_ops *ops, void *ops_arg, | ||
146 | int *ops_result, dlm_lockspace_t **lockspace); | ||
86 | 147 | ||
87 | /* | 148 | /* |
88 | * dlm_release_lockspace | 149 | * dlm_release_lockspace |