1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-12-25 20:23:49 +03:00

Compare commits

..

148 Commits

Author SHA1 Message Date
Alasdair Kergon
f9c8c1b964 pre-release 2008-10-17 17:42:08 +00:00
Alasdair Kergon
5650f67ef5 Use temp table to set device size when converting mirrors.
(Avoids having same mirror table loaded twice concurrently by first
using a 'zero' table to set the size of the device so when mirror
table is preloaded it doesn't have to be activated immediately.)
2008-10-17 10:57:15 +00:00
Alasdair Kergon
5ec25dfb94 In resume_mirror_images replace activate_lv with resume_lv as workaround.
(The resume has the side-effect of resuming all of the original
mirror's sub-lvs in addition to the new 'error' target middle layer.)
2008-10-17 10:50:14 +00:00
Alasdair Kergon
ef16682725 Avoid overwriting in-use on-disk text metadata by forgetting MDA_HEADER_SIZE. (Edward Allcutt) 2008-10-17 00:55:46 +00:00
Petr Rockai
883486cc67 Re-indent test-utils.sh consistently, using tabs. 2008-10-14 19:48:01 +00:00
Petr Rockai
f367f9b747 Conversion of last 2 tests to use test-utils.sh, by jstava. 2008-10-14 19:41:12 +00:00
Milan Broz
a3d987fa73 Fix snapshot monitoring library to not cancel monitoring invalid snapshot.
snapshot DSO unregistered itself when snapshot changed state to invalid.

This can cause a race (and several timeouts), when for example another snapshot
is added and in the middle of operation (suspend/resume) the monitoring thread
unregister itself.

Fix it by keeping the snapshot monitored after invalidation - just reset
threshold to not really print any messages to syslog.
2008-10-13 12:06:30 +00:00
Alasdair Kergon
2d48685673 . 2008-10-09 10:47:37 +00:00
Alasdair Kergon
9b21ace1e9 Generate man pages from templates and include version. (romster) 2008-10-08 12:50:13 +00:00
Alasdair Kergon
be2c03fa96 Add usrlibdir & usrsbindir to configure. 2008-10-07 19:11:59 +00:00
Alasdair Kergon
f5585e9252 Add usrsbindir to configure. 2008-10-07 19:08:46 +00:00
Petr Rockai
4d534dd7e4 Add a workaround for missing losetup -s by jstava, and a print a stacktrace
on errors (also by jstava). Currently requires bash, a fix for that may come
later -- explicitly using bash to run tests in the meantime.
2008-10-06 16:55:30 +00:00
Petr Rockai
c8584e1cce More test conversions by jstava. Make check still passes. 2008-10-06 16:47:07 +00:00
Alasdair Kergon
84a1de464c Fix conversion of md chunk size into sectors. 2008-10-03 14:22:18 +00:00
Alasdair Kergon
3966f3d319 device->devices 2008-10-01 22:48:26 +00:00
Petr Rockai
e6166cf711 Make harness.sh exit with non-zero status when tests fail. 2008-09-30 21:45:42 +00:00
Petr Rockai
2285712834 Cosmetic: get rid of trailing garbage on comments in t-vgslpit-usage.sh. 2008-09-30 21:43:55 +00:00
Petr Rockai
53cb6128e8 Improve harness.sh output: also mention failing test's name near the end of its
output. Avoids the need to scroll back just to see which failing test you are
looking at.
2008-09-30 21:43:16 +00:00
Alasdair Kergon
8c317baf19 Free text metadata buffer after a failure writing it. 2008-09-30 20:37:52 +00:00
Petr Rockai
8cac933c71 Fix [ a = b ] usage in t-vgsplit-operation: string comparison is '=', not '=='. 2008-09-30 18:29:10 +00:00
Petr Rockai
03e61a4bf8 Conversion of t-vgsplit-operation.sh by jstava. 2008-09-30 17:56:54 +00:00
Petr Rockai
71446a76b2 Fix a syntax error in one of the scripts, introduced by last commit. 2008-09-30 17:50:56 +00:00
Petr Rockai
28db8d6c7c More test conversions, all of these are by jstava. 2008-09-30 17:47:34 +00:00
Petr Rockai
786e33d7d5 Port over t-vgreduce-usage. Should fix testsuite hangs where pvremove -ff would
have waited for input on certain test failures.
2008-09-30 17:17:04 +00:00
Petr Rockai
b140d6c50e Convert t-vgsplit-usage.sh to use the new test-utils.sh. Original conversion by
jstava. Lvm1 testing restored by mornfall.
2008-09-30 15:20:09 +00:00
Petr Rockai
64a95abdee Convert t-pvremove-usage to use the new test-utils.sh. 2008-09-30 13:19:56 +00:00
Petr Rockai
57f926be17 Update test/Makefile.in to use the new harness for calling tests. 2008-09-29 16:07:02 +00:00
Petr Rockai
4933b67959 Add a test for reappearing lost PVs causing endless metadata correction
updates. (A problem Milan fixed recently.)
2008-09-29 16:06:10 +00:00
Petr Rockai
370b4f1b9e Add a simple test for partial activation. 2008-09-29 16:04:57 +00:00
Petr Rockai
f3b7baa84e Update a bunch of tests to use functionality from test-utils.sh. 2008-09-29 16:02:50 +00:00
Petr Rockai
eafdb2c807 Export testlib_cleanup_ from test-lib.sh, which is needed for test-utils.sh to
be able to call proper EXIT traps.
2008-09-29 16:00:53 +00:00
Petr Rockai
a91fa821ab Import new test utilities and a test harness. 2008-09-29 15:59:19 +00:00
Milan Broz
37ef162cda Fix misleading error message when there is no allocatable extents in VG. 2008-09-29 09:59:10 +00:00
Milan Broz
770928acfc Fix handling of PVs which reappeared with old metadata version. 2008-09-25 15:59:10 +00:00
Milan Broz
d0f3570219 Try to fix possible infinite loop in dependency tree walking (by mornfall). 2008-09-25 15:57:02 +00:00
Milan Broz
3d07c2605f Fix mirror DSO to call vgreduce with proper parameters. 2008-09-25 15:52:29 +00:00
Milan Broz
c350798528 Fix validation of --minor and --major in lvcreate to require -My always. 2008-09-24 16:32:51 +00:00
Alasdair Kergon
6bc3cc0bec . 2008-09-19 18:31:20 +00:00
Alasdair Kergon
2e3e5fcc81 suppress warning if old value found for now 2008-09-19 18:26:41 +00:00
Milan Broz
dfdb10f6de Add more vgreduce tests. (Jaroslav Stava) 2008-09-19 16:12:25 +00:00
Milan Broz
5cbe5909eb Fix vgreduce test, now requires --force flag. (Jaroslav Stava) 2008-09-19 16:10:46 +00:00
Alasdair Kergon
04d52b450b fix last release 2008-09-19 15:44:03 +00:00
Alasdair Kergon
a586a89547 . 2008-09-19 07:18:03 +00:00
Alasdair Kergon
1905eacf15 rename var 2008-09-19 07:12:45 +00:00
Alasdair Kergon
858ec0d740 revert unexplained removal of a '<backtrace>' message 2008-09-19 07:03:23 +00:00
Alasdair Kergon
76cfd406ca pre-release 2008-09-19 06:48:48 +00:00
Alasdair Kergon
9dbaad859d . 2008-09-19 06:44:54 +00:00
Alasdair Kergon
95d43e17b3 Improve the way VGs with PVs missing are handled so manual intervention
is required in fewer circumstances.  (mornfall)
2008-09-19 06:42:00 +00:00
Alasdair Kergon
09a2dff8de Add device/md_chunk_alignment to lvm.conf 2008-09-19 05:33:37 +00:00
Alasdair Kergon
57208f879a adjust pe_align for md chunk size 2008-09-19 05:19:09 +00:00
Alasdair Kergon
149638431d remove unsed var 2008-09-19 04:30:02 +00:00
Alasdair Kergon
30d2940c67 Pass struct physical_volume to pe_align. 2008-09-19 04:28:58 +00:00
Alasdair Kergon
5ee86fc5d0 remove unused var 2008-09-19 03:45:34 +00:00
Alasdair Kergon
a03d0e2c3f Store sysfs location in struct cmd_context. 2008-09-19 03:42:37 +00:00
Alasdair Kergon
8bd367d58d fix last patch return code 2008-09-19 00:20:39 +00:00
Alasdair Kergon
bc633e03aa Fix last checkin - tested wrong dnode. 2008-09-18 22:55:33 +00:00
Alasdair Kergon
797d0f1ef1 post-release 2008-09-18 20:09:51 +00:00
Alasdair Kergon
1be3e86aa0 Avoid shuffling remaining mirror images when removing one, retaining primary. 2008-09-18 19:56:50 +00:00
Alasdair Kergon
e56dd38021 Add missing LV error target activation in _remove_mirror_images. 2008-09-18 19:09:47 +00:00
Alasdair Kergon
410904bef1 Prevent resizing an LV while lvconvert is using it. 2008-09-18 18:51:58 +00:00
Alasdair Kergon
026cc120e7 Only resume devices in dm_tree_preload_children if size changes. 2008-09-18 18:34:53 +00:00
Alasdair Kergon
ef2fda05cf Avoid repeatedly wiping cache while VG_GLOBAL is held in vgscan & pvscan. 2008-09-16 18:05:11 +00:00
Alasdair Kergon
92277e3ae2 revert unnecessary 'stack's 2008-09-15 17:06:55 +00:00
Milan Broz
fbc34d70b0 Fix pvresize to not allow resize if PV has two metadata areas.
If the PV has two metadata areas, second one is located at the end of the device.

Do not allow resize of PV or second metadata area can be overwritten.
(The check was active only for orphan PVs.)
2008-09-12 15:26:45 +00:00
Milan Broz
91dcddbdf7 Do not scan for lvm1 entries in /proc if not running 2.4 kernel.
(LVM1 is only present in 2.4 kernel.)
2008-09-10 10:14:59 +00:00
Alasdair Kergon
874f42ad6c Extend deptree buffers so the largest possible device numbers fit. 2008-09-02 12:16:07 +00:00
Milan Broz
1989ef4ebc Fix setting of volume limit count if converting to lvm1 format.
Fixes problem when after downconvert to lvm1 VG is broken:

# lvcreate -n lv1 -l 4 vg_test
  Invalid LV in extent map (PV /dev/sdb1, PE 0, LV 0, LE 0)
  ...
2008-08-29 13:41:21 +00:00
Dave Wysochanski
4f4c72c065 Add ctype.h header file to silence compile warning on 'isdigit'.
uuid/uuid.c:86: warning: implicit declaration of function 'isdigit'
2008-08-29 00:49:46 +00:00
Milan Broz
666cc72661 Fix vgconvert logical volume id metadata validation.
If volume group is downconverted to lvm1 format,
check if lvid has supported format for conversion to lv_num in lvm1.
2008-08-28 18:41:51 +00:00
Milan Broz
4524e8f5c9 format1: Not detecing label on disc is not error, remove <backtrace> from debug log
(happens when you explicitly use -M 1)
2008-08-28 13:41:46 +00:00
Milan Broz
bd07a29886 Not detecing label on disc is not error, remove <backtrace> from debug log
and report it only if device cannot be read.
2008-08-28 13:28:13 +00:00
Milan Broz
a0d865492e fix vgreduce tests to detect partial command failure (Jaroslav Stava) 2008-08-28 11:20:49 +00:00
Milan Broz
de27790de8 add vgcreate rejects repeated invocation test
add vgcreate fails when the only pv has --metadatacopies 0 test
(by Jaroslav Stava)
2008-08-28 11:09:58 +00:00
Milan Broz
9c910b7be2 add vgrename by uuid test (Jaroslav Stava)
fix vgsplit rejects last mda copy test (Jaroslav Stava)
2008-08-28 10:59:10 +00:00
Milan Broz
7f23ab94e2 Fix lvmdump metadata gather option (-m) to work correctly. (Jaroslav Stava) 2008-08-28 10:40:44 +00:00
Milan Broz
77dc036c8f Add pvremove usage test (Jaroslav Stava) 2008-08-28 10:24:55 +00:00
Milan Broz
aa6e8d82ce - fix environment variable prefix to LVM (this is not GIT:-)
- add lvcreate rejects repeated invocation test
- fix pvs metadata test for partial failure test
- add pvchange reject --addtag to lvm1 pv test

(All fixes by Jaroslav Stava)
2008-08-28 10:07:34 +00:00
Dave Wysochanski
3010285bb3 Fix symbolic link creation in test infrastructure.
Original code would create "*.so" symbolic links if there were no actual
files ending in "so".  The second iteration would then cause an error
in the test logs.
2008-08-21 14:33:48 +00:00
Zdeněk Kabeláč
aaad3252f8 fail testcase for failed commands inside the for loop 2008-08-20 13:34:33 +00:00
Milan Broz
9065f534d8 Fix allocation bug in text metadata format write error path.
Function _text_pv_write doesn't use memory pool but static buffer,
call dm_pool_free in error path in _raw_write_mda_header is wrong.

Move pool free only to path where is the memory pool used.
2008-08-16 09:46:55 +00:00
Zdeněk Kabeláč
52361c94e5 valid parameter for lvchange -p is 'rw' 2008-08-13 14:28:17 +00:00
Zdeněk Kabeláč
798be60fef added test for coverage improvement
added test for metadata type 1
2008-08-13 13:49:07 +00:00
Zdeněk Kabeláč
6294154b15 get lv_list properly from vg->lst and fix compiler warning 2008-08-13 13:42:35 +00:00
Milan Broz
6594fe077d Fix vgcfgbackup to properly check filename if template is used. 2008-08-13 12:44:24 +00:00
Milan Broz
582706cde6 add tests for pvchange and vgreduce usage (Jaroslav Stava) 2008-08-12 10:04:31 +00:00
Milan Broz
6537cbdc17 test vgsplit: reject to give away pv with the last mda copy (Jaroslav Stava) 2008-08-12 10:01:56 +00:00
Zdeněk Kabeláč
53959459bb * more strict const 2008-08-07 14:02:32 +00:00
Zdeněk Kabeláč
22d6121099 added const modifiers
switched const char* to  const char[] elements to save few relocation entries
2008-08-07 14:01:17 +00:00
Zdeněk Kabeláč
48d7f6f2f4 added const and saved relocation entry 2008-08-07 13:59:49 +00:00
Zdeněk Kabeláč
9fd4ddc490 configure aborts if lcov or genhtml are missing with --enable-profiling 2008-08-05 14:29:38 +00:00
Zdeněk Kabeláč
a4d2fddbb2 add test for pool labels gfs
add test for metadatacopies0 and snapshot manipulation
2008-08-05 12:33:41 +00:00
Zdeněk Kabeláč
c54a3f2721 put dmeventd into the LD_LIBRARY_PATH for lvm-wrapper 2008-08-05 12:32:08 +00:00
Zdeněk Kabeláč
04c0dba697 vgremove tries to remove lv snapshot first.
Added function lv_remove_with_dependencies().
2008-08-05 12:05:26 +00:00
Zdeněk Kabeláč
5406e3b7c5 avoid endless option parsing loop
add support for lvm verbose operation -vvvv
add dlsym path to the test config file
2008-08-05 11:39:54 +00:00
Zdeněk Kabeláč
6b624b7d00 * parse error output for 'auto' keyword 2008-08-04 09:15:15 +00:00
Alasdair Kergon
2d364d4d80 Improve file descriptor leak detection to display likely culprit and filename. 2008-08-01 19:51:27 +00:00
Zdeněk Kabeláč
1f27bf3774 disable mdadm test-case until a better solution is found 2008-08-01 15:44:53 +00:00
Alasdair Kergon
d30a2653b5 remove now-redundant slash-stripping 2008-07-31 15:38:52 +00:00
Alasdair Kergon
3086822cd2 Change clustered mirror kernel module name from cmirror to dm-log-clustered. 2008-07-31 14:43:39 +00:00
Alasdair Kergon
2c08336490 Avoid looping forever in _pv_analyze_mda_raw used by pvck. 2008-07-31 13:07:01 +00:00
Alasdair Kergon
5936ac58c2 Change lvchange exit status to indicate if any part of the operation failed. 2008-07-31 13:03:01 +00:00
Alasdair Kergon
ded77e3f5c remove unused mdas variable 2008-07-31 12:40:52 +00:00
Alasdair Kergon
8a29df0a6c fix pvremove for pvs without mdas 2008-07-31 12:38:31 +00:00
Alasdair Kergon
9db22babaf Fix pvchange to handle PVs without mdas. 2008-07-31 12:28:51 +00:00
Alasdair Kergon
c318c5ed61 Refactor _text_pv_read and always return mda list if requested. 2008-07-31 10:50:18 +00:00
Dave Wysochanski
61243c65cd Add pvcreate tests to verify failure on md array detection. 2008-07-29 21:05:20 +00:00
Dave Wysochanski
4a5d5cb462 Fix trivial typo in pvcreate man page. 2008-07-29 18:35:00 +00:00
Dave Wysochanski
cbf1447ebd Refactor pvcreate - simplify return codes. 2008-07-25 14:59:51 +00:00
Dave Wysochanski
30104441bf Refactor pvcreate - --yes argument 2008-07-25 14:45:24 +00:00
Dave Wysochanski
b4a70804f0 Refactor pvcreate - --force parameter. 2008-07-25 14:36:55 +00:00
Dave Wysochanski
74f6707bde Refactor pvcreate - use '0' for no --uuid or --restorefile options. 2008-07-25 14:12:29 +00:00
Jim Meyering
223eb8c84d configure: regenerate 2008-07-25 08:00:40 +00:00
Jim Meyering
107d000606 Avoid compiler warnings (provoked by new configure.in bug) on RHEL5.
Do not override the default action of AC_CHECK_LIB([readline],...
(i.e., leave the ACTION-IF-FOUND parameter blank) so that the
subsequent check for rl_completion_matches can use -lreadline.

Also, replace AC_CHECK_FUNC+AC_DEFINE with an equivalent AC_CHECK_FUNCS call.
2008-07-25 08:00:18 +00:00
Dave Wysochanski
43e05607af Refactor pvcreate - move uuid and restorefile options. 2008-07-25 00:30:57 +00:00
Dave Wysochanski
55793452d5 Add pvcreate tests for uuid and restorefile. 2008-07-24 17:33:40 +00:00
Alasdair Kergon
686ba37255 . 2008-07-24 15:39:47 +00:00
Alasdair Kergon
03ed19dad5 reinstate lost FIXME
- only if kernel gives the info, not to be worked out in userspace
- with lvm.conf option to enable/disable the check
2008-07-24 15:25:09 +00:00
Jim Meyering
ad2b6e5de1 configure: regenerate 2008-07-24 14:54:26 +00:00
Jim Meyering
767676d6ff Don't make configure fail when readline library is not available. 2008-07-24 14:54:06 +00:00
Dave Wysochanski
bc7a54c615 Remove dead code, is_lvm_partition() - no functional change.
This code does nothing.  The function is #defined to 1 which ensures the only
two if statements referencing it will never be true.
2008-07-23 19:46:33 +00:00
Dave Wysochanski
1bda393678 Refactor pvcreate - move labelsector parameter parsing & validation. 2008-07-23 19:29:58 +00:00
Dave Wysochanski
bb5495c6bd Refactor pvcreate - divide parameter parsing & validation from create logic.
Move size (setphysicalvolumesize option), metadatacopies and metadatasize
validation.
2008-07-21 19:27:22 +00:00
Dave Wysochanski
484f905749 Refactor pvcreate to divide parameter parsing & validation from create logic. 2008-07-21 19:26:33 +00:00
Dave Wysochanski
e0d61a4336 Add more pvcreate tests to validate writing lvm2 label using --labelsector. 2008-07-21 18:50:10 +00:00
Dave Wysochanski
e643a16ba5 Refactor _lvcreate() - no functional change. 2008-07-17 15:19:42 +00:00
Dave Wysochanski
98fadec2b6 Only use lvm2 metadata for now. 2008-07-17 04:03:04 +00:00
Dave Wysochanski
14f464ecb0 Update pvcreate and vgsplit tests.
Add more pvcreate tests.
Start handling lvm1 and lvm2 metadata and metadatacopies=0,1.
2008-07-17 03:17:01 +00:00
Dave Wysochanski
2ecdaf9bd4 Add pvcreate sanity tests, check for label_write() failure in _text_pv_write().
Failure to check for label_write() return code caused the following test
to indicate it passed when it really failed:
pvcreate rejects labelsector > 1000000000000
2008-07-16 21:32:38 +00:00
Alasdair Kergon
707c898f66 Fix pvchange -M1 -u to preserve existing extent locations when there's a VG. 2008-07-16 10:46:12 +00:00
Alasdair Kergon
69e4400774 Cease recognising snapshot-in-use percentages returned by early development kernels. 2008-07-15 00:25:52 +00:00
Petr Rockai
695efde68d Fix gcc warnings. 2008-07-11 09:19:54 +00:00
Petr Rockai
0c4b769011 Add "flags" metadata field (akin to "status") for backward-compatible flags.
The "status" field is treated as it ever has been, unknown flags there are
treated as fatal metadata errors. However, in the "flags" field, any unknown
flags will be ignored and silently dropped. This improves
backward-compatibility possibilities. (Any versions without support for this
new "flag" field will drop the field altogether, which is same as ignoring all
the flags there.)
2008-07-10 11:30:57 +00:00
Alasdair Kergon
e53eff0634 . 2008-07-10 09:50:23 +00:00
Petr Rockai
6c75243a06 Add #include <signal.h> to dmeventd.c, fixes compilation on NetBSD. 2008-07-09 13:26:07 +00:00
Petr Rockai
efde37880b Fix dmeventd regression where mirror and snapshot monitoring libraries
failed to link against liblvm2cmd.

Dmeventd DSOs *require* lvm2cmd to be linked in.

For the future:
1) AC_SUBST does not create Makefile variables, only @foo@-style substitutions
2) When using `test', whitespace around `=' is essential:
    test a=b is true, as is test a=a
2008-07-09 09:59:42 +00:00
Alasdair Kergon
7d8f6381be post-release 2008-06-27 22:35:22 +00:00
Alasdair Kergon
3c361e3393 pre-release 2008-06-27 21:56:35 +00:00
Alasdair Kergon
8440ecef5e Enable readline by default if available. 2008-06-27 19:57:27 +00:00
Alasdair Kergon
6401f1b1c9 tweak lcov configuration/makefiles 2008-06-27 19:24:17 +00:00
Zdeněk Kabeláč
7487a7c988 Added generation of the versioned libdevmapper-event.so for LVM's test 2008-06-27 15:36:51 +00:00
Zdeněk Kabeláč
f44584fa10 extended configure with --enable-profiling for compiling code with gcov info
extended Makefile with targets:
  cov-reset - reset counters
  cov       - generete report to covhtml subdirectory
  covd      - generate report to covhtml-DATE-TIME subdirectory
2008-06-27 15:35:09 +00:00
Alasdair Kergon
7b32165614 Fix up cache for PVs without mdas after consistent VG metadata is processed. 2008-06-27 15:18:31 +00:00
Alasdair Kergon
b0dc94d187 Update validation of safe mirror log type conversions in lvconvert. (brassow) 2008-06-26 23:05:11 +00:00
Alasdair Kergon
0383c4e1d8 Fix lvconvert to disallow snapshot and mirror combinations. (mpatocka) 2008-06-26 21:38:58 +00:00
Alasdair Kergon
a8c5758222 Underline longer report help text headings. 2008-06-25 19:52:52 +00:00
Alasdair Kergon
a7fabfd8cb Fix reporting of LV fields alongside unallocated PV segments. 2008-06-25 16:52:27 +00:00
Dave Wysochanski
5d5b575d16 Test script cleanup. 2008-06-25 16:51:26 +00:00
Alasdair Kergon
ac1373653c post-release 2008-06-25 14:44:00 +00:00
169 changed files with 4694 additions and 3185 deletions

View File

@@ -39,6 +39,7 @@ ifeq ($(MAKECMDGOALS),distclean)
test \
po
DISTCLEAN_TARGETS += lib/misc/configure.h
DISTCLEAN_DIRS += lcov_reports*
endif
include make.tmpl
@@ -71,3 +72,36 @@ endif
check: all
$(MAKE) -C test all
ifneq ("@LCOV@", "")
.PHONY: lcov-reset lcov lcov-dated
ifeq ($(MAKECMDGOALS),lcov-dated)
LCOV_REPORTS_DIR=$(top_srcdir)/lcov_reports-$(shell date +%Y%m%d%k%M%S)
else
LCOV_REPORTS_DIR=$(top_srcdir)/lcov_reports
endif
lcov-reset:
$(LCOV) -d $(top_srcdir)/dmeventd --zerocounters
$(LCOV) -d $(top_srcdir)/lib --zerocounters
$(LCOV) -d $(top_srcdir)/tools --zerocounters
lcov: all
$(RM) -rf $(LCOV_REPORTS_DIR)
$(MKDIR_P) $(LCOV_REPORTS_DIR)
$(LCOV) -b $(top_srcdir)/lib -d $(top_srcdir)/lib -c -o $(LCOV_REPORTS_DIR)/lib.info
$(LCOV) -b $(top_srcdir)/tools -d $(top_srcdir)/tools -c -o $(LCOV_REPORTS_DIR)/tools.info
DMEVENTD_INFO="$(LCOV_REPORTS_DIR)/dmeventd.info" ;\
DMEVENTD_INFO_A="-a $$DMEVENTDINFO" ;\
$(LCOV) -b $(top_srcdir)/dmeventd -d $(top_srcdir)/dmeventd -c -o $$DMEVENTD_INFO || DMEVENTD_INFO_A="" ;\
$(LCOV) $$DMEVENTD_INFO_A -a $(LCOV_REPORTS_DIR)/lib.info \
-a $(LCOV_REPORTS_DIR)/tools.info \
-o $(LCOV_REPORTS_DIR)/lvm.info
ifneq ("@GENHTML@", "")
$(GENHTML) -o $(LCOV_REPORTS_DIR) -p $(top_srcdir) $(LCOV_REPORTS_DIR)/lvm.info
endif
lcov-dated: lcov
endif

View File

@@ -1 +1 @@
2.02.39-cvs (2008-06-11)
2.02.41-cvs (2008-10-17)

View File

@@ -1,5 +1,70 @@
Version 2.02.39 -
Version 2.02.41 - 17th October 2008
===================================
Use temp table to set device size when converting mirrors.
In resume_mirror_images replace activate_lv with resume_lv as workaround.
Avoid overwriting in-use on-disk text metadata by forgetting MDA_HEADER_SIZE.
Fix snapshot monitoring library to not cancel monitoring invalid snapshot.
Generate man pages from templates and include version.
Add usrlibdir and usrsbindir to configure.
Fix conversion of md chunk size into sectors.
Free text metadata buffer after a failure writing it.
Fix misleading error message when there are no allocatable extents in VG.
Fix handling of PVs which reappeared with old metadata version.
Fix mirror DSO to call vgreduce with proper parameters.
Fix validation of --minor and --major in lvcreate to require -My always.
Fix release: clvmd build, vgreduce consolidate & tests, /dev/ioerror warning.
Version 2.02.40 - 19th September 2008
=====================================
Allow lvremove to remove LVs from VGs with missing PVs.
In VG with PVs missing, by default allow activation of LVs that are complete.
Track PARTIAL_LV and MISSING_PV flags internally.
Require --force with --removemissing in vgreduce to remove partial LVs.
No longer write out PARTIAL flag into metadata backups.
Treat new default activation/missing_stripe_filler "error" as an error target.
Remove internal partial_mode.
Add devices/md_chunk_alignment to lvm.conf.
Pass struct physical_volume to pe_align and adjust for md chunk size.
Store sysfs location in struct cmd_context.
Avoid shuffling remaining mirror images when removing one, retaining primary.
Add missing LV error target activation in _remove_mirror_images.
Prevent resizing an LV while lvconvert is using it.
Avoid repeatedly wiping cache while VG_GLOBAL is held in vgscan & pvscan.
Fix pvresize to not allow resize if PV has two metadata areas.
Fix setting of volume limit count if converting to lvm1 format.
Fix vgconvert logical volume id metadata validation.
Fix lvmdump metadata gather option (-m) to work correctly.
Fix allocation bug in text metadata format write error path.
Fix vgcfgbackup to properly check filename if template is used.
configure aborts if lcov or genhtml are missing with --enable-profiling
vgremove tries to remove lv snapshot first.
Added function lv_remove_with_dependencies().
Improve file descriptor leak detection to display likely culprit and filename.
Change clustered mirror kernel module name from cmirror to dm-log-clustered.
Avoid looping forever in _pv_analyze_mda_raw used by pvck.
Change lvchange exit status to indicate if any part of the operation failed.
Fix pvchange and pvremove to handle PVs without mdas.
Refactor _text_pv_read and always return mda list if requested.
Fix configure to work w/o readline unless --enable-readline used. (2.02.39)
Remove is_lvm_partition template which has not yet been coded.
Refactor pvcreate to separate parameter parsing from validation logic.
Check for label_write() failure in _text_pv_write().
Add pvcreate tests and update vgsplit tests to handle lvm1 and lvm2 metadata.
Fix pvchange -M1 -u to preserve existing extent locations when there's a VG.
Cease recognising snapshot-in-use percentages returned by early devt kernels.
Add backward-compatible flags field to on-disk format_text metadata.
Fix dmeventd monitoring libraries to link against liblvm2cmd again. (2.02.39)
Version 2.02.39 - 27th June 2008
================================
Enable readline by default if available.
Update autoconf to 2008-01-16.
Add $DISTCLEAN_DIRS to make.tmpl.in.
Create coverage reports with --enable-profiling and make lcov or lcov-dated.
Fix up cache for PVs without mdas after consistent VG metadata is processed.
Update validation of safe mirror log type conversions in lvconvert.
Fix lvconvert to disallow snapshot and mirror combinations.
Fix reporting of LV fields alongside unallocated PV segments.
Add --unquoted and --rows to reporting tools.
Add and use uninitialized_var() macro to suppress invalid compiler warnings.
Introduce enum for md minor sb version to suppress compiler warning.
@@ -9,12 +74,12 @@ Version 2.02.39 -
Fix and improve readahead 'auto' calculation for stripe_size.
Fix lvchange output for -r auto setting if auto is already set.
Add test case for readahead.
Fix ambiguous use of identifier error_message_produced.
Avoid ambiguous use of identifier error_message_produced.
Begin syncing configure.in for merge/unification with device-mapper.
Fix add_mirror_images not to dereference uninitialized log_lv upon failure.
Don't call openlog for every debug line output by clvmd.
Add --force to lvextend and lvresize.
Fix vgchange to not activate mirror leg and log volumes directly.
Fix vgchange not to activate component mirror volumes directly.
Fix test directory clean up in make distclean.
Version 2.02.38 - 11th June 2008

View File

@@ -1,3 +1,14 @@
Version 1.02.29 -
=====================================
Add usrsbindir to configure.
Version 1.02.28 - 18th September 2008
=====================================
Only resume devices in dm_tree_preload_children if size changes.
Extend deptree buffers so the largest possible device numbers fit.
Generate versioned libdevmapper-event.so.
Underline longer report help text headings.
Version 1.02.27 - 25th June 2008
================================
Align struct memblock in dbg_malloc for sparc.

60
autoconf/config.guess vendored
View File

@@ -1,10 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
# Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
timestamp='2006-07-02'
timestamp='2008-01-23'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -56,8 +56,8 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -161,6 +161,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
@@ -329,7 +330,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
i86pc:SunOS:5.*:*)
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:6*:*)
@@ -531,7 +532,7 @@ EOF
echo rs6000-ibm-aix3.2
fi
exit ;;
*:AIX:*:[45])
*:AIX:*:[456])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
@@ -780,7 +781,7 @@ EOF
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
i*:MINGW*:*)
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
i*:windows32*:*)
@@ -790,12 +791,18 @@ EOF
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
x86:Interix*:[3456]*)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
EM64T:Interix*:[3456]*)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
*:Interix*:[3456]*)
case ${UNAME_MACHINE} in
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
EM64T | authenticamd)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
echo ia64-unknown-interix${UNAME_RELEASE}
exit ;;
esac ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
@@ -829,7 +836,14 @@ EOF
echo ${UNAME_MACHINE}-pc-minix
exit ;;
arm*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
echo ${UNAME_MACHINE}-unknown-linux-gnu
else
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
fi
exit ;;
avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
@@ -950,6 +964,9 @@ EOF
x86_64:Linux:*:*)
echo x86_64-unknown-linux-gnu
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us. cd to the root directory to prevent
@@ -1208,6 +1225,15 @@ EOF
SX-6:SUPER-UX:*:*)
echo sx6-nec-superux${UNAME_RELEASE}
exit ;;
SX-7:SUPER-UX:*:*)
echo sx7-nec-superux${UNAME_RELEASE}
exit ;;
SX-8:SUPER-UX:*:*)
echo sx8-nec-superux${UNAME_RELEASE}
exit ;;
SX-8R:SUPER-UX:*:*)
echo sx8r-nec-superux${UNAME_RELEASE}
exit ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit ;;
@@ -1458,9 +1484,9 @@ This script, last modified $timestamp, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
and
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
If the version you run ($0) is already up to date, please
send the following data and any information you think might be

66
autoconf/config.sub vendored
View File

@@ -1,10 +1,10 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
# Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
timestamp='2006-09-20'
timestamp='2008-01-16'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -72,8 +72,8 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -245,12 +245,12 @@ case $basic_machine in
| bfin \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| fr30 | frv \
| fido | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | mcore \
| maxq | mb | microblaze | mcore | mep \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@@ -324,7 +324,7 @@ case $basic_machine in
| clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
@@ -369,10 +369,14 @@ case $basic_machine in
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
| xstormy16-* | xtensa-* \
| xstormy16-* | xtensa*-* \
| ymp-* \
| z8k-*)
;;
# Recognize the basic CPU types without company name, with glob match.
xtensa*)
basic_machine=$basic_machine-unknown
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd)
@@ -443,6 +447,14 @@ case $basic_machine in
basic_machine=ns32k-sequent
os=-dynix
;;
blackfin)
basic_machine=bfin-unknown
os=-linux
;;
blackfin-*)
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
c90)
basic_machine=c90-cray
os=-unicos
@@ -475,8 +487,8 @@ case $basic_machine in
basic_machine=craynv-cray
os=-unicosmp
;;
cr16c)
basic_machine=cr16c-unknown
cr16)
basic_machine=cr16-unknown
os=-elf
;;
crds | unos)
@@ -668,6 +680,14 @@ case $basic_machine in
basic_machine=m68k-isi
os=-sysv
;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
;;
m68knommu-*)
basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
m88k-omron*)
basic_machine=m88k-omron
;;
@@ -683,6 +703,10 @@ case $basic_machine in
basic_machine=i386-pc
os=-mingw32
;;
mingw32ce)
basic_machine=arm-unknown
os=-mingw32ce
;;
miniframe)
basic_machine=m68000-convergent
;;
@@ -809,6 +833,14 @@ case $basic_machine in
basic_machine=i860-intel
os=-osf
;;
parisc)
basic_machine=hppa-unknown
os=-linux
;;
parisc-*)
basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
pbd)
basic_machine=sparc-tti
;;
@@ -925,6 +957,9 @@ case $basic_machine in
basic_machine=sh-hitachi
os=-hms
;;
sh5el)
basic_machine=sh5le-unknown
;;
sh64)
basic_machine=sh64-unknown
;;
@@ -1014,6 +1049,10 @@ case $basic_machine in
basic_machine=tic6x-unknown
os=-coff
;;
tile*)
basic_machine=tile-unknown
os=-linux-gnu
;;
tx39)
basic_machine=mipstx39-unknown
;;
@@ -1219,7 +1258,7 @@ case $os in
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers*)
| -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1414,6 +1453,9 @@ case $basic_machine in
m68*-cisco)
os=-aout
;;
mep-*)
os=-elf
;;
mips*-cisco)
os=-elf
;;

370
configure vendored
View File

@@ -663,6 +663,7 @@ target
target_cpu
target_vendor
target_os
SED
AWK
CC
CFLAGS
@@ -685,6 +686,8 @@ CSCOPE_CMD
ALLOCA
LIBOBJS
POW_LIB
LCOV
GENHTML
LVM2CMD_LIB
MSGFMT
MODPROBE_CMD
@@ -729,6 +732,8 @@ SNAPSHOTS
STATICDIR
STATIC_LINK
LIB_PTHREAD
usrlibdir
usrsbindir
LTLIBOBJS'
ac_subst_files=''
ac_precious_vars='build_alias
@@ -1315,9 +1320,10 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-lvm1_fallback Use this to fall back and use LVM1 binaries if
device-mapper is missing from the kernel
--enable-readline Enable readline support
--disable-readline Disable readline support
--disable-realtime Disable realtime clock support
--enable-debug Enable debugging
--enable-profiling Gather gcov profiling data
--disable-devmapper Disable device-mapper interaction
--disable-o_direct Disable O_DIRECT
--enable-cmdlib Build shared command library
@@ -1350,6 +1356,8 @@ Optional Packages:
--with-confdir=DIR Configuration files in DIR /etc
--with-staticdir=DIR Static binary in DIR EXEC_PREFIX/sbin
--with-dmdir=DIR Build against device-mapper source tree in DIR
--with-usrlibdir=DIR
--with-usrsbindir=DIR
Some influential environment variables:
CC C compiler command
@@ -1983,6 +1991,90 @@ case "$host_os" in
esac
################################################################################
{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; }
if test "${ac_cv_path_SED+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
for ac_i in 1 2 3 4 5 6 7; do
ac_script="$ac_script$as_nl$ac_script"
done
echo "$ac_script" | sed 99q >conftest.sed
$as_unset ac_script || ac_script=
# Extract the first word of "sed gsed" to use in msg output
if test -z "$SED"; then
set dummy sed gsed; ac_prog_name=$2
if test "${ac_cv_path_SED+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_path_SED_found=false
# Loop through the user's path and test for each of PROGNAME-LIST
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_prog in sed gsed; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
{ test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
# Check for GNU ac_path_SED and select it if it is found.
# Check for GNU $ac_path_SED
case `"$ac_path_SED" --version 2>&1` in
*GNU*)
ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
*)
ac_count=0
echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
echo '' >> "conftest.nl"
"$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
ac_count=`expr $ac_count + 1`
if test $ac_count -gt ${ac_path_SED_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_SED="$ac_path_SED"
ac_path_SED_max=$ac_count
fi
# 10*(2^10) chars as input seems more than enough
test $ac_count -gt 10 && break
done
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
$ac_path_SED_found && break 3
done
done
done
IFS=$as_save_IFS
fi
SED="$ac_cv_path_SED"
if test -z "$SED"; then
{ { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in \$PATH" >&5
echo "$as_me: error: no acceptable $ac_prog_name could be found in \$PATH" >&2;}
{ (exit 1); exit 1; }; }
fi
else
ac_cv_path_SED=$SED
fi
fi
{ echo "$as_me:$LINENO: result: $ac_cv_path_SED" >&5
echo "${ECHO_T}$ac_cv_path_SED" >&6; }
SED="$ac_cv_path_SED"
rm -f conftest.sed
for ac_prog in gawk mawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -3510,6 +3602,48 @@ echo "${ECHO_T}no" >&6; }
SET_MAKE="MAKE=${MAKE-make}"
fi
{ echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; }
if test -z "$MKDIR_P"; then
if test "${ac_cv_path_mkdir+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_prog in mkdir gmkdir; do
for ac_exec_ext in '' $ac_executable_extensions; do
{ test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
'mkdir (GNU coreutils) '* | \
'mkdir (coreutils) '* | \
'mkdir (fileutils) '4.1*)
ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
break 3;;
esac
done
done
done
IFS=$as_save_IFS
fi
if test "${ac_cv_path_mkdir+set}" = set; then
MKDIR_P="$ac_cv_path_mkdir -p"
else
# As a last resort, use the slow shell script. Don't cache a
# value for MKDIR_P within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the value is a relative name.
test -d ./--version && rmdir ./--version
MKDIR_P="$ac_install_sh -d"
fi
fi
{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5
echo "${ECHO_T}$MKDIR_P" >&6; }
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
@@ -8464,7 +8598,7 @@ echo $ECHO_N "checking whether to enable readline... $ECHO_C" >&6; }
if test "${enable_readline+set}" = set; then
enableval=$enable_readline; READLINE=$enableval
else
READLINE=no
READLINE=maybe
fi
{ echo "$as_me:$LINENO: result: $READLINE" >&5
@@ -8533,6 +8667,110 @@ fi
{ echo "$as_me:$LINENO: result: $COPTIMISE_FLAG" >&5
echo "${ECHO_T}$COPTIMISE_FLAG" >&6; }
################################################################################
{ echo "$as_me:$LINENO: checking whether to gather gcov profiling data" >&5
echo $ECHO_N "checking whether to gather gcov profiling data... $ECHO_C" >&6; }
# Check whether --enable-profiling was given.
if test "${enable_profiling+set}" = set; then
enableval=$enable_profiling; PROFILING=$enableval
else
PROFILING=no
fi
{ echo "$as_me:$LINENO: result: $PROFILING" >&5
echo "${ECHO_T}$PROFILING" >&6; }
if test "x$PROFILING" = xyes; then
COPTIMISE_FLAG="$COPTIMISE_FLAG -fprofile-arcs -ftest-coverage"
# Extract the first word of "lcov", so it can be a program name with args.
set dummy lcov; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_path_LCOV+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
case $LCOV in
[\\/]* | ?:[\\/]*)
ac_cv_path_LCOV="$LCOV" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_path_LCOV="$as_dir/$ac_word$ac_exec_ext"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_path_LCOV" && ac_cv_path_LCOV="no"
;;
esac
fi
LCOV=$ac_cv_path_LCOV
if test -n "$LCOV"; then
{ echo "$as_me:$LINENO: result: $LCOV" >&5
echo "${ECHO_T}$LCOV" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
# Extract the first word of "genhtml", so it can be a program name with args.
set dummy genhtml; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_path_GENHTML+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
case $GENHTML in
[\\/]* | ?:[\\/]*)
ac_cv_path_GENHTML="$GENHTML" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_path_GENHTML="$as_dir/$ac_word$ac_exec_ext"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_path_GENHTML" && ac_cv_path_GENHTML="no"
;;
esac
fi
GENHTML=$ac_cv_path_GENHTML
if test -n "$GENHTML"; then
{ echo "$as_me:$LINENO: result: $GENHTML" >&5
echo "${ECHO_T}$GENHTML" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
if test "$LCOV" = no -o "$GENHTML" = no ; then
{ { echo "$as_me:$LINENO: error: lcov and genhtml are required for profiling" >&5
echo "$as_me: error: lcov and genhtml are required for profiling" >&2;}
{ (exit 1); exit 1; }; }
fi
fi
################################################################################
{ echo "$as_me:$LINENO: checking whether to use device-mapper" >&5
echo $ECHO_N "checking whether to use device-mapper... $ECHO_C" >&6; }
@@ -8584,10 +8822,11 @@ fi
{ echo "$as_me:$LINENO: result: $CMDLIB" >&5
echo "${ECHO_T}$CMDLIB" >&6; }
test $CMDLIB=yes \
test x$CMDLIB = xyes \
&& LVM2CMD_LIB=-llvm2cmd \
|| LVM2CMD_LIB=
################################################################################
{ echo "$as_me:$LINENO: checking whether to install fsadm" >&5
echo $ECHO_N "checking whether to install fsadm... $ECHO_C" >&6; }
@@ -8610,12 +8849,21 @@ fi
{ echo "$as_me:$LINENO: result: $DMEVENTD" >&5
echo "${ECHO_T}$DMEVENTD" >&6; }
if test x$DMEVENTD = xyes && test x$MIRRORS != xinternal; then
{ { echo "$as_me:$LINENO: error: --enable-dmeventd currently requires --with-mirrors=internal
" >&5
if test x$DMEVENTD = xyes; then
if test x$MIRRORS != xinternal; then
{ { echo "$as_me:$LINENO: error: --enable-dmeventd currently requires --with-mirrors=internal
" >&5
echo "$as_me: error: --enable-dmeventd currently requires --with-mirrors=internal
" >&2;}
" >&2;}
{ (exit 1); exit 1; }; }
fi
if test x$CMDLIB = xno; then
{ { echo "$as_me:$LINENO: error: --enable-dmeventd requires --enable-cmdlib to be used as well
" >&5
echo "$as_me: error: --enable-dmeventd requires --enable-cmdlib to be used as well
" >&2;}
{ (exit 1); exit 1; }; }
fi
fi
if test x$DMEVENTD = xyes; then
@@ -8631,7 +8879,7 @@ if [ "x$exec_prefix" = xNONE -a "x$prefix" = xNONE ];
fi;
################################################################################
if test x$READLINE = xyes; then
if test x$READLINE != xno; then
{ echo "$as_me:$LINENO: checking for library containing tgetent" >&5
echo $ECHO_N "checking for library containing tgetent... $ECHO_C" >&6; }
if test "${ac_cv_search_tgetent+set}" = set; then
@@ -8712,9 +8960,13 @@ echo "${ECHO_T}$ac_cv_search_tgetent" >&6; }
ac_res=$ac_cv_search_tgetent
if test "$ac_res" != no; then
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
tg_found=yes
else
{ { echo "$as_me:$LINENO: error: termcap could not be found which is required for the
tg_found=no
fi
test x$READLINE:$tg_found = xyes:no &&
{ { echo "$as_me:$LINENO: error: termcap could not be found which is required for the
--enable-readline option (which is enabled by default). Either disable readline
support with --disable-readline or download and install termcap from:
ftp.gnu.org/gnu/termcap
@@ -8733,9 +8985,6 @@ Note: (n)curses also seems to work as a substitute for termcap. This was
not found either - but you could try installing that as well.
" >&2;}
{ (exit 1); exit 1; }; }
fi
fi
################################################################################
@@ -9336,7 +9585,8 @@ done
################################################################################
if test x$READLINE = xyes; then
if test x$READLINE != xno; then
rl_found=yes
{ echo "$as_me:$LINENO: checking for readline in -lreadline" >&5
echo $ECHO_N "checking for readline in -lreadline... $ECHO_C" >&6; }
@@ -9407,7 +9657,11 @@ _ACEOF
LIBS="-lreadline $LIBS"
else
{ { echo "$as_me:$LINENO: error: GNU Readline could not be found which is required for the
rl_found=no
fi
test x$READLINE:$rl_found = xyes:no &&
{ { echo "$as_me:$LINENO: error: GNU Readline could not be found which is required for the
--enable-readline option (which is enabled by default). Either disable readline
support with --disable-readline or download and install readline from:
ftp.gnu.org/gnu/readline
@@ -9422,12 +9676,14 @@ Note: if you are using precompiled packages you will also need the development
package as well (which may be called readline-devel or something similar).
" >&2;}
{ (exit 1); exit 1; }; }
if test $rl_found = yes; then
fi
{ echo "$as_me:$LINENO: checking for rl_completion_matches" >&5
echo $ECHO_N "checking for rl_completion_matches... $ECHO_C" >&6; }
if test "${ac_cv_func_rl_completion_matches+set}" = set; then
for ac_func in rl_completion_matches
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
@@ -9436,12 +9692,12 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define rl_completion_matches to an innocuous variant, in case <limits.h> declares rl_completion_matches.
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define rl_completion_matches innocuous_rl_completion_matches
#define $ac_func innocuous_$ac_func
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char rl_completion_matches (); below.
which can conflict with char $ac_func (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
@@ -9451,7 +9707,7 @@ cat >>conftest.$ac_ext <<_ACEOF
# include <assert.h>
#endif
#undef rl_completion_matches
#undef $ac_func
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
@@ -9459,18 +9715,18 @@ cat >>conftest.$ac_ext <<_ACEOF
#ifdef __cplusplus
extern "C"
#endif
char rl_completion_matches ();
char $ac_func ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_rl_completion_matches || defined __stub___rl_completion_matches
#if defined __stub_$ac_func || defined __stub___$ac_func
choke me
#endif
int
main ()
{
return rl_completion_matches ();
return $ac_func ();
;
return 0;
}
@@ -9493,32 +9749,34 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
ac_cv_func_rl_completion_matches=yes
eval "$as_ac_var=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_func_rl_completion_matches=no
eval "$as_ac_var=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
{ echo "$as_me:$LINENO: result: $ac_cv_func_rl_completion_matches" >&5
echo "${ECHO_T}$ac_cv_func_rl_completion_matches" >&6; }
if test $ac_cv_func_rl_completion_matches = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_RL_COMPLETION_MATCHES 1
ac_res=`eval echo '${'$as_ac_var'}'`
{ echo "$as_me:$LINENO: result: $ac_res" >&5
echo "${ECHO_T}$ac_res" >&6; }
if test `eval echo '${'$as_ac_var'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
cat >>confdefs.h <<\_ACEOF
#define READLINE_SUPPORT 1
_ACEOF
fi
fi
################################################################################
@@ -9628,6 +9886,24 @@ case $DMDIR in
*) DMDIR="`pwd`/$DMDIR" ;;
esac
# Check whether --with-usrlibdir was given.
if test "${with_usrlibdir+set}" = set; then
withval=$with_usrlibdir; usrlibdir="$withval"
else
usrlibdir='${prefix}/lib'
fi
# Check whether --with-usrsbindir was given.
if test "${with_usrsbindir+set}" = set; then
withval=$with_usrsbindir; usrsbindir="$withval"
else
usrsbindir='${prefix}/sbin'
fi
################################################################################
if test x$READLINE = xyes; then
@@ -10118,7 +10394,7 @@ if test "$ac_res" != no; then
ac_cv_func_getmntent=yes
cat >>confdefs.h <<\_ACEOF
#define HAVE_GETMNTENT 1
#define HAVE_GETMNTENT
_ACEOF
else
@@ -11293,6 +11569,8 @@ LVM_VERSION="\"`cat VERSION 2>/dev/null || echo Unknown`\""
################################################################################
ac_config_files="$ac_config_files Makefile make.tmpl include/Makefile lib/Makefile man/Makefile po/Makefile dmeventd/Makefile daemons/Makefile daemons/clvmd/Makefile dmeventd/mirror/Makefile dmeventd/snapshot/Makefile doc/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile lib/snapshot/Makefile test/Makefile scripts/Makefile tools/Makefile tools/version.h"
@@ -11752,6 +12030,7 @@ gives unlimited permission to copy, distribute and modify it."
ac_pwd='$ac_pwd'
srcdir='$srcdir'
INSTALL='$INSTALL'
MKDIR_P='$MKDIR_P'
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
@@ -11981,6 +12260,7 @@ target!$target$ac_delim
target_cpu!$target_cpu$ac_delim
target_vendor!$target_vendor$ac_delim
target_os!$target_os$ac_delim
SED!$SED$ac_delim
AWK!$AWK$ac_delim
CC!$CC$ac_delim
CFLAGS!$CFLAGS$ac_delim
@@ -12003,6 +12283,8 @@ CSCOPE_CMD!$CSCOPE_CMD$ac_delim
ALLOCA!$ALLOCA$ac_delim
LIBOBJS!$LIBOBJS$ac_delim
POW_LIB!$POW_LIB$ac_delim
LCOV!$LCOV$ac_delim
GENHTML!$GENHTML$ac_delim
LVM2CMD_LIB!$LVM2CMD_LIB$ac_delim
MSGFMT!$MSGFMT$ac_delim
MODPROBE_CMD!$MODPROBE_CMD$ac_delim
@@ -12026,9 +12308,6 @@ DM_IOCTLS!$DM_IOCTLS$ac_delim
DM_LIB_VERSION!$DM_LIB_VERSION$ac_delim
FSADM!$FSADM$ac_delim
GROUP!$GROUP$ac_delim
HAVE_LIBDL!$HAVE_LIBDL$ac_delim
HAVE_REALTIME!$HAVE_REALTIME$ac_delim
HAVE_SELINUX!$HAVE_SELINUX$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -12070,6 +12349,9 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
HAVE_LIBDL!$HAVE_LIBDL$ac_delim
HAVE_REALTIME!$HAVE_REALTIME$ac_delim
HAVE_SELINUX!$HAVE_SELINUX$ac_delim
INTL!$INTL$ac_delim
INTL_PACKAGE!$INTL_PACKAGE$ac_delim
JOBS!$JOBS$ac_delim
@@ -12088,10 +12370,12 @@ SNAPSHOTS!$SNAPSHOTS$ac_delim
STATICDIR!$STATICDIR$ac_delim
STATIC_LINK!$STATIC_LINK$ac_delim
LIB_PTHREAD!$LIB_PTHREAD$ac_delim
usrlibdir!$usrlibdir$ac_delim
usrsbindir!$usrsbindir$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 19; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 24; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
@@ -12318,6 +12602,11 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
[\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
*) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
esac
ac_MKDIR_P=$MKDIR_P
case $MKDIR_P in
[\\/$]* | ?:[\\/]* ) ;;
*/*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
esac
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
@@ -12371,6 +12660,7 @@ s&@builddir@&$ac_builddir&;t t
s&@abs_builddir@&$ac_abs_builddir&;t t
s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
s&@INSTALL@&$ac_INSTALL&;t t
s&@MKDIR_P@&$ac_MKDIR_P&;t t
$ac_datarootdir_hack
" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out

View File

@@ -62,6 +62,7 @@ esac
################################################################################
dnl -- Checks for programs.
AC_PROG_SED
AC_PROG_AWK
AC_PROG_CC
@@ -70,6 +71,7 @@ AC_PROG_GCC_TRADITIONAL
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_MKDIR_P
AC_PROG_RANLIB
AC_PATH_PROG(CFLOW_CMD, cflow)
AC_PATH_PROG(CSCOPE_CMD, cscope)
@@ -268,11 +270,11 @@ if test x$MIRRORS = xinternal; then
fi
################################################################################
dnl -- Enable readline
dnl -- Disable readline
AC_MSG_CHECKING(whether to enable readline)
AC_ARG_ENABLE([readline],
[ --enable-readline Enable readline support],
[READLINE=$enableval], [READLINE=no])
[ --disable-readline Disable readline support],
[READLINE=$enableval], [READLINE=maybe])
AC_MSG_RESULT($READLINE)
################################################################################
@@ -322,6 +324,23 @@ AC_ARG_WITH(optimisation,
[ COPTIMISE_FLAG="$withval" ])
AC_MSG_RESULT($COPTIMISE_FLAG)
################################################################################
dnl -- Enable profiling
AC_MSG_CHECKING(whether to gather gcov profiling data)
AC_ARG_ENABLE(profiling,
AC_HELP_STRING(--enable-profiling, [Gather gcov profiling data]),
PROFILING=$enableval, PROFILING=no)
AC_MSG_RESULT($PROFILING)
if test "x$PROFILING" = xyes; then
COPTIMISE_FLAG="$COPTIMISE_FLAG -fprofile-arcs -ftest-coverage"
AC_PATH_PROG(LCOV, lcov, no)
AC_PATH_PROG(GENHTML, genhtml, no)
if test "$LCOV" = no -o "$GENHTML" = no ; then
AC_MSG_ERROR([lcov and genhtml are required for profiling])
fi
fi
################################################################################
dnl -- Disable devmapper
AC_MSG_CHECKING(whether to use device-mapper)
@@ -351,10 +370,11 @@ AC_ARG_ENABLE(cmdlib, [ --enable-cmdlib Build shared command library],
CMDLIB=$enableval, CMDLIB=no)
AC_MSG_RESULT($CMDLIB)
AC_SUBST([LVM2CMD_LIB])
test $CMDLIB=yes \
test x$CMDLIB = xyes \
&& LVM2CMD_LIB=-llvm2cmd \
|| LVM2CMD_LIB=
################################################################################
dnl -- Enable fsadm
AC_MSG_CHECKING(whether to install fsadm)
@@ -370,10 +390,17 @@ DMEVENTD=$enableval)
AC_MSG_RESULT($DMEVENTD)
dnl -- dmeventd currently requires internal mirror support
if test x$DMEVENTD = xyes && test x$MIRRORS != xinternal; then
AC_MSG_ERROR(
--enable-dmeventd currently requires --with-mirrors=internal
)
if test x$DMEVENTD = xyes; then
if test x$MIRRORS != xinternal; then
AC_MSG_ERROR(
--enable-dmeventd currently requires --with-mirrors=internal
)
fi
if test x$CMDLIB = xno; then
AC_MSG_ERROR(
--enable-dmeventd requires --enable-cmdlib to be used as well
)
fi
fi
if test x$DMEVENTD = xyes; then
@@ -387,9 +414,11 @@ fi;
################################################################################
dnl -- Check for termcap (Shamelessly copied from parted 1.4.17)
if test x$READLINE = xyes; then
AC_SEARCH_LIBS(tgetent, ncurses curses termcap termlib, ,
AC_MSG_ERROR(
if test x$READLINE != xno; then
AC_SEARCH_LIBS([tgetent], [ncurses curses termcap termlib],
[tg_found=yes], [tg_found=no])
test x$READLINE:$tg_found = xyes:no &&
AC_MSG_ERROR(
termcap could not be found which is required for the
--enable-readline option (which is enabled by default). Either disable readline
support with --disable-readline or download and install termcap from:
@@ -399,7 +428,6 @@ Note: if you are using precompiled packages you will also need the development
Note: (n)curses also seems to work as a substitute for termcap. This was
not found either - but you could try installing that as well.
)
)
fi
################################################################################
@@ -491,9 +519,11 @@ AC_CHECK_HEADERS(getopt.h, AC_DEFINE([HAVE_GETOPTLONG], 1, [Define to 1 if getop
################################################################################
dnl -- Check for readline (Shamelessly copied from parted 1.4.17)
if test x$READLINE = xyes; then
AC_CHECK_LIB(readline, readline, ,
AC_MSG_ERROR(
if test x$READLINE != xno; then
rl_found=yes
AC_CHECK_LIB([readline], [readline], , [rl_found=no])
test x$READLINE:$rl_found = xyes:no &&
AC_MSG_ERROR(
GNU Readline could not be found which is required for the
--enable-readline option (which is enabled by default). Either disable readline
support with --disable-readline or download and install readline from:
@@ -501,12 +531,11 @@ support with --disable-readline or download and install readline from:
Note: if you are using precompiled packages you will also need the development
package as well (which may be called readline-devel or something similar).
)
)
AC_CHECK_FUNC([rl_completion_matches],
AC_DEFINE([HAVE_RL_COMPLETION_MATCHES], 1,
[Define to 1 if rl_completion_matches() is available.]))
AC_DEFINE([READLINE_SUPPORT], 1,
[Define to 1 to include the LVM readline shell.])
if test $rl_found = yes; then
AC_CHECK_FUNCS([rl_completion_matches])
AC_DEFINE([READLINE_SUPPORT], 1,
[Define to 1 to include the LVM readline shell.])
fi
fi
################################################################################
@@ -553,6 +582,16 @@ case $DMDIR in
*) DMDIR="`pwd`/$DMDIR" ;;
esac
AC_ARG_WITH(usrlibdir,
[ --with-usrlibdir=DIR],
[ usrlibdir="$withval"],
[ usrlibdir='${prefix}/lib' ])
AC_ARG_WITH(usrsbindir,
[ --with-usrsbindir=DIR],
[ usrsbindir="$withval"],
[ usrsbindir='${prefix}/sbin' ])
################################################################################
dnl -- Ensure additional headers required
if test x$READLINE = xyes; then
@@ -645,6 +684,8 @@ AC_SUBST(SNAPSHOTS)
AC_SUBST(STATICDIR)
AC_SUBST(STATIC_LINK)
AC_SUBST([LIB_PTHREAD])
AC_SUBST(usrlibdir)
AC_SUBST(usrsbindir)
################################################################################
dnl -- First and last lines should not contain files to generate in order to

View File

@@ -90,7 +90,7 @@ clvmd: $(OBJECTS) $(top_srcdir)/lib/liblvm.a
install_clvmd: $(TARGETS)
$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) clvmd \
$(sbindir)/clvmd
$(usrsbindir)/clvmd
install: $(INSTALL_TARGETS)

View File

@@ -141,8 +141,7 @@ static const char *decode_flags(unsigned char flags)
{
static char buf[128];
sprintf(buf, "0x%x (%s%s%s)", flags,
flags & LCK_PARTIAL_MODE ? "PARTIAL " : "",
sprintf(buf, "0x%x (%s%s)", flags,
flags & LCK_MIRROR_NOSYNC_MODE ? "MIRROR_NOSYNC " : "",
flags & LCK_DMEVENTD_MONITOR_MODE ? "DMEVENTD_MONITOR " : "");
@@ -413,9 +412,6 @@ int do_lock_lv(unsigned char command, unsigned char lock_flags, char *resource)
}
}
if (lock_flags & LCK_PARTIAL_MODE)
init_partial(1);
if (lock_flags & LCK_MIRROR_NOSYNC_MODE)
init_mirror_in_sync(1);
@@ -454,9 +450,6 @@ int do_lock_lv(unsigned char command, unsigned char lock_flags, char *resource)
break;
}
if (lock_flags & LCK_PARTIAL_MODE)
init_partial(0);
if (lock_flags & LCK_MIRROR_NOSYNC_MODE)
init_mirror_in_sync(0);

View File

@@ -23,6 +23,7 @@ ifeq ("@LIB_SUFFIX@","dylib")
LIB_SHARED = libdevmapper-event.dylib
else
LIB_SHARED = libdevmapper-event.so
VERSIONED_SHLIB = $(LIB_SHARED).$(LIB_VERSION)
endif
TARGETS = dmeventd
@@ -33,7 +34,7 @@ include ../make.tmpl
LDFLAGS += -ldl -ldevmapper -lpthread
CLDFLAGS += -ldl -ldevmapper -lpthread
dmeventd: $(LIB_SHARED) dmeventd.o
dmeventd: $(LIB_SHARED) $(VERSIONED_SHLIB) dmeventd.o
$(CC) -o $@ dmeventd.o $(CFLAGS) $(LDFLAGS) \
-L. -ldevmapper-event $(LIBS) -rdynamic
@@ -74,6 +75,10 @@ install_static: libdevmapper-event.a
$(libdir)/libdevmapper-event.a.$(LIB_VERSION)
$(LN_S) -f libdevmapper-event.a.$(LIB_VERSION) $(libdir)/libdevmapper-event.a
$(VERSIONED_SHLIB): $(LIB_SHARED)
$(RM) -f $@
$(LN_S) $(LIB_SHARED) $@
.PHONY: distclean_lib distclean
distclean_lib:

View File

@@ -36,6 +36,7 @@
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
#include <signal.h>
#include <arpa/inet.h> /* for htonl, ntohl */
#ifdef linux

View File

@@ -17,7 +17,7 @@ top_srcdir = @top_srcdir@
VPATH = @srcdir@
INCLUDES += -I${top_srcdir}/tools
CLDFLAGS += -L${top_srcdir}/tools -ldevmapper $(LVM2CMD_LIB)
CLDFLAGS += -L${top_srcdir}/tools -ldevmapper @LVM2CMD_LIB@
SOURCES = dmeventd_mirror.c

View File

@@ -152,7 +152,7 @@ static int _remove_failed_devices(const char *device)
}
/* FIXME Is any sanity-checking required on %s? */
if (CMD_SIZE <= snprintf(cmd_str, CMD_SIZE, "vgreduce --config devices{ignore_suspended_devices=1} --removemissing %s", vg)) {
if (CMD_SIZE <= snprintf(cmd_str, CMD_SIZE, "vgreduce --config devices{ignore_suspended_devices=1} --removemissing --force %s", vg)) {
/* this error should be caught above, but doesn't hurt to check again */
syslog(LOG_ERR, "Unable to form LVM command: Device name too long");
dm_pool_empty(_mem_pool); /* FIXME: not safe with multiple threads */

View File

@@ -17,7 +17,7 @@ top_srcdir = @top_srcdir@
VPATH = @srcdir@
INCLUDES += -I${top_srcdir}/tools
CLDFLAGS += -L${top_srcdir}/tools -ldevmapper $(LVM2CMD_LIB)
CLDFLAGS += -L${top_srcdir}/tools -ldevmapper @LVM2CMD_LIB@
SOURCES = dmeventd_snapshot.c

View File

@@ -99,24 +99,6 @@ static void _parse_snapshot_params(char *params, struct snap_status *stat)
stat->max = atoi(p);
}
/* send unregister command to itself */
static void _unregister_self(struct dm_task *dmt)
{
const char *name = dm_task_get_name(dmt);
struct dm_event_handler *dmevh;
if (!(dmevh = dm_event_handler_create()))
return;
if (dm_event_handler_set_dev_name(dmevh, name))
goto fail;
dm_event_handler_set_event_mask(dmevh, DM_EVENT_ALL_ERRORS|DM_EVENT_TIMEOUT);
dm_event_unregister_handler(dmevh);
fail:
dm_event_handler_destroy(dmevh);
}
void process_event(struct dm_task *dmt,
enum dm_event_mask event __attribute((unused)),
void **private)
@@ -149,7 +131,6 @@ void process_event(struct dm_task *dmt,
*/
if (stat.invalid || !stat.max) {
syslog(LOG_ERR, "Snapshot %s changed state to: %s\n", device, params);
_unregister_self(dmt);
*percent_warning = 0;
goto out;
}

View File

@@ -17,7 +17,7 @@ top_srcdir = @top_srcdir@
VPATH = @srcdir@
INCLUDES += -I${top_srcdir}/tools
CLDFLAGS += -L${top_srcdir}/tools -ldevmapper $(LVM2CMD_LIB)
CLDFLAGS += -L${top_srcdir}/tools -ldevmapper @LVM2CMD_LIB@
SOURCES = dmeventd_mirror.c

View File

@@ -152,7 +152,7 @@ static int _remove_failed_devices(const char *device)
}
/* FIXME Is any sanity-checking required on %s? */
if (CMD_SIZE <= snprintf(cmd_str, CMD_SIZE, "vgreduce --config devices{ignore_suspended_devices=1} --removemissing %s", vg)) {
if (CMD_SIZE <= snprintf(cmd_str, CMD_SIZE, "vgreduce --config devices{ignore_suspended_devices=1} --removemissing --force %s", vg)) {
/* this error should be caught above, but doesn't hurt to check again */
syslog(LOG_ERR, "Unable to form LVM command: Device name too long");
dm_pool_empty(_mem_pool); /* FIXME: not safe with multiple threads */

View File

@@ -17,7 +17,7 @@ top_srcdir = @top_srcdir@
VPATH = @srcdir@
INCLUDES += -I${top_srcdir}/tools
CLDFLAGS += -L${top_srcdir}/tools -ldevmapper $(LVM2CMD_LIB)
CLDFLAGS += -L${top_srcdir}/tools -ldevmapper @LVM2CMD_LIB@
SOURCES = dmeventd_snapshot.c

View File

@@ -99,24 +99,6 @@ static void _parse_snapshot_params(char *params, struct snap_status *stat)
stat->max = atoi(p);
}
/* send unregister command to itself */
static void _unregister_self(struct dm_task *dmt)
{
const char *name = dm_task_get_name(dmt);
struct dm_event_handler *dmevh;
if (!(dmevh = dm_event_handler_create()))
return;
if (dm_event_handler_set_dev_name(dmevh, name))
goto fail;
dm_event_handler_set_event_mask(dmevh, DM_EVENT_ALL_ERRORS|DM_EVENT_TIMEOUT);
dm_event_unregister_handler(dmevh);
fail:
dm_event_handler_destroy(dmevh);
}
void process_event(struct dm_task *dmt,
enum dm_event_mask event __attribute((unused)),
void **private)
@@ -149,7 +131,6 @@ void process_event(struct dm_task *dmt,
*/
if (stat.invalid || !stat.max) {
syslog(LOG_ERR, "Snapshot %s changed state to: %s\n", device, params);
_unregister_self(dmt);
*percent_warning = 0;
goto out;
}

View File

@@ -93,6 +93,11 @@ devices {
# 1 enables; 0 disables.
md_component_detection = 1
# By default, if a PV is placed directly upon an md device, LVM2
# will align its data blocks with the the chunk_size exposed in sysfs.
# 1 enables; 0 disables.
md_chunk_alignment = 1
# If, while scanning the system for PVs, LVM2 encounters a device-mapper
# device that has its I/O suspended, it waits for it to become accessible.
# Set this to 1 to skip such devices. This should only be needed
@@ -266,11 +271,13 @@ global {
}
activation {
# Device used in place of missing stripes if activating incomplete volume.
# For now, you need to set this up yourself first (e.g. with 'dmsetup')
# For example, you could make it return I/O errors using the 'error'
# target or make it return zeros.
missing_stripe_filler = "/dev/ioerror"
# How to fill in missing stripes if activating an incomplete volume.
# Using "error" will make inaccessible parts of the device return
# I/O errors on access. You can instead use a device path, in which
# case, that device will be used to in place of missing stripes.
# But note that using anything other than "error" with mirrored
# or snapshotted volumes is likely to result in data corruption.
missing_stripe_filler = "error"
# How much stack (in KB) to reserve for use while devices suspended
reserved_stack = 256

View File

@@ -61,6 +61,7 @@ SOURCES =\
format_text/import_vsn1.c \
format_text/tags.c \
format_text/text_label.c \
freeseg/freeseg.c \
label/label.c \
locking/file_locking.c \
locking/locking.c \

View File

@@ -1027,6 +1027,12 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s,
return 0;
}
if ((!lv->vg->cmd->partial_activation) && (lv->status & PARTIAL_LV)) {
log_error("Refusing activation of partial LV %s. Use --partial to override.",
lv->name);
return_0;
}
if (test_mode()) {
_skip("Activating '%s'.", lv->name);
return 1;

View File

@@ -47,7 +47,6 @@ struct dev_manager {
struct cmd_context *cmd;
const char *stripe_filler;
void *target_state;
uint32_t pvmove_mirror_count;
@@ -59,8 +58,6 @@ struct lv_layer {
const char *old_name;
};
static const char *stripe_filler = NULL;
static char *_build_dlid(struct dm_pool *mem, const char *lvid, const char *layer)
{
char *dlid;
@@ -379,8 +376,7 @@ static int _percent_run(struct dev_manager *dm, const char *name,
!segtype->ops->target_percent(&dm->target_state, dm->mem,
dm->cmd, seg, params,
&total_numerator,
&total_denominator,
percent))
&total_denominator))
goto_out;
} while (next);
@@ -393,7 +389,7 @@ static int _percent_run(struct dev_manager *dm, const char *name,
if (total_denominator)
*percent = (float) total_numerator *100 / total_denominator;
else if (*percent < 0)
else
*percent = 100;
log_debug("LV percent: %f", *percent);
@@ -444,13 +440,6 @@ struct dev_manager *dev_manager_create(struct cmd_context *cmd,
dm->cmd = cmd;
dm->mem = mem;
if (!stripe_filler) {
stripe_filler = find_config_tree_str(cmd,
"activation/missing_stripe_filler",
DEFAULT_STRIPE_FILLER);
}
dm->stripe_filler = stripe_filler;
if (!(dm->vg_name = dm_pool_strdup(dm->mem, vg_name)))
goto_bad;
@@ -700,6 +689,68 @@ bad:
return NULL;
}
static char *_add_error_device(struct dev_manager *dm, struct dm_tree *dtree,
struct lv_segment *seg, int s)
{
char *id, *name;
char errid[32];
struct dm_tree_node *node;
struct lv_segment *seg_i;
int segno = -1, i = 0;;
uint64_t size = seg->len * seg->lv->vg->extent_size;
list_iterate_items(seg_i, &seg->lv->segments) {
if (seg == seg_i)
segno = i;
++i;
}
if (segno < 0) {
log_error("_add_error_device called with bad segment");
return_NULL;
}
sprintf(errid, "missing_%d_%d", segno, s);
if (!(id = build_dlid(dm, seg->lv->lvid.s, errid)))
return_NULL;
if (!(name = build_dm_name(dm->mem, seg->lv->vg->name,
seg->lv->name, errid)))
return_NULL;
if (!(node = dm_tree_add_new_dev(dtree, name, id, 0, 0, 0, 0, 0)))
return_NULL;
if (!dm_tree_node_add_error_target(node, size))
return_NULL;
return id;
}
static int _add_error_area(struct dev_manager *dm, struct dm_tree_node *node,
struct lv_segment *seg, int s)
{
char *dlid;
uint64_t extent_size = seg->lv->vg->extent_size;
if (!strcmp(dm->cmd->stripe_filler, "error")) {
/*
* FIXME, the tree pointer is first field of dm_tree_node, but
* we don't have the struct definition available.
*/
struct dm_tree **tree = (struct dm_tree **) node;
dlid = _add_error_device(dm, *tree, seg, s);
if (!dlid)
return_0;
dm_tree_node_add_target_area(node, NULL, dlid,
extent_size * seg_le(seg, s));
} else
dm_tree_node_add_target_area(node,
dm->cmd->stripe_filler,
NULL, UINT64_C(0));
return 1;
}
int add_areas_line(struct dev_manager *dm, struct lv_segment *seg,
struct dm_tree_node *node, uint32_t start_area,
uint32_t areas)
@@ -713,11 +764,10 @@ int add_areas_line(struct dev_manager *dm, struct lv_segment *seg,
(!seg_pvseg(seg, s) ||
!seg_pv(seg, s) ||
!seg_dev(seg, s))) ||
(seg_type(seg, s) == AREA_LV && !seg_lv(seg, s)))
dm_tree_node_add_target_area(node,
dm->stripe_filler,
NULL, UINT64_C(0));
else if (seg_type(seg, s) == AREA_PV)
(seg_type(seg, s) == AREA_LV && !seg_lv(seg, s))) {
if (!_add_error_area(dm, node, seg, s))
return_0;
} else if (seg_type(seg, s) == AREA_PV)
dm_tree_node_add_target_area(node,
dev_name(seg_dev(seg, s)),
NULL,

29
lib/cache/lvmcache.c vendored
View File

@@ -97,9 +97,10 @@ static void _update_cache_info_lock_state(struct lvmcache_info *info,
int was_locked = (info->status & CACHE_LOCKED) ? 1 : 0;
/*
* Cache becomes invalid whenever lock state changes
* Cache becomes invalid whenever lock state changes unless
* exclusive VG_GLOBAL is held (i.e. while scanning).
*/
if (was_locked != locked) {
if (!vgname_is_locked(VG_GLOBAL) && (was_locked != locked)) {
info->status |= CACHE_INVALID;
*cached_vgmetadata_valid = 0;
}
@@ -166,7 +167,7 @@ void lvmcache_drop_metadata(const char *vgname)
/* Indicate that PVs could now be missing from the cache */
init_full_scan_done(0);
} else
} else if (!vgname_is_locked(VG_GLOBAL))
_drop_metadata(vgname);
}
@@ -845,6 +846,7 @@ static int _lvmcache_update_vgname(struct lvmcache_info *info,
{
struct lvmcache_vginfo *vginfo, *primary_vginfo, *orphan_vginfo;
struct lvmcache_info *info2, *info3;
char mdabuf[32];
// struct lvmcache_vginfo *old_vginfo, *next;
if (!vgname || (info && info->vginfo && !strcmp(info->vginfo->vgname, vgname)))
@@ -914,11 +916,16 @@ static int _lvmcache_update_vgname(struct lvmcache_info *info,
orphan_vginfo = vginfo_from_vgname(primary_vginfo->fmt->orphan_vg_name, NULL);
_drop_vginfo(info2, primary_vginfo);
_vginfo_attach_info(orphan_vginfo, info2);
log_debug("lvmcache: %s: now in VG %s%s%s%s",
if (info2->mdas.n)
sprintf(mdabuf, " with %u mdas",
list_size(&info2->mdas));
else
mdabuf[0] = '\0';
log_debug("lvmcache: %s: now in VG %s%s%s%s%s",
dev_name(info2->dev),
vgname, orphan_vginfo->vgid[0] ? " (" : "",
orphan_vginfo->vgid[0] ? orphan_vginfo->vgid : "",
orphan_vginfo->vgid[0] ? ")" : "");
orphan_vginfo->vgid[0] ? ")" : "", mdabuf);
}
if (!_insert_vginfo(vginfo, vgid, vgstatus, creation_host,
@@ -947,13 +954,17 @@ static int _lvmcache_update_vgname(struct lvmcache_info *info,
/* FIXME Check consistency of list! */
vginfo->fmt = fmt;
if (info)
log_debug("lvmcache: %s: now in VG %s%s%s%s",
if (info) {
if (info->mdas.n)
sprintf(mdabuf, " with %u mdas", list_size(&info->mdas));
else
mdabuf[0] = '\0';
log_debug("lvmcache: %s: now in VG %s%s%s%s%s",
dev_name(info->dev),
vgname, vginfo->vgid[0] ? " (" : "",
vginfo->vgid[0] ? vginfo->vgid : "",
vginfo->vgid[0] ? ")" : "");
else
vginfo->vgid[0] ? ")" : "", mdabuf);
} else
log_debug("lvmcache: initialised VG %s", vgname);
return 1;

View File

@@ -75,6 +75,49 @@ static int _get_env_vars(struct cmd_context *cmd)
return 1;
}
static void _get_sysfs_dir(struct cmd_context *cmd)
{
static char proc_mounts[PATH_MAX];
static char *split[4], buffer[PATH_MAX + 16];
FILE *fp;
char *sys_mnt = NULL;
cmd->sysfs_dir[0] = '\0';
if (!*cmd->proc_dir) {
log_debug("No proc filesystem found: skipping sysfs detection");
return;
}
if (dm_snprintf(proc_mounts, sizeof(proc_mounts),
"%s/mounts", cmd->proc_dir) < 0) {
log_error("Failed to create /proc/mounts string for sysfs detection");
return;
}
if (!(fp = fopen(proc_mounts, "r"))) {
log_sys_error("_get_sysfs_dir: fopen %s", proc_mounts);
return;
}
while (fgets(buffer, sizeof(buffer), fp)) {
if (dm_split_words(buffer, 4, 0, split) == 4 &&
!strcmp(split[2], "sysfs")) {
sys_mnt = split[1];
break;
}
}
if (fclose(fp))
log_sys_error("fclose", proc_mounts);
if (!sys_mnt) {
log_error("Failed to find sysfs mount point");
return;
}
strncpy(cmd->sysfs_dir, sys_mnt, sizeof(cmd->sysfs_dir));
}
static void _init_logging(struct cmd_context *cmd)
{
int append = 1;
@@ -154,6 +197,7 @@ static int _process_config(struct cmd_context *cmd)
{
mode_t old_umask;
const char *read_ahead;
struct stat st;
/* umask */
cmd->default_settings.umask = find_config_tree_int(cmd,
@@ -189,6 +233,8 @@ static int _process_config(struct cmd_context *cmd)
cmd->proc_dir[0] = '\0';
}
_get_sysfs_dir(cmd);
/* activation? */
cmd->default_settings.activation = find_config_tree_int(cmd,
"global/activation",
@@ -218,6 +264,30 @@ static int _process_config(struct cmd_context *cmd)
return 0;
}
cmd->stripe_filler = find_config_tree_str(cmd,
"activation/missing_stripe_filler",
DEFAULT_STRIPE_FILLER);
/* FIXME Missing error code checks from the stats, not log_warn?, notify if setting overridden, delay message/check till it is actually used (eg consider if lvm shell - file could appear later after this check)? */
if (!strcmp(cmd->stripe_filler, "/dev/ioerror") &&
stat(cmd->stripe_filler, &st))
cmd->stripe_filler = "error";
if (strcmp(cmd->stripe_filler, "error")) {
if (stat(cmd->stripe_filler, &st)) {
log_warn("WARNING: activation/missing_stripe_filler = \"%s\" "
"is invalid,", cmd->stripe_filler);
log_warn(" stat failed: %s", strerror(errno));
log_warn("Falling back to \"error\" missing_stripe_filler.");
cmd->stripe_filler = "error";
} else if (!S_ISBLK(st.st_mode)) {
log_warn("WARNING: activation/missing_stripe_filler = \"%s\" "
"is not a block device.", cmd->stripe_filler);
log_warn("Falling back to \"error\" missing_stripe_filler.");
cmd->stripe_filler = "error";
}
}
return 1;
}
@@ -534,7 +604,7 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
*/
if (find_config_tree_bool(cmd, "devices/sysfs_scan",
DEFAULT_SYSFS_SCAN)) {
if ((filters[nr_filt] = sysfs_filter_create(cmd->proc_dir)))
if ((filters[nr_filt] = sysfs_filter_create(cmd->sysfs_dir)))
nr_filt++;
}
@@ -755,6 +825,11 @@ static int _init_segtypes(struct cmd_context *cmd)
segtype->library = NULL;
list_add(&cmd->segtypes, &segtype->list);
if (!(segtype = init_free_segtype(cmd)))
return 0;
segtype->library = NULL;
list_add(&cmd->segtypes, &segtype->list);
#ifdef SNAPSHOT_INTERNAL
if (!(segtype = init_snapshot_segtype(cmd)))
return 0;
@@ -931,6 +1006,7 @@ struct cmd_context *create_toolcontext(struct arg *the_args, unsigned is_static,
cmd->args = the_args;
cmd->is_static = is_static;
cmd->is_long_lived = is_long_lived;
cmd->handles_missing_pvs = 0;
cmd->hosttags = 0;
list_init(&cmd->formats);
list_init(&cmd->segtypes);

View File

@@ -66,8 +66,10 @@ struct cmd_context {
struct command *command;
struct arg *args;
char **argv;
unsigned is_static; /* Static binary? */
unsigned is_long_lived; /* Optimises persistent_filter handling */
unsigned is_static:1; /* Static binary? */
unsigned is_long_lived:1; /* Optimises persistent_filter handling */
unsigned handles_missing_pvs:1;
unsigned partial_activation:1;
struct dev_filter *filter;
int dump_filter; /* Dump filter when exiting? */
@@ -81,6 +83,7 @@ struct cmd_context {
struct archive_params *archive_params;
struct backup_params *backup_params;
const char *stripe_filler;
/* List of defined tags */
struct list tags;
@@ -89,6 +92,7 @@ struct cmd_context {
char sys_dir[PATH_MAX];
char dev_dir[PATH_MAX];
char proc_dir[PATH_MAX];
char sysfs_dir[PATH_MAX];
};
struct cmd_context *create_toolcontext(struct arg *the_args, unsigned is_static, unsigned is_long_lived);

View File

@@ -1011,7 +1011,7 @@ float find_config_tree_float(struct cmd_context *cmd, const char *path,
return _find_config_float(cmd->cft_override ? cmd->cft_override->root : NULL, cmd->cft->root, path, fail);
}
static int _str_in_array(const char *str, const char *values[])
static int _str_in_array(const char *str, const char * const values[])
{
int i;
@@ -1024,9 +1024,8 @@ static int _str_in_array(const char *str, const char *values[])
static int _str_to_bool(const char *str, int fail)
{
static const char *_true_values[] = { "y", "yes", "on", "true", NULL };
static const char *_false_values[] =
{ "n", "no", "off", "false", NULL };
const char * const _true_values[] = { "y", "yes", "on", "true", NULL };
const char * const _false_values[] = { "n", "no", "off", "false", NULL };
if (_str_in_array(str, _true_values))
return 1;
@@ -1276,7 +1275,7 @@ unsigned maybe_config_section(const char *str, unsigned len)
begin_count = _count_tokens(str, len, TOK_SECTION_B);
end_count = _count_tokens(str, len, TOK_SECTION_E);
if (begin_count && end_count && (begin_count - end_count == 0))
if (begin_count && end_count && (begin_count == end_count))
return 1;
else
return 0;

View File

@@ -32,6 +32,7 @@
#define DEFAULT_PROC_DIR "/proc"
#define DEFAULT_SYSFS_SCAN 1
#define DEFAULT_MD_COMPONENT_DETECTION 1
#define DEFAULT_MD_CHUNK_ALIGNMENT 1
#define DEFAULT_IGNORE_SUSPENDED_DEVICES 1
#define DEFAULT_LOCK_DIR "/var/lock/lvm"
@@ -91,7 +92,7 @@
# define DEFAULT_ACTIVATION 0
#endif
#define DEFAULT_STRIPE_FILLER "/dev/ioerror"
#define DEFAULT_STRIPE_FILLER "error"
#define DEFAULT_MIRROR_REGION_SIZE 512 /* KB */
#define DEFAULT_INTERVAL 15

View File

@@ -24,6 +24,7 @@
/* Define some portable printing types */
#define PRIsize_t "zu"
#define PRIptrdiff_t "td"
#define PRIpid_t PRId32
struct str_list {
struct list list;

View File

@@ -1,6 +1,6 @@
/*
* Copyright (C) 2004 Luca Berra
* Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
* Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -16,6 +16,7 @@
#include "lib.h"
#include "metadata.h"
#include "xlate.h"
#include "filter.h"
#ifdef linux
@@ -124,6 +125,62 @@ out:
return ret;
}
/*
* Retrieve chunk size from md device using sysfs.
*/
unsigned long dev_md_chunk_size(const char *sysfs_dir, struct device *dev)
{
char path[PATH_MAX+1], buffer[64];
FILE *fp;
struct stat info;
unsigned long chunk_size_bytes = 0UL;
if (MAJOR(dev->dev) != md_major())
return 0;
if (!sysfs_dir || !*sysfs_dir)
return_0;
if (dm_snprintf(path, PATH_MAX, "%s/dev/block/%d:%d/md/chunk_size",
sysfs_dir, MAJOR(dev->dev), MINOR(dev->dev)) < 0) {
log_error("dm_snprintf md chunk_size failed");
return 0;
}
/* old sysfs structure */
if (stat(path, &info) &&
dm_snprintf(path, PATH_MAX, "%s/block/md%d/md/chunk_size",
sysfs_dir, MINOR(dev->dev)) < 0) {
log_error("dm_snprintf old md chunk size failed");
return 0;
}
if (!(fp = fopen(path, "r"))) {
log_sys_error("fopen", path);
return 0;
}
if (!fgets(buffer, sizeof(buffer), fp)) {
log_sys_error("fgets", path);
goto out;
}
if (sscanf(buffer, "%lu", &chunk_size_bytes) != 1) {
log_error("sysfs file %s not in expected format: %s", path,
buffer);
goto out;
}
log_very_verbose("Device %s md chunk size is %lu bytes.",
dev_name(dev), chunk_size_bytes);
out:
if (fclose(fp))
log_sys_error("fclose", path);
return chunk_size_bytes >> SECTOR_SHIFT;
}
#else
int dev_is_md(struct device *dev __attribute((unused)),
@@ -132,4 +189,10 @@ int dev_is_md(struct device *dev __attribute((unused)),
return 0;
}
unsigned long dev_md_chunk_size(const char *sysfs_dir __attribute((unused)),
struct device *dev __attribute((unused)))
{
return 0UL;
}
#endif

View File

@@ -93,11 +93,7 @@ const char *dev_name_confirmed(struct device *dev, int quiet);
/* Does device contain md superblock? If so, where? */
int dev_is_md(struct device *dev, uint64_t *sb);
/* FIXME Check partition type if appropriate */
#define is_lvm_partition(a) 1
/* int is_lvm_partition(const char *name); */
unsigned long dev_md_chunk_size(const char *sysfs_dir, struct device *dev);
int is_partitioned_dev(struct device *dev);

View File

@@ -24,9 +24,9 @@
typedef enum { SIZE_LONG = 0, SIZE_SHORT = 1, SIZE_UNIT = 2 } size_len_t;
static struct {
static const struct {
alloc_policy_t alloc;
const char *str;
const char str[12]; /* must be changed when size extends 11 chars */
} _policies[] = {
{
ALLOC_CONTIGUOUS, "contiguous"}, {
@@ -36,7 +36,7 @@ static struct {
ALLOC_INHERIT, "inherit"}
};
static int _num_policies = sizeof(_policies) / sizeof(*_policies);
static const int _num_policies = sizeof(_policies) / sizeof(*_policies);
uint64_t units_to_bytes(const char *units, char *unit_type)
{
@@ -155,7 +155,7 @@ static const char *_display_size(const struct cmd_context *cmd,
uint64_t byte = UINT64_C(0);
uint64_t units = UINT64_C(1024);
char *size_buf = NULL;
const char *size_str[][3] = {
const char * const size_str[][3] = {
{" Exabyte", " EB", "E"},
{" Petabyte", " PB", "P"},
{" Terabyte", " TB", "T"},
@@ -578,10 +578,7 @@ void vgdisplay_full(const struct volume_group *vg)
struct lv_list *lvl;
char uuid[64] __attribute((aligned(8)));
if (vg->status & PARTIAL_VG)
active_pvs = list_size(&vg->pvs);
else
active_pvs = vg->pv_count;
active_pvs = vg->pv_count - vg_missing_pv_count(vg);
log_print("--- Volume group ---");
log_print("VG Name %s", vg->name);
@@ -664,10 +661,7 @@ void vgdisplay_colons(const struct volume_group *vg)
const char *access;
char uuid[64] __attribute((aligned(8)));
if (vg->status & PARTIAL_VG)
active_pvs = list_size(&vg->pvs);
else
active_pvs = vg->pv_count;
active_pvs = vg->pv_count - vg_missing_pv_count(vg);
list_iterate_items(lvl, &vg->lvs)
if (lv_is_visible(lvl->lv) && !(lvl->lv->status & SNAPSHOT))

View File

@@ -20,47 +20,11 @@
#include <dirent.h>
static int _locate_sysfs_blocks(const char *proc, char *path, size_t len,
static int _locate_sysfs_blocks(const char *sysfs_dir, char *path, size_t len,
unsigned *sysfs_depth)
{
char proc_mounts[PATH_MAX];
FILE *fp;
char *split[4], buffer[PATH_MAX + 16];
const char *sys_mnt = NULL;
struct stat info;
if (!*proc) {
log_verbose("No proc filesystem found: skipping sysfs filter");
return 0;
}
if (dm_snprintf(proc_mounts, sizeof(proc_mounts),
"%s/mounts", proc) < 0) {
log_error("Failed to create /proc/mounts string");
return 0;
}
if (!(fp = fopen(proc_mounts, "r"))) {
log_sys_error("fopen %s", proc_mounts);
return 0;
}
while (fgets(buffer, sizeof(buffer), fp)) {
if (dm_split_words(buffer, 4, 0, split) == 4 &&
!strcmp(split[2], "sysfs")) {
sys_mnt = split[1];
break;
}
}
if (fclose(fp))
log_sys_error("fclose", proc_mounts);
if (!sys_mnt) {
log_error("Failed to find sysfs mount point");
return 0;
}
/*
* unified classification directory for all kernel subsystems
*
@@ -70,7 +34,7 @@ static int _locate_sysfs_blocks(const char *proc, char *path, size_t len,
* `-- sr0 -> ../../../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0/block/sr0
*
*/
if (dm_snprintf(path, len, "%s/%s", sys_mnt,
if (dm_snprintf(path, len, "%s/%s", sysfs_dir,
"subsystem/block/devices") >= 0) {
if (!stat(path, &info)) {
*sysfs_depth = 0;
@@ -87,7 +51,7 @@ static int _locate_sysfs_blocks(const char *proc, char *path, size_t len,
* `-- sr0 -> ../../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0/block/sr0
*
*/
if (dm_snprintf(path, len, "%s/%s", sys_mnt, "class/block") >= 0) {
if (dm_snprintf(path, len, "%s/%s", sysfs_dir, "class/block") >= 0) {
if (!stat(path, &info)) {
*sysfs_depth = 0;
return 1;
@@ -112,7 +76,7 @@ static int _locate_sysfs_blocks(const char *proc, char *path, size_t len,
* ...
*
*/
if (dm_snprintf(path, len, "%s/%s", sys_mnt, "block") >= 0) {
if (dm_snprintf(path, len, "%s/%s", sysfs_dir, "block") >= 0) {
if (!stat(path, &info)) {
*sysfs_depth = 1;
return 1;
@@ -321,7 +285,7 @@ static void _destroy(struct dev_filter *f)
dm_pool_destroy(ds->mem);
}
struct dev_filter *sysfs_filter_create(const char *proc)
struct dev_filter *sysfs_filter_create(const char *sysfs_dir)
{
char sys_block[PATH_MAX];
unsigned sysfs_depth;
@@ -329,7 +293,12 @@ struct dev_filter *sysfs_filter_create(const char *proc)
struct dev_set *ds;
struct dev_filter *f;
if (!_locate_sysfs_blocks(proc, sys_block, sizeof(sys_block), &sysfs_depth))
if (!*sysfs_dir) {
log_verbose("No proc filesystem found: skipping sysfs filter");
return NULL;
}
if (!_locate_sysfs_blocks(sysfs_dir, sys_block, sizeof(sys_block), &sysfs_depth))
return NULL;
if (!(mem = dm_pool_create("sysfs", 256))) {
@@ -357,7 +326,7 @@ struct dev_filter *sysfs_filter_create(const char *proc)
#else
struct dev_filter *sysfs_filter_create(const char *proc __attribute((unused)))
struct dev_filter *sysfs_filter_create(const char *sysfs_dir __attribute((unused)))
{
return NULL;
}

View File

@@ -18,6 +18,6 @@
#include "config.h"
#include "dev-cache.h"
struct dev_filter *sysfs_filter_create(const char *proc);
struct dev_filter *sysfs_filter_create(const char *sysfs_dir);
#endif

View File

@@ -212,7 +212,7 @@ int export_pv(struct cmd_context *cmd, struct dm_pool *mem,
struct pv_disk *pvd, struct physical_volume *pv);
int import_vg(struct dm_pool *mem,
struct volume_group *vg, struct disk_list *dl, int partial);
struct volume_group *vg, struct disk_list *dl);
int export_vg(struct vg_disk *vgd, struct volume_group *vg);
int import_lv(struct dm_pool *mem, struct logical_volume *lv, struct lv_disk *lvd);

View File

@@ -23,7 +23,7 @@
#include "segtype.h"
/* VG consistency checks */
static int _check_vgs(struct list *pvs, int *partial)
static int _check_vgs(struct list *pvs)
{
struct list *pvh, *t;
struct disk_list *dl = NULL;
@@ -33,8 +33,6 @@ static int _check_vgs(struct list *pvs, int *partial)
uint32_t exported = 0;
int first_time = 1;
*partial = 0;
/*
* If there are exported and unexported PVs, ignore exported ones.
* This means an active VG won't be affected if disks are inserted
@@ -98,10 +96,6 @@ static int _check_vgs(struct list *pvs, int *partial)
dl->vgd.pe_total, dl->vgd.pe_allocated,
dl->vgd.pvg_total);
list_del(pvh);
if (partial_mode()) {
*partial = 1;
continue;
}
return 0;
}
pv_count++;
@@ -111,9 +105,6 @@ static int _check_vgs(struct list *pvs, int *partial)
if (pv_count != first->vgd.pv_cur) {
log_error("%d PV(s) found for VG %s: expected %d",
pv_count, first->pvd.vg_name, first->vgd.pv_cur);
if (!partial_mode())
return 0;
*partial = 1;
}
return 1;
@@ -125,7 +116,6 @@ static struct volume_group *_build_vg(struct format_instance *fid,
struct dm_pool *mem = fid->fmt->cmd->mem;
struct volume_group *vg = dm_pool_alloc(mem, sizeof(*vg));
struct disk_list *dl;
int partial;
if (!vg)
goto_bad;
@@ -142,12 +132,12 @@ static struct volume_group *_build_vg(struct format_instance *fid,
list_init(&vg->lvs);
list_init(&vg->tags);
if (!_check_vgs(pvs, &partial))
if (!_check_vgs(pvs))
goto_bad;
dl = list_item(pvs->n, struct disk_list);
if (!import_vg(mem, vg, dl, partial))
if (!import_vg(mem, vg, dl))
goto_bad;
if (!import_pvs(fid->fmt, mem, vg, pvs, &vg->pvs, &vg->pv_count))

View File

@@ -95,6 +95,7 @@ int import_pv(const struct format_type *fmt, struct dm_pool *mem,
pv->pe_start = pvd->pe_start;
pv->pe_count = pvd->pe_total;
pv->pe_alloc_count = 0;
pv->pe_align = 0;
/* Fix up pv size if missing or impossibly large */
if (!pv->size || pv->size > (1ULL << 62)) {
@@ -213,7 +214,7 @@ int export_pv(struct cmd_context *cmd, struct dm_pool *mem __attribute((unused))
}
int import_vg(struct dm_pool *mem,
struct volume_group *vg, struct disk_list *dl, int partial)
struct volume_group *vg, struct disk_list *dl)
{
struct vg_disk *vgd = &dl->vgd;
memcpy(vg->id.uuid, vgd->vg_uuid, ID_LEN);
@@ -235,10 +236,10 @@ int import_vg(struct dm_pool *mem,
if (vgd->vg_status & VG_EXTENDABLE)
vg->status |= RESIZEABLE_VG;
if (partial || (vgd->vg_access & VG_READ))
if (vgd->vg_access & VG_READ)
vg->status |= LVM_READ;
if (!partial && (vgd->vg_access & VG_WRITE))
if (vgd->vg_access & VG_WRITE)
vg->status |= LVM_WRITE;
if (vgd->vg_access & VG_CLUSTERED)
@@ -254,9 +255,6 @@ int import_vg(struct dm_pool *mem,
vg->max_pv = vgd->pv_max;
vg->alloc = ALLOC_NORMAL;
if (partial)
vg->status |= PARTIAL_VG;
return 1;
}

View File

@@ -173,6 +173,7 @@ int import_pool_pv(const struct format_type *fmt, struct dm_pool *mem,
pv->pe_start = POOL_PE_START;
pv->pe_count = pv->size / POOL_PE_SIZE;
pv->pe_alloc_count = 0;
pv->pe_align = 0;
list_init(&pv->tags);
list_init(&pv->segments);

View File

@@ -134,10 +134,8 @@ int archive_display(struct cmd_context *cmd, const char *vg_name)
{
int r1, r2;
init_partial(1);
r1 = archive_list(cmd, cmd->archive_params->dir, vg_name);
r2 = backup_list(cmd, cmd->backup_params->dir, vg_name);
init_partial(0);
return r1 && r2;
}
@@ -146,9 +144,7 @@ int archive_display_file(struct cmd_context *cmd, const char *file)
{
int r;
init_partial(1);
r = archive_list_file(cmd, file);
init_partial(0);
return r;
}
@@ -393,7 +389,7 @@ void check_current_backup(struct volume_group *vg)
char path[PATH_MAX];
struct volume_group *vg_backup;
if ((vg->status & PARTIAL_VG) || (vg->status & EXPORTED_VG))
if (vg->status & EXPORTED_VG)
return;
if (dm_snprintf(path, sizeof(path), "%s/%s",

View File

@@ -321,6 +321,20 @@ static int _print_header(struct formatter *f,
return 1;
}
static int _print_flag_config(struct formatter *f, int status, int type)
{
char buffer[4096];
if (!print_flags(status, type | STATUS_FLAG, buffer, sizeof(buffer)))
return_0;
outf(f, "status = %s", buffer);
if (!print_flags(status, type, buffer, sizeof(buffer)))
return_0;
outf(f, "flags = %s", buffer);
return 1;
}
static int _print_vg(struct formatter *f, struct volume_group *vg)
{
char buffer[4096];
@@ -332,9 +346,8 @@ static int _print_vg(struct formatter *f, struct volume_group *vg)
outf(f, "seqno = %u", vg->seqno);
if (!print_flags(vg->status, VG_FLAGS, buffer, sizeof(buffer)))
if (!_print_flag_config(f, vg->status, VG_FLAGS))
return_0;
outf(f, "status = %s", buffer);
if (!list_empty(&vg->tags)) {
if (!print_tags(&vg->tags, buffer, sizeof(buffer)))
@@ -408,9 +421,8 @@ static int _print_pvs(struct formatter *f, struct volume_group *vg)
return_0;
outnl(f);
if (!print_flags(pv->status, PV_FLAGS, buffer, sizeof(buffer)))
if (!_print_flag_config(f, pv->status, PV_FLAGS))
return_0;
outf(f, "status = %s", buffer);
if (!list_empty(&pv->tags)) {
if (!print_tags(&pv->tags, buffer, sizeof(buffer)))
@@ -520,9 +532,8 @@ static int _print_lv(struct formatter *f, struct logical_volume *lv)
outf(f, "id = \"%s\"", buffer);
if (!print_flags(lv->status, LV_FLAGS, buffer, sizeof(buffer)))
if (!_print_flag_config(f, lv->status, LV_FLAGS))
return_0;
outf(f, "status = %s", buffer);
if (!list_empty(&lv->tags)) {
if (!print_tags(&lv->tags, buffer, sizeof(buffer)))

View File

@@ -25,48 +25,52 @@
struct flag {
const int mask;
const char *description;
int kind;
};
static struct flag _vg_flags[] = {
{EXPORTED_VG, "EXPORTED"},
{RESIZEABLE_VG, "RESIZEABLE"},
{PARTIAL_VG, "PARTIAL"},
{PVMOVE, "PVMOVE"},
{LVM_READ, "READ"},
{LVM_WRITE, "WRITE"},
{CLUSTERED, "CLUSTERED"},
{SHARED, "SHARED"},
{PRECOMMITTED, NULL},
{0, NULL}
{EXPORTED_VG, "EXPORTED", STATUS_FLAG},
{RESIZEABLE_VG, "RESIZEABLE", STATUS_FLAG},
{PVMOVE, "PVMOVE", STATUS_FLAG},
{LVM_READ, "READ", STATUS_FLAG},
{LVM_WRITE, "WRITE", STATUS_FLAG},
{CLUSTERED, "CLUSTERED", STATUS_FLAG},
{SHARED, "SHARED", STATUS_FLAG},
{PARTIAL_VG, NULL, 0},
{PRECOMMITTED, NULL, 0},
{0, NULL, 0}
};
static struct flag _pv_flags[] = {
{ALLOCATABLE_PV, "ALLOCATABLE"},
{EXPORTED_VG, "EXPORTED"},
{0, NULL}
{ALLOCATABLE_PV, "ALLOCATABLE", STATUS_FLAG},
{EXPORTED_VG, "EXPORTED", STATUS_FLAG},
{MISSING_PV, "MISSING", COMPATIBLE_FLAG},
{0, NULL, 0}
};
static struct flag _lv_flags[] = {
{LVM_READ, "READ"},
{LVM_WRITE, "WRITE"},
{FIXED_MINOR, "FIXED_MINOR"},
{VISIBLE_LV, "VISIBLE"},
{PVMOVE, "PVMOVE"},
{LOCKED, "LOCKED"},
{MIRROR_NOTSYNCED, "NOTSYNCED"},
{MIRROR_IMAGE, NULL},
{MIRROR_LOG, NULL},
{MIRRORED, NULL},
{VIRTUAL, NULL},
{SNAPSHOT, NULL},
{ACTIVATE_EXCL, NULL},
{CONVERTING, NULL},
{0, NULL}
{LVM_READ, "READ", STATUS_FLAG},
{LVM_WRITE, "WRITE", STATUS_FLAG},
{FIXED_MINOR, "FIXED_MINOR", STATUS_FLAG},
{VISIBLE_LV, "VISIBLE", STATUS_FLAG},
{PVMOVE, "PVMOVE", STATUS_FLAG},
{LOCKED, "LOCKED", STATUS_FLAG},
{MIRROR_NOTSYNCED, "NOTSYNCED", STATUS_FLAG},
{MIRROR_IMAGE, NULL, 0},
{MIRROR_LOG, NULL, 0},
{MIRRORED, NULL, 0},
{VIRTUAL, NULL, 0},
{SNAPSHOT, NULL, 0},
{ACTIVATE_EXCL, NULL, 0},
{CONVERTING, NULL, 0},
{PARTIAL_LV, NULL, 0},
{POSTORDER_FLAG, NULL, 0},
{0, NULL, 0}
};
static struct flag *_get_flags(int type)
{
switch (type) {
switch (type & ~STATUS_FLAG) {
case VG_FLAGS:
return _vg_flags;
@@ -101,6 +105,9 @@ int print_flags(uint32_t status, int type, char *buffer, size_t size)
if (status & flags[f].mask) {
status &= ~flags[f].mask;
if ((type & STATUS_FLAG) != flags[f].kind)
continue;
/* Internal-only flag? */
if (!flags[f].description)
continue;
@@ -151,7 +158,16 @@ int read_flags(uint32_t *status, int type, struct config_value *cv)
break;
}
if (!flags[f].description) {
if (type == VG_FLAGS && !strcmp(cv->v.str, "PARTIAL")) {
/*
* Exception: We no longer write this flag out, but it
* might be encountered in old backup files, so restore
* it in that case. It is never part of live metadata
* though, so only vgcfgrestore needs to be concerned
* by this case.
*/
s |= PARTIAL_VG;
} else if (!flags[f].description && (type & STATUS_FLAG)) {
log_err("Unknown status flag '%s'.", cv->v.str);
return 0;
}
@@ -160,6 +176,6 @@ int read_flags(uint32_t *status, int type, struct config_value *cv)
}
out:
*status = s;
*status |= s;
return 1;
}

View File

@@ -139,7 +139,7 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt,
struct raw_locn *rlocn;
uint64_t area_start;
uint64_t area_size;
uint64_t prev_sector;
uint64_t prev_sector, prev_sector2;
uint64_t latest_mrec_offset;
int i;
uint64_t offset;
@@ -184,8 +184,11 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt,
offset2 = size2 = 0;
i = 0;
while (prev_sector != latest_mrec_offset) {
prev_sector2 = prev_sector;
prev_sector = _get_prev_sector_circular(area_start, area_size,
prev_sector);
if (prev_sector > prev_sector2)
goto_out;
/*
* FIXME: for some reason, the whole metadata region from
* area->start to area->start+area->size is not used.
@@ -343,10 +346,8 @@ static int _raw_write_mda_header(const struct format_type *fmt,
MDA_HEADER_SIZE -
sizeof(mdah->checksum_xl)));
if (!dev_write(dev, start_byte, MDA_HEADER_SIZE, mdah)) {
dm_pool_free(fmt->cmd->mem, mdah);
if (!dev_write(dev, start_byte, MDA_HEADER_SIZE, mdah))
return_0;
}
return 1;
}
@@ -512,7 +513,7 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
struct mda_header *mdah;
struct pv_list *pvl;
int r = 0;
uint32_t new_wrap = 0, old_wrap = 0;
uint64_t new_wrap = 0, old_wrap = 0, new_end;
int found = 0;
int noprecommit = 0;
@@ -551,10 +552,11 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
if (rlocn && (rlocn->offset + rlocn->size > mdah->size))
old_wrap = (rlocn->offset + rlocn->size) - mdah->size;
new_end = new_wrap ? new_wrap + MDA_HEADER_SIZE :
mdac->rlocn.offset + mdac->rlocn.size;
if ((new_wrap && old_wrap) ||
(rlocn && ((new_wrap > rlocn->offset) ||
(old_wrap && (mdac->rlocn.offset + mdac->rlocn.size >
rlocn->offset)))) ||
(rlocn && (new_wrap || old_wrap) && (new_end > rlocn->offset)) ||
(mdac->rlocn.size >= mdah->size)) {
log_error("VG %s metadata too large for circular buffer",
vg->name);
@@ -572,7 +574,7 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
goto_out;
if (new_wrap) {
log_debug("Writing metadata to %s at %" PRIu64 " len %" PRIu32,
log_debug("Writing metadata to %s at %" PRIu64 " len %" PRIu64,
dev_name(mdac->area.dev), mdac->area.start +
MDA_HEADER_SIZE, new_wrap);
@@ -591,13 +593,20 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
mdac->rlocn.checksum = calc_crc(mdac->rlocn.checksum,
fidtc->raw_metadata_buf +
mdac->rlocn.size -
new_wrap, new_wrap);
new_wrap, (uint32_t) new_wrap);
r = 1;
out:
if (!r && !dev_close(mdac->area.dev))
stack;
if (!r) {
if (!dev_close(mdac->area.dev))
stack;
if (fidtc->raw_metadata_buf) {
dm_free(fidtc->raw_metadata_buf);
fidtc->raw_metadata_buf = NULL;
}
}
return r;
}
@@ -667,6 +676,7 @@ static int _vg_commit_raw_rlocn(struct format_instance *fid,
if (!_raw_write_mda_header(fid->fmt, mdac->area.dev, mdac->area.start,
mdah)) {
dm_pool_free(fid->fmt->cmd->mem, mdah);
log_error("Failed to write metadata area header");
goto out;
}
@@ -749,6 +759,7 @@ static int _vg_remove_raw(struct format_instance *fid, struct volume_group *vg,
if (!_raw_write_mda_header(fid->fmt, mdac->area.dev, mdac->area.start,
mdah)) {
dm_pool_free(fid->fmt->cmd->mem, mdah);
log_error("Failed to write metadata area header");
goto out;
}
@@ -1163,7 +1174,7 @@ static int _mda_setup(const struct format_type *fmt,
if (!pvmetadatacopies)
return 1;
alignment = pe_align() << SECTOR_SHIFT;
alignment = pe_align(pv) << SECTOR_SHIFT;
disk_size = pv->size << SECTOR_SHIFT;
pe_start <<= SECTOR_SHIFT;
pe_end <<= SECTOR_SHIFT;
@@ -1330,7 +1341,7 @@ static int _text_pv_write(const struct format_type *fmt, struct physical_volume
/* Set pe_start to first aligned sector after any metadata
* areas that begin before pe_start */
pv->pe_start = pe_align();
pv->pe_start = pe_align(pv);
list_iterate_items(mda, &info->mdas) {
mdac = (struct mda_context *) mda->metadata_locn;
if (pv->dev == mdac->area.dev &&
@@ -1339,9 +1350,9 @@ static int _text_pv_write(const struct format_type *fmt, struct physical_volume
(pv->pe_start << SECTOR_SHIFT))) {
pv->pe_start = (mdac->area.start + mdac->area.size)
>> SECTOR_SHIFT;
adjustment = pv->pe_start % pe_align();
adjustment = pv->pe_start % pe_align(pv);
if (adjustment)
pv->pe_start += (pe_align() - adjustment);
pv->pe_start += (pe_align(pv) - adjustment);
}
}
if (!add_da
@@ -1363,7 +1374,10 @@ static int _text_pv_write(const struct format_type *fmt, struct physical_volume
}
}
label_write(pv->dev, label);
if (!label_write(pv->dev, label)) {
dev_close(pv->dev);
return_0;
}
if (!dev_close(pv->dev))
return_0;
@@ -1393,43 +1407,33 @@ static int _add_raw(struct list *raw_list, struct device_area *dev_area)
return 1;
}
static int _text_pv_read(const struct format_type *fmt, const char *pv_name,
struct physical_volume *pv, struct list *mdas)
static int _get_pv_if_in_vg(struct lvmcache_info *info,
struct physical_volume *pv)
{
struct label *label;
struct device *dev;
struct lvmcache_info *info;
struct metadata_area *mda, *mda_new;
struct mda_context *mdac, *mdac_new;
struct data_area_list *da;
if (!(dev = dev_cache_get(pv_name, fmt->cmd->filter)))
return_0;
/* FIXME Optimise out repeated reading when cache lock held */
if (!(label_read(dev, &label, UINT64_C(0))))
return_0;
info = (struct lvmcache_info *) label->info;
/* Have we already cached vgname? */
if (info->vginfo && info->vginfo->vgname &&
!is_orphan_vg(info->vginfo->vgname) &&
get_pv_from_vg_by_id(info->fmt, info->vginfo->vgname,
info->vginfo->vgid, info->dev->pvid, pv)) {
info->vginfo->vgid, info->dev->pvid, pv))
return 1;
return 0;
}
static int _populate_pv_fields(struct lvmcache_info *info,
struct physical_volume *pv)
{
struct data_area_list *da;
/* Have we already cached vgname? */
if (_get_pv_if_in_vg(info, pv))
return 1;
}
/* Perform full scan (just the first time) and try again */
if (!memlock() && !full_scan_done()) {
lvmcache_label_scan(fmt->cmd, 2);
lvmcache_label_scan(info->fmt->cmd, 2);
if (info->vginfo && info->vginfo->vgname &&
!is_orphan_vg(info->vginfo->vgname) &&
get_pv_from_vg_by_id(info->fmt, info->vginfo->vgname,
info->vginfo->vgid,
info->dev->pvid, pv)) {
if (_get_pv_if_in_vg(info, pv))
return 1;
}
}
/* Orphan */
@@ -1442,13 +1446,35 @@ static int _text_pv_read(const struct format_type *fmt, const char *pv_name,
/* Currently only support exactly one data area */
if (list_size(&info->das) != 1) {
log_error("Must be exactly one data area (found %d) on PV %s",
list_size(&info->das), dev_name(dev));
list_size(&info->das), dev_name(info->dev));
return 0;
}
list_iterate_items(da, &info->das)
pv->pe_start = da->disk_locn.offset >> SECTOR_SHIFT;
return 1;
}
static int _text_pv_read(const struct format_type *fmt, const char *pv_name,
struct physical_volume *pv, struct list *mdas)
{
struct label *label;
struct device *dev;
struct lvmcache_info *info;
struct metadata_area *mda, *mda_new;
struct mda_context *mdac, *mdac_new;
if (!(dev = dev_cache_get(pv_name, fmt->cmd->filter)))
return_0;
if (!(label_read(dev, &label, UINT64_C(0))))
return_0;
info = (struct lvmcache_info *) label->info;
if (!_populate_pv_fields(info, pv))
return 0;
if (!mdas)
return 1;

View File

@@ -36,9 +36,11 @@
* common code for reading and writing them.
*/
enum {
COMPATIBLE_FLAG = 0x0,
VG_FLAGS,
PV_FLAGS,
LV_FLAGS
LV_FLAGS,
STATUS_FLAG = 0x8,
};
struct text_vg_version_ops {

View File

@@ -125,6 +125,31 @@ static int _read_id(struct id *id, struct config_node *cn, const char *path)
return 1;
}
static int _read_flag_config(struct config_node *n, uint32_t *status, int type)
{
struct config_node *cn;
*status = 0;
if (!(cn = find_config_node(n, "status"))) {
log_error("Could not find status flags.");
return 0;
}
if (!(read_flags(status, type | STATUS_FLAG, cn->v))) {
log_error("Could not read status flags.");
return 0;
}
if ((cn = find_config_node(n, "flags"))) {
if (!(read_flags(status, type, cn->v))) {
log_error("Could not read flags.");
return 0;
}
}
return 1;
}
static int _read_pv(struct format_instance *fid, struct dm_pool *mem,
struct volume_group *vg, struct config_node *pvn,
struct config_node *vgn __attribute((unused)),
@@ -169,11 +194,6 @@ static int _read_pv(struct format_instance *fid, struct dm_pool *mem,
else
log_error("Couldn't find device with uuid '%s'.",
buffer);
if (partial_mode())
vg->status |= PARTIAL_VG;
else
return 0;
}
if (!(pv->vg_name = dm_pool_strdup(mem, vg->name)))
@@ -181,16 +201,14 @@ static int _read_pv(struct format_instance *fid, struct dm_pool *mem,
memcpy(&pv->vgid, &vg->id, sizeof(vg->id));
if (!(cn = find_config_node(pvn, "status"))) {
log_error("Couldn't find status flags for physical volume.");
return 0;
}
if (!(read_flags(&pv->status, PV_FLAGS, cn->v))) {
if (!_read_flag_config(pvn, &pv->status, PV_FLAGS)) {
log_error("Couldn't read status flags for physical volume.");
return 0;
}
if (!pv->dev)
pv->status |= MISSING_PV;
/* Late addition */
_read_int64(pvn, "dev_size", &pv->size);
@@ -223,6 +241,7 @@ static int _read_pv(struct format_instance *fid, struct dm_pool *mem,
pv->pe_size = vg->extent_size;
pv->pe_alloc_count = 0;
pv->pe_align = 0;
pv->fmt = fid->fmt;
/* Fix up pv size if missing or impossibly large */
@@ -493,13 +512,9 @@ static int _read_lvnames(struct format_instance *fid __attribute((unused)),
return 0;
}
if (!(cn = find_config_node(lvn, "status"))) {
log_error("Couldn't find status flags for logical volume.");
return 0;
}
if (!(read_flags(&lv->status, LV_FLAGS, cn->v))) {
log_error("Couldn't read status flags for logical volume.");
if (!_read_flag_config(lvn, &lv->status, LV_FLAGS)) {
log_error("Couldn't read status flags for logical volume %s.",
lv->name);
return 0;
}
@@ -692,14 +707,8 @@ static struct volume_group *_read_vg(struct format_instance *fid,
goto bad;
}
if (!(cn = find_config_node(vgn, "status"))) {
log_error("Couldn't find status flags for volume group %s.",
vg->name);
goto bad;
}
if (!(read_flags(&vg->status, VG_FLAGS, cn->v))) {
log_error("Couldn't read status flags for volume group %s.",
if (!_read_flag_config(vgn, &vg->status, VG_FLAGS)) {
log_error("Error reading flags of volume group %s.",
vg->name);
goto bad;
}
@@ -789,11 +798,6 @@ static struct volume_group *_read_vg(struct format_instance *fid,
dm_hash_destroy(pv_hash);
if (vg->status & PARTIAL_VG) {
vg->status &= ~LVM_WRITE;
vg->status |= LVM_READ;
}
/*
* Finished.
*/
@@ -826,7 +830,7 @@ static const char *_read_vgname(const struct format_type *fmt,
struct config_tree *cft, struct id *vgid,
uint32_t *vgstatus, char **creation_host)
{
struct config_node *vgn, *cn;
struct config_node *vgn;
struct dm_pool *mem = fmt->cmd->mem;
char *vgname;
int old_suppress;
@@ -855,18 +859,12 @@ static const char *_read_vgname(const struct format_type *fmt,
return 0;
}
if (!(cn = find_config_node(vgn, "status"))) {
if (!_read_flag_config(vgn, vgstatus, VG_FLAGS)) {
log_error("Couldn't find status flags for volume group %s.",
vgname);
return 0;
}
if (!(read_flags(vgstatus, VG_FLAGS, cn->v))) {
log_error("Couldn't read status flags for volume group %s.",
vgname);
return 0;
}
return vgname;
}

60
lib/freeseg/freeseg.c Normal file
View File

@@ -0,0 +1,60 @@
/*
* Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License v.2.1.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "lib.h"
#include "toolcontext.h"
#include "segtype.h"
#include "display.h"
#include "text_export.h"
#include "text_import.h"
#include "config.h"
#include "str_list.h"
#include "targets.h"
#include "lvm-string.h"
#include "activate.h"
#include "str_list.h"
#include "metadata.h"
static const char *_freeseg_name(const struct lv_segment *seg)
{
return seg->segtype->name;
}
static void _freeseg_destroy(const struct segment_type *segtype)
{
dm_free((void *)segtype);
}
static struct segtype_handler _freeseg_ops = {
.name = _freeseg_name,
.destroy = _freeseg_destroy,
};
struct segment_type *init_free_segtype(struct cmd_context *cmd)
{
struct segment_type *segtype = dm_malloc(sizeof(*segtype));
if (!segtype)
return_NULL;
segtype->cmd = cmd;
segtype->ops = &_freeseg_ops;
segtype->name = "free";
segtype->private = NULL;
segtype->flags = SEG_VIRTUAL | SEG_CANNOT_BE_ZEROED;
log_very_verbose("Initialised segtype: %s", segtype->name);
return segtype;
}

View File

@@ -284,7 +284,7 @@ int label_read(struct device *dev, struct label **result,
}
if (!(l = _find_labeller(dev, buf, &sector, scan_sector)))
goto_out;
goto out;
if ((r = (l->ops->read)(l, dev, buf, result)) && result && *result)
(*result)->sector = sector;
@@ -361,7 +361,7 @@ int label_verify(struct device *dev)
}
if (!(l = _find_labeller(dev, buf, &sector, UINT64_C(0))))
goto_out;
goto out;
r = l->ops->verify ? l->ops->verify(l, buf, sector) : 1;

View File

@@ -315,9 +315,6 @@ static int _lock_for_cluster(unsigned char cmd, uint32_t flags, const char *name
args[0] = flags & 0x7F; /* Maskoff lock flags */
args[1] = flags & 0xC0; /* Bitmap flags */
if (partial_mode())
args[1] |= LCK_PARTIAL_MODE;
if (mirror_in_sync())
args[1] |= LCK_MIRROR_NOSYNC_MODE;

View File

@@ -292,6 +292,10 @@ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname)
if (is_orphan_vg(vgname))
return 1;
/* LVM1 is only present in 2.4 kernels. */
if (strncmp(cmd->kernel_vsn, "2.4.", 4))
return 1;
if (dm_snprintf(path, sizeof(path), "%s/lvm/VGs/%s", cmd->proc_dir,
vgname) < 0) {
log_error("LVM1 proc VG pathname too long for %s", vgname);

View File

@@ -83,7 +83,6 @@ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname);
/*
* Additional lock bits for cluster communication
*/
#define LCK_PARTIAL_MODE 0x00000001U /* Running in partial mode */
#define LCK_MIRROR_NOSYNC_MODE 0x00000002U /* Mirrors don't require sync */
#define LCK_DMEVENTD_MONITOR_MODE 0x00000004U /* Register with dmeventd */

View File

@@ -29,7 +29,6 @@ static struct str_list _log_dev_alias;
static int _verbose_level = VERBOSE_BASE_LEVEL;
static int _test = 0;
static int _partial = 0;
static int _md_filtering = 0;
static int _pvmove = 0;
static int _full_scan_done = 0; /* Restrict to one full scan during each cmd */
@@ -154,11 +153,6 @@ void init_test(int level)
_test = level;
}
void init_partial(int level)
{
_partial = level;
}
void init_md_filtering(int level)
{
_md_filtering = level;
@@ -254,11 +248,6 @@ int test_mode()
return _test;
}
int partial_mode()
{
return _partial;
}
int md_filtering()
{
return _md_filtering;

View File

@@ -64,7 +64,6 @@ void fin_syslog(void);
void init_verbose(int level);
void init_test(int level);
void init_partial(int level);
void init_md_filtering(int level);
void init_pvmove(int level);
void init_full_scan_done(int level);
@@ -84,7 +83,6 @@ void init_error_message_produced(int error_message_produced);
void set_cmd_name(const char *cmd_name);
int test_mode(void);
int partial_mode(void);
int md_filtering(void);
int pvmove_mode(void);
int full_scan_done(void);

View File

@@ -1169,7 +1169,7 @@ static int _allocate(struct alloc_handle *ah,
stack;
areas_size = list_size(pvms);
if (areas_size < ah->area_count + ah->log_count) {
if (areas_size && areas_size < (ah->area_count + ah->log_count)) {
if (ah->alloc != ALLOC_ANYWHERE) {
log_error("Not enough PVs with free space available "
"for parallel allocation.");
@@ -2048,6 +2048,27 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
return 1;
}
/*
* remove LVs with its dependencies - LV leaf nodes should be removed first
*/
int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *lv,
const force_t force)
{
struct list *snh, *snht;
if (lv_is_origin(lv)) {
/* remove snapshot LVs first */
list_iterate_safe(snh, snht, &lv->snapshot_segs) {
if (!lv_remove_with_dependencies(cmd, list_struct_base(snh, struct lv_segment,
origin_list)->cow,
force))
return 0;
}
}
return lv_remove_single(cmd, lv, force);
}
/*
* insert_layer_for_segments_on_pv() inserts a layer segment for a segment area.
* However, layer modification could split the underlying layer segment.
@@ -2339,11 +2360,7 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,
struct segment_type *segtype;
struct lv_segment *mapseg;
if (!(segtype = get_segtype_from_string(cmd, "striped")))
return_NULL;
/* create an empty layer LV */
len = strlen(lv_where->name) + 32;
if (!(name = alloca(len))) {
log_error("layer name allocation failed. "
@@ -2363,12 +2380,43 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,
return NULL;
}
if (strstr(name, "_mimagetmp")) {
log_very_verbose("Creating transient 'zero' LV"
" for Mirror -> mirror up-convert.");
segtype = get_segtype_from_string(cmd, "zero");
if (!lv_add_virtual_segment(layer_lv, 0, lv_where->le_count, segtype)) {
log_error("Creation of intermediate layer LV failed.");
return NULL;
}
if (!vg_write(lv_where->vg)) {
log_error("Failed to write intermediate VG metadata");
return NULL;
}
if (!vg_commit(lv_where->vg)) {
log_error("Failed to commit intermediate VG metadata");
vg_revert(lv_where->vg);
return NULL;
}
if (!activate_lv(cmd, layer_lv)) {
log_error("Failed to resume intermediate 'zero' LV, %s", name);
return NULL;
}
}
log_very_verbose("Inserting layer %s for %s",
layer_lv->name, lv_where->name);
if (!_move_lv_segments(layer_lv, lv_where, 0, 0))
return_NULL;
if (!(segtype = get_segtype_from_string(cmd, "striped")))
return_NULL;
/* allocate a new linear segment */
if (!(mapseg = alloc_lv_segment(cmd->mem, segtype,
lv_where, 0, layer_lv->le_count,

View File

@@ -71,6 +71,13 @@ struct pv_segment;
//#define PRECOMMITTED 0x00200000U /* VG - internal use only */
#define CONVERTING 0x00400000U /* LV */
#define MISSING_PV 0x00800000U /* PV */
#define PARTIAL_LV 0x01000000U /* LV - derived flag, not
written out in metadata*/
//#define POSTORDER_FLAG 0x02000000U /* Not real flags, reserved for
//#define POSTORDER_OPEN_FLAG 0x04000000U temporary use inside vg_read. */
#define LVM_READ 0x00000100U /* LV VG */
#define LVM_WRITE 0x00000200U /* LV VG */
#define CLUSTERED 0x00000400U /* VG */
@@ -168,6 +175,7 @@ struct physical_volume {
uint64_t pe_start;
uint32_t pe_count;
uint32_t pe_alloc_count;
unsigned long pe_align;
struct list segments; /* Ordered pv_segments covering complete PV */
struct list tags;
@@ -416,6 +424,9 @@ int lv_remove(struct logical_volume *lv);
int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
force_t force);
int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *lv,
force_t force);
int lv_rename(struct cmd_context *cmd, struct logical_volume *lv,
const char *new_name);
@@ -529,6 +540,7 @@ int add_mirror_log(struct cmd_context *cmd, struct logical_volume *lv,
int reconfigure_mirror_images(struct lv_segment *mirrored_seg, uint32_t num_mirrors,
struct list *removable_pvs, unsigned remove_log);
int collapse_mirrored_lv(struct logical_volume *lv);
int shift_mirror_images(struct lv_segment *mirrored_seg, unsigned mimage);
struct logical_volume *find_pvmove_lv(struct volume_group *vg,
struct device *dev, uint32_t lv_type);
@@ -559,6 +571,7 @@ uint64_t pv_pe_start(const pv_t *pv);
uint32_t pv_pe_count(const pv_t *pv);
uint32_t pv_pe_alloc_count(const pv_t *pv);
int vg_missing_pv_count(const vg_t *vg);
uint32_t vg_status(const vg_t *vg);
#define vg_is_clustered(vg) (vg_status((vg)) & CLUSTERED)

View File

@@ -27,6 +27,7 @@
#include "display.h"
#include "locking.h"
#include "archiver.h"
#include "defaults.h"
#include <sys/param.h>
@@ -64,9 +65,30 @@ static struct pv_list *_find_pv_in_vg(const struct volume_group *vg,
static struct physical_volume *_find_pv_in_vg_by_uuid(const struct volume_group *vg,
const struct id *id);
unsigned long pe_align(void)
unsigned long pe_align(struct physical_volume *pv)
{
return MAX(65536UL, lvm_getpagesize()) >> SECTOR_SHIFT;
if (pv->pe_align)
goto out;
pv->pe_align = MAX(65536UL, lvm_getpagesize()) >> SECTOR_SHIFT;
/*
* Align to chunk size of underlying md device if present
*/
if (!pv->dev)
goto out;
if (find_config_tree_bool(pv->fmt->cmd, "devices/md_chunk_alignment",
DEFAULT_MD_CHUNK_ALIGNMENT))
pv->pe_align = MAX(pv->pe_align,
dev_md_chunk_size(pv->fmt->cmd->sysfs_dir,
pv->dev));
log_very_verbose("%s: Setting PE alignment to %lu sectors.",
dev_name(pv->dev), pv->pe_align);
out:
return pv->pe_align;
}
/**
@@ -126,8 +148,8 @@ int add_pv_to_vg(struct volume_group *vg, const char *pv_name,
/* FIXME Do proper rounding-up alignment? */
/* Reserved space for label; this holds 0 for PVs created by LVM1 */
if (pv->pe_start < pe_align())
pv->pe_start = pe_align();
if (pv->pe_start < pe_align(pv))
pv->pe_start = pe_align(pv);
/*
* pe_count must always be calculated by pv_setup
@@ -296,11 +318,14 @@ static int remove_lvs_in_vg(struct cmd_context *cmd,
struct volume_group *vg,
force_t force)
{
struct list *lst;
struct lv_list *lvl;
list_iterate_items(lvl, &vg->lvs)
if (!lv_remove_single(cmd, lvl->lv, force))
return 0;
while ((lst = list_first(&vg->lvs))) {
lvl = list_item(lst, struct lv_list);
if (!lv_remove_with_dependencies(cmd, lvl->lv, force))
return 0;
}
return 1;
}
@@ -314,9 +339,9 @@ int vg_remove_single(struct cmd_context *cmd, const char *vg_name,
struct pv_list *pvl;
int ret = 1;
if (!vg || !consistent || (vg_status(vg) & PARTIAL_VG)) {
log_error("Volume group \"%s\" not found or inconsistent.",
vg_name);
if (!vg || !consistent || vg_missing_pv_count(vg)) {
log_error("Volume group \"%s\" not found, is inconsistent "
"or has PVs missing.", vg_name);
log_error("Consider vgreduce --removemissing if metadata "
"is inconsistent.");
return 0;
@@ -468,19 +493,15 @@ struct volume_group *vg_create(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg;
struct dm_pool *mem = cmd->mem;
int consistent = 0;
int old_partial;
if (!(vg = dm_pool_zalloc(mem, sizeof(*vg))))
return_NULL;
/* is this vg name already in use ? */
old_partial = partial_mode();
init_partial(1);
if (vg_read(cmd, vg_name, NULL, &consistent)) {
log_err("A volume group called '%s' already exists.", vg_name);
goto bad;
}
init_partial(old_partial);
if (!id_create(&vg->id)) {
log_err("Couldn't create uuid for volume group '%s'.", vg_name);
@@ -768,7 +789,7 @@ static void _free_pv(struct dm_pool *mem, struct physical_volume *pv)
dm_pool_free(mem, pv);
}
static struct physical_volume *_alloc_pv(struct dm_pool *mem)
static struct physical_volume *_alloc_pv(struct dm_pool *mem, struct device *dev)
{
struct physical_volume *pv = dm_pool_zalloc(mem, sizeof(*pv));
@@ -784,7 +805,9 @@ static struct physical_volume *_alloc_pv(struct dm_pool *mem)
pv->pe_start = 0;
pv->pe_count = 0;
pv->pe_alloc_count = 0;
pv->pe_align = 0;
pv->fmt = NULL;
pv->dev = dev;
pv->status = ALLOCATABLE_PV;
@@ -805,7 +828,7 @@ static struct physical_volume *_pv_create(const struct format_type *fmt,
uint64_t pvmetadatasize, struct list *mdas)
{
struct dm_pool *mem = fmt->cmd->mem;
struct physical_volume *pv = _alloc_pv(mem);
struct physical_volume *pv = _alloc_pv(mem, dev);
if (!pv)
return NULL;
@@ -818,8 +841,6 @@ static struct physical_volume *_pv_create(const struct format_type *fmt,
goto bad;
}
pv->dev = dev;
if (!dev_get_size(pv->dev, &pv->size)) {
log_error("%s: Couldn't get size.", pv_dev_name(pv));
goto bad;
@@ -1171,6 +1192,161 @@ int vgs_are_compatible(struct cmd_context *cmd __attribute((unused)),
return 1;
}
struct _lv_postorder_baton {
int (*fn)(struct logical_volume *lv, void *data);
void *data;
};
static int _lv_postorder_visit(struct logical_volume *,
int (*fn)(struct logical_volume *lv, void *data),
void *data);
static int _lv_postorder_level(struct logical_volume *lv, void *data)
{
struct _lv_postorder_baton *baton = data;
if (lv->status & POSTORDER_OPEN_FLAG)
return 1; // a data structure loop has closed...
lv->status |= POSTORDER_OPEN_FLAG;
int r =_lv_postorder_visit(lv, baton->fn, baton->data);
lv->status &= ~POSTORDER_OPEN_FLAG;
lv->status |= POSTORDER_FLAG;
return r;
};
static int _lv_each_dependency(struct logical_volume *lv,
int (*fn)(struct logical_volume *lv, void *data),
void *data)
{
int i, s;
struct lv_segment *lvseg;
struct logical_volume *deps[] = {
lv->snapshot ? lv->snapshot->origin : 0,
lv->snapshot ? lv->snapshot->cow : 0 };
for (i = 0; i < sizeof(deps) / sizeof(*deps); ++i) {
if (deps[i] && !fn(deps[i], data))
return_0;
}
list_iterate_items(lvseg, &lv->segments) {
if (lvseg->log_lv && !fn(lvseg->log_lv, data))
return_0;
for (s = 0; s < lvseg->area_count; ++s) {
if (seg_type(lvseg, s) == AREA_LV && !fn(seg_lv(lvseg,s), data))
return_0;
}
}
return 1;
}
static int _lv_postorder_cleanup(struct logical_volume *lv, void *data)
{
if (!(lv->status & POSTORDER_FLAG))
return 1;
lv->status &= ~POSTORDER_FLAG;
if (!_lv_each_dependency(lv, _lv_postorder_cleanup, data))
return_0;
return 1;
}
static int _lv_postorder_visit(struct logical_volume *lv,
int (*fn)(struct logical_volume *lv, void *data),
void *data)
{
struct _lv_postorder_baton baton;
int r;
if (lv->status & POSTORDER_FLAG)
return 1;
baton.fn = fn;
baton.data = data;
r = _lv_each_dependency(lv, _lv_postorder_level, &baton);
if (r) {
r = fn(lv, data);
log_verbose("visited %s", lv->name);
}
return r;
}
/*
* This will walk the LV dependency graph in depth-first order and in the
* postorder, call a callback function "fn". The void *data is passed along all
* the calls. The callback may return zero to indicate an error and terminate
* the depth-first walk. The error is propagated to return value of
* _lv_postorder.
*/
static int _lv_postorder(struct logical_volume *lv,
int (*fn)(struct logical_volume *lv, void *data),
void *data)
{
int r;
r = _lv_postorder_visit(lv, fn, data);
_lv_postorder_cleanup(lv, 0);
return r;
}
struct _lv_mark_if_partial_baton {
int partial;
};
static int _lv_mark_if_partial_collect(struct logical_volume *lv, void *data)
{
struct _lv_mark_if_partial_baton *baton = data;
if (lv->status & PARTIAL_LV)
baton->partial = 1;
return 1;
}
static int _lv_mark_if_partial_single(struct logical_volume *lv, void *data)
{
int s;
struct _lv_mark_if_partial_baton baton;
struct lv_segment *lvseg;
list_iterate_items(lvseg, &lv->segments) {
for (s = 0; s < lvseg->area_count; ++s) {
if (seg_type(lvseg, s) == AREA_PV) {
if (seg_pv(lvseg, s)->status & MISSING_PV)
lv->status |= PARTIAL_LV;
}
}
}
baton.partial = 0;
_lv_each_dependency(lv, _lv_mark_if_partial_collect, &baton);
if (baton.partial)
lv->status |= PARTIAL_LV;
return 1;
}
static int _lv_mark_if_partial(struct logical_volume *lv)
{
return _lv_postorder(lv, _lv_mark_if_partial_single, NULL);
}
/*
* Mark LVs with missing PVs using PARTIAL_LV status flag. The flag is
* propagated transitively, so LVs referencing other LVs are marked
* partial as well, if any of their referenced LVs are marked partial.
*/
static int _vg_mark_partial_lvs(struct volume_group *vg)
{
struct logical_volume *lv;
struct lv_list *lvl;
list_iterate_items(lvl, &vg->lvs) {
lv = lvl->lv;
if (!_lv_mark_if_partial(lv))
return_0;
}
return 1;
}
int vg_validate(struct volume_group *vg)
{
struct pv_list *pvl, *pvl2;
@@ -1252,6 +1428,13 @@ int vg_validate(struct volume_group *vg)
}
}
if (!(vg->fid->fmt->features & FMT_UNLIMITED_VOLS) &&
(!vg->max_lv || !vg->max_pv)) {
log_error("Internal error: Volume group %s has limited PV/LV count"
" but limit is not set.", vg->name);
r = 0;
}
return r;
}
@@ -1268,8 +1451,13 @@ int vg_write(struct volume_group *vg)
return_0;
if (vg->status & PARTIAL_VG) {
log_error("Cannot change metadata for partial volume group %s",
vg->name);
log_error("Cannot update partial volume group %s.", vg->name);
return 0;
}
if (vg_missing_pv_count(vg) && !vg->cmd->handles_missing_pvs) {
log_error("Cannot update volume group %s while physical "
"volumes are missing.", vg->name);
return 0;
}
@@ -1468,9 +1656,20 @@ static int _update_pv_list(struct list *all_pvs, struct volume_group *vg)
return 1;
}
int vg_missing_pv_count(const vg_t *vg)
{
int ret = 0;
struct pv_list *pvl;
list_iterate_items(pvl, &vg->pvs) {
if (pvl->pv->status & MISSING_PV)
++ ret;
}
return ret;
}
/* Caller sets consistent to 1 if it's safe for vg_read to correct
* inconsistent metadata on disk (i.e. the VG write lock is held).
* This guarantees only consistent metadata is returned unless PARTIAL_VG.
* This guarantees only consistent metadata is returned.
* If consistent is 0, caller must check whether consistent == 1 on return
* and take appropriate action if it isn't (e.g. abort; get write lock
* and call vg_read again).
@@ -1488,8 +1687,10 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
const struct format_type *fmt;
struct volume_group *vg, *correct_vg = NULL;
struct metadata_area *mda;
struct lvmcache_info *info;
int inconsistent = 0;
int inconsistent_vgid = 0;
int inconsistent_pvs = 0;
unsigned use_precommitted = precommitted;
struct list *pvids;
struct pv_list *pvl, *pvl2;
@@ -1507,6 +1708,11 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
}
if ((correct_vg = lvmcache_get_vg(vgid, precommitted))) {
if (vg_missing_pv_count(correct_vg)) {
log_verbose("There are %d physical volumes missing.",
vg_missing_pv_count(correct_vg));
_vg_mark_partial_lvs(correct_vg);
}
*consistent = 1;
return correct_vg;
}
@@ -1564,7 +1770,46 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
/* Ensure every PV in the VG was in the cache */
if (correct_vg) {
if (list_size(&correct_vg->pvs) != list_size(pvids)) {
/*
* If the VG has PVs without mdas, they may still be
* orphans in the cache: update the cache state here.
*/
if (!inconsistent &&
list_size(&correct_vg->pvs) > list_size(pvids)) {
list_iterate_items(pvl, &correct_vg->pvs) {
if (!pvl->pv->dev) {
inconsistent_pvs = 1;
break;
}
if (str_list_match_item(pvids, pvl->pv->dev->pvid))
continue;
/*
* PV not marked as belonging to this VG in cache.
* Check it's an orphan without metadata area.
*/
if (!(info = info_from_pvid(pvl->pv->dev->pvid, 1)) ||
!info->vginfo || !is_orphan_vg(info->vginfo->vgname) ||
list_size(&info->mdas)) {
inconsistent_pvs = 1;
break;
}
}
/* If the check passed, let's update VG and recalculate pvids */
if (!inconsistent_pvs) {
log_debug("Updating cache for PVs without mdas "
"in VG %s.", vgname);
lvmcache_update_vg(correct_vg, use_precommitted);
if (!(pvids = lvmcache_get_pvids(cmd, vgname, vgid)))
return_NULL;
}
}
if (list_size(&correct_vg->pvs) != list_size(pvids)
+ vg_missing_pv_count(correct_vg)) {
log_debug("Cached VG %s had incorrect PV list",
vgname);
@@ -1573,6 +1818,8 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
else
correct_vg = NULL;
} else list_iterate_items(pvl, &correct_vg->pvs) {
if (pvl->pv->status & MISSING_PV)
continue;
if (!str_list_match_item(pvids, pvl->pv->dev->pvid)) {
log_debug("Cached VG %s had incorrect PV list",
vgname);
@@ -1629,11 +1876,10 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
/* FIXME Also ensure contents same - checksums same? */
if (correct_vg->seqno != vg->seqno) {
inconsistent = 1;
if (vg->seqno > correct_vg->seqno) {
if (!_update_pv_list(&all_pvs, vg))
return_NULL;
if (!_update_pv_list(&all_pvs, vg))
return_NULL;
if (vg->seqno > correct_vg->seqno)
correct_vg = vg;
}
}
}
@@ -1655,15 +1901,6 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
if (!*consistent)
return correct_vg;
/* Don't touch partial volume group metadata */
/* Should be fixed manually with vgcfgbackup/restore etc. */
if ((correct_vg->status & PARTIAL_VG)) {
log_error("Inconsistent metadata copies found for "
"partial volume group %s", vgname);
*consistent = 0;
return correct_vg;
}
/* Don't touch if vgids didn't match */
if (inconsistent_vgid) {
log_error("Inconsistent metadata UUIDs found for "
@@ -1702,6 +1939,12 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
}
}
if (vg_missing_pv_count(correct_vg)) {
log_verbose("There are %d physical volumes missing.",
vg_missing_pv_count(correct_vg));
_vg_mark_partial_lvs(correct_vg);
}
if ((correct_vg->status & PVMOVE) && !pvmove_mode()) {
log_error("WARNING: Interrupted pvmove detected in "
"volume group %s", correct_vg->name);
@@ -1761,11 +2004,10 @@ static struct volume_group *_vg_read_by_vgid(struct cmd_context *cmd,
if ((vg = _vg_read(cmd, NULL, vgid,
&consistent, precommitted)) &&
!strncmp((char *)vg->id.uuid, vgid, ID_LEN)) {
if (!consistent) {
log_error("Volume group %s metadata is "
"inconsistent", vg->name);
if (!partial_mode())
return NULL;
}
return vg;
}
@@ -1793,6 +2035,7 @@ static struct volume_group *_vg_read_by_vgid(struct cmd_context *cmd,
if ((vg = _vg_read(cmd, vgname, vgid, &consistent,
precommitted)) &&
!strncmp((char *)vg->id.uuid, vgid, ID_LEN)) {
if (!consistent) {
log_error("Volume group %s metadata is "
"inconsistent", vgname);
@@ -1926,7 +2169,6 @@ static int _get_pvs(struct cmd_context *cmd, struct list **pvslist)
struct list *vgids;
struct volume_group *vg;
int consistent = 0;
int old_partial;
int old_pvmove;
lvmcache_label_scan(cmd, 0);
@@ -1948,9 +2190,7 @@ static int _get_pvs(struct cmd_context *cmd, struct list **pvslist)
/* Read every VG to ensure cache consistency */
/* Orphan VG is last on list */
old_partial = partial_mode();
old_pvmove = pvmove_mode();
init_partial(1);
init_pvmove(1);
list_iterate_items(strl, vgids) {
vgid = strl->str;
@@ -1975,7 +2215,6 @@ static int _get_pvs(struct cmd_context *cmd, struct list **pvslist)
list_add(results, pvh);
}
init_pvmove(old_pvmove);
init_partial(old_partial);
if (pvslist)
*pvslist = results;
@@ -2035,6 +2274,7 @@ int pv_write_orphan(struct cmd_context *cmd, struct physical_volume *pv)
pv->vg_name = cmd->fmt->orphan_vg_name;
pv->status = ALLOCATABLE_PV;
pv->pe_alloc_count = 0;
if (!dev_get_size(pv->dev, &pv->size)) {
log_error("%s: Couldn't get size.", pv_dev_name(pv));

View File

@@ -61,6 +61,14 @@
//#define MIRROR_NOTSYNCED 0x00080000U /* LV */
#define ACTIVATE_EXCL 0x00100000U /* LV - internal use only */
#define PRECOMMITTED 0x00200000U /* VG - internal use only */
//#define CONVERTING 0x00400000U /* LV */
//#define MISSING_PV 0x00800000U /* PV */
//#define PARTIAL_LV 0x01000000U /* LV - derived flag, not
// written out in metadata*/
#define POSTORDER_FLAG 0x02000000U /* Not real flags, reserved for */
#define POSTORDER_OPEN_FLAG 0x04000000U /* temporary use inside vg_read. */
//#define LVM_READ 0x00000100U /* LV VG */
//#define LVM_WRITE 0x00000200U /* LV VG */
@@ -239,7 +247,7 @@ struct format_handler {
/*
* Utility functions
*/
unsigned long pe_align(void);
unsigned long pe_align(struct physical_volume *pv);
int vg_validate(struct volume_group *vg);
int pv_write_orphan(struct cmd_context *cmd, struct physical_volume *pv);

View File

@@ -135,6 +135,53 @@ uint32_t adjusted_mirror_region_size(uint32_t extent_size, uint32_t extents,
return region_size;
}
/*
* shift_mirror_images
* @mirrored_seg
* @mimage: The position (index) of the image to move to the end
*
* When dealing with removal of legs, we often move a 'removable leg'
* to the back of the 'areas' array. It is critically important not
* to simply swap it for the last area in the array. This would have
* the affect of reordering the remaining legs - altering position of
* the primary. So, we must shuffle all of the areas in the array
* to maintain their relative position before moving the 'removable
* leg' to the end.
*
* Short illustration of the problem:
* - Mirror consists of legs A, B, C and we want to remove A
* - We swap A and C and then remove A, leaving C, B
* This scenario is problematic in failure cases where A dies, because
* B becomes the primary. If the above happens, we effectively throw
* away any changes made between the time of failure and the time of
* restructuring the mirror.
*
* So, any time we want to move areas to the end to be removed, use
* this function.
*/
int shift_mirror_images(struct lv_segment *mirrored_seg, unsigned mimage)
{
int i;
struct lv_segment_area area;
if (mimage >= mirrored_seg->area_count) {
log_error("Invalid index (%u) of mirror image supplied "
"to shift_mirror_images()", mimage);
return 0;
}
area = mirrored_seg->areas[mimage];
/* Shift remaining images down to fill the hole */
for (i = mimage + 1; i < mirrored_seg->area_count; i++)
mirrored_seg->areas[i-1] = mirrored_seg->areas[i];
/* Place this one at the end */
mirrored_seg->areas[i-1] = area;
return 1;
}
/*
* This function writes a new header to the mirror log header to the lv
*
@@ -444,7 +491,6 @@ static int _remove_mirror_images(struct logical_volume *lv,
struct logical_volume *detached_log_lv = NULL;
struct logical_volume *lv1 = NULL;
struct lv_segment *mirrored_seg = first_seg(lv);
struct lv_segment_area area;
uint32_t old_area_count = mirrored_seg->area_count;
uint32_t new_area_count = mirrored_seg->area_count;
struct lv_list *lvl;
@@ -469,13 +515,12 @@ static int _remove_mirror_images(struct logical_volume *lv,
for (s = 0; s < mirrored_seg->area_count &&
old_area_count - new_area_count < num_removed; s++) {
sub_lv = seg_lv(mirrored_seg, s);
if (!is_temporary_mirror_layer(sub_lv) &&
_is_mirror_image_removable(sub_lv, removable_pvs)) {
/* Swap segment to end */
if (!shift_mirror_images(mirrored_seg, s))
return_0;
new_area_count--;
area = mirrored_seg->areas[new_area_count];
mirrored_seg->areas[new_area_count] = mirrored_seg->areas[s];
mirrored_seg->areas[s] = area;
}
}
if (num_removed && old_area_count == new_area_count)
@@ -552,6 +597,17 @@ static int _remove_mirror_images(struct logical_volume *lv,
log_very_verbose("Updating \"%s\" in kernel", mirrored_seg->lv->name);
/*
* Avoid having same mirror target loaded twice simultaneously by first
* resuming the removed LV which now contains an error segment.
* As it's now detached from mirrored_seg->lv we must resume it
* explicitly.
*/
if (lv1 && !resume_lv(lv1->vg->cmd, lv1)) {
log_error("Problem resuming temporary LV, %s", lv1->name);
return 0;
}
if (!resume_lv(mirrored_seg->lv->vg->cmd, mirrored_seg->lv)) {
log_error("Problem reactivating %s", mirrored_seg->lv->name);
return 0;
@@ -1140,6 +1196,8 @@ int remove_mirror_log(struct cmd_context *cmd,
struct list *removable_pvs)
{
float sync_percent;
struct lvinfo info;
struct volume_group *vg = lv->vg;
/* Unimplemented features */
if (list_size(&lv->segments) != 1) {
@@ -1148,10 +1206,21 @@ int remove_mirror_log(struct cmd_context *cmd,
}
/* Had disk log, switch to core. */
if (!lv_mirror_percent(cmd, lv, 0, &sync_percent, NULL)) {
log_error("Unable to determine mirror sync status.");
if (lv_info(cmd, lv, &info, 0, 0) && info.exists) {
if (!lv_mirror_percent(cmd, lv, 0, &sync_percent, NULL)) {
log_error("Unable to determine mirror sync status.");
return 0;
}
} else if (vg_is_clustered(vg)) {
log_error("Unable to convert the log of inactive "
"cluster mirror %s", lv->name);
return 0;
} else if (yes_no_prompt("Full resync required to convert "
"inactive mirror %s to core log. "
"Proceed? [y/n]: "))
sync_percent = 0;
else
return 0;
}
if (sync_percent >= 100.0)
init_mirror_in_sync(1);
@@ -1269,12 +1338,9 @@ int attach_mirror_log(struct lv_segment *seg, struct logical_volume *log_lv)
return add_seg_to_segs_using_this_lv(log_lv, seg);
}
int add_mirror_log(struct cmd_context *cmd,
struct logical_volume *lv,
uint32_t log_count,
uint32_t region_size,
struct list *allocatable_pvs,
alloc_policy_t alloc)
int add_mirror_log(struct cmd_context *cmd, struct logical_volume *lv,
uint32_t log_count, uint32_t region_size,
struct list *allocatable_pvs, alloc_policy_t alloc)
{
struct alloc_handle *ah;
const struct segment_type *segtype;
@@ -1282,17 +1348,31 @@ int add_mirror_log(struct cmd_context *cmd,
float sync_percent;
int in_sync;
struct logical_volume *log_lv;
struct lvinfo info;
/* Unimplemented features */
if (log_count > 1) {
log_error("log_count > 1 is not supported");
return 0;
}
if (list_size(&lv->segments) != 1) {
log_error("Multiple-segment mirror is not supported");
return 0;
}
/*
* We are unable to convert the log of inactive cluster mirrors
* due to the inability to detect whether the mirror is active
* on remote nodes (even though it is inactive on this node)
*/
if (vg_is_clustered(lv->vg) &&
!(lv_info(cmd, lv, &info, 0, 0) && info.exists)) {
log_error("Unable to convert the log of inactive "
"cluster mirror %s", lv->name);
return 0;
}
if (!(parallel_areas = build_parallel_areas_from_lv(cmd, lv)))
return_0;

View File

@@ -77,7 +77,7 @@ struct segtype_handler {
struct cmd_context *cmd,
struct lv_segment *seg, char *params,
uint64_t *total_numerator,
uint64_t *total_denominator, float *percent);
uint64_t *total_denominator);
int (*target_present) (const struct lv_segment *seg,
unsigned *attributes);
int (*modules_needed) (struct dm_pool *mem,
@@ -95,6 +95,7 @@ struct segment_type *get_segtype_from_string(struct cmd_context *cmd,
struct segment_type *init_striped_segtype(struct cmd_context *cmd);
struct segment_type *init_zero_segtype(struct cmd_context *cmd);
struct segment_type *init_error_segtype(struct cmd_context *cmd);
struct segment_type *init_free_segtype(struct cmd_context *cmd);
#ifdef SNAPSHOT_INTERNAL
struct segment_type *init_snapshot_segtype(struct cmd_context *cmd);

View File

@@ -176,8 +176,7 @@ static struct mirror_state *_mirrored_init_target(struct dm_pool *mem,
static int _mirrored_target_percent(void **target_state, struct dm_pool *mem,
struct cmd_context *cmd, struct lv_segment *seg,
char *params, uint64_t *total_numerator,
uint64_t *total_denominator,
float *percent __attribute((unused)))
uint64_t *total_denominator)
{
struct mirror_state *mirr_state;
uint64_t numerator, denominator;
@@ -376,7 +375,7 @@ static int _mirrored_target_present(const struct lv_segment *seg __attribute((un
* FIXME: Fails incorrectly if cmirror was built into kernel.
*/
if (attributes) {
if (!_mirror_attributes && module_present("cmirror"))
if (!_mirror_attributes && module_present("log-clustered"))
_mirror_attributes |= MIRROR_LOG_CLUSTERED;
*attributes = _mirror_attributes;
}

View File

@@ -155,7 +155,7 @@
/* Define to 1 to include support for realtime clock. */
#undef HAVE_REALTIME
/* Define to 1 if rl_completion_matches() is available. */
/* Define to 1 if you have the `rl_completion_matches' function. */
#undef HAVE_RL_COMPLETION_MATCHES
/* Define to 1 if you have the `rmdir' function. */

View File

@@ -21,7 +21,8 @@
static inline char *last_path_component(char const *name)
{
char const *slash = strrchr (name, '/');
char const *slash = strrchr(name, '/');
char const *res = slash ? slash + 1 : name;
return (char *) res;
return (char *)res;
}

View File

@@ -303,6 +303,10 @@ static int _lvstatus_disp(struct dm_report *rh __attribute((unused)), struct dm_
return 0;
}
/* Blank if this is a "free space" LV. */
if (!*lv->name)
goto out;
if (lv->status & PVMOVE)
repstr[0] = 'p';
else if (lv->status & CONVERTING)
@@ -332,8 +336,10 @@ static int _lvstatus_disp(struct dm_report *rh __attribute((unused)), struct dm_
repstr[1] = '-';
else if (lv->status & LVM_WRITE)
repstr[1] = 'w';
else
else if (lv->status & LVM_READ)
repstr[1] = 'r';
else
repstr[1] = '-';
repstr[2] = _alloc_policy_char(lv->alloc);
@@ -375,6 +381,7 @@ static int _lvstatus_disp(struct dm_report *rh __attribute((unused)), struct dm_
repstr[5] = '-';
}
out:
dm_report_field_set_value(field, repstr, NULL);
return 1;
}
@@ -432,7 +439,7 @@ static int _vgstatus_disp(struct dm_report *rh __attribute((unused)), struct dm_
else
repstr[2] = '-';
if (vg->status & PARTIAL_VG)
if (vg_missing_pv_count(vg))
repstr[3] = 'p';
else
repstr[3] = '-';

View File

@@ -95,20 +95,14 @@ static int _snap_target_percent(void **target_state __attribute((unused)),
struct cmd_context *cmd __attribute((unused)),
struct lv_segment *seg __attribute((unused)),
char *params, uint64_t *total_numerator,
uint64_t *total_denominator, float *percent)
uint64_t *total_denominator)
{
float percent2;
uint64_t numerator, denominator;
if (strchr(params, '/')) {
if (sscanf(params, "%" PRIu64 "/%" PRIu64,
&numerator, &denominator) == 2) {
*total_numerator += numerator;
*total_denominator += denominator;
}
} else if (sscanf(params, "%f", &percent2) == 1) {
*percent += percent2;
*percent /= 2;
if (sscanf(params, "%" PRIu64 "/%" PRIu64,
&numerator, &denominator) == 2) {
*total_numerator += numerator;
*total_denominator += denominator;
}
return 1;

View File

@@ -19,8 +19,9 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <ctype.h>
static char _c[] =
static const char _c[] =
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#";
static int _built_inverse;
@@ -67,11 +68,29 @@ int lvnum_from_lvid(union lvid *lvid)
lv_num *= sizeof(_c) - 1;
if ((c = strchr(_c, lvid->id[1].uuid[i])))
lv_num += (int) (c - _c);
if (lv_num < 0)
lv_num = 0;
}
return lv_num;
}
int lvid_in_restricted_range(union lvid *lvid)
{
int i;
for (i = 0; i < ID_LEN - 3; i++)
if (lvid->id[1].uuid[i] != '0')
return 0;
for (i = ID_LEN - 3; i < ID_LEN; i++)
if (!isdigit(lvid->id[1].uuid[i]))
return 0;
return 1;
}
int id_create(struct id *id)
{
int randomfile;
@@ -110,7 +129,7 @@ int id_create(struct id *id)
*/
static void _build_inverse(void)
{
char *ptr;
const char *ptr;
if (_built_inverse)
return;

View File

@@ -34,6 +34,7 @@ union lvid {
int lvid_from_lvnum(union lvid *lvid, struct id *vgid, uint32_t lv_num);
int lvnum_from_lvid(union lvid *lvid);
int lvid_in_restricted_range(union lvid *lvid);
void uuid_from_num(char *uuid, uint32_t num);

View File

@@ -1501,6 +1501,11 @@ static int _create_and_load_v4(struct dm_task *dmt)
return r;
}
uint64_t dm_task_get_existing_table_size(struct dm_task *dmt)
{
return dmt->existing_table_size;
}
static int _reload_with_suppression_v4(struct dm_task *dmt)
{
struct dm_task *task;
@@ -1534,6 +1539,12 @@ static int _reload_with_suppression_v4(struct dm_task *dmt)
return r;
}
/* Store existing table size */
t2 = task->head;
while (t2 && t2->next)
t2 = t2->next;
dmt->existing_table_size = t2 ? t2->start + t2->length : 0;
if ((task->dmi.v4->flags & DM_READONLY_FLAG) ? 1 : 0 != dmt->read_only)
goto no_match;

View File

@@ -58,6 +58,7 @@ struct dm_task {
int no_open_count;
int skip_lockfs;
int suppress_identical_reload;
uint64_t existing_table_size;
char *uuid;
};
@@ -69,5 +70,6 @@ struct cmd_data {
};
int dm_check_version(void);
uint64_t dm_task_get_existing_table_size(struct dm_task *dmt);
#endif

View File

@@ -181,8 +181,9 @@ int dm_task_add_target(struct dm_task *dmt,
uint64_t size, const char *ttype, const char *params);
/*
* Format major/minor numbers correctly for input to driver
* Format major/minor numbers correctly for input to driver.
*/
#define DM_FORMAT_DEV_BUFSIZE 13 /* Minimum bufsize to handle worst case. */
int dm_format_dev(char *buf, int bufsize, uint32_t dev_major, uint32_t dev_minor);
/* Use this to retrive target information returned from a STATUS call */

View File

@@ -99,6 +99,7 @@ struct load_properties {
uint32_t read_ahead_flags;
unsigned segment_count;
unsigned size_changed;
struct list segs;
const char *new_name;
@@ -603,6 +604,7 @@ struct dm_tree_node *dm_tree_add_new_dev(struct dm_tree *dtree,
dnode->props.major = major;
dnode->props.minor = minor;
dnode->props.new_name = NULL;
dnode->props.size_changed = 0;
} else if (strcmp(name, dnode->name)) {
/* Do we need to rename node? */
if (!(dnode->props.new_name = dm_pool_strdup(dtree->mem, name))) {
@@ -1243,7 +1245,7 @@ static int _emit_areas_line(struct dm_task *dmt __attribute((unused)),
size_t paramsize, int *pos)
{
struct seg_area *area;
char devbuf[10];
char devbuf[DM_FORMAT_DEV_BUFSIZE];
int tw;
const char *prefix = "";
@@ -1270,7 +1272,8 @@ static int _emit_segment_line(struct dm_task *dmt, struct load_segment *seg, uin
int pos = 0;
int tw;
int r;
char originbuf[10], cowbuf[10], logbuf[10];
char originbuf[DM_FORMAT_DEV_BUFSIZE], cowbuf[DM_FORMAT_DEV_BUFSIZE];
char logbuf[DM_FORMAT_DEV_BUFSIZE];
const char *logtype;
switch(seg->type) {
@@ -1493,6 +1496,13 @@ static int _load_node(struct dm_tree_node *dnode)
if (r && !dnode->info.inactive_table)
log_verbose("Suppressed %s identical table reload.",
dnode->name);
if ((dnode->props.size_changed =
(dm_task_get_existing_table_size(dmt) == seg_start) ? 0 : 1))
log_debug("Table size changed from %" PRIu64 " to %"
PRIu64 " for %s",
dm_task_get_existing_table_size(dmt),
seg_start, dnode->name);
}
dnode->props.segment_count = 0;
@@ -1504,8 +1514,8 @@ out:
}
int dm_tree_preload_children(struct dm_tree_node *dnode,
const char *uuid_prefix,
size_t uuid_prefix_len)
const char *uuid_prefix,
size_t uuid_prefix_len)
{
void *handle = NULL;
struct dm_tree_node *child;
@@ -1540,8 +1550,8 @@ int dm_tree_preload_children(struct dm_tree_node *dnode,
}
}
/* Resume device immediately if it has parents */
if (!dm_tree_node_num_children(child, 1))
/* Resume device immediately if it has parents and its size changed */
if (!dm_tree_node_num_children(child, 1) || !child->props.size_changed)
continue;
if (!child->info.inactive_table && !child->info.suspended)

View File

@@ -267,8 +267,7 @@ static void _display_fields(struct dm_report *rh)
log_warn("%s Fields", desc);
log_warn("%*.*s", (int) strlen(desc) + 7,
(int) strlen(desc) + 7,
"------------------------------------------");
"-------------------------------------------------------------------------------");
}
/* FIXME Add line-wrapping at terminal width (or 80 cols) */

View File

@@ -21,8 +21,13 @@ CC = @CC@
RANLIB = @RANLIB@
SHELL = /bin/sh
INSTALL = @INSTALL@
MKDIR_P = @MKDIR_P@
MSGFMT = @MSGFMT@
LCOV = @LCOV@
GENHTML = @GENHTML@
LN_S = @LN_S@
SED = @SED@
LIBS = @LIBS@
DEFS += @DEFS@
CFLAGS += @CFLAGS@
@@ -38,7 +43,9 @@ bindir = $(DESTDIR)@bindir@
confdir = $(DESTDIR)@CONFDIR@/lvm
includedir = $(DESTDIR)@includedir@
libdir = $(DESTDIR)@libdir@
usrlibdir = $(DESTDIR)@usrlibdir@
sbindir = $(DESTDIR)@sbindir@
usrsbindir = $(DESTDIR)@usrsbindir@
infodir = $(DESTDIR)@infodir@
mandir = $(DESTDIR)@mandir@
localedir = $(DESTDIR)@LOCALEDIR@
@@ -91,6 +98,8 @@ LDFLAGS += -L$(top_srcdir)/lib -L$(libdir)
STRIP=
#STRIP = -s
LVM_VERSION := $(shell cat $(top_srcdir)/VERSION)
LIB_VERSION := $(shell cat $(top_srcdir)/VERSION | \
awk -F '.' '{printf "%s.%s",$$1,$$2}')
@@ -204,11 +213,15 @@ $(LIB_STATIC): $(OBJECTS)
clean: $(SUBDIRS.clean)
$(RM) $(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) $(SOURCES:%.c=%.d) \
$(SOURCES:%.c=%.pot) $(LDDEPS)
$(SOURCES:%.c=%.pot) $(SOURCES:%.c=%.gcno) \
$(SOURCES:%.c=%.gcda) $(LDDEPS)
distclean: $(SUBDIRS.distclean)
$(RM) $(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) $(DISTCLEAN_TARGETS) \
$(SOURCES:%.c=%.d) $(SOURCES:%.c=%.pot) $(LDDEPS) \
$(RM) -rf $(DISTCLEAN_DIRS)
$(RM) $(DISTCLEAN_TARGETS) \
$(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) $(SOURCES:%.c=%.d) \
$(SOURCES:%.c=%.pot) $(SOURCES:%.c=%.gcno) \
$(SOURCES:%.c=%.gcda) $(LDDEPS) \
config.cache config.log config.status \
Makefile make.tmpl core \
version.h lvm2.po

View File

@@ -35,12 +35,25 @@ MAN8CLUSTER=clvmd.8
MAN5DIR=${mandir}/man5
MAN8DIR=${mandir}/man8
CLEAN_TARGETS=$(MAN5) $(MAN8) $(MAN8CLUSTER) $(FSADMMAN)
include $(top_srcdir)/make.tmpl
ifneq ("@CLVMD@", "none")
install: install_cluster
endif
all: man
.PHONY: man
man: $(MAN5) $(MAN8) $(MAN8CLUSTER)
$(MAN5) $(MAN8) $(MAN8CLUSTER): Makefile
%: %.in
$(SED) -e "s/#VERSION#/$(LVM_VERSION)/" $< > $@
install:
@echo "Installing $(MAN8) in $(MAN8DIR)"
@for f in $(MAN8); \

View File

@@ -1,4 +1,4 @@
.TH CLVMD 8 "LVM TOOLS" "Red Hat Inc" \" -*- nroff -*-
.TH CLVMD 8 "LVM TOOLS #VERSION#" "Red Hat Inc" \" -*- nroff -*-
.SH NAME
clvmd \- cluster LVM daemon
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH "FSADM" "8" "LVM TOOLS" "Red Hat, Inc" "\""
.TH "FSADM" "8" "LVM TOOLS #VERSION#" "Red Hat, Inc" "\""
.SH "NAME"
fsadm \- utility to resize or check filesystem on a device
.SH "SYNOPSIS"

View File

@@ -1,4 +1,4 @@
.TH LVCHANGE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVCHANGE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvchange \- change attributes of a logical volume
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVCONVERT 8 "LVM TOOLS" "Red Hat, Inc" \" -*- nroff -*-
.TH LVCONVERT 8 "LVM TOOLS #VERSION#" "Red Hat, Inc" \" -*- nroff -*-
.SH NAME
lvconvert \- convert a logical volume from linear to mirror or snapshot
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVCREATE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVCREATE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvcreate \- create a logical volume in an existing volume group
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVDISPLAY 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVDISPLAY 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvdisplay \- display attributes of a logical volume
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVEXTEND 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVEXTEND 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvextend \- extend the size of a logical volume
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVM 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVM 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvm \- LVM2 tools
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVM.CONF 5 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVM.CONF 5 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvm.conf \- Configuration file for LVM2
.SH SYNOPSIS
@@ -300,12 +300,16 @@ in \fBlvm\fP (8).
.TP
\fBactivation\fP \(em Settings affecting device-mapper activation
.IP
\fBmissing_stripe_filler\fP \(em When activating an incomplete
logical volume in partial mode, this missing data is replaced
with this device. It could perhaps be a block device that always
returns an error when it is accessed, or one that always
returns zeros. See \fBlvcreate\fP (8) for how to create
such devices.
\fBmissing_stripe_filler\fP \(em When activating an incomplete logical
volume in partial mode, this option dictates how the missing data is
replaced. A value of "error" will cause activation to create error
mappings for the missing data, meaning that read access to missing
portions of the volume will result in I/O errors. You can instead also
use a device path, and in that case this device will be used in place of
missing stripes. However, note that using anything other than
"error" with mirrored or snapshotted volumes is likely to result in data
corruption. For instructions on how to create a device that always
returns zeros, see \fBlvcreate\fP (8).
.IP
\fBmirror_region_size\fP \(em Unit size in KB for copy operations
when mirroring.

View File

@@ -1,4 +1,4 @@
.TH LVMCHANGE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVMCHANGE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvmchange \- change attributes of the logical volume manager
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVMDISKSCAN 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVMDISKSCAN 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvmdiskscan \- scan for all devices visible to LVM2
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVMDUMP "8" "" "Red Hat, Inc."
.TH LVMDUMP 8 "LVM TOOLS #VERSION#" "Red Hat, Inc."
.SH NAME
lvmdump - create lvm2 information dumps for diagnostic purposes
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVREDUCE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVREDUCE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvreduce \- reduce the size of a logical volume
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVREMOVE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVREMOVE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvremove \- remove a logical volume
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVRENAME 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVRENAME 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvrename \- rename a logical volume
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVRESIZE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVRESIZE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvresize \- resize a logical volume
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVS 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVS 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvs \- report information about logical volumes
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVSCAN 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVSCAN 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvscan \- scan (all disks) for logical volumes
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH PVCHANGE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH PVCHANGE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
pvchange \- change attributes of a physical volume
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH PVCK 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH PVCK 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
pvck \- check physical volume metadata
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH PVCREATE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH PVCREATE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
pvcreate \- initialize a disk or partition for use by LVM
.SH SYNOPSIS
@@ -125,6 +125,13 @@ SCSI disk for later use by LVM:
.B pvcreate /dev/sdc4 /dev/sde
.sp
.SH SEE ALSO
.BR lvm "(8), " vgcreate "(8), " vgextend "(8), " lvcreate "(8), "
.BR cfdisk "(8), " fdisk "(8), " losetup "(8), " mdadd "(8), "
.BR vgcfgrestore "(8), " vgconvert "(8)"
.BR lvm (8),
.BR vgcreate (8),
.BR vgextend (8),
.BR lvcreate (8),
.BR cfdisk (8),
.BR fdisk (8),
.BR losetup (8),
.BR mdadm (8),
.BR vgcfgrestore (8),
.BR vgconvert (8)

View File

@@ -1,4 +1,4 @@
.TH PVDISPLAY 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH PVDISPLAY 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
pvdisplay \- display attributes of a physical volume
.SH SYNOPSIS
@@ -44,7 +44,7 @@ Only display the size of the given physical volumes.
Display the mapping of physical extents to logical volumes and
logical extents.
.SH SEE ALSO
.BR lvm (8),
.BR pvcreate (8),
.BR lvcreate (8),
.BR lvm (8),
.BR pvcreate (8),
.BR lvcreate (8),
.BR vgcreate (8)

View File

@@ -1,4 +1,4 @@
.TH PVMOVE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH PVMOVE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
pvmove \- move physical extents
.SH SYNOPSIS
@@ -93,6 +93,7 @@ to free physical extents elsewhere in the volume group, giving verbose
runtime information, use:
.sp
\ pvmove -v /dev/hda4
.sp
.SH SEE ALSO
.BR lvm (8), vgconvert (8)
.BR lvm (8),
.BR vgconvert (8)

View File

@@ -1,4 +1,4 @@
.TH PVREMOVE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH PVREMOVE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
pvremove \- remove a physical volume
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH PVRESIZE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH PVRESIZE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
pvresize \- resize a disk or partition in use by LVM2
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH PVS 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH PVS 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
pvs \- report information about physical volumes
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH PVSCAN 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH PVSCAN 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
pvscan \- scan all disks for physical volumes
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH VGCFGBACKUP 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH VGCFGBACKUP 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
vgcfgbackup \- backup volume group descriptor area
.SH SYNOPSIS

Some files were not shown because too many files have changed in this diff Show More