*/
int init_locking(int type, struct cmd_context *cmd)
{
- init_lockingfailed(0);
-
if (type < 0)
type = find_config_tree_int(cmd, "global/locking_type", 1);
/* FIXME Ensure only read ops are permitted */
log_verbose("Locking disabled - only read operations permitted.");
-
- init_no_locking(&_locking, cmd);
- init_lockingfailed(1);
+ init_readonly_locking(&_locking, cmd);
return 1;
}
*/
int init_no_locking(struct locking_type *locking, struct cmd_context *cmd);
+int init_boottime_locking(struct locking_type *locking, struct cmd_context *cmd);
+
int init_file_locking(struct locking_type *locking, struct cmd_context *cmd);
int init_external_locking(struct locking_type *locking, struct cmd_context *cmd);
return 1;
}
+static int _readonly_lock_resource(struct cmd_context *cmd,
+ const char *resource,
+ uint32_t flags)
+{
+ if (flags & LCK_TYPE_MASK == LCK_WRITE) {
+ log_error("Write locks are prohibited with --ignorelockingfailure.");
+ return 0;
+ }
+ return _no_lock_resource(cmd, resource, flags);
+}
+
int init_no_locking(struct locking_type *locking, struct cmd_context *cmd __attribute((unused)))
{
locking->lock_resource = _no_lock_resource;
return 1;
}
+
+int init_readonly_locking(struct locking_type *locking, struct cmd_context *cmd __attribute((unused)))
+{
+ locking->lock_resource = _readonly_lock_resource;
+ locking->reset_locking = _no_reset_locking;
+ locking->fin_locking = _no_fin_locking;
+ locking->flags = 0;
+
+ return 1;
+}
uint32_t failure = 0;
if ((status & CLUSTERED) &&
- (vg_is_clustered(vg)) && !locking_is_clustered() &&
- !lockingfailed()) {
+ (vg_is_clustered(vg)) && !locking_is_clustered()) {
log_error("Skipping clustered volume group %s", vg->name);
/* Return because other flags are considered undefined. */
return FAILED_CLUSTERED;
goto_bad;
}
- if (vg_is_clustered(vg) && !locking_is_clustered() &&
- !lockingfailed()) {
+ if (vg_is_clustered(vg) && !locking_is_clustered()) {
log_error("Skipping clustered volume group %s", vg->name);
failure |= FAILED_CLUSTERED;
goto_bad;
static int _debug_level = 0;
static int _log_cmd_name = 0;
static int _ignorelockingfailure = 0;
-static int _lockingfailed = 0;
static int _security_level = SECURITY_LEVEL;
static char _cmd_name[30] = "";
static int _mirror_in_sync = 0;
_ignorelockingfailure = level;
}
-void init_lockingfailed(int level)
-{
- _lockingfailed = level;
-}
-
void init_security_level(int level)
{
_security_level = level;
return _trust_cache;
}
-int lockingfailed()
-{
- return _lockingfailed;
-}
-
int ignorelockingfailure()
{
return _ignorelockingfailure;
if (!deactivate_lv(cmd, lv))
return_0;
} else {
- if (lockingfailed() && (vg_is_clustered(lv->vg))) {
- log_verbose("Locking failed: ignoring clustered "
- "logical volume %s", lv->name);
- return 0;
- }
-
if (lv_is_origin(lv) || (activate == CHANGE_AE)) {
log_verbose("Activating logical volume \"%s\" "
"exclusively", lv->name);
return ECMD_FAILED;
}
- if (activate && lockingfailed() && (vg_is_clustered(vg))) {
- log_error("Locking inactive: ignoring clustered "
- "volume group %s", vg->name);
- return ECMD_FAILED;
- }
-
/* FIXME Move into library where clvmd can use it */
- if (activate && !lockingfailed())
+ if (activate)
check_current_backup(vg);
if (activate && (active = lvs_in_vg_activated(vg))) {