Lines Matching full:lock

5  * underlying calls for lock conversion
38 * only one that holds a lock on exit (res->spinlock).
43 struct dlm_lock *lock, int flags,
48 struct dlm_lock *lock, int flags, int type);
61 struct dlm_lock *lock, int flags, int type) in dlmconvert_master() argument
72 status = __dlmconvert_master(dlm, res, lock, flags, type, in dlmconvert_master()
83 dlm_queue_ast(dlm, lock); in dlmconvert_master()
93 /* performs lock conversion at the lockres master site
96 * taken: takes and drops lock->spinlock
99 * call_ast: whether ast should be called for this lock
104 struct dlm_lock *lock, int flags, in __dlmconvert_master() argument
114 lock->ml.type, lock->ml.convert_type, type); in __dlmconvert_master()
116 spin_lock(&lock->spinlock); in __dlmconvert_master()
119 if (lock->ml.convert_type != LKM_IVMODE) { in __dlmconvert_master()
120 mlog(ML_ERROR, "attempted to convert a lock with a lock " in __dlmconvert_master()
127 if (!dlm_lock_on_list(&res->granted, lock)) { in __dlmconvert_master()
128 mlog(ML_ERROR, "attempted to convert a lock not on grant " in __dlmconvert_master()
135 switch (lock->ml.type) { in __dlmconvert_master()
139 dlm_lock_mode_name(lock->ml.type), in __dlmconvert_master()
141 lock->lksb->flags |= DLM_LKSB_PUT_LVB; in __dlmconvert_master()
149 dlm_lock_mode_name(lock->ml.type), in __dlmconvert_master()
151 lock->lksb->flags |= DLM_LKSB_GET_LVB; in __dlmconvert_master()
155 dlm_lock_mode_name(lock->ml.type), in __dlmconvert_master()
165 if (type <= lock->ml.type) in __dlmconvert_master()
171 if (tmplock == lock) in __dlmconvert_master()
188 mlog(0, "res %.*s, granting %s lock\n", res->lockname.len, in __dlmconvert_master()
190 /* immediately grant the new lock type */ in __dlmconvert_master()
191 lock->lksb->status = DLM_NORMAL; in __dlmconvert_master()
192 if (lock->ml.node == dlm->node_num) in __dlmconvert_master()
193 mlog(0, "doing in-place convert for nonlocal lock\n"); in __dlmconvert_master()
194 lock->ml.type = type; in __dlmconvert_master()
195 if (lock->lksb->flags & DLM_LKSB_PUT_LVB) in __dlmconvert_master()
196 memcpy(res->lvb, lock->lksb->lvb, DLM_LVB_LEN); in __dlmconvert_master()
199 * Move the lock to the tail because it may be the only lock which has in __dlmconvert_master()
202 list_move_tail(&lock->list, &res->granted); in __dlmconvert_master()
210 mlog(0, "failed to convert NOQUEUE lock %.*s from " in __dlmconvert_master()
212 lock->ml.type, type); in __dlmconvert_master()
219 lock->ml.convert_type = type; in __dlmconvert_master()
220 /* do not alter lock refcount. switching lists. */ in __dlmconvert_master()
221 list_move_tail(&lock->list, &res->converting); in __dlmconvert_master()
224 spin_unlock(&lock->spinlock); in __dlmconvert_master()
234 struct dlm_lock *lock) in dlm_revert_pending_convert() argument
236 /* do not alter lock refcount. switching lists. */ in dlm_revert_pending_convert()
237 list_move_tail(&lock->list, &res->granted); in dlm_revert_pending_convert()
238 lock->ml.convert_type = LKM_IVMODE; in dlm_revert_pending_convert()
239 lock->lksb->flags &= ~(DLM_LKSB_GET_LVB|DLM_LKSB_PUT_LVB); in dlm_revert_pending_convert()
242 /* messages the master site to do lock conversion
251 struct dlm_lock *lock, int flags, int type) in dlmconvert_remote() argument
255 mlog(0, "type=%d, convert_type=%d, busy=%d\n", lock->ml.type, in dlmconvert_remote()
256 lock->ml.convert_type, res->state & DLM_LOCK_RES_IN_PROGRESS); in dlmconvert_remote()
269 if (lock->ml.convert_type != LKM_IVMODE) { in dlmconvert_remote()
271 mlog(ML_ERROR, "converting a remote lock that is already " in dlmconvert_remote()
273 dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)), in dlmconvert_remote()
274 dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)), in dlmconvert_remote()
275 lock->ml.convert_type); in dlmconvert_remote()
280 if (lock->ml.type == type && lock->ml.convert_type == LKM_IVMODE) { in dlmconvert_remote()
285 dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)), in dlmconvert_remote()
286 dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)), in dlmconvert_remote()
287 lock->ml.type, lock->ml.convert_type); in dlmconvert_remote()
293 /* move lock to local convert queue */ in dlmconvert_remote()
294 /* do not alter lock refcount. switching lists. */ in dlmconvert_remote()
295 list_move_tail(&lock->list, &res->converting); in dlmconvert_remote()
296 lock->convert_pending = 1; in dlmconvert_remote()
297 lock->ml.convert_type = type; in dlmconvert_remote()
300 if (lock->ml.type == LKM_EXMODE) { in dlmconvert_remote()
302 lock->lksb->flags |= DLM_LKSB_PUT_LVB; in dlmconvert_remote()
304 if (lock->ml.convert_type == LKM_NLMODE) in dlmconvert_remote()
308 lock->lksb->flags |= DLM_LKSB_GET_LVB; in dlmconvert_remote()
316 status = dlm_send_remote_convert_request(dlm, res, lock, flags, type); in dlmconvert_remote()
327 dlm_revert_pending_convert(res, lock); in dlmconvert_remote()
328 } else if (!lock->convert_pending) { in dlmconvert_remote()
329 mlog(0, "%s: res %.*s, owner died and lock has been moved back " in dlmconvert_remote()
335 lock->convert_pending = 0; in dlmconvert_remote()
355 struct dlm_lock *lock, int flags, int type) in dlm_send_remote_convert_request() argument
369 convert.cookie = lock->ml.cookie; in dlm_send_remote_convert_request()
380 vec[1].iov_base = lock->lksb->lvb; in dlm_send_remote_convert_request()
435 struct dlm_lock *lock = NULL; in dlm_convert_lock_handler() local
485 lock = tmp_lock; in dlm_convert_lock_handler()
486 dlm_lock_get(lock); in dlm_convert_lock_handler()
491 if (!lock) { in dlm_convert_lock_handler()
493 mlog(ML_ERROR, "did not find lock to convert on grant queue! " in dlm_convert_lock_handler()
501 /* found the lock */ in dlm_convert_lock_handler()
502 lksb = lock->lksb; in dlm_convert_lock_handler()
520 status = __dlmconvert_master(dlm, res, lock, flags, in dlm_convert_lock_handler()
537 if (lock) in dlm_convert_lock_handler()
538 dlm_lock_put(lock); in dlm_convert_lock_handler()
542 dlm_queue_ast(dlm, lock); in dlm_convert_lock_handler()