/* We do async lookups on rsb's that need new masters. The rsb's waiting for a lookup reply are kept on the recover_list.  */
static int recover_master(struct dlm_rsb *r)
/* We do async lookups on rsb's that need new masters. The rsb's waiting for a lookup reply are kept on the recover_list.  */
static int recover_master(struct dlm_rsb *r)
{
	struct dlm_ls *ls = r->res_ls;
	int error, dir_nodeid, ret_nodeid, our_nodeid = dlm_our_nodeid();
	dir_nodeid = dlm_dir_nodeid(r);
	if (dir_nodeid == our_nodeid) {
		error = dlm_dir_lookup(ls, our_nodeid, r->res_name,
				       r->res_length, &ret_nodeid);
		if (error)
			log_error(ls, "recover dir lookup error %d", error);
		if (ret_nodeid == our_nodeid)
			ret_nodeid = 0;
		set_new_master(r, ret_nodeid);
	} else {
		recover_list_add(r);
		error = dlm_send_rcom_lookup(r, dir_nodeid);
	}
	return error;
}