DLM_ASSERT(!lkb->lkb_status, dlm_print_lkb(lkb););
}
-static int put_lkb(struct dlm_lkb *lkb)
+/* __put_lkb() is used when an lkb may not have an rsb attached to
+ it so we need to provide the lockspace explicitly */
+
+static int __put_lkb(struct dlm_ls *ls, struct dlm_lkb *lkb)
{
- struct dlm_ls *ls = lkb->lkb_resource->res_ls;
uint16_t bucket = lkb->lkb_id & 0xFFFF;
write_lock(&ls->ls_lkbtbl[bucket].lock);
int dlm_put_lkb(struct dlm_lkb *lkb)
{
- return put_lkb(lkb);
+ struct dlm_ls *ls;
+
+ DLM_ASSERT(lkb->lkb_resource, dlm_print_lkb(lkb););
+ DLM_ASSERT(lkb->lkb_resource->res_ls, dlm_print_lkb(lkb););
+
+ ls = lkb->lkb_resource->res_ls;
+ return __put_lkb(ls, lkb);
}
/* This is only called to add a reference when the code already holds
error = 0;
out_put:
if (convert || error)
- put_lkb(lkb);
+ __put_lkb(ls, lkb);
if (error == -EAGAIN)
error = 0;
out:
if (error == -DLM_EUNLOCK || error == -DLM_ECANCEL)
error = 0;
out_put:
- put_lkb(lkb);
+ dlm_put_lkb(lkb);
out:
unlock_recovery(ls);
dlm_put_lockspace(ls);
lkb->lkb_flags |= DLM_IFL_MSTCPY;
error = receive_request_args(ls, lkb, ms);
if (error) {
- put_lkb(lkb);
+ __put_lkb(ls, lkb);
goto fail;
}
error = find_rsb(ls, ms->m_extra, namelen, R_MASTER, &r);
if (error) {
- put_lkb(lkb);
+ __put_lkb(ls, lkb);
goto fail;
}
if (error == -EINPROGRESS)
error = 0;
if (error)
- put_lkb(lkb);
+ dlm_put_lkb(lkb);
return;
fail:
unlock_rsb(r);
put_rsb(r);
- put_lkb(lkb);
+ dlm_put_lkb(lkb);
return;
fail:
unlock_rsb(r);
put_rsb(r);
- put_lkb(lkb);
+ dlm_put_lkb(lkb);
return;
fail:
unlock_rsb(r);
put_rsb(r);
- put_lkb(lkb);
+ dlm_put_lkb(lkb);
return;
fail:
unlock_rsb(r);
put_rsb(r);
- put_lkb(lkb);
+ dlm_put_lkb(lkb);
}
static void receive_bast(struct dlm_ls *ls, struct dlm_message *ms)
unlock_rsb(r);
put_rsb(r);
- put_lkb(lkb);
+ dlm_put_lkb(lkb);
}
static void receive_lookup(struct dlm_ls *ls, struct dlm_message *ms)
unlock_rsb(r);
put_rsb(r);
out:
- put_lkb(lkb);
+ dlm_put_lkb(lkb);
}
static void __receive_convert_reply(struct dlm_rsb *r, struct dlm_lkb *lkb,
_receive_convert_reply(lkb, ms);
out:
- put_lkb(lkb);
+ dlm_put_lkb(lkb);
}
static void _receive_unlock_reply(struct dlm_lkb *lkb, struct dlm_message *ms)
_receive_unlock_reply(lkb, ms);
out:
- put_lkb(lkb);
+ dlm_put_lkb(lkb);
}
static void _receive_cancel_reply(struct dlm_lkb *lkb, struct dlm_message *ms)
_receive_cancel_reply(lkb, ms);
out:
- put_lkb(lkb);
+ dlm_put_lkb(lkb);
}
static void receive_lookup_reply(struct dlm_ls *ls, struct dlm_message *ms)
unlock_rsb(r);
put_rsb(r);
out:
- put_lkb(lkb);
+ dlm_put_lkb(lkb);
}
int dlm_receive_message(struct dlm_header *hd, int nodeid, int recovery)
ls->ls_stub_ms.m_result = -DLM_EUNLOCK;
_remove_from_waiters(lkb);
_receive_unlock_reply(lkb, &ls->ls_stub_ms);
- put_lkb(lkb);
+ dlm_put_lkb(lkb);
break;
case DLM_MSG_CANCEL:
ls->ls_stub_ms.m_result = -DLM_ECANCEL;
_remove_from_waiters(lkb);
_receive_cancel_reply(lkb, &ls->ls_stub_ms);
- put_lkb(lkb);
+ dlm_put_lkb(lkb);
break;
default:
if (test(ls, lkb)) {
del_lkb(r, lkb);
/* this put should free the lkb */
- if (!put_lkb(lkb))
+ if (!dlm_put_lkb(lkb))
log_error(ls, "purged lkb not released");
}
}
error = receive_rcom_lock_args(ls, lkb, r, rc);
if (error) {
- put_lkb(lkb);
+ __put_lkb(ls, lkb);
goto out_unlock;
}
unlock_rsb(r);
put_rsb(r);
- put_lkb(lkb);
+ dlm_put_lkb(lkb);
return 0;
}