1 |
robbat2 09/07/24 23:37:37 |
2 |
|
3 |
Added: lvm2-start.sh-2.02.49-r1 lvm2-stop.sh-2.02.49-r1 |
4 |
lvm2-2.02.49-lockdir-override.patch |
5 |
Log: |
6 |
Bug #268999: allow overriding of the locking directory for use during early boot. This gives us functional locking while root is still read-only instead of failing the lock path. |
7 |
(Portage version: 2.2_rc33/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 sys-fs/lvm2/files/lvm2-start.sh-2.02.49-r1 |
11 |
|
12 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/lvm2/files/lvm2-start.sh-2.02.49-r1?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/lvm2/files/lvm2-start.sh-2.02.49-r1?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: lvm2-start.sh-2.02.49-r1 |
16 |
=================================================================== |
17 |
# /lib/rcscripts/addons/lvm-start.sh |
18 |
# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/lvm2-start.sh-2.02.49-r1,v 1.1 2009/07/24 23:37:37 robbat2 Exp $ |
19 |
|
20 |
locking="--lock-dir /dev/.lvm/" |
21 |
|
22 |
dm_in_proc() { |
23 |
local retval=0 |
24 |
for x in devices misc ; do |
25 |
grep -qs 'device-mapper' /proc/${x} |
26 |
retval=$((${retval} + $?)) |
27 |
done |
28 |
return ${retval} |
29 |
} |
30 |
|
31 |
# LVM support for /usr, /home, /opt .... |
32 |
# This should be done *before* checking local |
33 |
# volumes, or they never get checked. |
34 |
|
35 |
# NOTE: Add needed modules for LVM or RAID, etc |
36 |
# to /etc/modules.autoload if needed |
37 |
if [ -z "${CDBOOT}" -a -x /sbin/vgscan ] ; then |
38 |
if [ -e /proc/modules ] && ! dm_in_proc ; then |
39 |
modprobe dm-mod 2>/dev/null |
40 |
fi |
41 |
|
42 |
if [ -d /proc/lvm ] || dm_in_proc ; then |
43 |
ebegin "Setting up the Logical Volume Manager" |
44 |
#still echo stderr for debugging |
45 |
# Extra PV find pass because some devices might not have been available until very recently |
46 |
/sbin/pvscan ${locking} >/dev/null |
47 |
# Now make the nodes |
48 |
/sbin/vgscan --mknodes ${locking} >/dev/null |
49 |
if [ -x /sbin/vgchange ] && \ |
50 |
[ -f /etc/lvmtab -o -d /etc/lvm ] |
51 |
then |
52 |
/sbin/vgchange ${locking} -a y >/dev/null |
53 |
fi |
54 |
eend $? "Failed to setup the LVM" |
55 |
fi |
56 |
fi |
57 |
|
58 |
# vim:ts=4 |
59 |
|
60 |
|
61 |
|
62 |
1.1 sys-fs/lvm2/files/lvm2-stop.sh-2.02.49-r1 |
63 |
|
64 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/lvm2/files/lvm2-stop.sh-2.02.49-r1?rev=1.1&view=markup |
65 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/lvm2/files/lvm2-stop.sh-2.02.49-r1?rev=1.1&content-type=text/plain |
66 |
|
67 |
Index: lvm2-stop.sh-2.02.49-r1 |
68 |
=================================================================== |
69 |
# /lib/rcscripts/addons/lvm-stop.sh |
70 |
# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/lvm2-stop.sh-2.02.49-r1,v 1.1 2009/07/24 23:37:37 robbat2 Exp $ |
71 |
|
72 |
locking="--lock-dir /dev/.lvm/" |
73 |
|
74 |
# Stop LVM2 |
75 |
if [ -x /sbin/vgchange ] && \ |
76 |
[ -x /sbin/lvdisplay ] && \ |
77 |
[ -x /sbin/vgdisplay ] && \ |
78 |
[ -x /sbin/lvchange ] && \ |
79 |
[ -f /etc/lvmtab -o -d /etc/lvm ] && \ |
80 |
[ -d /proc/lvm -o "`grep device-mapper /proc/misc 2>/dev/null`" ] |
81 |
then |
82 |
einfo "Shutting down the Logical Volume Manager" |
83 |
# If these commands fail it is not currently an issue |
84 |
# as the system is going down anyway based on the current LVM |
85 |
# functionality as described in this forum thread |
86 |
#https://www.redhat.com/archives/linux-lvm/2001-May/msg00523.html |
87 |
|
88 |
LOGICAL_VOLUMES=`/sbin/lvdisplay ${locking} |grep "LV Name"|sed -e 's/.*LV Name\s*\(.*\)/\1/'|sort` |
89 |
VOLUME_GROUPS=`/sbin/vgdisplay ${locking} |grep "VG Name"|sed -e 's/.*VG Name\s*\(.*\)/\1/'|sort` |
90 |
for x in ${LOGICAL_VOLUMES} |
91 |
do |
92 |
LV_IS_ACTIVE=`/sbin/lvdisplay ${locking} ${x}|grep "# open"|awk '{print $3}'` |
93 |
if [ "${LV_IS_ACTIVE}" = 0 ] |
94 |
then |
95 |
ebegin " Shutting Down logical volume: ${x} " |
96 |
/sbin/lvchange -an ${locking} -P ${x} >/dev/null |
97 |
eend $? |
98 |
fi |
99 |
done |
100 |
|
101 |
for x in ${VOLUME_GROUPS} |
102 |
do |
103 |
VG_HAS_ACTIVE_LV=`/sbin/vgdisplay ${locking} ${x}|grep "Open LV"|sed -e 's/.*Open LV\s*\(.*\)/\1/'` |
104 |
if [ "${VG_HAS_ACTIVE_LV}" = 0 ] |
105 |
then |
106 |
ebegin " Shutting Down volume group: ${x} " |
107 |
/sbin/vgchange -an ${locking} -P ${x} >/dev/null |
108 |
eend |
109 |
fi |
110 |
done |
111 |
|
112 |
for x in ${LOGICAL_VOLUMES} |
113 |
do |
114 |
LV_IS_ACTIVE=`/sbin/lvdisplay ${locking} ${x}|grep "# open"|sed -e 's/.*# open\s*\(.*\)/\1/'` |
115 |
if [ "${LV_IS_ACTIVE}" = 1 ] |
116 |
then |
117 |
if type mountinfo >/dev/null 2>&1; then |
118 |
ROOT_DEVICE=`mountinfo -t /` |
119 |
else |
120 |
ROOT_DEVICE=`mount | awk '{if($3 == "/" && $1 != "rootfs"){print $1}}'` |
121 |
fi |
122 |
|
123 |
MOUNTED_DEVICE=${x} |
124 |
[ -L ${ROOT_DEVICE} ] && ROOT_DEVICE="`/bin/readlink ${ROOT_DEVICE}`" |
125 |
[ -L ${x} ] && MOUNTED_DEVICE="`/bin/readlink ${x}`" |
126 |
if [ ! ${ROOT_DEVICE} = ${MOUNTED_DEVICE} ] |
127 |
then |
128 |
ewarn " Unable to shutdown: ${x} " |
129 |
fi |
130 |
fi |
131 |
done |
132 |
einfo "Finished Shutting down the Logical Volume Manager" |
133 |
fi |
134 |
|
135 |
# vim:ts=4 |
136 |
|
137 |
|
138 |
|
139 |
1.1 sys-fs/lvm2/files/lvm2-2.02.49-lockdir-override.patch |
140 |
|
141 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/lvm2/files/lvm2-2.02.49-lockdir-override.patch?rev=1.1&view=markup |
142 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/lvm2/files/lvm2-2.02.49-lockdir-override.patch?rev=1.1&content-type=text/plain |
143 |
|
144 |
Index: lvm2-2.02.49-lockdir-override.patch |
145 |
=================================================================== |
146 |
diff -Nuarp --exclude '*~' --exclude '*.[oda]' --exclude '*.so' --exclude '*.static' --exclude test --exclude '*.in' --exclude Makefile --exclude man --exclude '*.pc' --exclude autoconf --exclude '*.po' LVM2.2.02.49.orig/lib/locking/file_locking.c LVM2.2.02.49/lib/locking/file_locking.c |
147 |
--- LVM2.2.02.49.orig/lib/locking/file_locking.c 2008-11-12 01:30:52.000000000 -0800 |
148 |
+++ LVM2.2.02.49/lib/locking/file_locking.c 2009-07-23 17:39:10.021993262 -0700 |
149 |
@@ -271,17 +271,22 @@ static int _file_lock_resource(struct cm |
150 |
return 1; |
151 |
} |
152 |
|
153 |
-int init_file_locking(struct locking_type *locking, struct cmd_context *cmd) |
154 |
+int init_file_locking(struct locking_type *locking, struct cmd_context *cmd, const char *lock_dir) |
155 |
{ |
156 |
locking->lock_resource = _file_lock_resource; |
157 |
locking->reset_locking = _reset_file_locking; |
158 |
locking->fin_locking = _fin_file_locking; |
159 |
locking->flags = 0; |
160 |
|
161 |
- /* Get lockfile directory from config file */ |
162 |
- strncpy(_lock_dir, find_config_tree_str(cmd, "global/locking_dir", |
163 |
- DEFAULT_LOCK_DIR), |
164 |
- sizeof(_lock_dir)); |
165 |
+ if(lock_dir) { |
166 |
+ /* Get lockfile directory from commandline */ |
167 |
+ strncpy(_lock_dir, lock_dir, sizeof(_lock_dir)); |
168 |
+ } else { |
169 |
+ /* Get lockfile directory from config file */ |
170 |
+ strncpy(_lock_dir, find_config_tree_str(cmd, "global/locking_dir", |
171 |
+ DEFAULT_LOCK_DIR), |
172 |
+ sizeof(_lock_dir)); |
173 |
+ } |
174 |
|
175 |
if (!dm_create_dir(_lock_dir)) |
176 |
return 0; |
177 |
diff -Nuarp --exclude '*~' --exclude '*.[oda]' --exclude '*.so' --exclude '*.static' --exclude test --exclude '*.in' --exclude Makefile --exclude man --exclude '*.pc' --exclude autoconf --exclude '*.po' LVM2.2.02.49.orig/lib/locking/locking.c LVM2.2.02.49/lib/locking/locking.c |
178 |
--- LVM2.2.02.49.orig/lib/locking/locking.c 2009-07-14 22:49:47.000000000 -0700 |
179 |
+++ LVM2.2.02.49/lib/locking/locking.c 2009-07-23 17:32:53.558509986 -0700 |
180 |
@@ -213,7 +213,7 @@ static void _update_vg_lock_count(const |
181 |
* Select a locking type |
182 |
* type: locking type; if < 0, then read config tree value |
183 |
*/ |
184 |
-int init_locking(int type, struct cmd_context *cmd) |
185 |
+int init_locking(int type, struct cmd_context *cmd, const char *lock_dir) |
186 |
{ |
187 |
if (type < 0) |
188 |
type = find_config_tree_int(cmd, "global/locking_type", 1); |
189 |
@@ -228,7 +228,7 @@ int init_locking(int type, struct cmd_co |
190 |
|
191 |
case 1: |
192 |
log_very_verbose("File-based locking selected."); |
193 |
- if (!init_file_locking(&_locking, cmd)) |
194 |
+ if (!init_file_locking(&_locking, cmd, lock_dir)) |
195 |
break; |
196 |
return 1; |
197 |
|
198 |
@@ -268,7 +268,7 @@ int init_locking(int type, struct cmd_co |
199 |
log_warn("WARNING: Falling back to local file-based locking."); |
200 |
log_warn("Volume Groups with the clustered attribute will " |
201 |
"be inaccessible."); |
202 |
- if (init_file_locking(&_locking, cmd)) |
203 |
+ if (init_file_locking(&_locking, cmd, lock_dir)) |
204 |
return 1; |
205 |
} |
206 |
|
207 |
diff -Nuarp --exclude '*~' --exclude '*.[oda]' --exclude '*.so' --exclude '*.static' --exclude test --exclude '*.in' --exclude Makefile --exclude man --exclude '*.pc' --exclude autoconf --exclude '*.po' LVM2.2.02.49.orig/lib/locking/locking.h LVM2.2.02.49/lib/locking/locking.h |
208 |
--- LVM2.2.02.49.orig/lib/locking/locking.h 2009-06-12 01:30:19.000000000 -0700 |
209 |
+++ LVM2.2.02.49/lib/locking/locking.h 2009-07-23 17:31:49.638555398 -0700 |
210 |
@@ -19,7 +19,7 @@ |
211 |
#include "uuid.h" |
212 |
#include "config.h" |
213 |
|
214 |
-int init_locking(int type, struct cmd_context *cmd); |
215 |
+int init_locking(int type, struct cmd_context *cmd, const char *lock_dir); |
216 |
void fin_locking(void); |
217 |
void reset_locking(void); |
218 |
int vg_write_lock_held(void); |
219 |
diff -Nuarp --exclude '*~' --exclude '*.[oda]' --exclude '*.so' --exclude '*.static' --exclude test --exclude '*.in' --exclude Makefile --exclude man --exclude '*.pc' --exclude autoconf --exclude '*.po' LVM2.2.02.49.orig/lib/locking/locking_types.h LVM2.2.02.49/lib/locking/locking_types.h |
220 |
--- LVM2.2.02.49.orig/lib/locking/locking_types.h 2009-07-14 22:57:11.000000000 -0700 |
221 |
+++ LVM2.2.02.49/lib/locking/locking_types.h 2009-07-23 17:37:58.598009804 -0700 |
222 |
@@ -42,7 +42,7 @@ int init_no_locking(struct locking_type |
223 |
|
224 |
int init_readonly_locking(struct locking_type *locking, struct cmd_context *cmd); |
225 |
|
226 |
-int init_file_locking(struct locking_type *locking, struct cmd_context *cmd); |
227 |
+int init_file_locking(struct locking_type *locking, struct cmd_context *cmd, const char *lock_dir); |
228 |
|
229 |
int init_external_locking(struct locking_type *locking, struct cmd_context *cmd); |
230 |
|
231 |
diff -Nuarp --exclude '*~' --exclude '*.[oda]' --exclude '*.so' --exclude '*.static' --exclude test --exclude '*.in' --exclude Makefile --exclude man --exclude '*.pc' --exclude autoconf --exclude '*.po' LVM2.2.02.49.orig/liblvm/lvm_base.c LVM2.2.02.49/liblvm/lvm_base.c |
232 |
--- LVM2.2.02.49.orig/liblvm/lvm_base.c 2009-07-13 20:01:18.000000000 -0700 |
233 |
+++ LVM2.2.02.49/liblvm/lvm_base.c 2009-07-23 17:38:09.830509799 -0700 |
234 |
@@ -39,7 +39,7 @@ lvm_t lvm_create(const char *system_dir) |
235 |
|
236 |
/* FIXME: locking_type config option needed? */ |
237 |
/* initialize locking */ |
238 |
- if (!init_locking(-1, cmd)) { |
239 |
+ if (!init_locking(-1, cmd, NULL)) { |
240 |
/* FIXME: use EAGAIN as error code here */ |
241 |
log_error("Locking initialisation failed."); |
242 |
lvm_destroy((lvm_t) cmd); |
243 |
diff -Nuarp --exclude '*~' --exclude '*.[oda]' --exclude '*.so' --exclude '*.static' --exclude test --exclude '*.in' --exclude Makefile --exclude man --exclude '*.pc' --exclude autoconf --exclude '*.po' LVM2.2.02.49.orig/tools/args.h LVM2.2.02.49/tools/args.h |
244 |
--- LVM2.2.02.49.orig/tools/args.h 2009-06-04 05:01:16.000000000 -0700 |
245 |
+++ LVM2.2.02.49/tools/args.h 2009-07-23 17:30:36.680664586 -0700 |
246 |
@@ -22,6 +22,7 @@ arg(version_ARG, '\0', "version", NULL, |
247 |
arg(quiet_ARG, '\0', "quiet", NULL, 0) |
248 |
arg(physicalvolumesize_ARG, '\0', "setphysicalvolumesize", size_mb_arg, 0) |
249 |
arg(ignorelockingfailure_ARG, '\0', "ignorelockingfailure", NULL, 0) |
250 |
+arg(lock_dir_ARG, '\0', "lock-dir", string_arg, 0) |
251 |
arg(nolocking_ARG, '\0', "nolocking", NULL, 0) |
252 |
arg(metadatacopies_ARG, '\0', "metadatacopies", int_arg, 0) |
253 |
arg(metadatasize_ARG, '\0', "metadatasize", size_mb_arg, 0) |
254 |
diff -Nuarp --exclude '*~' --exclude '*.[oda]' --exclude '*.so' --exclude '*.static' --exclude test --exclude '*.in' --exclude Makefile --exclude man --exclude '*.pc' --exclude autoconf --exclude '*.po' LVM2.2.02.49.orig/tools/commands.h LVM2.2.02.49/tools/commands.h |
255 |
--- LVM2.2.02.49.orig/tools/commands.h 2009-07-06 12:13:26.000000000 -0700 |
256 |
+++ LVM2.2.02.49/tools/commands.h 2009-07-23 17:30:36.680664586 -0700 |
257 |
@@ -70,6 +70,7 @@ xx(lvchange, |
258 |
"\t[-f|--force]\n" |
259 |
"\t[-h|--help]\n" |
260 |
"\t[--ignorelockingfailure]\n" |
261 |
+ "\t[--lock-dir path]\n" |
262 |
"\t[--ignoremonitoring]\n" |
263 |
"\t[--monitor {y|n}]\n" |
264 |
"\t[-M|--persistent y|n] [--major major] [--minor minor]\n" |
265 |
@@ -85,7 +86,7 @@ xx(lvchange, |
266 |
"\tLogicalVolume[Path] [LogicalVolume[Path]...]\n", |
267 |
|
268 |
alloc_ARG, autobackup_ARG, available_ARG, contiguous_ARG, force_ARG, |
269 |
- ignorelockingfailure_ARG, ignoremonitoring_ARG, major_ARG, minor_ARG, |
270 |
+ ignorelockingfailure_ARG, lock_dir_ARG, ignoremonitoring_ARG, major_ARG, minor_ARG, |
271 |
monitor_ARG, partial_ARG, permission_ARG, persistent_ARG, readahead_ARG, |
272 |
resync_ARG, refresh_ARG, addtag_ARG, deltag_ARG, test_ARG, yes_ARG) |
273 |
|
274 |
@@ -185,6 +186,7 @@ xx(lvdisplay, |
275 |
"\t[-d|--debug]\n" |
276 |
"\t[-h|--help]\n" |
277 |
"\t[--ignorelockingfailure]\n" |
278 |
+ "\t[--lock-dir path]\n" |
279 |
"\t[-m|--maps]\n" |
280 |
"\t[--nosuffix]\n" |
281 |
"\t[-P|--partial] " "\n" |
282 |
@@ -199,6 +201,7 @@ xx(lvdisplay, |
283 |
"\t[-d|--debug]\n" |
284 |
"\t[-h|--help]\n" |
285 |
"\t[--ignorelockingfailure]\n" |
286 |
+ "\t[--lock-dir path]\n" |
287 |
"\t[--noheadings]\n" |
288 |
"\t[--nosuffix]\n" |
289 |
"\t[-o|--options [+]Field[,Field]]\n" |
290 |
@@ -213,7 +216,7 @@ xx(lvdisplay, |
291 |
"\t[LogicalVolume[Path] [LogicalVolume[Path]...]]\n", |
292 |
|
293 |
aligned_ARG, all_ARG, colon_ARG, columns_ARG, disk_ARG, |
294 |
- ignorelockingfailure_ARG, maps_ARG, noheadings_ARG, nosuffix_ARG, |
295 |
+ ignorelockingfailure_ARG, lock_dir_ARG, maps_ARG, noheadings_ARG, nosuffix_ARG, |
296 |
options_ARG, sort_ARG, partial_ARG, segments_ARG, separator_ARG, |
297 |
unbuffered_ARG, units_ARG) |
298 |
|
299 |
@@ -373,6 +376,7 @@ xx(lvs, |
300 |
"\t[-d|--debug]\n" |
301 |
"\t[-h|--help]\n" |
302 |
"\t[--ignorelockingfailure]\n" |
303 |
+ "\t[--lock-dir path]\n" |
304 |
"\t[--nameprefixes]\n" |
305 |
"\t[--noheadings]\n" |
306 |
"\t[--nosuffix]\n" |
307 |
@@ -390,7 +394,7 @@ xx(lvs, |
308 |
"\t[--version]" "\n" |
309 |
"\t[LogicalVolume[Path] [LogicalVolume[Path]...]]\n", |
310 |
|
311 |
- aligned_ARG, all_ARG, ignorelockingfailure_ARG, nameprefixes_ARG, |
312 |
+ aligned_ARG, all_ARG, ignorelockingfailure_ARG, lock_dir_ARG, nameprefixes_ARG, |
313 |
noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG, |
314 |
rows_ARG, segments_ARG, separator_ARG, sort_ARG, trustcache_ARG, |
315 |
unbuffered_ARG, units_ARG, unquoted_ARG) |
316 |
@@ -404,11 +408,12 @@ xx(lvscan, |
317 |
"\t[-d|--debug] " "\n" |
318 |
"\t[-h|-?|--help] " "\n" |
319 |
"\t[--ignorelockingfailure]\n" |
320 |
+ "\t[--lock-dir path]\n" |
321 |
"\t[-P|--partial] " "\n" |
322 |
"\t[-v|--verbose] " "\n" |
323 |
"\t[--version]\n", |
324 |
|
325 |
- all_ARG, blockdevice_ARG, disk_ARG, ignorelockingfailure_ARG, partial_ARG) |
326 |
+ all_ARG, blockdevice_ARG, disk_ARG, ignorelockingfailure_ARG, lock_dir_ARG, partial_ARG) |
327 |
|
328 |
xx(pvchange, |
329 |
"Change attributes of physical volume(s)", |
330 |
@@ -510,6 +515,7 @@ xx(pvdisplay, |
331 |
"\t[-d|--debug]\n" |
332 |
"\t[-h|--help]\n" |
333 |
"\t[--ignorelockingfailure]\n" |
334 |
+ "\t[--lock-dir path]\n" |
335 |
"\t[-m|--maps]\n" |
336 |
"\t[--nosuffix]\n" |
337 |
"\t[-s|--short]\n" |
338 |
@@ -524,6 +530,7 @@ xx(pvdisplay, |
339 |
"\t[-d|--debug]\n" |
340 |
"\t[-h|--help]\n" |
341 |
"\t[--ignorelockingfailure]\n" |
342 |
+ "\t[--lock-dir path]\n" |
343 |
"\t[--noheadings]\n" |
344 |
"\t[--nosuffix]\n" |
345 |
"\t[-o|--options [+]Field[,Field]]\n" |
346 |
@@ -535,7 +542,7 @@ xx(pvdisplay, |
347 |
"\t[--version]" "\n" |
348 |
"\t[PhysicalVolumePath [PhysicalVolumePath...]]\n", |
349 |
|
350 |
- aligned_ARG, all_ARG, colon_ARG, columns_ARG, ignorelockingfailure_ARG, |
351 |
+ aligned_ARG, all_ARG, colon_ARG, columns_ARG, ignorelockingfailure_ARG, lock_dir_ARG, |
352 |
maps_ARG, noheadings_ARG, nosuffix_ARG, options_ARG, separator_ARG, |
353 |
short_ARG, sort_ARG, unbuffered_ARG, units_ARG) |
354 |
|
355 |
@@ -585,6 +592,7 @@ xx(pvs, |
356 |
"\t[-d|--debug]" "\n" |
357 |
"\t[-h|-?|--help] " "\n" |
358 |
"\t[--ignorelockingfailure]\n" |
359 |
+ "\t[--lock-dir path]\n" |
360 |
"\t[--nameprefixes]\n" |
361 |
"\t[--noheadings]\n" |
362 |
"\t[--nosuffix]\n" |
363 |
@@ -602,7 +610,7 @@ xx(pvs, |
364 |
"\t[--version]\n" |
365 |
"\t[PhysicalVolume [PhysicalVolume...]]\n", |
366 |
|
367 |
- aligned_ARG, all_ARG, ignorelockingfailure_ARG, nameprefixes_ARG, |
368 |
+ aligned_ARG, all_ARG, ignorelockingfailure_ARG, lock_dir_ARG, nameprefixes_ARG, |
369 |
noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG, |
370 |
rows_ARG, segments_ARG, separator_ARG, sort_ARG, trustcache_ARG, |
371 |
unbuffered_ARG, units_ARG, unquoted_ARG) |
372 |
@@ -615,13 +623,14 @@ xx(pvscan, |
373 |
"\t{-e|--exported | -n|--novolumegroup} " "\n" |
374 |
"\t[-h|-?|--help]" "\n" |
375 |
"\t[--ignorelockingfailure]\n" |
376 |
+ "\t[--lock-dir path]\n" |
377 |
"\t[-P|--partial] " "\n" |
378 |
"\t[-s|--short] " "\n" |
379 |
"\t[-u|--uuid] " "\n" |
380 |
"\t[-v|--verbose] " "\n" |
381 |
"\t[--version]\n", |
382 |
|
383 |
- exported_ARG, ignorelockingfailure_ARG, novolumegroup_ARG, partial_ARG, |
384 |
+ exported_ARG, ignorelockingfailure_ARG, lock_dir_ARG, novolumegroup_ARG, partial_ARG, |
385 |
short_ARG, uuid_ARG) |
386 |
|
387 |
xx(segtypes, |
388 |
@@ -637,12 +646,13 @@ xx(vgcfgbackup, |
389 |
"\t[-f|--file filename] " "\n" |
390 |
"\t[-h|-?|--help] " "\n" |
391 |
"\t[--ignorelockingfailure]\n" |
392 |
+ "\t[--lock-dir path]\n" |
393 |
"\t[-P|--partial] " "\n" |
394 |
"\t[-v|--verbose]" "\n" |
395 |
"\t[--version] " "\n" |
396 |
"\t[VolumeGroupName...]\n", |
397 |
|
398 |
- file_ARG, ignorelockingfailure_ARG, partial_ARG) |
399 |
+ file_ARG, ignorelockingfailure_ARG, lock_dir_ARG, partial_ARG) |
400 |
|
401 |
xx(vgcfgrestore, |
402 |
"Restore volume group configuration", |
403 |
@@ -671,6 +681,7 @@ xx(vgchange, |
404 |
"\t[-d|--debug] " "\n" |
405 |
"\t[-h|--help] " "\n" |
406 |
"\t[--ignorelockingfailure]\n" |
407 |
+ "\t[--lock-dir path]\n" |
408 |
"\t[--ignoremonitoring]\n" |
409 |
"\t[--monitor {y|n}]\n" |
410 |
"\t[--refresh]\n" |
411 |
@@ -689,7 +700,7 @@ xx(vgchange, |
412 |
"\t[VolumeGroupName...]\n", |
413 |
|
414 |
addtag_ARG, alloc_ARG, allocation_ARG, autobackup_ARG, available_ARG, |
415 |
- clustered_ARG, deltag_ARG, ignorelockingfailure_ARG, ignoremonitoring_ARG, |
416 |
+ clustered_ARG, deltag_ARG, ignorelockingfailure_ARG, lock_dir_ARG, ignoremonitoring_ARG, |
417 |
logicalvolume_ARG, maxphysicalvolumes_ARG, monitor_ARG, partial_ARG, |
418 |
physicalextentsize_ARG, refresh_ARG, resizeable_ARG, resizable_ARG, |
419 |
test_ARG, uuid_ARG) |
420 |
@@ -752,6 +763,7 @@ xx(vgdisplay, |
421 |
"\t[-d|--debug] " "\n" |
422 |
"\t[-h|--help] " "\n" |
423 |
"\t[--ignorelockingfailure]" "\n" |
424 |
+ "\t[--lock-dir path]\n" |
425 |
"\t[--nosuffix]\n" |
426 |
"\t[-P|--partial] " "\n" |
427 |
"\t[--units hsbkmgtHKMGT]\n" |
428 |
@@ -764,6 +776,7 @@ xx(vgdisplay, |
429 |
"\t[-d|--debug] " "\n" |
430 |
"\t[-h|--help] " "\n" |
431 |
"\t[--ignorelockingfailure]" "\n" |
432 |
+ "\t[--lock-dir path]\n" |
433 |
"\t[--noheadings]\n" |
434 |
"\t[--nosuffix]\n" |
435 |
"\t[-o|--options [+]Field[,Field]]\n" |
436 |
@@ -777,7 +790,7 @@ xx(vgdisplay, |
437 |
"\t[VolumeGroupName [VolumeGroupName...]]\n", |
438 |
|
439 |
activevolumegroups_ARG, aligned_ARG, colon_ARG, columns_ARG, disk_ARG, |
440 |
- ignorelockingfailure_ARG, noheadings_ARG, nosuffix_ARG, options_ARG, |
441 |
+ ignorelockingfailure_ARG, lock_dir_ARG, noheadings_ARG, nosuffix_ARG, options_ARG, |
442 |
partial_ARG, short_ARG, separator_ARG, sort_ARG, unbuffered_ARG, units_ARG) |
443 |
|
444 |
xx(vgexport, |
445 |
@@ -844,12 +857,13 @@ xx(vgmknodes, |
446 |
"\t[-d|--debug]\n" |
447 |
"\t[-h|--help]\n" |
448 |
"\t[--ignorelockingfailure]\n" |
449 |
+ "\t[--lock-dir path]\n" |
450 |
"\t[--refresh]\n" |
451 |
"\t[-v|--verbose]\n" |
452 |
"\t[--version]" "\n" |
453 |
"\t[VolumeGroupName...]\n", |
454 |
|
455 |
- ignorelockingfailure_ARG, refresh_ARG) |
456 |
+ ignorelockingfailure_ARG, lock_dir_ARG, refresh_ARG) |
457 |
|
458 |
xx(vgreduce, |
459 |
"Remove physical volume(s) from a volume group", |
460 |
@@ -909,6 +923,7 @@ xx(vgs, |
461 |
"\t[-d|--debug]\n" |
462 |
"\t[-h|--help]\n" |
463 |
"\t[--ignorelockingfailure]\n" |
464 |
+ "\t[--lock-dir path]\n" |
465 |
"\t[--nameprefixes]\n" |
466 |
"\t[--noheadings]\n" |
467 |
"\t[--nosuffix]\n" |
468 |
@@ -925,7 +940,7 @@ xx(vgs, |
469 |
"\t[--version]\n" |
470 |
"\t[VolumeGroupName [VolumeGroupName...]]\n", |
471 |
|
472 |
- aligned_ARG, all_ARG, ignorelockingfailure_ARG, nameprefixes_ARG, |
473 |
+ aligned_ARG, all_ARG, ignorelockingfailure_ARG, lock_dir_ARG, nameprefixes_ARG, |
474 |
noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG, |
475 |
rows_ARG, separator_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG, units_ARG, |
476 |
unquoted_ARG) |
477 |
@@ -937,12 +952,13 @@ xx(vgscan, |
478 |
"\t[-d|--debug]\n" |
479 |
"\t[-h|--help]\n" |
480 |
"\t[--ignorelockingfailure]\n" |
481 |
+ "\t[--lock-dir path]\n" |
482 |
"\t[--mknodes]\n" |
483 |
"\t[-P|--partial] " "\n" |
484 |
"\t[-v|--verbose]\n" |
485 |
"\t[--version]" "\n", |
486 |
|
487 |
- ignorelockingfailure_ARG, mknodes_ARG, partial_ARG) |
488 |
+ ignorelockingfailure_ARG, lock_dir_ARG, mknodes_ARG, partial_ARG) |
489 |
|
490 |
xx(vgsplit, |
491 |
"Move physical volumes into a new or existing volume group", |
492 |
diff -Nuarp --exclude '*~' --exclude '*.[oda]' --exclude '*.so' --exclude '*.static' --exclude test --exclude '*.in' --exclude Makefile --exclude man --exclude '*.pc' --exclude autoconf --exclude '*.po' LVM2.2.02.49.orig/tools/lvmcmdline.c LVM2.2.02.49/tools/lvmcmdline.c |
493 |
--- LVM2.2.02.49.orig/tools/lvmcmdline.c 2009-07-13 12:49:49.000000000 -0700 |
494 |
+++ LVM2.2.02.49/tools/lvmcmdline.c 2009-07-23 17:37:30.774058849 -0700 |
495 |
@@ -964,6 +964,7 @@ int lvm_run_command(struct cmd_context * |
496 |
{ |
497 |
int ret = 0; |
498 |
int locking_type; |
499 |
+ const char *lock_dir; |
500 |
|
501 |
init_error_message_produced(0); |
502 |
|
503 |
@@ -1015,7 +1016,12 @@ int lvm_run_command(struct cmd_context * |
504 |
else |
505 |
locking_type = -1; |
506 |
|
507 |
- if (!init_locking(locking_type, cmd)) { |
508 |
+ if(arg_count(cmd, lock_dir_ARG)) { |
509 |
+ /* Get lockfile directory from commandline */ |
510 |
+ lock_dir = arg_str_value(cmd, lock_dir_ARG, ""); |
511 |
+ } |
512 |
+ |
513 |
+ if (!init_locking(locking_type, cmd, lock_dir)) { |
514 |
log_error("Locking type %d initialisation failed.", |
515 |
locking_type); |
516 |
ret = ECMD_FAILED; |
517 |
diff -Nuarp LVM2.2.02.49.orig/man/lvm.8.in LVM2.2.02.49/man/lvm.8.in |
518 |
--- LVM2.2.02.49.orig/man/lvm.8.in 2009-05-14 09:46:13.000000000 -0700 |
519 |
+++ LVM2.2.02.49/man/lvm.8.in 2009-07-24 15:48:14.768492371 -0700 |
520 |
@@ -202,6 +202,11 @@ This lets you proceed with read-only met |
521 |
One use for this is in a system init script if the lock directory |
522 |
is mounted read-only when the script runs. |
523 |
.TP |
524 |
+\fB--lock-dir\fP |
525 |
+This lets you override the directory used for lockfiles, as an alternative to |
526 |
+entirely overriding locking failures. One use for this is in a system init script |
527 |
+where parts of the system are still read-only. |
528 |
+.TP |
529 |
\fB--addtag tag\fP |
530 |
Add the tag \fBtag\fP to a PV, VG or LV. |
531 |
A tag is a word that can be used to group LVM2 objects of the same type |