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

4621 Commits

Author SHA1 Message Date
Dave Wysochanski
77e0ed4be7 Refactor vg_commit() to add _vg_commit_mdas().
Factor out calling mda->ops->vg_commit() for each mda.
No functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:35:33 +00:00
Dave Wysochanski
69d1732334 Update _vg_read and _text_create_text_instance to use fid_add_mda[s].
When we are constructing the vg, we may need to adjust the list of
metadata_areas if there are ignored mdas.  At label read time, we
do not read the metadata of ignored mdas, and as a result, they do
not get placed on vg->fid->metadata_areas inside _text_create_text_instance
since lvmcache does not have these areas attached to vginfo->infos.
However, when we're checking the pvids inside _vg_read, after having
read another metadata area from another PV, we do have the opportunity
to update the metadata_area and metadata_areas_ignored lists based
on the read metadata_area.  We need accurate mda lists for the reporting
functions that count the ignored mdas, as well as general correctness
of mda balancing.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:35:17 +00:00
Dave Wysochanski
bb723d7897 Use mdas_empty_or_ignored() in place of checks for empty mda list.
With the addition of ignored mdas, we replace all checks for an empty
mda list with a new function to look for either an empty mda list or
ignored mdas.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:34:58 +00:00
Dave Wysochanski
f9c307cd07 Add mdas_empty_or_ignored() helper function.
Add a helper function to consolidate checking for an empty mdas list
or ignored mdas.  Ignored mdas should behave almost identically to
an empty mda list - the metadata areas should not be read or written
to.  This function will make it easier to implement metadata balancing
and easier to track pvs with an empty mda list or ignored mdas.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:34:40 +00:00
Dave Wysochanski
e6bd367b57 Implement ignore of mda if bit set by skipping r/w of metadata.
We implement ignore of an mda at label_read time by checking for
the ignore bit, and then skipping the reading of the vgname and
other information in the metadata.  This will have an effect similar
to a PV found with no mdas.  Thus, it will look like an orphan in the
cache until we scan the rest of the system and find a PV with
metadata, and the mda will not be on the vg->fid->metadata_areas
list so no read/writes will be done to the metadata area.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:34:24 +00:00
Dave Wysochanski
2f8e0473f4 Update pvchange, pvs and vgs man pages for metadata ignore.
Explain --metadataignore argument to pvchange, add new fields to pvs / vgs.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:34:12 +00:00
Dave Wysochanski
88fc1b143e Add --metadataignore to pvchange, allowing for ignoring of metadata areas.
This patch just modifies pvchange to call the underlying ignore
functions for mdas.  Ensure special cases do not reflect changes
in metadata (PVs with 0 mdas, setting ignored when already ignored,
clearing ignored when not ignored).

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:33:58 +00:00
Dave Wysochanski
cdbe475fe3 Define new functions and vgs/pvs fields related to mda ignore.
Define a new pvs field, pv_mda_used_count, and a new vgs field,
vg_mda_used_count to match the existing pv_mda_count and vg_mda_count.
These new fields count the number of mdas that have the 'ignored' bit
clear (they are in use on the PV / VG).  Also define various supporting
functions to implement the counting as well as setting the ignored
flag and determining if an mda is ignored.  These high level functions
call into the lower level location independent mda ignore functions
defined by earlier patches.

Note that counting ignored mdas in a vg requires traversing both lists
and checking for the ignored bit on the mda.  The count of 'ignored'
mdas then is defined by having the bit set, not by which list the mda
is on.  The list does determine whether LVM actually does read/write to
the mda, though we must count the bits in order to return accurate numbers
for the various counts.  Also, pv_mda_set_ignored must search both vg
lists for ignored mda.  If the state changes and needs to be committed
to disk, the ignored mda will be on the non-ignored list.

Note also in pv_mda_set_ignored(), we must properly manage the mda lists.
If we change the ignored state of an mda, we must change any mdas on
vg->fid->metadata_areas that correspond to this pv.  Also, we may
need to allocate a copy of the mda, as is done when fid->metadata_areas
is populated from _vg_read(), if we are un-ignoring an ignored mda.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:33:44 +00:00
Dave Wysochanski
9ccac021a7 Add metadata_areas_ignored list and functions to manage ignored mdas.
Add a second mda list, metadata_areas_ignored to fid, and a couple
functions, fid_add_mda() and fid_add_mdas() to help manage the lists.

These functions are needed to properly count the ignored mdas and
manage the lists attached to the 'fid' and ultimately the 'vg'.

Ensure metadata_areas_ignored is initialized in other formats, even
if the list is never used.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:33:22 +00:00
Dave Wysochanski
f55a20eb36 Rename fid->metadata_areas to fid->metadata_areas_in_use.
Rename the metadata_areas list to an 'in_use' list to prepare for
future 'ignored' list.
2010-06-28 20:32:44 +00:00
Dave Wysochanski
6b596f685f Use vg_mda_count() in vgdisplay.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:32:21 +00:00
Dave Wysochanski
ef4fa155a5 Add mda location specific mda_copy constructor.
Because of the way mdas are handled internally, where a PV in a VG
has mdas on both info->mdas and vg->fid->metadata_areas list, we
need a location independent copy constructor for struct
metadata_area.  Break up the existing format-text specific copy
constructor into a format independent piece and a format dependent
piece.

This function is necessary to properly implement pv_set_mda_ignored().

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Reviewed-by: Alasdair G Kergon <agk@redhat.com>
2010-06-28 20:31:59 +00:00
Dave Wysochanski
29f24d4634 Add mda_locns_match() internal library function for mapping pv/device to VG mda.
A metadata_area is defined independent of the location.  One downside
is that there is no obvious mapping from a pv to an mda.  For a PV in
a VG, we need a way to start with a PV and end up with an MDA, if we
are to manage mdas starting with a device/pv.  This function provides
us a way to go down the list of PVs on a VG, and identify which ones
match a particular PV.

I'm not entirely happy with this approach, but it does fit into the
existing structures in a reasonable way.

An alternative solution might be to refactor the VG - PV interface such
that mdas are a list tied to a PV.  However, this seemed a bit tricky since
a PV does not come into existence until after the list of mdas is
constructed (see _vg_read() - we create a 'fid' and attach mdas to it,
then we go through them and attach pvs).

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Reviewed-by: Alasdair G Kergon <agk@redhat.com>
2010-06-28 20:31:38 +00:00
Dave Wysochanski
a6b36a5901 Ensure in-memory state matches on-disk state of mda ignore bit.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:31:18 +00:00
Dave Wysochanski
09e0f43ba0 Allow raw_read_mda_header to be called from text_label.c.
We'd like to pass in mda_header to vgname_from_mda().  In order to
do this, we need to call raw_read_mda_header() from text_label.c,
_text_read(), which gets called from the label_read() path, and
peers into the metadata and update vginfo cache.  We should check
the disable bit here, and if set, not peer into the vg metadata,
thus reducing the I/O to disk.

In the process, move vgname_from_mda() to layout.h, since the fn
only gets called from format_text code, and we need the mda_header
definition from the private layout.h.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:31:01 +00:00
Dave Wysochanski
da0b4d8770 Move dev_open/dev_close outside vgname_from_mda().
Refactor vgname_from_mda() so caller must open/close the device.
Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:30:46 +00:00
Dave Wysochanski
96597c2eab Move dev_open / dev_close outside _vg_read_raw_area().
This refactoring moves the device open/close up one level to the caller of
_vg_read_raw_area().  Should be no functional change and facilitate future
changes related to metadata balancing.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:30:30 +00:00
Dave Wysochanski
322c5868b3 Add location independent flag and functions to ignore mdas.
First we add a 'flags' field to the location independent
metadata_area structure, and a MDA_IGNORE flag.  The
mda_is_ignored and mda_set_ignored functions are added to
manage the flag.  Adding the flag and functions gives a
library interface to ignore metadata areas independent of
the underlying location (disk, file, etc).  The location
specific read/write functions must then handle the specifics
of what this flag means to the location.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Reviewed-by: Alasdair G Kergon <agk@redhat.com>
2010-06-28 20:30:14 +00:00
Dave Wysochanski
d144d5eeb7 Add text format specific 'rlocn' ignore flag and access functions.
Adding a flag to the 'rlocn' structure in the mda header of the
text format allows us to flip a bit to ignore an area on disk that
stores the metadata via the text format specific mda_header.
This patch defines the flag and access functions to manage the flag.
Other patches will manage the ignore on a format-independent basis,
by using a flag in the metadata_area structure.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:29:57 +00:00
Dave Wysochanski
7c604e7649 Change 'filler' to 'flags' in on-disk 'raw_locn' structure.
Future patches will make use of a specific flag in the on-disk 'raw_locn'
structure to enable/disable metadata areas, and facilitate metadata
balancing.

Note that 'filler' is always set to '0' (see add_mda() - memset),
so use of this area as a non-zero flags field is a safe way to
provide future code features.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:29:42 +00:00
Petr Rockai
eddb91d1e7 Minor shell style cleanup. 2010-06-28 19:13:33 +00:00
Petr Rockai
0da9500f13 Refactor the handles_missing_pv logic in lvchange. 2010-06-28 19:10:16 +00:00
Jonathan Earl Brassow
68c31a2a36 Fix for bz608048 from Taka...
The same region size is used for both mirror volume and mirrored
log volume, but when the physical extent size is bigger than region size,
the size of mirror leg for mirrored log is smaller than the region size
and lvcreate command fails.

This patch adjusts a region size of mirrored log to a smaller value of
region size or physical extent size.

[This patch ensures that the region_size of the mirrored log does not
exceed the size of the mirrored log itself, which would violate the
kernel constraint: (region_size <= ti->len).]

Signed-off-by: Takahiro Yasui <takahiro.yasui@hds.com>
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
2010-06-28 14:19:41 +00:00
Alasdair Kergon
e6f716f551 generate liblvm2cmd exported symbols too 2010-06-25 18:23:10 +00:00
Alasdair Kergon
8b2055719d Generate liblvm2app and libdevmapper exported symbols from header files.
Detection is simply by prefix - dm_ or lvm_ - and any additional symbols needed
but not detected this way are placed in .exported_symbols.
2010-06-25 18:17:38 +00:00
Alasdair Kergon
9bce3d3bcf actually, let's keep these in same order as in header 2010-06-25 12:21:47 +00:00
Alasdair Kergon
4de36d0072 Update liblvm2app exported symbols.
Add Makefile target to generate current list of lvm2app.h functions.
2010-06-25 12:19:52 +00:00
Zdenek Kabelac
c78b0274ba Fix typo reported in Debian bugzilla #586043 2010-06-24 08:36:57 +00:00
Zdenek Kabelac
d301e5917f Preload libc locale messages.
Preload libc.mo file for localized lvm before taking memory lock - this way
we prevent disk access for some error paths in libdm, that prints localized
errno messages while they are still in memory locked state.
2010-06-24 08:29:30 +00:00
Zdenek Kabelac
2e08761496 Add few missing information about what is this script doing.
(based upon Debian bugzilla suggestion)
2010-06-24 08:18:54 +00:00
Petr Rockai
a8dfed8267 Add a test of wait_for_locks behaviour (adapted from an original by Dave). 2010-06-24 07:57:54 +00:00
Jonathan Earl Brassow
fb99185a60 update WHATS_NEW file with entry for simultaneous mirror image and
mirrored log image fault-handling fix.
2010-06-23 21:01:42 +00:00
Jonathan Earl Brassow
98f5d4ad4b Committing Taka's patch... He found a problem during
the failure of a device that contained both a image of
a mirror and an image of the mirrored log.  The order
of the handling of those faults was important (and
wrong), this patch corrects that.

Patch-From: Takahiro Yasui <tyasui@redhat.com>
2010-06-23 20:32:29 +00:00
Alasdair Kergon
1ed3c7cc63 post-release 2010-06-23 19:35:11 +00:00
Alasdair Kergon
d2cd8375ff pre-release 2010-06-23 17:48:41 +00:00
Alasdair Kergon
85691c0afb In some C++ standards, typeof is not reserved. 2010-06-23 17:03:14 +00:00
Peter Rajnoha
acc70bce86 Fix udev rules to handle spurious events properly.
We can use DM_UDEV_PRIMARY_SOURCE_FLAG to identify the spurious events
and use it as an indication that the device has already been activated before
(and hence we can find this property in udev database).

WARNING: This change requires udev startup script to preserve udev database
from initrd. All the information stored there during activation of devices
is important for the initial "udevadm trigger --action=add" call that is
used in udev startup script. If not done this way, udev startup script needs
to define DM_UDEV_PRIMARY_SOURCE_FLAG=1 property for any ADD events it uses.
2010-06-23 17:00:32 +00:00
Milan Broz
be2d9395c7 Fix clvmd init script status
- s/Active clustred VG/clustered VG/ (only LV can be active)

- print only active LVs (not all) in status command
(In the lvdisplay form /dev/vg/lv.)

For now, still use awk (already used in clustered_vgs).

https://bugzilla.redhat.com/show_bug.cgi?id=598495
2010-06-23 16:24:13 +00:00
Mike Snitzer
3ba8ffe741 Use more standard naming for PVs and VG in vgimportclone example. 2010-06-23 16:12:30 +00:00
Mike Snitzer
eba612b4c5 Cleanup sentences of the example provided in the vgimportclone man page
(motivated by a patch that Debian was carrying).
2010-06-23 14:15:55 +00:00
Jonathan Earl Brassow
42f7fd0590 The function that runs to compress a stacked mirror after
converting from 2-way to 3-way mirror (collapse_mirrored_lv)
was calling '_remove_mirror_images' with the 'remove_log'
parameter set.  When the code was put in to fix 599898 to
honor log parameters during conversion, this argument was
suddenly being honored.  Thus, when someone would convert from
a 2-way to 3-way mirror, the log would get removed.

'collapse_mirrored_lv' should not be calling '_remove_mirror_images'
with 'remove_log' set.
2010-06-23 13:57:26 +00:00
Zdenek Kabelac
7c15f34267 Fix typo: "INTERNAL ERROR" -> "INTERNAL_ERROR"
Author: Xinwei Hu
        xwhu at novell dot com
2010-06-23 12:54:46 +00:00
Alasdair Kergon
07ae1d4943 Add lv_path to reports to offer full /dev pathname. 2010-06-23 12:32:08 +00:00
Zdenek Kabelac
99cd5c7098 Fix typo: premitted -> permitted
Signed-off-by: Takahiro Yasui<tyasui@redhat.com>
2010-06-23 10:22:59 +00:00
Zdenek Kabelac
b6c8580d4d Better WHATS_NEW message - as we still have not fixed 'make exec_prefix' build 2010-06-23 10:21:00 +00:00
Milan Broz
f9e177d281 Fix "allocated" warning typo. 2010-06-22 21:10:53 +00:00
Dave Wysochanski
58f55600d0 Add device name to output of error messages in raw_read_mda_header().
It would be helpful if we had the device name when something like
a mda_header checksum error occurs.

Before:
./tools/lvm pvs -opv_name,vg_name,uuid,mda_count,pv_mda_count_ignored,vg_mda_count,vg_mda_count_ignored,vg_mda_copies
  Incorrect metadata area header checksum
  PV         VG      PV UUID                                #PMda #PMdaIgn #VMda #VMdaIgn #VMdaCps
  /dev/loop0 vgtest2 sVv26t-gjpb-Rcau-uBDO-Cx04-GbRR-6Ssq7e     2        0     4        0        4
  /dev/loop1 vgtest2 zXWStT-qE8F-mbkc-RfgH-aytv-mptF-Y5Ce09     2        0     4        0        4
  /dev/loop2         riCpK9-9G8r-LlIp-i2oh-mb3N-CUzk-u5YpuR     1        0     0        0        0
  /dev/loop3 vgtest  tQCUjm-rmyd-i92d-4eeE-UYBW-v1vQ-kRaA17     2        0     4        2        0
  /dev/loop4 vgtest  ZRvpeI-p8F1-ccVW-BBac-xhl1-aGXU-CbP0oo     2        2     4        2        0

After:
./tools/lvm pvs -opv_name,vg_name,uuid,mda_count,pv_mda_count_ignored,vg_mda_count,vg_mda_count_ignored,vg_mda_copies
  Incorrect metadata area header checksum on /dev/loop2 at offset 4096
  PV         VG      PV UUID                                #PMda #PMdaIgn #VMda #VMdaIgn #VMdaCps
  /dev/loop0 vgtest2 sVv26t-gjpb-Rcau-uBDO-Cx04-GbRR-6Ssq7e     2        0     4        0        4
  /dev/loop1 vgtest2 zXWStT-qE8F-mbkc-RfgH-aytv-mptF-Y5Ce09     2        0     4        0        4
  /dev/loop2         riCpK9-9G8r-LlIp-i2oh-mb3N-CUzk-u5YpuR     1        0     0        0        0
  /dev/loop3 vgtest  tQCUjm-rmyd-i92d-4eeE-UYBW-v1vQ-kRaA17     2        0     4        2        0
  /dev/loop4 vgtest  ZRvpeI-p8F1-ccVW-BBac-xhl1-aGXU-CbP0oo     2        2     4        2        0
2010-06-22 19:18:27 +00:00
Milan Broz
eac8de9bfb Use flexible data[] in cmirrord request to prevent abort in runtime size checks. 2010-06-22 13:11:29 +00:00
Zdenek Kabelac
21a5699f12 Adding section number for lvm.conf manpages. 2010-06-22 07:34:34 +00:00
Jonathan Earl Brassow
a7d355a28c Mirrors can be layered - as in the case of an converting 2-way
to 3-way mirror.  When conversion operations are performed on
these types of mirrors, log options can be confused/ignored.

In the case of a converting 3-way mirror, we have a top-level
2-way corelog mirror whose legs are 1) a 2-way disk-log mirror
and 2) a linear device.  If we wish to convert this 3-way mirror
to a 2-way mirror, the linear device is removed and the extra
top layer is eliminated.  If we also wished to convert the disk
log to a core log in the same step, ambiguity creeps in.  It is
somewhat obvious what the user wants - a 2-way mirror with a
corelog.  However, looking at the top level mirror before
compression, it seems that the mirror already has a core log.
This is why the operation seemed to fail.

This patch simply re-evaluates what mirrored_seg points to after
a compression and then considers the log argument.

This is a fix for bug 599898.
2010-06-21 16:12:33 +00:00