mirror of
git://sourceware.org/git/lvm2.git
synced 2025-02-06 01:58:01 +03:00
Add global/wait_for_locks to lvm.conf so blocking on locks can be disabled.
This commit is contained in:
parent
2918b433a3
commit
1cc59fa4ac
@ -1,5 +1,6 @@
|
||||
Version 2.02.50 -
|
||||
================================
|
||||
Add global/wait_for_locks to lvm.conf so blocking for locks can be disabled.
|
||||
All LV locks are non-blocking so remove LCK_NONBLOCK from separate macros.
|
||||
Fix race condition with vgcreate and vgextend on same device (2.02.49).
|
||||
Remove redundant validate_name call from vgreduce.
|
||||
|
@ -247,6 +247,9 @@ global {
|
||||
# Type 3 uses built-in clustered locking.
|
||||
locking_type = 1
|
||||
|
||||
# Set to 0 to fail when a lock request cannot be satisfied immediately.
|
||||
wait_for_locks = 1
|
||||
|
||||
# If using external locking (type 2) and initialisation fails,
|
||||
# with this set to 1 an attempt will be made to use the built-in
|
||||
# clustered locking.
|
||||
|
@ -39,6 +39,7 @@
|
||||
#define DEFAULT_LOCKING_LIB "liblvm2clusterlock.so"
|
||||
#define DEFAULT_FALLBACK_TO_LOCAL_LOCKING 1
|
||||
#define DEFAULT_FALLBACK_TO_CLUSTERED_LOCKING 1
|
||||
#define DEFAULT_WAIT_FOR_LOCKS 1
|
||||
|
||||
#define DEFAULT_MIRRORLOG "disk"
|
||||
#define DEFAULT_MIRROR_LOG_FAULT_POLICY "allocate"
|
||||
|
@ -35,6 +35,7 @@ static sigset_t _oldset;
|
||||
static int _vg_lock_count = 0; /* Number of locks held */
|
||||
static int _vg_write_lock_held = 0; /* VG write lock held? */
|
||||
static int _signals_blocked = 0;
|
||||
static int _blocking_supported = 0;
|
||||
|
||||
static volatile sig_atomic_t _sigint_caught = 0;
|
||||
static volatile sig_atomic_t _handler_installed;
|
||||
@ -217,7 +218,9 @@ int init_locking(int type, struct cmd_context *cmd)
|
||||
{
|
||||
if (type < 0)
|
||||
type = find_config_tree_int(cmd, "global/locking_type", 1);
|
||||
|
||||
|
||||
_blocking_supported = find_config_tree_int(cmd,
|
||||
"global/wait_for_locks", DEFAULT_WAIT_FOR_LOCKS);
|
||||
|
||||
switch (type) {
|
||||
case 0:
|
||||
@ -227,7 +230,9 @@ int init_locking(int type, struct cmd_context *cmd)
|
||||
return 1;
|
||||
|
||||
case 1:
|
||||
log_very_verbose("File-based locking selected.");
|
||||
log_very_verbose("%sFile-based locking selected.",
|
||||
_blocking_supported ? "" : "Non-blocking ");
|
||||
|
||||
if (!init_file_locking(&_locking, cmd))
|
||||
break;
|
||||
return 1;
|
||||
@ -379,7 +384,7 @@ int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags)
|
||||
* This will enforce correctness and prevent deadlocks rather
|
||||
* than relying on the caller to set the flag properly.
|
||||
*/
|
||||
if (vgs_locked())
|
||||
if (!_blocking_supported || vgs_locked())
|
||||
flags |= LCK_NONBLOCK;
|
||||
|
||||
/* Lock VG to change on-disk metadata. */
|
||||
|
@ -270,6 +270,10 @@ If the tools were configured \fB--with-cluster=internal\fP
|
||||
All changes to logical volumes and their states are communicated
|
||||
using locks.
|
||||
.IP
|
||||
\fBwait_for_locks\fP \(em When set to 1, the default, the tools
|
||||
wait if a lock request cannot be satisfied immediately.
|
||||
When set to 0, the operation is aborted instead.
|
||||
.IP
|
||||
\fBlocking_dir\fP \(em The directory LVM2 places its file locks
|
||||
if \fBlocking_type\fP is set to 1. The default is \fB/var/lock/lvm\fP.
|
||||
.IP
|
||||
|
Loading…
x
Reference in New Issue
Block a user