diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2009-07-24 23:37:37 +0000 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2009-07-24 23:37:37 +0000 |
commit | 7249a9bc7427187390092e81e067d96e91f20794 (patch) | |
tree | d87928536fa74c7ee42710e2fda6896847dcd532 /sys-fs | |
parent | Automated update of use.local.desc (diff) | |
download | gentoo-2-7249a9bc7427187390092e81e067d96e91f20794.tar.gz gentoo-2-7249a9bc7427187390092e81e067d96e91f20794.tar.bz2 gentoo-2-7249a9bc7427187390092e81e067d96e91f20794.zip |
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.
(Portage version: 2.2_rc33/cvs/Linux x86_64)
Diffstat (limited to 'sys-fs')
-rw-r--r-- | sys-fs/lvm2/ChangeLog | 11 | ||||
-rw-r--r-- | sys-fs/lvm2/files/lvm2-2.02.49-lockdir-override.patch | 386 | ||||
-rwxr-xr-x | sys-fs/lvm2/files/lvm2-start.sh-2.02.49-r1 | 42 | ||||
-rwxr-xr-x | sys-fs/lvm2/files/lvm2-stop.sh-2.02.49-r1 | 67 | ||||
-rw-r--r-- | sys-fs/lvm2/lvm2-2.02.49-r1.ebuild | 216 |
5 files changed, 721 insertions, 1 deletions
diff --git a/sys-fs/lvm2/ChangeLog b/sys-fs/lvm2/ChangeLog index c0496b0eb980..64e005fb72b2 100644 --- a/sys-fs/lvm2/ChangeLog +++ b/sys-fs/lvm2/ChangeLog @@ -1,6 +1,15 @@ # ChangeLog for sys-fs/lvm2 # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/ChangeLog,v 1.164 2009/07/22 01:06:26 robbat2 Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/ChangeLog,v 1.165 2009/07/24 23:37:37 robbat2 Exp $ + +*lvm2-2.02.49-r1 (24 Jul 2009) + + 24 Jul 2009; Robin H. Johnson <robbat2@gentoo.org> + +files/lvm2-start.sh-2.02.49-r1, +files/lvm2-stop.sh-2.02.49-r1, + +lvm2-2.02.49-r1.ebuild, +files/lvm2-2.02.49-lockdir-override.patch: + 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. *lvm2-2.02.49 (22 Jul 2009) diff --git a/sys-fs/lvm2/files/lvm2-2.02.49-lockdir-override.patch b/sys-fs/lvm2/files/lvm2-2.02.49-lockdir-override.patch new file mode 100644 index 000000000000..12fc06563548 --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-2.02.49-lockdir-override.patch @@ -0,0 +1,386 @@ +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 +--- LVM2.2.02.49.orig/lib/locking/file_locking.c 2008-11-12 01:30:52.000000000 -0800 ++++ LVM2.2.02.49/lib/locking/file_locking.c 2009-07-23 17:39:10.021993262 -0700 +@@ -271,17 +271,22 @@ static int _file_lock_resource(struct cm + return 1; + } + +-int init_file_locking(struct locking_type *locking, struct cmd_context *cmd) ++int init_file_locking(struct locking_type *locking, struct cmd_context *cmd, const char *lock_dir) + { + locking->lock_resource = _file_lock_resource; + locking->reset_locking = _reset_file_locking; + locking->fin_locking = _fin_file_locking; + locking->flags = 0; + +- /* Get lockfile directory from config file */ +- strncpy(_lock_dir, find_config_tree_str(cmd, "global/locking_dir", +- DEFAULT_LOCK_DIR), +- sizeof(_lock_dir)); ++ if(lock_dir) { ++ /* Get lockfile directory from commandline */ ++ strncpy(_lock_dir, lock_dir, sizeof(_lock_dir)); ++ } else { ++ /* Get lockfile directory from config file */ ++ strncpy(_lock_dir, find_config_tree_str(cmd, "global/locking_dir", ++ DEFAULT_LOCK_DIR), ++ sizeof(_lock_dir)); ++ } + + if (!dm_create_dir(_lock_dir)) + return 0; +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 +--- LVM2.2.02.49.orig/lib/locking/locking.c 2009-07-14 22:49:47.000000000 -0700 ++++ LVM2.2.02.49/lib/locking/locking.c 2009-07-23 17:32:53.558509986 -0700 +@@ -213,7 +213,7 @@ static void _update_vg_lock_count(const + * Select a locking type + * type: locking type; if < 0, then read config tree value + */ +-int init_locking(int type, struct cmd_context *cmd) ++int init_locking(int type, struct cmd_context *cmd, const char *lock_dir) + { + if (type < 0) + type = find_config_tree_int(cmd, "global/locking_type", 1); +@@ -228,7 +228,7 @@ int init_locking(int type, struct cmd_co + + case 1: + log_very_verbose("File-based locking selected."); +- if (!init_file_locking(&_locking, cmd)) ++ if (!init_file_locking(&_locking, cmd, lock_dir)) + break; + return 1; + +@@ -268,7 +268,7 @@ int init_locking(int type, struct cmd_co + log_warn("WARNING: Falling back to local file-based locking."); + log_warn("Volume Groups with the clustered attribute will " + "be inaccessible."); +- if (init_file_locking(&_locking, cmd)) ++ if (init_file_locking(&_locking, cmd, lock_dir)) + return 1; + } + +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 +--- LVM2.2.02.49.orig/lib/locking/locking.h 2009-06-12 01:30:19.000000000 -0700 ++++ LVM2.2.02.49/lib/locking/locking.h 2009-07-23 17:31:49.638555398 -0700 +@@ -19,7 +19,7 @@ + #include "uuid.h" + #include "config.h" + +-int init_locking(int type, struct cmd_context *cmd); ++int init_locking(int type, struct cmd_context *cmd, const char *lock_dir); + void fin_locking(void); + void reset_locking(void); + int vg_write_lock_held(void); +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 +--- LVM2.2.02.49.orig/lib/locking/locking_types.h 2009-07-14 22:57:11.000000000 -0700 ++++ LVM2.2.02.49/lib/locking/locking_types.h 2009-07-23 17:37:58.598009804 -0700 +@@ -42,7 +42,7 @@ int init_no_locking(struct locking_type + + int init_readonly_locking(struct locking_type *locking, struct cmd_context *cmd); + +-int init_file_locking(struct locking_type *locking, struct cmd_context *cmd); ++int init_file_locking(struct locking_type *locking, struct cmd_context *cmd, const char *lock_dir); + + int init_external_locking(struct locking_type *locking, struct cmd_context *cmd); + +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 +--- LVM2.2.02.49.orig/liblvm/lvm_base.c 2009-07-13 20:01:18.000000000 -0700 ++++ LVM2.2.02.49/liblvm/lvm_base.c 2009-07-23 17:38:09.830509799 -0700 +@@ -39,7 +39,7 @@ lvm_t lvm_create(const char *system_dir) + + /* FIXME: locking_type config option needed? */ + /* initialize locking */ +- if (!init_locking(-1, cmd)) { ++ if (!init_locking(-1, cmd, NULL)) { + /* FIXME: use EAGAIN as error code here */ + log_error("Locking initialisation failed."); + lvm_destroy((lvm_t) cmd); +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 +--- LVM2.2.02.49.orig/tools/args.h 2009-06-04 05:01:16.000000000 -0700 ++++ LVM2.2.02.49/tools/args.h 2009-07-23 17:30:36.680664586 -0700 +@@ -22,6 +22,7 @@ arg(version_ARG, '\0', "version", NULL, + arg(quiet_ARG, '\0', "quiet", NULL, 0) + arg(physicalvolumesize_ARG, '\0', "setphysicalvolumesize", size_mb_arg, 0) + arg(ignorelockingfailure_ARG, '\0', "ignorelockingfailure", NULL, 0) ++arg(lock_dir_ARG, '\0', "lock-dir", string_arg, 0) + arg(nolocking_ARG, '\0', "nolocking", NULL, 0) + arg(metadatacopies_ARG, '\0', "metadatacopies", int_arg, 0) + arg(metadatasize_ARG, '\0', "metadatasize", size_mb_arg, 0) +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 +--- LVM2.2.02.49.orig/tools/commands.h 2009-07-06 12:13:26.000000000 -0700 ++++ LVM2.2.02.49/tools/commands.h 2009-07-23 17:30:36.680664586 -0700 +@@ -70,6 +70,7 @@ xx(lvchange, + "\t[-f|--force]\n" + "\t[-h|--help]\n" + "\t[--ignorelockingfailure]\n" ++ "\t[--lock-dir path]\n" + "\t[--ignoremonitoring]\n" + "\t[--monitor {y|n}]\n" + "\t[-M|--persistent y|n] [--major major] [--minor minor]\n" +@@ -85,7 +86,7 @@ xx(lvchange, + "\tLogicalVolume[Path] [LogicalVolume[Path]...]\n", + + alloc_ARG, autobackup_ARG, available_ARG, contiguous_ARG, force_ARG, +- ignorelockingfailure_ARG, ignoremonitoring_ARG, major_ARG, minor_ARG, ++ ignorelockingfailure_ARG, lock_dir_ARG, ignoremonitoring_ARG, major_ARG, minor_ARG, + monitor_ARG, partial_ARG, permission_ARG, persistent_ARG, readahead_ARG, + resync_ARG, refresh_ARG, addtag_ARG, deltag_ARG, test_ARG, yes_ARG) + +@@ -185,6 +186,7 @@ xx(lvdisplay, + "\t[-d|--debug]\n" + "\t[-h|--help]\n" + "\t[--ignorelockingfailure]\n" ++ "\t[--lock-dir path]\n" + "\t[-m|--maps]\n" + "\t[--nosuffix]\n" + "\t[-P|--partial] " "\n" +@@ -199,6 +201,7 @@ xx(lvdisplay, + "\t[-d|--debug]\n" + "\t[-h|--help]\n" + "\t[--ignorelockingfailure]\n" ++ "\t[--lock-dir path]\n" + "\t[--noheadings]\n" + "\t[--nosuffix]\n" + "\t[-o|--options [+]Field[,Field]]\n" +@@ -213,7 +216,7 @@ xx(lvdisplay, + "\t[LogicalVolume[Path] [LogicalVolume[Path]...]]\n", + + aligned_ARG, all_ARG, colon_ARG, columns_ARG, disk_ARG, +- ignorelockingfailure_ARG, maps_ARG, noheadings_ARG, nosuffix_ARG, ++ ignorelockingfailure_ARG, lock_dir_ARG, maps_ARG, noheadings_ARG, nosuffix_ARG, + options_ARG, sort_ARG, partial_ARG, segments_ARG, separator_ARG, + unbuffered_ARG, units_ARG) + +@@ -373,6 +376,7 @@ xx(lvs, + "\t[-d|--debug]\n" + "\t[-h|--help]\n" + "\t[--ignorelockingfailure]\n" ++ "\t[--lock-dir path]\n" + "\t[--nameprefixes]\n" + "\t[--noheadings]\n" + "\t[--nosuffix]\n" +@@ -390,7 +394,7 @@ xx(lvs, + "\t[--version]" "\n" + "\t[LogicalVolume[Path] [LogicalVolume[Path]...]]\n", + +- aligned_ARG, all_ARG, ignorelockingfailure_ARG, nameprefixes_ARG, ++ aligned_ARG, all_ARG, ignorelockingfailure_ARG, lock_dir_ARG, nameprefixes_ARG, + noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG, + rows_ARG, segments_ARG, separator_ARG, sort_ARG, trustcache_ARG, + unbuffered_ARG, units_ARG, unquoted_ARG) +@@ -404,11 +408,12 @@ xx(lvscan, + "\t[-d|--debug] " "\n" + "\t[-h|-?|--help] " "\n" + "\t[--ignorelockingfailure]\n" ++ "\t[--lock-dir path]\n" + "\t[-P|--partial] " "\n" + "\t[-v|--verbose] " "\n" + "\t[--version]\n", + +- all_ARG, blockdevice_ARG, disk_ARG, ignorelockingfailure_ARG, partial_ARG) ++ all_ARG, blockdevice_ARG, disk_ARG, ignorelockingfailure_ARG, lock_dir_ARG, partial_ARG) + + xx(pvchange, + "Change attributes of physical volume(s)", +@@ -510,6 +515,7 @@ xx(pvdisplay, + "\t[-d|--debug]\n" + "\t[-h|--help]\n" + "\t[--ignorelockingfailure]\n" ++ "\t[--lock-dir path]\n" + "\t[-m|--maps]\n" + "\t[--nosuffix]\n" + "\t[-s|--short]\n" +@@ -524,6 +530,7 @@ xx(pvdisplay, + "\t[-d|--debug]\n" + "\t[-h|--help]\n" + "\t[--ignorelockingfailure]\n" ++ "\t[--lock-dir path]\n" + "\t[--noheadings]\n" + "\t[--nosuffix]\n" + "\t[-o|--options [+]Field[,Field]]\n" +@@ -535,7 +542,7 @@ xx(pvdisplay, + "\t[--version]" "\n" + "\t[PhysicalVolumePath [PhysicalVolumePath...]]\n", + +- aligned_ARG, all_ARG, colon_ARG, columns_ARG, ignorelockingfailure_ARG, ++ aligned_ARG, all_ARG, colon_ARG, columns_ARG, ignorelockingfailure_ARG, lock_dir_ARG, + maps_ARG, noheadings_ARG, nosuffix_ARG, options_ARG, separator_ARG, + short_ARG, sort_ARG, unbuffered_ARG, units_ARG) + +@@ -585,6 +592,7 @@ xx(pvs, + "\t[-d|--debug]" "\n" + "\t[-h|-?|--help] " "\n" + "\t[--ignorelockingfailure]\n" ++ "\t[--lock-dir path]\n" + "\t[--nameprefixes]\n" + "\t[--noheadings]\n" + "\t[--nosuffix]\n" +@@ -602,7 +610,7 @@ xx(pvs, + "\t[--version]\n" + "\t[PhysicalVolume [PhysicalVolume...]]\n", + +- aligned_ARG, all_ARG, ignorelockingfailure_ARG, nameprefixes_ARG, ++ aligned_ARG, all_ARG, ignorelockingfailure_ARG, lock_dir_ARG, nameprefixes_ARG, + noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG, + rows_ARG, segments_ARG, separator_ARG, sort_ARG, trustcache_ARG, + unbuffered_ARG, units_ARG, unquoted_ARG) +@@ -615,13 +623,14 @@ xx(pvscan, + "\t{-e|--exported | -n|--novolumegroup} " "\n" + "\t[-h|-?|--help]" "\n" + "\t[--ignorelockingfailure]\n" ++ "\t[--lock-dir path]\n" + "\t[-P|--partial] " "\n" + "\t[-s|--short] " "\n" + "\t[-u|--uuid] " "\n" + "\t[-v|--verbose] " "\n" + "\t[--version]\n", + +- exported_ARG, ignorelockingfailure_ARG, novolumegroup_ARG, partial_ARG, ++ exported_ARG, ignorelockingfailure_ARG, lock_dir_ARG, novolumegroup_ARG, partial_ARG, + short_ARG, uuid_ARG) + + xx(segtypes, +@@ -637,12 +646,13 @@ xx(vgcfgbackup, + "\t[-f|--file filename] " "\n" + "\t[-h|-?|--help] " "\n" + "\t[--ignorelockingfailure]\n" ++ "\t[--lock-dir path]\n" + "\t[-P|--partial] " "\n" + "\t[-v|--verbose]" "\n" + "\t[--version] " "\n" + "\t[VolumeGroupName...]\n", + +- file_ARG, ignorelockingfailure_ARG, partial_ARG) ++ file_ARG, ignorelockingfailure_ARG, lock_dir_ARG, partial_ARG) + + xx(vgcfgrestore, + "Restore volume group configuration", +@@ -671,6 +681,7 @@ xx(vgchange, + "\t[-d|--debug] " "\n" + "\t[-h|--help] " "\n" + "\t[--ignorelockingfailure]\n" ++ "\t[--lock-dir path]\n" + "\t[--ignoremonitoring]\n" + "\t[--monitor {y|n}]\n" + "\t[--refresh]\n" +@@ -689,7 +700,7 @@ xx(vgchange, + "\t[VolumeGroupName...]\n", + + addtag_ARG, alloc_ARG, allocation_ARG, autobackup_ARG, available_ARG, +- clustered_ARG, deltag_ARG, ignorelockingfailure_ARG, ignoremonitoring_ARG, ++ clustered_ARG, deltag_ARG, ignorelockingfailure_ARG, lock_dir_ARG, ignoremonitoring_ARG, + logicalvolume_ARG, maxphysicalvolumes_ARG, monitor_ARG, partial_ARG, + physicalextentsize_ARG, refresh_ARG, resizeable_ARG, resizable_ARG, + test_ARG, uuid_ARG) +@@ -752,6 +763,7 @@ xx(vgdisplay, + "\t[-d|--debug] " "\n" + "\t[-h|--help] " "\n" + "\t[--ignorelockingfailure]" "\n" ++ "\t[--lock-dir path]\n" + "\t[--nosuffix]\n" + "\t[-P|--partial] " "\n" + "\t[--units hsbkmgtHKMGT]\n" +@@ -764,6 +776,7 @@ xx(vgdisplay, + "\t[-d|--debug] " "\n" + "\t[-h|--help] " "\n" + "\t[--ignorelockingfailure]" "\n" ++ "\t[--lock-dir path]\n" + "\t[--noheadings]\n" + "\t[--nosuffix]\n" + "\t[-o|--options [+]Field[,Field]]\n" +@@ -777,7 +790,7 @@ xx(vgdisplay, + "\t[VolumeGroupName [VolumeGroupName...]]\n", + + activevolumegroups_ARG, aligned_ARG, colon_ARG, columns_ARG, disk_ARG, +- ignorelockingfailure_ARG, noheadings_ARG, nosuffix_ARG, options_ARG, ++ ignorelockingfailure_ARG, lock_dir_ARG, noheadings_ARG, nosuffix_ARG, options_ARG, + partial_ARG, short_ARG, separator_ARG, sort_ARG, unbuffered_ARG, units_ARG) + + xx(vgexport, +@@ -844,12 +857,13 @@ xx(vgmknodes, + "\t[-d|--debug]\n" + "\t[-h|--help]\n" + "\t[--ignorelockingfailure]\n" ++ "\t[--lock-dir path]\n" + "\t[--refresh]\n" + "\t[-v|--verbose]\n" + "\t[--version]" "\n" + "\t[VolumeGroupName...]\n", + +- ignorelockingfailure_ARG, refresh_ARG) ++ ignorelockingfailure_ARG, lock_dir_ARG, refresh_ARG) + + xx(vgreduce, + "Remove physical volume(s) from a volume group", +@@ -909,6 +923,7 @@ xx(vgs, + "\t[-d|--debug]\n" + "\t[-h|--help]\n" + "\t[--ignorelockingfailure]\n" ++ "\t[--lock-dir path]\n" + "\t[--nameprefixes]\n" + "\t[--noheadings]\n" + "\t[--nosuffix]\n" +@@ -925,7 +940,7 @@ xx(vgs, + "\t[--version]\n" + "\t[VolumeGroupName [VolumeGroupName...]]\n", + +- aligned_ARG, all_ARG, ignorelockingfailure_ARG, nameprefixes_ARG, ++ aligned_ARG, all_ARG, ignorelockingfailure_ARG, lock_dir_ARG, nameprefixes_ARG, + noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG, + rows_ARG, separator_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG, units_ARG, + unquoted_ARG) +@@ -937,12 +952,13 @@ xx(vgscan, + "\t[-d|--debug]\n" + "\t[-h|--help]\n" + "\t[--ignorelockingfailure]\n" ++ "\t[--lock-dir path]\n" + "\t[--mknodes]\n" + "\t[-P|--partial] " "\n" + "\t[-v|--verbose]\n" + "\t[--version]" "\n", + +- ignorelockingfailure_ARG, mknodes_ARG, partial_ARG) ++ ignorelockingfailure_ARG, lock_dir_ARG, mknodes_ARG, partial_ARG) + + xx(vgsplit, + "Move physical volumes into a new or existing volume group", +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 +--- LVM2.2.02.49.orig/tools/lvmcmdline.c 2009-07-13 12:49:49.000000000 -0700 ++++ LVM2.2.02.49/tools/lvmcmdline.c 2009-07-23 17:37:30.774058849 -0700 +@@ -964,6 +964,7 @@ int lvm_run_command(struct cmd_context * + { + int ret = 0; + int locking_type; ++ const char *lock_dir; + + init_error_message_produced(0); + +@@ -1015,7 +1016,12 @@ int lvm_run_command(struct cmd_context * + else + locking_type = -1; + +- if (!init_locking(locking_type, cmd)) { ++ if(arg_count(cmd, lock_dir_ARG)) { ++ /* Get lockfile directory from commandline */ ++ lock_dir = arg_str_value(cmd, lock_dir_ARG, ""); ++ } ++ ++ if (!init_locking(locking_type, cmd, lock_dir)) { + log_error("Locking type %d initialisation failed.", + locking_type); + ret = ECMD_FAILED; +diff -Nuarp LVM2.2.02.49.orig/man/lvm.8.in LVM2.2.02.49/man/lvm.8.in +--- LVM2.2.02.49.orig/man/lvm.8.in 2009-05-14 09:46:13.000000000 -0700 ++++ LVM2.2.02.49/man/lvm.8.in 2009-07-24 15:48:14.768492371 -0700 +@@ -202,6 +202,11 @@ This lets you proceed with read-only met + One use for this is in a system init script if the lock directory + is mounted read-only when the script runs. + .TP ++\fB--lock-dir\fP ++This lets you override the directory used for lockfiles, as an alternative to ++entirely overriding locking failures. One use for this is in a system init script ++where parts of the system are still read-only. ++.TP + \fB--addtag tag\fP + Add the tag \fBtag\fP to a PV, VG or LV. + A tag is a word that can be used to group LVM2 objects of the same type diff --git a/sys-fs/lvm2/files/lvm2-start.sh-2.02.49-r1 b/sys-fs/lvm2/files/lvm2-start.sh-2.02.49-r1 new file mode 100755 index 000000000000..698300381572 --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-start.sh-2.02.49-r1 @@ -0,0 +1,42 @@ +# /lib/rcscripts/addons/lvm-start.sh +# $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 $ + +locking="--lock-dir /dev/.lvm/" + +dm_in_proc() { + local retval=0 + for x in devices misc ; do + grep -qs 'device-mapper' /proc/${x} + retval=$((${retval} + $?)) + done + return ${retval} +} + +# LVM support for /usr, /home, /opt .... +# This should be done *before* checking local +# volumes, or they never get checked. + +# NOTE: Add needed modules for LVM or RAID, etc +# to /etc/modules.autoload if needed +if [ -z "${CDBOOT}" -a -x /sbin/vgscan ] ; then + if [ -e /proc/modules ] && ! dm_in_proc ; then + modprobe dm-mod 2>/dev/null + fi + + if [ -d /proc/lvm ] || dm_in_proc ; then + ebegin "Setting up the Logical Volume Manager" + #still echo stderr for debugging + # Extra PV find pass because some devices might not have been available until very recently + /sbin/pvscan ${locking} >/dev/null + # Now make the nodes + /sbin/vgscan --mknodes ${locking} >/dev/null + if [ -x /sbin/vgchange ] && \ + [ -f /etc/lvmtab -o -d /etc/lvm ] + then + /sbin/vgchange ${locking} -a y >/dev/null + fi + eend $? "Failed to setup the LVM" + fi +fi + +# vim:ts=4 diff --git a/sys-fs/lvm2/files/lvm2-stop.sh-2.02.49-r1 b/sys-fs/lvm2/files/lvm2-stop.sh-2.02.49-r1 new file mode 100755 index 000000000000..d3252e5c71c2 --- /dev/null +++ b/sys-fs/lvm2/files/lvm2-stop.sh-2.02.49-r1 @@ -0,0 +1,67 @@ +# /lib/rcscripts/addons/lvm-stop.sh +# $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 $ + +locking="--lock-dir /dev/.lvm/" + +# Stop LVM2 +if [ -x /sbin/vgchange ] && \ + [ -x /sbin/lvdisplay ] && \ + [ -x /sbin/vgdisplay ] && \ + [ -x /sbin/lvchange ] && \ + [ -f /etc/lvmtab -o -d /etc/lvm ] && \ + [ -d /proc/lvm -o "`grep device-mapper /proc/misc 2>/dev/null`" ] +then + einfo "Shutting down the Logical Volume Manager" + # If these commands fail it is not currently an issue + # as the system is going down anyway based on the current LVM + # functionality as described in this forum thread + #https://www.redhat.com/archives/linux-lvm/2001-May/msg00523.html + + LOGICAL_VOLUMES=`/sbin/lvdisplay ${locking} |grep "LV Name"|sed -e 's/.*LV Name\s*\(.*\)/\1/'|sort` + VOLUME_GROUPS=`/sbin/vgdisplay ${locking} |grep "VG Name"|sed -e 's/.*VG Name\s*\(.*\)/\1/'|sort` + for x in ${LOGICAL_VOLUMES} + do + LV_IS_ACTIVE=`/sbin/lvdisplay ${locking} ${x}|grep "# open"|awk '{print $3}'` + if [ "${LV_IS_ACTIVE}" = 0 ] + then + ebegin " Shutting Down logical volume: ${x} " + /sbin/lvchange -an ${locking} -P ${x} >/dev/null + eend $? + fi + done + + for x in ${VOLUME_GROUPS} + do + VG_HAS_ACTIVE_LV=`/sbin/vgdisplay ${locking} ${x}|grep "Open LV"|sed -e 's/.*Open LV\s*\(.*\)/\1/'` + if [ "${VG_HAS_ACTIVE_LV}" = 0 ] + then + ebegin " Shutting Down volume group: ${x} " + /sbin/vgchange -an ${locking} -P ${x} >/dev/null + eend + fi + done + + for x in ${LOGICAL_VOLUMES} + do + LV_IS_ACTIVE=`/sbin/lvdisplay ${locking} ${x}|grep "# open"|sed -e 's/.*# open\s*\(.*\)/\1/'` + if [ "${LV_IS_ACTIVE}" = 1 ] + then + if type mountinfo >/dev/null 2>&1; then + ROOT_DEVICE=`mountinfo -t /` + else + ROOT_DEVICE=`mount | awk '{if($3 == "/" && $1 != "rootfs"){print $1}}'` + fi + + MOUNTED_DEVICE=${x} + [ -L ${ROOT_DEVICE} ] && ROOT_DEVICE="`/bin/readlink ${ROOT_DEVICE}`" + [ -L ${x} ] && MOUNTED_DEVICE="`/bin/readlink ${x}`" + if [ ! ${ROOT_DEVICE} = ${MOUNTED_DEVICE} ] + then + ewarn " Unable to shutdown: ${x} " + fi + fi + done + einfo "Finished Shutting down the Logical Volume Manager" +fi + +# vim:ts=4 diff --git a/sys-fs/lvm2/lvm2-2.02.49-r1.ebuild b/sys-fs/lvm2/lvm2-2.02.49-r1.ebuild new file mode 100644 index 000000000000..c695dbd73a4f --- /dev/null +++ b/sys-fs/lvm2/lvm2-2.02.49-r1.ebuild @@ -0,0 +1,216 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/lvm2-2.02.49-r1.ebuild,v 1.1 2009/07/24 23:37:37 robbat2 Exp $ + +EAPI=2 +inherit eutils multilib toolchain-funcs autotools + +DESCRIPTION="User-land utilities for LVM2 (device-mapper) software." +HOMEPAGE="http://sources.redhat.com/lvm2/" +SRC_URI="ftp://sources.redhat.com/pub/lvm2/${PN/lvm/LVM}.${PV}.tgz + ftp://sources.redhat.com/pub/lvm2/old/${PN/lvm/LVM}.${PV}.tgz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86" + +IUSE="readline static clvm cman lvm1 selinux" + +DEPEND="!sys-fs/device-mapper + clvm? ( =sys-cluster/dlm-2* + cman? ( =sys-cluster/cman-2* ) )" + +RDEPEND="${DEPEND} + !sys-fs/lvm-user + !sys-fs/clvm" + +S="${WORKDIR}/${PN/lvm/LVM}.${PV}" + +pkg_setup() { + # 1. Genkernel no longer copies /sbin/lvm blindly. + # 2. There are no longer any linking deps in /usr. + if use static; then + elog "Warning, we no longer overwrite /sbin/lvm and /sbin/dmsetup with" + elog "their static versions. If you need the static binaries," + elog "you must append .static the filename!" + fi +} + +src_unpack() { + unpack ${A} +} + +src_prepare() { + epatch "${FILESDIR}"/${PN}-2.02.45-dmeventd.patch + epatch "${FILESDIR}"/lvm.conf-2.02.45.patch + epatch "${FILESDIR}"/${PN}-2.02.48-device-mapper-export-format.patch + epatch "${FILESDIR}"/${PN}-2.02.48-as-needed.patch + epatch "${FILESDIR}"/${PN}-2.02.48-fix-pkgconfig.patch + epatch "${FILESDIR}"/${PN}-2.02.49-lockdir-override.patch + eautoreconf +} + +src_configure() { + local myconf + local buildmode + + myconf="${myconf} --enable-dmeventd" + myconf="${myconf} --enable-cmdlib" + myconf="${myconf} --enable-applib" + myconf="${myconf} --enable-fsadm" + + # Most of this package does weird stuff. + # The build options are tristate, and --without is NOT supported + # options: 'none', 'internal', 'shared' + if use static ; then + einfo "Building static LVM, for usage inside genkernel" + buildmode="internal" + # This only causes the .static versions to become available + # For recent systems, there are no linkages against anything in /usr anyway. + # We explicitly provide the .static versions so that they can be included in + # initramfs environments. + myconf="${myconf} --enable-static_link" + else + ewarn "Building shared LVM, it will not work inside genkernel!" + buildmode="shared" + fi + + # dmeventd requires mirrors to be internal, and snapshot available + # so we cannot disable them + myconf="${myconf} --with-mirrors=internal" + myconf="${myconf} --with-snapshots=internal" + + if use lvm1 ; then + myconf="${myconf} --with-lvm1=${buildmode}" + else + myconf="${myconf} --with-lvm1=none" + fi + + # disable O_DIRECT support on hppa, breaks pv detection (#99532) + use hppa && myconf="${myconf} --disable-o_direct" + + if use clvm; then + myconf="${myconf} --with-cluster=${buildmode}" + # 4-state! Make sure we get it right, per bug 210879 + # Valid options are: none, cman, gulm, all + # + # 2009/02: + # gulm is removed now, now dual-state: + # cman, none + # all still exists, but is not needed + # + # 2009/07: + # TODO: add corosync and re-enable ALL + local clvmd="" + use cman && clvmd="cman" + #clvmd="${clvmd/cmangulm/all}" + [ -z "${clvmd}" ] && clvmd="none" + myconf="${myconf} --with-clvmd=${clvmd}" + myconf="${myconf} --with-pool=${buildmode}" + else + myconf="${myconf} --with-clvmd=none --with-cluster=none" + fi + + myconf="${myconf} --sbindir=/sbin --with-staticdir=/sbin" + econf $(use_enable readline) \ + $(use_enable selinux) \ + --enable-pkgconfig \ + --libdir=/usr/$(get_libdir) \ + ${myconf} \ + CLDFLAGS="${LDFLAGS}" || die +} + +src_compile() { + einfo "Doing symlinks" + pushd include + emake || die "Failed to prepare symlinks" + popd + + einfo "Doing device-mapper" + pushd libdm + emake || die "failed to build libdm" + #emake ioctl/libdevmapper.a || die "failed to build libdm/ioctl/libdevmapper.a" + popd + + einfo "Doing lib" + pushd lib + emake || die "failed to build lib" + popd + + einfo "Doing main build" + emake || die "compile problem" +} + +src_install() { + emake DESTDIR="${D}" install + + dodir /$(get_libdir) + # Put these in root so we can reach before /usr is up + for i in \ + libdevmapper-event{,-lvm2{mirror,snapshot}} \ + libdevmapper \ + liblvm2{format1,snapshot,cmd} \ + ; do + b="${D}"/usr/$(get_libdir)/${i} + if [ -f "${b}".so ]; then + mv -f "${b}".so* "${D}"/$(get_libdir) || die + gen_usr_ldscript ${i}.so || die + fi + done + + dodoc README VERSION WHATS_NEW doc/*.{conf,c,txt} + insinto /$(get_libdir)/rcscripts/addons + newins "${FILESDIR}"/lvm2-start.sh-2.02.49-r1 lvm-start.sh || die + newins "${FILESDIR}"/lvm2-stop.sh-2.02.49-r1 lvm-stop.sh || die + newinitd "${FILESDIR}"/lvm.rc-2.02.28-r2 lvm || die + newconfd "${FILESDIR}"/lvm.confd-2.02.28-r2 lvm || die + if use clvm; then + newinitd "${FILESDIR}"/clvmd.rc-2.02.39 clvmd || die + newconfd "${FILESDIR}"/clvmd.confd-2.02.39 clvmd || die + fi + + # move shared libs to /lib(64) + if use static; then + dolib.a libdm/ioctl/libdevmapper.a || die "dolib.a libdevmapper.a" + fi + #gen_usr_ldscript libdevmapper.so + + insinto /etc + doins "${FILESDIR}"/dmtab + insinto /$(get_libdir)/rcscripts/addons + doins "${FILESDIR}"/dm-start.sh + + # Device mapper stuff + newinitd "${FILESDIR}"/device-mapper.rc-1.02.22-r3 device-mapper || die + newconfd "${FILESDIR}"/device-mapper.conf-1.02.22-r3 device-mapper || die + + newinitd "${FILESDIR}"/1.02.22-dmeventd.initd dmeventd || die + if use static; then + dolib.a daemons/dmeventd/libdevmapper-event.a \ + || die "dolib.a libdevmapper-event.a" + fi + #gen_usr_ldscript libdevmapper-event.so + + insinto /etc/udev/rules.d/ + newins "${FILESDIR}"/64-device-mapper.rules-1.02.22-r5 64-device-mapper.rules || die + + elog "USE flag nocman is deprecated and replaced" + elog "with the cman USE flag." + elog "" + elog "USE flags clvm and cman are masked" + elog "by default and need to be unmasked to use them" + elog "" + elog "Rebuild your genkernel initramfs if you are using lvm" +} + +pkg_postinst() { + elog "lvm volumes are no longer automatically created for" + elog "baselayout-2 users. If you are using baselayout-2, be sure to" + elog "run: # rc-update add lvm boot" + elog "Do NOT add it if you are using baselayout-1 still." +} + +src_test() { + einfo "Testcases disabled because of device-node mucking" + einfo "If you want them, compile the package and see ${S}/tests" +} |