]> sourceware.org Git - lvm2.git/log
lvm2.git
13 years agoAdd dm_zalloc and use it and dm_pool_zalloc throughout.
Alasdair Kergon [Thu, 30 Sep 2010 21:06:50 +0000 (21:06 +0000)]
Add dm_zalloc and use it and dm_pool_zalloc throughout.

13 years agoFix copyright dates on new files lib/metadata/{lv|vg|pv}.[ch].
Dave Wysochanski [Thu, 30 Sep 2010 20:47:18 +0000 (20:47 +0000)]
Fix copyright dates on new files lib/metadata/{lv|vg|pv}.[ch].

13 years agoUpdate WHATS_NEW for commits related to generic property functions
Dave Wysochanski [Thu, 30 Sep 2010 14:26:48 +0000 (14:26 +0000)]
Update WHATS_NEW for commits related to generic property functions

13 years agoFix memory leak of vg_read while using live copies of metadata in directories.
Peter Rajnoha [Thu, 30 Sep 2010 14:12:14 +0000 (14:12 +0000)]
Fix memory leak of vg_read while using live copies of metadata in directories.

13 years agoAdd pv_get_property and create generic internal _get_property function.
Dave Wysochanski [Thu, 30 Sep 2010 14:09:45 +0000 (14:09 +0000)]
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.

13 years agoAdd pv 'get' functions for all pv properties.
Dave Wysochanski [Thu, 30 Sep 2010 14:09:33 +0000 (14:09 +0000)]
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.

13 years agoAdd pv_name_dup() and pv_fmt_dup() helper functions.
Dave Wysochanski [Thu, 30 Sep 2010 14:09:22 +0000 (14:09 +0000)]
Add pv_name_dup() and pv_fmt_dup() helper functions.

13 years agoAdd pv_mda_size, pv_mda_free, and pv_used functions, call from 'disp' functions.
Dave Wysochanski [Thu, 30 Sep 2010 14:09:10 +0000 (14:09 +0000)]
Add pv_mda_size, pv_mda_free, and pv_used functions, call from 'disp' functions.

13 years agoAdd 'get' functions for vg fields.
Dave Wysochanski [Thu, 30 Sep 2010 14:08:58 +0000 (14:08 +0000)]
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.

13 years agoMake generic GET_*_PROPERTY_FN macros and define secondary macro for vg, pv, lv.
Dave Wysochanski [Thu, 30 Sep 2010 14:08:46 +0000 (14:08 +0000)]
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.

13 years agoAdd supporting functions vg_name_dup, vg_fmt_dup, vg_system_id_dup.
Dave Wysochanski [Thu, 30 Sep 2010 14:08:33 +0000 (14:08 +0000)]
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.

13 years agoAdd pv_tags_dup, vg_tags_dup, lv_tags_dup functions that call tags_format_and_copy.
Dave Wysochanski [Thu, 30 Sep 2010 14:08:19 +0000 (14:08 +0000)]
Add pv_tags_dup, vg_tags_dup, lv_tags_dup functions that call tags_format_and_copy.

13 years agoAdd tags_format_and_copy() common function and call from _tags_disp.
Dave Wysochanski [Thu, 30 Sep 2010 14:08:07 +0000 (14:08 +0000)]
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().

13 years agoAdd pv_uuid_dup, vg_uuid_dup, and lv_uuid_dup, and call id_format_and_copy.
Dave Wysochanski [Thu, 30 Sep 2010 14:07:47 +0000 (14:07 +0000)]
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.

13 years agoAdd id_format_and_copy() common function and call from _uuid_disp.
Dave Wysochanski [Thu, 30 Sep 2010 14:07:33 +0000 (14:07 +0000)]
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.

13 years agoSimplify logic to create 'attr' strings.
Dave Wysochanski [Thu, 30 Sep 2010 14:07:19 +0000 (14:07 +0000)]
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.

13 years agoAdd {pv|vg|lv}_attr_dup() functions and refactor 'disp' functions.
Dave Wysochanski [Thu, 30 Sep 2010 13:52:55 +0000 (13:52 +0000)]
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().

13 years agoAdd lib/metadata/vg.[ch] and lib/metadata/lv.[ch].
Dave Wysochanski [Thu, 30 Sep 2010 13:16:55 +0000 (13:16 +0000)]
Add lib/metadata/vg.[ch] and lib/metadata/lv.[ch].

These got missed when git cvsexportcommit was used.

13 years agoAdd lib/metadata/pv.[ch] new files.
Dave Wysochanski [Thu, 30 Sep 2010 13:15:42 +0000 (13:15 +0000)]
Add lib/metadata/pv.[ch] new files.

Apparently git cvsexportcommit does not properly add new files
from a git commit.

13 years agoRefactor metadata.[ch] into lv.[ch] for lv functions.
Dave Wysochanski [Thu, 30 Sep 2010 13:05:45 +0000 (13:05 +0000)]
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.

13 years agoRefactor metadata.[ch] into pv.[ch] for pv functions.
Dave Wysochanski [Thu, 30 Sep 2010 13:05:20 +0000 (13:05 +0000)]
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.

13 years agoRefactor metadata.[ch] into vg.[ch] for vg functions.
Dave Wysochanski [Thu, 30 Sep 2010 13:04:55 +0000 (13:04 +0000)]
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.

13 years agoFix memory leak of config_tree
Zdenek Kabelac [Thu, 30 Sep 2010 11:44:54 +0000 (11:44 +0000)]
Fix memory leak of config_tree

Adding missing destroy_config_tree() for cft_override if it has been allocated.

13 years agoFix leaked pool report
Zdenek Kabelac [Thu, 30 Sep 2010 11:40:14 +0000 (11:40 +0000)]
Fix leaked pool report

Swap pool destruction order in dmeventd_lvm2_exit() to fix leak report.

13 years agoMaps fix
Zdenek Kabelac [Thu, 30 Sep 2010 11:32:40 +0000 (11:32 +0000)]
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])

13 years agoAdd missing cleanup rule for generated .exported_symbols_generated
Zdenek Kabelac [Thu, 30 Sep 2010 10:08:58 +0000 (10:08 +0000)]
Add missing cleanup rule for generated .exported_symbols_generated

13 years agoSpeed up unquoting of quoted double quotes and backslashes.
Alasdair Kergon [Tue, 28 Sep 2010 01:29:06 +0000 (01:29 +0000)]
Speed up unquoting of quoted double quotes and backslashes.

13 years agodrop an unnecessary 'stack'
Alasdair Kergon [Mon, 27 Sep 2010 19:15:13 +0000 (19:15 +0000)]
drop an unnecessary 'stack'

13 years agowas renamed
Alasdair Kergon [Mon, 27 Sep 2010 19:10:46 +0000 (19:10 +0000)]
was renamed

13 years agoSpeed up CRC32 calculations by using a larger lookup table.
Alasdair Kergon [Mon, 27 Sep 2010 19:09:34 +0000 (19:09 +0000)]
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.

13 years agopre-release
Alasdair Kergon [Fri, 24 Sep 2010 16:24:57 +0000 (16:24 +0000)]
pre-release

13 years agoAdd escape sequence for ':' and '@' found in device names used as PVs.
Peter Rajnoha [Thu, 23 Sep 2010 12:02:33 +0000 (12:02 +0000)]
Add escape sequence for ':' and '@' found in device names used as PVs.

13 years agoReplace alloca with dm_malloc in _aligned_io.
Alasdair Kergon [Wed, 22 Sep 2010 22:31:45 +0000 (22:31 +0000)]
Replace alloca with dm_malloc in _aligned_io.

(This section of code dates from 2.4 and could be written more efficiently nowadays.)

13 years agoFix handling of partial VG for lvm1 format metadata
Milan Broz [Wed, 22 Sep 2010 13:45:21 +0000 (13:45 +0000)]
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

13 years agoFix name in msg in last checkin.
Alasdair Kergon [Wed, 22 Sep 2010 01:50:38 +0000 (01:50 +0000)]
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.)

13 years agoTrack recursive filter iteration to avoid refreshing while in use. (2.02.56)
Alasdair Kergon [Wed, 22 Sep 2010 01:36:13 +0000 (01:36 +0000)]
Track recursive filter iteration to avoid refreshing while in use. (2.02.56)

13 years ago"goto_bad" should be used in alloc_printed_tags function, not "goto bad".
Peter Rajnoha [Tue, 21 Sep 2010 10:42:02 +0000 (10:42 +0000)]
"goto_bad" should be used in alloc_printed_tags function, not "goto bad".

13 years agoRevert to old glibc behaviour for vsnprintf used in emit_to_buffer function.
Peter Rajnoha [Mon, 20 Sep 2010 14:25:27 +0000 (14:25 +0000)]
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!

13 years agoUse dynamic allocation for metadata's tag buffer (removes 4096 char. limit).
Peter Rajnoha [Mon, 20 Sep 2010 14:23:20 +0000 (14:23 +0000)]
Use dynamic allocation for metadata's tag buffer (removes 4096 char. limit).

13 years agoUpdate vg_mda_free 'get' function to multiply by SECTOR_SIZE.
Dave Wysochanski [Thu, 9 Sep 2010 19:38:03 +0000 (19:38 +0000)]
Update vg_mda_free 'get' function to multiply by SECTOR_SIZE.

13 years agoAdd random suffix to archive file names to prevent races when being created.
Peter Rajnoha [Thu, 9 Sep 2010 13:13:12 +0000 (13:13 +0000)]
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.

13 years agoReinitialize archive and backup handling on toolcontext refresh.
Peter Rajnoha [Thu, 9 Sep 2010 13:07:13 +0000 (13:07 +0000)]
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.

13 years agoThis patch fixes an issue where cluster mirror write I/O
Jonathan Earl Brassow [Mon, 30 Aug 2010 18:37:42 +0000 (18:37 +0000)]
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.

13 years agoDo not run singlenode clvmd tests if support for singlenode not compiled in.
Milan Broz [Fri, 27 Aug 2010 08:52:54 +0000 (08:52 +0000)]
Do not run singlenode clvmd tests if support for singlenode not compiled in.

13 years agoCurrently tests require SI units enabled and data alignment to 1MiB.
Milan Broz [Fri, 27 Aug 2010 07:59:40 +0000 (07:59 +0000)]
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.

13 years agoThis patch fixes a problem where the mirror polling process
Jonathan Earl Brassow [Thu, 26 Aug 2010 16:29:12 +0000 (16:29 +0000)]
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.

13 years agoThis patch fixes a potential for I/O to hang and LVM commands
Jonathan Earl Brassow [Thu, 26 Aug 2010 14:21:50 +0000 (14:21 +0000)]
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.

13 years agoFix previous const removal.
Milan Broz [Thu, 26 Aug 2010 12:22:05 +0000 (12:22 +0000)]
Fix previous const removal.

13 years agoFix return type qualifier to avoid compiler warning.
Milan Broz [Thu, 26 Aug 2010 12:08:19 +0000 (12:08 +0000)]
Fix return type qualifier to avoid compiler warning.

introduced in commit b16b4d92a7bd80b61b85c5db857173a8f0567374
"Improve various log messages."

fixes a lot of
../include/metadata.h:148: warning: type qualifiers ignored on function return type

13 years agoMake example.conf description for 'default_data_alignment' more generic.
Mike Snitzer [Wed, 25 Aug 2010 13:06:03 +0000 (13:06 +0000)]
Make example.conf description for 'default_data_alignment' more generic.

13 years agoFix timestamp.
Milan Broz [Wed, 25 Aug 2010 11:25:02 +0000 (11:25 +0000)]
Fix timestamp.

Not only in Wonderland time can run backwards.

13 years agoUpdate configure after last change.
Milan Broz [Mon, 23 Aug 2010 13:44:31 +0000 (13:44 +0000)]
Update configure after last change.

13 years agoBased on auto-detection or user requested cluster managers for clvmd,
Fabio M. Di Nitto [Mon, 23 Aug 2010 11:37:02 +0000 (11:37 +0000)]
Based on auto-detection or user requested cluster managers for clvmd,
set appropriate Required-Start and Required-Stop at configure time.

Reorder the checks for user selected cluster managers to match auto
detected ones, to be consistent in the output.

Add special case for qdiskd that´s started after cman/lock_gulmd for
RHEL-4/RHEL-5.

13 years agoFix pvmove --abort <dev> return code
Milan Broz [Mon, 23 Aug 2010 11:34:40 +0000 (11:34 +0000)]
Fix pvmove --abort <dev> return code

It prints error code even if abort operation succeeds:

pvmove --abort /dev/sdb
  Command failed with status code 5.

13 years agoFix pvmove --abort to work even for empty pvmove LV
Milan Broz [Mon, 23 Aug 2010 11:34:10 +0000 (11:34 +0000)]
Fix pvmove --abort to work even for empty pvmove LV

If pvmove crashed and metadata contains pvmove LV
but without miorrored segments, pvmove --abort
will not repair the situation (and finish wth success!).

Fix it by allowing metadata update if aborting
(thus removing pvmove LV) even if no moved LVs detected.

(Tested on real metadata provided by an lvm user:-)

13 years agoVerify that pvcreate --dataalignment really does override the topology
Mike Snitzer [Sat, 21 Aug 2010 15:43:45 +0000 (15:43 +0000)]
Verify that pvcreate --dataalignment really does override the topology
detected alignment.

NOTE: lvm2 doesn't detect MD 1.2 metadata (now the default on RHEL6) so
for now I'm forcing 1.0 metadata.  This was needed to be able to reuse
the existing loop devices but recreate the md device with different
raid0 striping.

13 years ago.
Alasdair Kergon [Sat, 21 Aug 2010 00:18:05 +0000 (00:18 +0000)]
.

13 years agoautoreconf also updates configure.h.in
Alasdair Kergon [Sat, 21 Aug 2010 00:16:37 +0000 (00:16 +0000)]
autoreconf also updates configure.h.in

13 years agoUpdate configure for snitm changes
Dave Wysochanski [Fri, 20 Aug 2010 22:32:18 +0000 (22:32 +0000)]
Update configure for snitm changes

13 years agoSwitch to using configure --with-default-data-alignment=<NUM> to
Mike Snitzer [Fri, 20 Aug 2010 22:24:58 +0000 (22:24 +0000)]
Switch to using configure --with-default-data-alignment=<NUM> to
establish DEFAULT_DATA_ALIGNMENT.  Again, 0=64KiB, 1=1MiB, 2=2MiB

Default is 1.

13 years agoUpdate heuristic used for default and detected data alignment.
Mike Snitzer [Fri, 20 Aug 2010 20:59:05 +0000 (20:59 +0000)]
Update heuristic used for default and detected data alignment.

Add "devices/default_data_alignment" to lvm.conf to control the internal
default that LVM2 uses: 0==64k, 1==1MB, 2==2MB, etc.

If --dataalignment (or lvm.conf's "devices/data_alignment") is specified
then it is always used to align the start of the data area.  This means
the md_chunk_alignment and data_alignment_detection are disabled if set.

(Same now applies to pvcreate --dataalignmentoffset, the specified value
will be used instead of the result from data_alignment_offset_detection)

set_pe_align() still looks to use the determined default alignment
(based on lvm.conf's default_data_alignment) if the default is a
multiple of the MD or topology detected values.

13 years agoUpdate WHATS_NEW
Dave Wysochanski [Fri, 20 Aug 2010 20:35:55 +0000 (20:35 +0000)]
Update WHATS_NEW

13 years agoDefine GET_NUM_PROPERTY_FN macro to simplify numeric property 'get' functions.
Dave Wysochanski [Fri, 20 Aug 2010 13:02:39 +0000 (13:02 +0000)]
Define GET_NUM_PROPERTY_FN macro to simplify numeric property 'get' functions.

13 years agoAdd implmentation for simple numeric 'get' property functions.
Dave Wysochanski [Fri, 20 Aug 2010 12:45:09 +0000 (12:45 +0000)]
Add implmentation for simple numeric 'get' property functions.

Add 'get' functions based on the simple macro function definition for a
numeric property.

Add 'get' functions for the following: _vg_extent_count_get,
_vg_free_count_get, _max_lv_get, _max_pv_get, _pv_count_get,
_lv_count_get, _snap_count_get, _vg_seqno_get, _vg_size_get,
_vg_free_get, vg_mda_*.

For size functions, multiply by SECTOR_SIZE to return the value in bytes.

13 years agoDefine GET_NUM_PROPERTY_FN macro to simplify numeric property 'get' functions.
Dave Wysochanski [Fri, 20 Aug 2010 12:44:58 +0000 (12:44 +0000)]
Define GET_NUM_PROPERTY_FN macro to simplify numeric property 'get' functions.

13 years agoAdd properties.[ch] to lib/report, defined based on columns.h.
Dave Wysochanski [Fri, 20 Aug 2010 12:44:47 +0000 (12:44 +0000)]
Add properties.[ch] to lib/report, defined based on columns.h.

Extend the existing reporting infrastructure definitions and structures
to include a 'get' and 'set' function for each field.  We will provide
a 'get' and 'set' function for each of these fields, which will be utilized
by exported lvm2app functions.

Define a default _not_implemented 'get' and 'set' function that just sets
an errno and returns 0.  Future patches will actually implement the
specific 'get' and 'set' functions for each property.  For read-only
properties, only the 'get' function will be implemented.

Define vg_get_property() function to query a property.  We will call
this from a lvm2app function.

13 years agoAdd macro definitions to report infrastructure for character array length.
Dave Wysochanski [Fri, 20 Aug 2010 12:44:30 +0000 (12:44 +0000)]
Add macro definitions to report infrastructure for character array length.

Rather than hard code the size of the field, use a #define, so we can re-use.
The #define will be needed in a future patch when we extend the reporting
infrastructure to have 'get' and 'set' functions for each field, allowing
lvm2app functions which query any report field.  In order to provide a
generic lookup based on the field id, we will define a type containing this
field id, and thus, we will need to re-use the length of this string as
it's defined inside libdevmapper.h.

13 years agoRemove explicit double quotes from columns.h 'id' entries.
Dave Wysochanski [Fri, 20 Aug 2010 12:44:17 +0000 (12:44 +0000)]
Remove explicit double quotes from columns.h 'id' entries.

The 'id' entries in columns.h are the report field names.  Since these are
unique, we'd like to use them in generation of 'get' / 'set' functions.
As a step towards using them for this purpose, remove the explicit double
quotes and use the macro '#' character to add the double quotes back when
placing them into the '_fields' array 'id' member.

13 years agoAdd 'flags' field to columns.h and define FIELD_MODIFIABLE.
Dave Wysochanski [Fri, 20 Aug 2010 12:44:03 +0000 (12:44 +0000)]
Add 'flags' field to columns.h and define FIELD_MODIFIABLE.

Add a 'flags' field to columns.h, and set it to 0 by default.
Define FIELD_MODIFIABLE flag to indicate whether a 'set' function exists
to change the field's value.

13 years agoAdd vg_mda_size and vg_mda_free functions.
Dave Wysochanski [Fri, 20 Aug 2010 12:43:49 +0000 (12:43 +0000)]
Add vg_mda_size and vg_mda_free functions.

Add supporting functions to get vg_mda_size and vg_mda_free fields.
Should be no functional change.

13 years agoFix wrong use of LCK_WRITE
Milan Broz [Thu, 19 Aug 2010 23:26:31 +0000 (23:26 +0000)]
Fix wrong use of LCK_WRITE

In all top vg read functions only LCK_VG_READ/WRITE can be used.
All other vg lock definitions are low-level backend machinery.

Moreover, LCK_WRITE cannot be tested through bitmask.
This patch fixes these mistakes.

For _recover_vg() we do not need lock_flags, it can be only
two of above and we always upgrading to LCK_VG_WRITE lock there.
(N.B. that code is racy)

There is no functional change in code (despite wrong masking
it produces correct bits:-)

13 years agoDetect LUKS signature in pvcreate
Milan Broz [Thu, 19 Aug 2010 23:08:18 +0000 (23:08 +0000)]
Detect LUKS signature in pvcreate

One shiny day we should use libblkid here. But now using LUKS is
very common together with LVM and pvcreate destroys LUKS completely.

So for user's convenience, try to detect LUKS signature and allow abort.

13 years agoFix file descriptor leak in swap signature detection
Milan Broz [Thu, 19 Aug 2010 23:05:45 +0000 (23:05 +0000)]
Fix file descriptor leak in swap signature detection

13 years agoRemove assumption that --yes must be used only in --force mode
Milan Broz [Thu, 19 Aug 2010 23:04:37 +0000 (23:04 +0000)]
Remove assumption that --yes must be used only in --force mode

This is not only undocumented but is is also in violation with --help
documentation.

Using --yes without --force is useful in pvcreate when it detects
old signature.

13 years agoChange the pvcreate swap/md logic
Milan Broz [Thu, 19 Aug 2010 23:03:34 +0000 (23:03 +0000)]
Change the pvcreate swap/md logic

pvcreate detects MD and swap signature.

The logic hidden there is not only documented but it is also
user unfriendly. Who invented this logic should run pvcreate
on its own critical MD device to see why;-)

This patch
 - creates one function instead of duplication code
 - asks if user want to overwrite signature
 - allows aborting (!)
 (Please note that writing LVM signatute without wiping old
 is wrong, it confuses blkid, MD will not work anyway and
 swap and LUKS is broken too.)

13 years agopost-release
Alasdair Kergon [Thu, 19 Aug 2010 22:33:14 +0000 (22:33 +0000)]
post-release

13 years agopre-release
Alasdair Kergon [Wed, 18 Aug 2010 20:57:10 +0000 (20:57 +0000)]
pre-release

13 years agoFix dm-mod autoloading logic to not assume control node is set correctly.
Peter Rajnoha [Wed, 18 Aug 2010 13:11:56 +0000 (13:11 +0000)]
Fix dm-mod autoloading logic to not assume control node is set correctly.

We can't rely on the fact that udev should prepare the node with right major
and minor number to trigger the module autoloading. We have to take into
account that the node could be missing or it could exist with improper
major and minor number assigned (e.g. from previous kernel versions in
an environment with static nodes and without udev). Make any corrections
if needed!

13 years agoFix for bug 596453: multiple mirror image failures cause lvm repair...
Jonathan Earl Brassow [Tue, 17 Aug 2010 23:56:23 +0000 (23:56 +0000)]
Fix for bug 596453: multiple mirror image failures cause lvm repair...

The lvm repair issues I believe are the superficial symptoms of this
bug - there are worse issues that are not as clearly seen.  From my
inline comments:
* If the mirror was successfully recovered, we want to always
* force every machine to write to all devices - otherwise,
* corruption will occur.  Here's how:
*    Node1 suffers a failure and marks a region out-of-sync
*    Node2 attempts a write, gets by is_remote_recovering,
*          and queries the sync status of the region - finding
*          it out-of-sync.
*    Node2 thinks the write should be a nosync write, but it
*          hasn't suffered the drive failure that Node1 has yet.
*          It then issues a generic_make_request directly to
*          the primary image only - which is exactly the device
*          that has suffered the failure.
*    Node2 suffers a lost write - which completely bypasses the
*          mirror layer because it had gone through generic_m_r.
*    The file system will likely explode at this point due to
*    I/O errors.  If it wasn't the primary that failed, it is
*    easily possible in this case to issue writes to just one
*    of the remaining images - also leaving the mirror inconsistent.
*
* We let in_sync() return 1 in a cluster regardless of what is
* in the bitmap once recovery has successfully completed on a
* mirror.  This ensures the mirroring code will continue to
* attempt to write to all mirror images.  The worst that can
* happen for reads is that additional read attempts may be
* taken.

13 years agoAttempt to fix buildbot failure in t-lvconvert-mirror.sh due to failing to
Alasdair Kergon [Tue, 17 Aug 2010 22:01:41 +0000 (22:01 +0000)]
Attempt to fix buildbot failure in t-lvconvert-mirror.sh due to failing to
wait for mirror to get into sync before running subsequent command.

13 years agoUse 'SINGLENODE' instead of 'dead' in clvmd singlenode messages.
Alasdair Kergon [Tue, 17 Aug 2010 19:25:05 +0000 (19:25 +0000)]
Use 'SINGLENODE' instead of 'dead' in clvmd singlenode messages.
Ignore snapshots when performing mirror recovery beneath an origin.
Pass LCK_ORIGIN_ONLY flag around cluster.
Add suspend_lv_origin and resume_lv_origin using LCK_ORIGIN_ONLY.

13 years agoAllow internal suspend and resume of origin without its snapshots.
Alasdair Kergon [Tue, 17 Aug 2010 16:25:32 +0000 (16:25 +0000)]
Allow internal suspend and resume of origin without its snapshots.

13 years agoFix dev_manager_transient to access -real device not snapshot-origin. (brassow)
Alasdair Kergon [Tue, 17 Aug 2010 01:51:12 +0000 (01:51 +0000)]
Fix dev_manager_transient to access -real device not snapshot-origin. (brassow)

Another reminder why cloning functions impedes maintenance.

13 years agoMonitor origin -real device below snapshot instead of overlay device. (brassow)
Alasdair Kergon [Tue, 17 Aug 2010 01:16:41 +0000 (01:16 +0000)]
Monitor origin -real device below snapshot instead of overlay device. (brassow)

13 years agoDon't really change monitoring status when in test mode.
Alasdair Kergon [Mon, 16 Aug 2010 23:29:09 +0000 (23:29 +0000)]
Don't really change monitoring status when in test mode.

13 years agoAdd some v1 to v2 metadata upgrade testing.
Mike Snitzer [Mon, 16 Aug 2010 23:21:20 +0000 (23:21 +0000)]
Add some v1 to v2 metadata upgrade testing.

13 years agoVarious small cleanups and fixes related to monitoring.
Alasdair Kergon [Mon, 16 Aug 2010 22:54:35 +0000 (22:54 +0000)]
Various small cleanups and fixes related to monitoring.

13 years agoRemove superfluous NULL pointer tests before dm_free from dmeventd.
Alasdair Kergon [Mon, 16 Aug 2010 18:19:46 +0000 (18:19 +0000)]
Remove superfluous NULL pointer tests before dm_free from dmeventd.

13 years agoFix for bug 612291: dm devices of split off mirror images are not removed
Jonathan Earl Brassow [Mon, 16 Aug 2010 18:02:14 +0000 (18:02 +0000)]
Fix for bug 612291: dm devices of split off mirror images are not removed

DM devices were not handled properly on nodes in a cluster that were not
where the splitmirrors command was issued.  This was happening because
suspend_lv/resume_lv were being used in a place where activate_lv should
have been used.

When the suspend/resume are issued on (effectively) new LVs, their
'resource' (UUID) is not located in the lv_hash.  Thus, both operations
turn into no-ops.  You can see this from the output of clvmd from one
of the remote nodes:
<snip>
do_suspend_lv, lock not already held
<snip>
do_resume_lv, lock not already held

'activate_lv' enjoins the other nodes in the cluster to process the lock
and activate the new LV.  clvmd output from remote node as follows:
do_lock_lv: resource 'zMseY7CBuO3Ty09vXlplPAHzD0Y0CovjrTdv0R1VcwggMwPdYhutHErRcwm5Nd2S', cmd = 0x19 LCK_LV_ACTIVATE (READ|LV|NONBLOCK), flags = 0x84 (DMEVENTD_MONITOR ), memlock = 1
sync_lock: 'zMseY7CBuO3Ty09vXlplPAHzD0Y0CovjrTdv0R1VcwggMwPdYhutHErRcwm5Nd2S' mode:1 flags=1
sync_lock: returning lkid 27b0001

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>
13 years agoset DEFAULT_RUN_DIR (missed from earlier checkin?)
Alasdair Kergon [Mon, 16 Aug 2010 17:49:26 +0000 (17:49 +0000)]
set DEFAULT_RUN_DIR (missed from earlier checkin?)

13 years agoWHATS_NEW_DM
Peter Rajnoha [Mon, 16 Aug 2010 11:22:08 +0000 (11:22 +0000)]
WHATS_NEW_DM

13 years agodm-mod autoloading support is in kernel 2.6.36 actually.
Peter Rajnoha [Mon, 16 Aug 2010 11:13:18 +0000 (11:13 +0000)]
dm-mod autoloading support is in kernel 2.6.36 actually.

13 years agoFix udev rules to support udev database content generated by older rules.
Peter Rajnoha [Thu, 12 Aug 2010 13:41:18 +0000 (13:41 +0000)]
Fix udev rules to support udev database content generated by older rules.

This can happen with older rules (without support for synthesized events)
that are still part of initrd while using new udev rules in the system itself.

The consequence was that new udev rules incorrectly assumed that not having
DM_UDEV_PRIMARY_SOURCE_FLAG set always means the uevent is synthesized and
inappropriate (device is still not properly activated) and so it should be
ignored. However, initrd is not updated automatically while updating the
libdevmapper/udev rules in the system and so we end up with the rules not
detecting and setting crucial parts in the initrd environment and the rules
in the system that rely on the information that should have been stored in
udev db (which is incorrect in this configuration, of course).

The overall consequence is that the update of libdevmapper/lvm2 without
regenerating the initrd could end up with a boot failure! Ignoring the event
means removing any existing symlinks in /dev!

To fix this, increase udev rules version to make a difference. So from now on,
mark rules without proper support for synthesized events as
DM_UDEV_RULES_VSN="1" and 2 (or higher) if that support is included.

13 years agoReinstate detection of inappropriate uevent with DISK_RO set and suppress it.
Peter Rajnoha [Thu, 12 Aug 2010 13:07:08 +0000 (13:07 +0000)]
Reinstate detection of inappropriate uevent with DISK_RO set and suppress it.

We still need to detect this one! We're not so strict with CHANGE events as
with the ADD events while applying filters in the rules so this one would
pass and it would process the rules prematurely (because it appears *before*
the actual CHANGE event used when resuming a DM device while setting read-only
state at the same time).

13 years agoFix clvmd init script return code when executed as non-root user.
Fabio M. Di Nitto [Thu, 12 Aug 2010 09:14:59 +0000 (09:14 +0000)]
Fix clvmd init script return code when executed as non-root user.

clvmd daemon itself does the right thing when invoked as non-root, by
returning 4.

The patch removes the use daemon function from
/etc/rc.d/init.d/functions that´s unnecessary and has th bad habit to
mask the return codes from the real daemon.

Add a simple and generic check to see if clvmd is executed by root or not.

Our stop/reload/restart paths in the init script are complex and not all
the tools involved in the process are guaranteed to return 4 if executed
by non-root against a process that´s running as root (for example kill
-TERM will return -1 and parsing the output to catch the error is
suboptimal at best).

https://bugzilla.redhat.com/show_bug.cgi?id=553381

13 years agofix t-pvcreate-operation-md.sh to require kernel.org Linux >= 2.6.33 for
Mike Snitzer [Thu, 12 Aug 2010 04:56:05 +0000 (04:56 +0000)]
fix t-pvcreate-operation-md.sh to require kernel.org Linux >= 2.6.33 for
the final alignment_offset check.  In the future, might look to check
for the RHEL6 kernel too.

13 years agoChange default alignment of pe_start to 1MB.
Mike Snitzer [Thu, 12 Aug 2010 04:11:48 +0000 (04:11 +0000)]
Change default alignment of pe_start to 1MB.

The new standard in the storage industry is to default alignment of data
areas to 1MB.  fdisk, parted, and mdadm have all been updated to this
default.

Update LVM to align the PV's data area start (pe_start) to 1MB.  This
provides a more useful default than the previous default of 64K (which
generally ended up being a 192K pe_start once the first metadata area
was created).

Before this patch:
# pvs -o name,vg_mda_size,pe_start
  PV         VMdaSize  1st PE
  /dev/sdd     188.00k 192.00k

After this patch:
# pvs -o name,vg_mda_size,pe_start
  PV         VMdaSize  1st PE
  /dev/sdd    1020.00k   1.00m

The heuristic for setting the default alignment for LVM data areas is:
- If the default value (1MB) is a multiple of the detected alignment
  then just use the default.
- Otherwise, use the detected value.

In practice this means we'll almost always use 1MB -- that is unless:
- the alignment was explicitly specified with --dataalignment
- or MD's full stripe width, or the {minimum,optimal}_io_size exceeds
  1MB
- or the specified/detected value is not a power-of-2

13 years agoRequire --restorefile when using pvcreate --uuid.
Mike Snitzer [Thu, 12 Aug 2010 04:08:59 +0000 (04:08 +0000)]
Require --restorefile when using pvcreate --uuid.

Introduce --norestorefile to allow user to override the new requirement.

This can also be overridden with "devices/require_restorefile_with_uuid"
in lvm.conf -- however the default is 1.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
13 years agoWHATS_NEW_DM
Peter Rajnoha [Wed, 11 Aug 2010 13:12:31 +0000 (13:12 +0000)]
WHATS_NEW_DM

13 years agoRecognise and give preference to md device partitions (blkext major).
Peter Rajnoha [Wed, 11 Aug 2010 12:14:23 +0000 (12:14 +0000)]
Recognise and give preference to md device partitions (blkext major).

We can already detect MD devices internally. But when using MD partitions,
these have "block extended major" (blkext) assigned (259). Blkext major
is also used in general, so we need to check whether the original device
is an MD device actually.

This page took 0.067642 seconds and 5 git commands to generate.