28 #include <linux/module.h>
30 #include <linux/types.h>
33 #include <linux/sysctl.h>
34 #include <linux/random.h>
36 #include <linux/socket.h>
50 #define MLOG_MASK_PREFIX ML_DLM
61 int type,
int *call_ast,
80 int call_ast = 0, kick_thread = 0;
85 __dlm_wait_on_lockres(res);
89 status = __dlmconvert_master(dlm, res, lock, flags, type,
90 &call_ast, &kick_thread);
122 int type,
int *call_ast,
131 mlog(0,
"type=%d, convert_type=%d, new convert_type=%d\n",
132 lock->
ml.type, lock->
ml.convert_type, type);
138 mlog(
ML_ERROR,
"attempted to convert a lock with a lock "
139 "conversion pending\n");
145 if (!dlm_lock_on_list(&res->
granted, lock)) {
146 mlog(
ML_ERROR,
"attempted to convert a lock not on grant "
153 switch (lock->
ml.type) {
156 mlog(0,
"will set lvb: converting %s->%s\n",
157 dlm_lock_mode_name(lock->
ml.type),
158 dlm_lock_mode_name(type));
165 mlog(0,
"will fetch new value into "
166 "lvb: converting %s->%s\n",
167 dlm_lock_mode_name(lock->
ml.type),
168 dlm_lock_mode_name(type));
171 mlog(0,
"will NOT fetch new value "
172 "into lvb: converting %s->%s\n",
173 dlm_lock_mode_name(lock->
ml.type),
174 dlm_lock_mode_name(type));
192 if (!dlm_lock_compatible(tmplock->
ml.type, type))
198 if (!dlm_lock_compatible(tmplock->
ml.type, type))
201 if (!dlm_lock_compatible(tmplock->
ml.convert_type, type))
208 mlog(0,
"res %.*s, granting %s lock\n", res->
lockname.len,
209 res->
lockname.name, dlm_lock_mode_name(type));
213 mlog(0,
"doing in-place convert for nonlocal lock\n");
224 mlog(0,
"failed to convert NOQUEUE lock %.*s from "
226 lock->
ml.type, type);
233 lock->
ml.convert_type =
type;
265 struct dlm_lock *lock,
int flags,
int type)
269 mlog(0,
"type=%d, convert_type=%d, busy=%d\n", lock->
ml.type,
274 mlog(0,
"bailing out early since res is RECOVERING "
275 "on secondary queue\n");
281 __dlm_wait_on_lockres(res);
285 mlog(
ML_ERROR,
"converting a remote lock that is already "
286 "converting! (cookie=%u:%llu, conv=%d)\n",
289 lock->
ml.convert_type);
298 lock->
ml.convert_type =
type;
300 if (flags & LKM_VALBLK) {
306 flags &= ~LKM_VALBLK;
317 status = dlm_send_remote_convert_request(dlm, res, lock, flags, type);
347 struct dlm_lock *lock,
int flags,
int type)
372 vec[1].iov_base = lock->
lksb->lvb;
377 vec, veclen, res->
owner, &status);
382 mlog(0,
"node %u returned DLM_RECOVERING from convert "
383 "message!\n", res->
owner);
385 mlog(0,
"node %u returned DLM_MIGRATING from convert "
386 "message!\n", res->
owner);
388 mlog(0,
"node %u returned DLM_FORWARD from convert "
389 "message!\n", res->
owner);
393 mlog(
ML_ERROR,
"Error %d when sending message %u (key 0x%x) to "
403 mlog(0,
"node %u died so returning DLM_RECOVERING "
404 "from convert message!\n", res->
owner);
406 ret = dlm_err_to_dlm_status(tmpret);
432 int call_ast = 0, kick_thread = 0, ast_reserved = 0, wake = 0;
440 "Domain %s not fully joined!\n", dlm->
name);
457 mlog(0,
"lvb: %s\n", flags & LKM_PUT_LVB ?
"put lvb" :
468 status = __dlm_lockres_state_to_status(res);
476 if (lock->
ml.cookie == cnv->
cookie &&
486 mlog(
ML_ERROR,
"did not find lock to convert on grant queue! "
498 if (flags & LKM_PUT_LVB) {
502 }
else if (flags & LKM_GET_LVB) {
508 status = __dlm_lockres_state_to_status(res);
513 status = __dlmconvert_master(dlm, res, lock, flags,
515 &call_ast, &kick_thread);
536 else if (ast_reserved)