1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 20:25:52 +03:00
Commit Graph

4902 Commits

Author SHA1 Message Date
Milan Broz
b0485a996f Restrict lvm1 partial mode.
Current lvm1 allocation code seems to not properly
map segments on missing PVs.

For now disable this functionality.
(It never worked and previous commit just introduced segfault here.)

So the partial mode in lvm1 can only process missing PVs
with no LV segments only.

Also do not use random PV UUID for missing part but use fixed
string derived from VG UUID (to not confuse clvmd tests).
2010-10-04 18:59:01 +00:00
Alasdair Kergon
ac0252ca07 Add dm_zalloc and use it and dm_pool_zalloc throughout. 2010-09-30 21:06:50 +00:00
Dave Wysochanski
0ca1492ca5 Fix copyright dates on new files lib/metadata/{lv|vg|pv}.[ch]. 2010-09-30 20:47:18 +00:00
Dave Wysochanski
d06b88437e Update WHATS_NEW for commits related to generic property functions 2010-09-30 14:26:48 +00:00
Peter Rajnoha
5936dd0381 Fix memory leak of vg_read while using live copies of metadata in directories. 2010-09-30 14:12:14 +00:00
Dave Wysochanski
4df3d5ad25 Add pv_get_property and create generic internal _get_property function.
We need to use a similar function for pv and lv properties, so just make
a generic _get_property() function that contains most of the required
functionality.  Also, add a check to ensure the field name matches the
object passed in by re-using report_type_t enum.  For pv properties,
the report_type might be either PVS or LABEL.

In addition, add 'const' to 'get' functions object parameter, but not
'set' functions.  Add _not_implemented_set() and _not_implemented_get()
functions.
2010-09-30 14:09:45 +00:00
Dave Wysochanski
f9bbf60213 Add pv 'get' functions for all pv properties.
Add 'get' functions for all pv properties.
Multiply by SECTOR_SIZE for pv properties pv_mda_free, pv_mda_size,
pe_start, pv_size, pv_free, pv_used.
2010-09-30 14:09:33 +00:00
Dave Wysochanski
b184f791d4 Add pv_name_dup() and pv_fmt_dup() helper functions. 2010-09-30 14:09:22 +00:00
Dave Wysochanski
1cd292af8f Add pv_mda_size, pv_mda_free, and pv_used functions, call from 'disp' functions. 2010-09-30 14:09:10 +00:00
Dave Wysochanski
1f4f0d1926 Add 'get' functions for vg fields.
Add 'get' functions based on generic macros for VG, PV, and LV.
Add 'get' functions for vg string fields, vg_name, vg_fmt, vg_sysid,
vg_uuid, vg_attr, and vg_tags, and all numeric fields.
2010-09-30 14:08:58 +00:00
Dave Wysochanski
5d74ec6400 Make generic GET_*_PROPERTY_FN macros and define secondary macro for vg, pv, lv.
Will need similar macros for VG, PV and LV, so define a generic one, and just
pass in the struct name and variable name for the specific macro.
2010-09-30 14:08:46 +00:00
Dave Wysochanski
b1ef78d000 Add supporting functions vg_name_dup, vg_fmt_dup, vg_system_id_dup.
Add supporting functions for vg_name, vg_fmt, vg_system_id.
Append "_dup" to end of supporting functions to make clear the strings
are dup'd and to avoid namespace conflict with vg_name.
2010-09-30 14:08:33 +00:00
Dave Wysochanski
c508945ca9 Add pv_tags_dup, vg_tags_dup, lv_tags_dup functions that call tags_format_and_copy. 2010-09-30 14:08:19 +00:00
Dave Wysochanski
f15033c0e1 Add tags_format_and_copy() common function and call from _tags_disp.
Add a common function to allocate memory and format a string of
tags.
Call tags_format_and_copy() from _tags_disp().
2010-09-30 14:08:07 +00:00
Dave Wysochanski
254d672dcc Add pv_uuid_dup, vg_uuid_dup, and lv_uuid_dup, and call id_format_and_copy.
Add supporting functions for pv_uuid, vg_uuid, and lv_uuid.
Call new function id_format_and_copy.  Use 'const' where appropriate.
Add "_dup" suffix to indicate memory is being allocated.
Call {pv|vg|lv}_uuid_dup from lvm2app uuid functions.
2010-09-30 14:07:47 +00:00
Dave Wysochanski
f4fd41552d Add id_format_and_copy() common function and call from _uuid_disp.
Add supporting uuid function to allocate memory and call id_write_format.
Call id_format_and_copy from _uuid_disp.
2010-09-30 14:07:33 +00:00
Dave Wysochanski
4bbadbe1cf Simplify logic to create 'attr' strings.
This patch addresses code review request to simplify creation of 'attr'
strings.  The simplification is done in this separate patch to more
easily review and ensure the simplification is done without error.
2010-09-30 14:07:19 +00:00
Dave Wysochanski
14663348d0 Add {pv|vg|lv}_attr_dup() functions and refactor 'disp' functions.
Move the creating of the 'attr' strings into a common function so
they can be called from the 'disp' functions as well as the new
'get' property functions.
Add "_dup" suffix to indicate memory is allocated.
Refactor pvstatus_disp to take pv argument and call pv_attr_dup().
2010-09-30 13:52:55 +00:00
Dave Wysochanski
e32e2eb011 Add lib/metadata/vg.[ch] and lib/metadata/lv.[ch].
These got missed when git cvsexportcommit was used.
2010-09-30 13:16:55 +00:00
Dave Wysochanski
b88b638d6e Add lib/metadata/pv.[ch] new files.
Apparently git cvsexportcommit does not properly add new files
from a git commit.
2010-09-30 13:15:42 +00:00
Dave Wysochanski
b171907fc5 Refactor metadata.[ch] into lv.[ch] for lv functions.
This patch is similar to the other patches for pv and vg
functionality, and separates lv functionality into separate
files, concentrating on reporting fields and simple functions.
2010-09-30 13:05:45 +00:00
Dave Wysochanski
f42b708eae Refactor metadata.[ch] into pv.[ch] for pv functions.
The metadata.[ch] files are very large.  This patch makes a first
attempt at separating out pv functions and data, particularly
related to the reporting fields calculations.

More code could be moved here but for now I'm stopping at reporting
functions 'get' / 'set' functions.
2010-09-30 13:05:20 +00:00
Dave Wysochanski
81f0124a58 Refactor metadata.[ch] into vg.[ch] for vg functions.
The metadata.[ch] files are very large.  This patch makes a first
attempt at separating out vg functions and data, particularly
related to the reporting fields calculations.
2010-09-30 13:04:55 +00:00
Zdenek Kabelac
3d7e8602ed Fix memory leak of config_tree
Adding missing destroy_config_tree() for cft_override if it has been allocated.
2010-09-30 11:44:54 +00:00
Zdenek Kabelac
1ebbfd9958 Fix leaked pool report
Swap pool destruction order in dmeventd_lvm2_exit() to fix leak report.
2010-09-30 11:40:14 +00:00
Zdenek Kabelac
c631be7684 Maps fix
Read complete content of /proc/self/maps into one buffer without
realocation in the middle of reading and before doing any m/unlock
operation with these lines - as some of them gets change.
With previous implementation we've read some mappings twice ([stack])
2010-09-30 11:32:40 +00:00
Zdenek Kabelac
c7df0240f9 Add missing cleanup rule for generated .exported_symbols_generated 2010-09-30 10:08:58 +00:00
Alasdair Kergon
f6b1c45bf1 Speed up unquoting of quoted double quotes and backslashes. 2010-09-28 01:29:06 +00:00
Alasdair Kergon
8a075c6123 drop an unnecessary 'stack' 2010-09-27 19:15:13 +00:00
Alasdair Kergon
46d4a6acf8 was renamed 2010-09-27 19:10:46 +00:00
Alasdair Kergon
44a31a9c2f Speed up CRC32 calculations by using a larger lookup table.
Use -DDEBUG_CRC32 to revert to old function and check new one gives same result.
2010-09-27 19:09:34 +00:00
Alasdair Kergon
87368c35b9 pre-release 2010-09-24 16:24:57 +00:00
Peter Rajnoha
bad35c6554 Add escape sequence for ':' and '@' found in device names used as PVs. 2010-09-23 12:02:33 +00:00
Alasdair Kergon
0cb07b65f3 Replace alloca with dm_malloc in _aligned_io.
(This section of code dates from 2.4 and could be written more efficiently nowadays.)
2010-09-22 22:31:45 +00:00
Milan Broz
980d2d8683 Fix handling of partial VG for lvm1 format metadata
If some lvm1 device is missing, lvm fails on all operations
# vgcfgbackup -f bck -P vg_test
  Partial mode. Incomplete volume groups will be activated read-only.
  3 PV(s) found for VG vg_test: expected 4
  PV segment VG free_count mismatch: 152599 != 228909
  PV segment VG extent_count mismatch: 152600 != 228910
  Internal error: PV segments corrupted in vg_test.
  Volume group "vg_test" not found

Allow loading of lvm1 partial VG by allocating "new" missing PV,
which covers lost space. Also this fake mising PV inform code
that it is partial VG.

https://bugzilla.redhat.com/show_bug.cgi?id=501390
2010-09-22 13:45:21 +00:00
Alasdair Kergon
ec8a4dac46 Fix name in msg in last checkin.
(The problem the last checkin addressed was a segfault in 'pvs -a' if .cache
didn't contain every PV in a VG.)
2010-09-22 01:50:38 +00:00
Alasdair Kergon
a171bb6e85 Track recursive filter iteration to avoid refreshing while in use. (2.02.56) 2010-09-22 01:36:13 +00:00
Peter Rajnoha
064ed484b4 "goto_bad" should be used in alloc_printed_tags function, not "goto bad". 2010-09-21 10:42:02 +00:00
Peter Rajnoha
70431c8146 Revert to old glibc behaviour for vsnprintf used in emit_to_buffer function.
Revert to old glibc behaviour for vsnprintf used in emit_to_buffer fn.
Otherwise, the check that follows would be wrong for new glibc versions.
This caused the rh bug #633033 to be undetected and pass throught the check,
corrupting the metadata!
2010-09-20 14:25:27 +00:00
Peter Rajnoha
48ae64529a Use dynamic allocation for metadata's tag buffer (removes 4096 char. limit). 2010-09-20 14:23:20 +00:00
Dave Wysochanski
97709450ca Update vg_mda_free 'get' function to multiply by SECTOR_SIZE. 2010-09-09 19:38:03 +00:00
Peter Rajnoha
d20ce59b80 Add random suffix to archive file names to prevent races when being created.
In certain configurations, we're not under a VG rw lock while trying to write
a new archive file with VG metadata. A common example is using "vgs" while
having the content of backup and archive directories empty. The code scans the
content of these directories and tries to determine the final index that should
be used in archive name. Since we're not under a lock, we can get into a race
while choosing the index which could end up showing errors about not being able
to rename to final archive name. Let's add random number suffix to these archive
file names so we can avoid the race.
2010-09-09 13:13:12 +00:00
Peter Rajnoha
dc8478458e Reinitialize archive and backup handling on toolcontext refresh.
For example, when using '--config "backup { ... }"' line, the values from
lvm.conf (or default values) should be overridden. This patch adds
reinitialisation of archive and backup handling on toolcontext refresh
which makes these settings to be applied.
2010-09-09 13:07:13 +00:00
Jonathan Earl Brassow
34cbedceaf This patch fixes an issue where cluster mirror write I/O
can be opprobriously slow if created with '--nosync'.

One of the ways cluster mirrors coordinate I/O and recovery
amoung the different machines is by the use of the log
function 'is_remote_recovering()' which lets nodes know if
a region they wish to perform a write on is currently being
recovered on another node.  If the region is being recovered,
the I/O is delayed.

The 'is_remote_recovering' routine has been optimized to
avoid the deluge of requests that would be issued to the
userspace log server by maintaining a marker of how far
the recovery has gotten.  It can then immediately return
'not recovering' if the region being inquired about is
less than this mark.  Additionally, if the region of
concern is greater than the mark, the function will
limit the number of transmissions to userspace by assuming
the region /is/ being recovered when skipping the
transmission.  This limits the amount of processing
and updates the mark in 1/4 sec time steps.

This patch fixes a problem where 'the mark' is not being
updated because of faulty logic in the userspace log
daemon.  When '--nosync' is used to create a cluster
mirror, the userspace log daemon never has a chance
to update the mark in the normal way.  The fix is to set
the mark to "complete" if the mirror was created with
the --nosync flag.
2010-08-30 18:37:42 +00:00
Milan Broz
ba6662c5d6 Do not run singlenode clvmd tests if support for singlenode not compiled in. 2010-08-27 08:52:54 +00:00
Milan Broz
068fed4534 Currently tests require SI units enabled and data alignment to 1MiB.
For now force it in lvm.conf (otherwise it fails on older systems like RHEL5
where are these options disabled by default).

FIXME: it should test and detect both versions.
2010-08-27 07:59:40 +00:00
Jonathan Earl Brassow
6ec8c52201 This patch fixes a problem where the mirror polling process
may never complete.

If you convert from a linear to a mirror and then convert that
mirror back to linear /while/ the previous (up)convert is
taking place, the mirror polling process will never complete.
This is because the function that polls the mirror for
completion doesn't check if it is still polling a mirror and
the copy_percent that it gets back from the linear device is
certainly never 100%.

The fix is simply to check if the daemon is still looking at
a mirror device - if not, return PROGRESS_CHECK_FAILED.

The user sees the following output from the first (up)convert
if someone else sneaks in and does a down-convert shortly
after their convert:
[root@bp-01 ~]# lvconvert -m1 vg/lv
  vg/lv: Converted: 43.4%
  ABORTING: Mirror percentage check failed.
2010-08-26 16:29:12 +00:00
Jonathan Earl Brassow
a71d6051ed This patch fixes a potential for I/O to hang and LVM commands
to block when a mirror under a snapshot suffers a failure.

The problem has to do with label scanning.  When a mirror suffers
a failure, the kernel blocks I/O to prevent corruption.  When
LVM attempts to repair the mirror, it scans the devices on the
system for LVM labels.  While mirrors are skipped during this
scanning process, snapshot-origins are not.  When the origin is
scanned, it kicks up I/O to the mirror (which is blocked)
underneath - causing the label scan (an thus the repair operation)
to hang.

This patch simply bypasses snapshot-origin devices when doing
labels scans (while ignore_suspended_devices() is set).  This
fixes the issue.
2010-08-26 14:21:50 +00:00
Milan Broz
fc86426b56 Fix previous const removal. 2010-08-26 12:22:05 +00:00
Milan Broz
c7af31dbd7 Fix return type qualifier to avoid compiler warning.
introduced in commit b16b4d92a7
"Improve various log messages."

fixes a lot of
../include/metadata.h:148: warning: type qualifiers ignored on function return type
2010-08-26 12:08:19 +00:00