/* Four stage 4 varieties: do_request(), do_convert(), do_unlock(), do_cancel() These are called on the master node for the given lock and from the central locking logic.  */
static int do_request(struct dlm_rsb *r, struct dlm_lkb *lkb)
/* Four stage 4 varieties: do_request(), do_convert(), do_unlock(), do_cancel() These are called on the master node for the given lock and from the central locking logic.  */
static int do_request(struct dlm_rsb *r, struct dlm_lkb *lkb)
{
	int error = 0;
	if (can_be_granted(r, lkb, 1, NULL)) {
		grant_lock(r, lkb);
		queue_cast(r, lkb, 0);
		goto out;
	}
	if (can_be_queued(lkb)) {
		error = -EINPROGRESS;
		add_lkb(r, lkb, DLM_LKSTS_WAITING);
		send_blocking_asts(r, lkb);
		add_timeout(lkb);
		goto out;
	}
	error = -EAGAIN;
	if (force_blocking_asts(lkb))
		send_blocking_asts_all(r, lkb);
	queue_cast(r, lkb, -EAGAIN);
 out:
	return error;
}