mirror of
git://sourceware.org/git/lvm2.git
synced 2025-08-05 16:22:02 +03:00
Remove lockingfailed().
We provide a lock type that behaves like no_locking, but is not clustered. Moreover, it also forbids any write locks. This magically (and consistently) prevents use of clustered VGs, or changing local VGs with --ignorelockingfailure. As a bonus, we can remove the special hacks in a few places. Of course, people looking for trouble can always set their locking_type to 0 to override.
This commit is contained in:
@ -66,6 +66,17 @@ static int _no_lock_resource(struct cmd_context *cmd, const char *resource,
|
||||
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;
|
||||
@ -75,3 +86,13 @@ int init_no_locking(struct locking_type *locking, struct cmd_context *cmd __attr
|
||||
|
||||
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user