static int lm_prepare_lockspace(struct lockspace *ls, struct action *act)
{
- int rv;
+ int rv = -1;
if (ls->lm_type == LD_LM_DLM)
rv = lm_prepare_lockspace_dlm(ls);
rv = lm_prepare_lockspace_sanlock(ls);
else if (ls->lm_type == LD_LM_IDM)
rv = lm_prepare_lockspace_idm(ls);
- else
- return -1;
if (act)
act->lm_rv = rv;
static int lm_add_lockspace(struct lockspace *ls, struct action *act, int adopt_only, int adopt_ok, int nodelay)
{
- int rv;
+ int rv = -1;
if (ls->lm_type == LD_LM_DLM)
rv = lm_add_lockspace_dlm(ls, adopt_only, adopt_ok);
rv = lm_add_lockspace_sanlock(ls, adopt_only, adopt_ok, nodelay);
else if (ls->lm_type == LD_LM_IDM)
rv = lm_add_lockspace_idm(ls, adopt_only, adopt_ok);
- else
- return -1;
if (act)
act->lm_rv = rv;
static int lm_rem_lockspace(struct lockspace *ls, struct action *act, int free_vg)
{
- int rv;
+ int rv = -1;
if (ls->lm_type == LD_LM_DLM)
rv = lm_rem_lockspace_dlm(ls, free_vg);
rv = lm_rem_lockspace_sanlock(ls, free_vg);
else if (ls->lm_type == LD_LM_IDM)
rv = lm_rem_lockspace_idm(ls, free_vg);
- else
- return -1;
if (act)
act->lm_rv = rv;
static int lm_lock(struct lockspace *ls, struct resource *r, int mode, struct action *act,
struct val_blk *vb_out, int *retry, int adopt_only, int adopt_ok)
{
- int rv;
+ int rv = -1;
if (ls->lm_type == LD_LM_DLM)
rv = lm_lock_dlm(ls, r, mode, vb_out, adopt_only, adopt_ok);
else if (ls->lm_type == LD_LM_IDM)
rv = lm_lock_idm(ls, r, mode, vb_out, act->lv_uuid,
&act->pvs, adopt_only, adopt_ok);
- else
- return -1;
if (act)
act->lm_rv = rv;
static int lm_convert(struct lockspace *ls, struct resource *r,
int mode, struct action *act, uint32_t r_version)
{
- int rv;
+ int rv = -1;
if (ls->lm_type == LD_LM_DLM)
rv = lm_convert_dlm(ls, r, mode, r_version);
rv = lm_convert_sanlock(ls, r, mode, r_version);
else if (ls->lm_type == LD_LM_IDM)
rv = lm_convert_idm(ls, r, mode, r_version);
- else
- return -1;
if (act)
act->lm_rv = rv;
static int lm_unlock(struct lockspace *ls, struct resource *r, struct action *act,
uint32_t r_version, uint32_t lmu_flags)
{
- int rv;
+ int rv = -1;
if (ls->lm_type == LD_LM_DLM)
rv = lm_unlock_dlm(ls, r, r_version, lmu_flags);
rv = lm_unlock_sanlock(ls, r, r_version, lmu_flags);
else if (ls->lm_type == LD_LM_IDM)
rv = lm_unlock_idm(ls, r, r_version, lmu_flags);
- else
- return -1;
if (act)
act->lm_rv = rv;
INIT_LIST_HEAD(&vg_lockd);
INIT_LIST_HEAD(&to_unlock);
+ if (daemon_test)
+ return;
+
/*
* Get list of lockspaces from currently running lock managers.
* Get list of shared VGs from file written by prior lvmlockd.
static inline int lm_init_vg_dlm(char *ls_name, char *vg_name, uint32_t flags, char *vg_args)
{
+ if (daemon_test)
+ return 0;
return -1;
}
static inline int lm_prepare_lockspace_dlm(struct lockspace *ls)
{
+ if (daemon_test)
+ return 0;
return -1;
}
static inline int lm_add_lockspace_dlm(struct lockspace *ls, int adopt_only, int adopt_ok)
{
+ if (daemon_test)
+ return 0;
return -1;
}
static inline int lm_purge_locks_dlm(struct lockspace *ls)
{
+ if (daemon_test)
+ return 0;
return -1;
}
static inline int lm_rem_lockspace_dlm(struct lockspace *ls, int free_vg)
{
+ if (daemon_test)
+ return 0;
return -1;
}
static inline int lm_lock_dlm(struct lockspace *ls, struct resource *r, int ld_mode,
struct val_blk *vb_out, int adopt_only, int adopt_ok)
{
+ if (daemon_test)
+ return 0;
return -1;
}
static inline int lm_convert_dlm(struct lockspace *ls, struct resource *r,
int ld_mode, uint32_t r_version)
{
+ if (daemon_test)
+ return 0;
return -1;
}
static inline int lm_unlock_dlm(struct lockspace *ls, struct resource *r,
uint32_t r_version, uint32_t lmu_flags)
{
+ if (daemon_test)
+ return 0;
return -1;
}
static inline int lm_rem_resource_dlm(struct lockspace *ls, struct resource *r)
{
+ if (daemon_test)
+ return 0;
return -1;
}
static inline int lm_get_lockspaces_dlm(struct list_head *ls_rejoin)
{
+ if (daemon_test)
+ return 0;
return -1;
}
static inline int lm_data_size_dlm(void)
{
+ if (daemon_test)
+ return 0;
return -1;
}
static inline int lm_is_running_dlm(void)
{
+ if (daemon_test)
+ return 1;
return 0;
}
static inline int lm_support_dlm(void)
{
+ if (daemon_test)
+ return 1;
return 0;
}