]> git.proxmox.com Git - lvm.git/blob - patchdir/autodetect-locking-type.patch
buildsys: update make upload target for stretch
[lvm.git] / patchdir / autodetect-locking-type.patch
1 Index: new/lib/locking/locking.c
2 ===================================================================
3 --- new.orig/lib/locking/locking.c 2011-06-11 02:03:07.000000000 +0200
4 +++ new/lib/locking/locking.c 2011-09-21 10:01:47.000000000 +0200
5 @@ -225,7 +225,16 @@
6 suppress_messages = 1;
7
8 if (type < 0)
9 - type = find_config_tree_int(cmd, "global/locking_type", 1);
10 + type = find_config_tree_int(cmd, "global/locking_type", -1);
11 +
12 + if (type < 0) {
13 + struct stat info;
14 + if (stat("/etc/cluster/cluster.conf", &info) == 0) {
15 + type = 3;
16 + } else {
17 + type = 1;
18 + }
19 + }
20
21 _blocking_supported = find_config_tree_int(cmd,
22 "global/wait_for_locks", DEFAULT_WAIT_FOR_LOCKS);
23 Index: new/doc/example.conf.in
24 ===================================================================
25 --- new.orig/doc/example.conf.in 2011-07-01 16:09:19.000000000 +0200
26 +++ new/doc/example.conf.in 2011-09-21 10:01:47.000000000 +0200
27 @@ -350,13 +350,16 @@
28 proc = "/proc"
29
30 # Type of locking to use. Defaults to local file-based locking (1).
31 + # Proxmox VE sets default locking_type to 3 if file
32 + # /etc/cluster/cluster.conf exists. So there is normally no need
33 + # to set this value here.
34 # Turn locking off by setting to 0 (dangerous: risks metadata corruption
35 # if LVM2 commands get run concurrently).
36 # Type 2 uses the external shared library locking_library.
37 # Type 3 uses built-in clustered locking.
38 # Type 4 uses read-only locking which forbids any operations that might
39 # change metadata.
40 - locking_type = 1
41 + # locking_type = 1
42
43 # Set to 0 to fail when a lock request cannot be satisfied immediately.
44 wait_for_locks = 1