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