1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
Commit Graph

2080 Commits

Author SHA1 Message Date
Alasdair Kergon
499091c061 pre-release 2011-08-19 16:31:00 +00:00
Alasdair Kergon
3250b38583 _ for static fns 2011-08-19 15:59:15 +00:00
Jonathan Earl Brassow
a2facf4ad4 Add ability to merge back a RAID1 image that has been split w/ --trackchanges
Argument layout is very similar to the merge command for snapshots.
2011-08-18 19:43:08 +00:00
Jonathan Earl Brassow
f439e65b64 Add support for m-way to n-way up-convert in RAID1 (no linear to n-way yet)
This patch adds the ability to upconvert a raid1 array - say from 2-way to
3-way.  It does not yet support upconverting linear to n-way.

The 'raid' device-mapper target allows for individual components (images) of
an array to be specified for rebuild.  This mechanism is used when adding
new images to the array so that the new images can be resync'ed while the
rest of the images in the array can remain 'in-sync'.  (There is no
mirror-on-mirror layering required.)
2011-08-18 19:41:21 +00:00
Jonathan Earl Brassow
6d04311efa Add the ability to split an image from the mirror and track changes.
~> lvconvert --splitmirrors 1 --trackchanges vg/lv
The '--trackchanges' option allows a user the ability to use an image of
a RAID1 array for the purposes of temporary read-only access.  The image
can be merged back into the array at a later time and only the blocks that
have changed in the array since the split will be resync'ed.  This
operation can be thought of as a partial split.  The image is never completely
extracted from the array, in that the array reserves the position the device
occupied and tracks the differences between the array and the split image via
a bitmap.  The image itself is rendered read-only and the name (<LV>_rimage_*)
cannot be changed.  The user can complete the split (permanently splitting the
image from the array) by re-issuing the 'lvconvert' command without the
'--trackchanges' argument and specifying the '--name' argument.
	~> lvconvert --splitmirrors 1 --name my_split vg/lv
Merging the tracked image back into the array is done with the '--merge'
option (included in a follow-on patch).
	~> lvconvert --merge vg/lv_rimage_<n>

The internal mechanics of this are relatively simple.  The 'raid' device-
mapper target allows for the specification of an empty slot in an array
via '- -'.  This is what will be used if a partial activation of an array
is ever required.  (It would also be possible to use 'error' targets in
place of the '- -'.)  If a RAID image is found to be both read-only and
visible, then it is considered separate from the array and '- -' is used
to hold it's position in the array.  So, all that needs to be done to
temporarily split an image from the array /and/ cause the kernel target's
bitmap to track (aka "mark") changes made is to make the specified image
visible and read-only.  To merge the device back into the array, the image
needs to be returned to the read/write state of the top-level LV and made
invisible.
2011-08-18 19:38:26 +00:00
Jonathan Earl Brassow
a324baf6a1 Add --splitmirrors support for RAID1 (1 image only)
Users already have the ability to split an image from an LV of "mirror"
segtype.  This patch extends that ability to LVs of "raid1" segtype.

This patch only allows a single image to be split off, however.  (The
"mirror" segtype allows an arbitrary number of images to be split off.
e.g.  4-way => 3-way/linear, 2-way/2-way, linear,3-way)
2011-08-18 19:34:18 +00:00
Jonathan Earl Brassow
63d32fb6a6 When down-converting RAID1, don't activate sub-lvs between suspend/resume
of top-level LV.

We can't activate sub-lv's that are being removed from a RAID1 LV while it
is suspended.  However, this is what was being used to have them show-up
so we could remove them.  'sync_local_dev_names' is a sufficient and
proper replacement and can be done after the top-level LV is resumed.
2011-08-18 19:31:33 +00:00
Alasdair Kergon
f1c2a5af58 Add -V as short form of --virtualsize in lvcreate. 2011-08-17 15:15:36 +00:00
Alasdair Kergon
c4323a0f4b makefile fixes 2011-08-12 13:03:35 +00:00
Alasdair Kergon
4536abf08a post-release 2011-08-12 02:34:08 +00:00
Alasdair Kergon
34ae78d203 pre-release 2011-08-12 01:34:11 +00:00
Alasdair Kergon
40dbaac892 pre-release fixes incl make distclean and configure --with-raid=none/shared 2011-08-11 19:18:17 +00:00
Jonathan Earl Brassow
4aebd52c4c Add ability to down-convert RAID1 arrays.
Also, add some simple RAID tests to testsuite.
2011-08-11 18:24:40 +00:00
Zdenek Kabelac
85ee8e10db Update udev rules to skip DM flags decoding for removed devices
Skip decoding of DM flags when device is removed.

We currently need DM flags only for add|change events. So forking
dmsetup process for removed devices is a waste of CPU time.

Udev is already quite slow, so make it just a tiny bit faster.
2011-08-11 17:55:29 +00:00
Zdenek Kabelac
cf98c05082 Add detect_internal_vg_cache_corruption to lvm.conf
Add config option to enable crc checking of VG structures.
Currently it's disabled by default.

For the internal test-suite this check it is enabled.

Note: In the case the internal error is detected, debug build with
compile option DEBUG_ENFORCE_POOL_LOCKING helps to catch the source
of the problem.
2011-08-11 17:46:13 +00:00
Zdenek Kabelac
031c986ea8 Lock memory for shared VG
Use debug pool locking functionality. So the command could check,
whether the memory in the pool has not been modified.

For lv_postoder() instead of unlocking and locking for every changed
struct status member do it once when entering and leaving function.
(mprotect would trap each such memory access).
Currently lv_postoder() does not modify other part of vg structure
then status flags of each LV with flags that are reverted back to
its original state after function exit.
2011-08-11 17:34:30 +00:00
Zdenek Kabelac
bb115a7a6c Cache and share generated VG structs
Extend vginfo cache with cached VG structure. So if the same metadata
are use, skip mda decoding in the case, the same data are in use.
This helps for operations like activation of all LVs in one VG,
where same data were decoded giving the same output result.

Patch adds 1-to-1 connection between volume_group and lvmcache_vginfo.
2011-08-11 17:24:23 +00:00
Peter Rajnoha
47d7f00e16 Fix possible format instance memory leaks and premature releases in _vg_read. 2011-08-11 16:31:40 +00:00
Peter Rajnoha
d183554c72 Suppress locking error messages in monitoring init scripts. 2011-08-11 15:27:46 +00:00
Milan Broz
fc438d74b7 Never ever use uninitialised descriptors if pipe() fails
(because of maximum open count fd exceeded or so).

Better return busy message, so even clients fail in more controlled way.

Without patch,  clvmd crashes with various strange backtraces
if under heavy load of connection requests.

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

(It still can OOM but that's different issue.)
2011-08-11 12:57:10 +00:00
Jonathan Earl Brassow
3041b72f06 Add dmeventd monitoring for RAID devices. 2011-08-11 05:00:20 +00:00
Jonathan Earl Brassow
ff58e019d8 Add RAID metadata devices to considered devices in _add_lv_to_dtree.
_add_lv_to_dtree must also add RAID metadata devices.
2011-08-11 04:18:17 +00:00
Jonathan Earl Brassow
66d9675559 Fix renaming of RAID logical volumes.
The function 'for_each_sub_lv', which rename uses, was not handling the
RAID metadata areas.  Thus, the metadata LVs were not being renamed.
2011-08-11 03:29:51 +00:00
Zdenek Kabelac
077a6755ff Replace free_vg with release_vg
Move the free_vg() to  vg.c  and replace free_vg  with release_vg
and make the _free_vg internal.

Patch is needed for sharing VG in vginfo cache so the release_vg function name
is a better fit here.
2011-08-10 20:25:29 +00:00
Zdenek Kabelac
789f9c55e5 Remove INCONSISTENT_VG flag
As this flag could not have been set by the current code - removing it.

Note: because of the wrong code logic this call:

lvmcache_update_vg(correct_vg, correct_vg->status & PRECOMMITTED &
			   (inconsistent ? INCONSISTENT_VG : 0));

had always passed '0' - now after flag removal it's passing
PRECOMMITTED flag in - this present functinal change in this patch.

To match the original functionality - 0 had to be always passed.
More testing is needed here.
2011-08-10 20:17:33 +00:00
Milan Broz
05960a0c55 If anything bad happens and unlocking fails
(here clvmd crashed in the middle of operation),
lock is not removed from cache - here is one example:

locking/cluster_locking.c:497       Locking VG V_vg_test UN (VG) (0x6)
locking/cluster_locking.c:113   Error writing data to clvmd: Broken pipe
locking/locking.c:399         <backtrace>
locking/locking.c:461         <backtrace>
  Internal error: Volume Group vg_test was not unlocked

Code should always remove lock info from lvmcache and update counters
on unlock, even if unlock fails.
2011-08-10 16:07:53 +00:00
Milan Broz
5ddda8cd56 Initialise clvmd locks before lvm context to avoid open descriptor leaks.
(At least /dev/mapper/control is open after lvm context init.)
2011-08-10 11:00:32 +00:00
Milan Broz
7cf607705b Remove obsoleted GULM clvmd cluster locking support. 2011-08-09 18:11:00 +00:00
Peter Rajnoha
cf9927697b Suppress low-level locking errors and warnings while using --sysinit.
Today, we use "suppress_messages" flag (set internally in init_locking fn based
on 'ignorelockingfailure() && getenv("LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES")'.
This way, we can suppress high level messages like "File-based locking
initialisation failed" or "Internal cluster locking initialisation failed".

However, each locking has its own sequence of initialization steps and these
could log some errors as well. It's quite misleading for the user to see such
errors and warnings if the "--sysinit" is used (and so the ignorelockingfailure
&& LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES environment variable). Errors and
warnings from these intermediary steps should be suppressed as well if requested.

This patch propagates the "suppress_messages" flag deeper into locking init
functions. I've also added these flags for other locking types for consistency,
though it's not actually used for no_locking and readonly_locking.
2011-08-09 11:44:57 +00:00
Zdenek Kabelac
425862fb95 Remove unused inconsistent_seqno
Last usage was removed in Petr's commit related to VG mda repair fix
where relaxed check starts to ignore inconsistencies coming from
PVs that are marked MISSING - thus removing unused variable.
2011-08-04 15:18:10 +00:00
Zdenek Kabelac
586f310618 Remove meaningless const type qualifiers on cast type
Static analyzis noticed we do not really need them - so removing.
2011-08-04 14:30:51 +00:00
Zdenek Kabelac
5dfa0945cb Minor memory leak fix
Defer the test of the function return value after the string memory is released.
Otherwise in this error path the string would present memory leak.
(Thought in this case we are already out of memory...)
2011-08-04 12:40:24 +00:00
Zdenek Kabelac
fb2f985dfe Add test for fcntl error in singlenode client code.
Static analyzer noticed this check could be handy.
2011-08-04 12:13:50 +00:00
Zdenek Kabelac
765918a528 Remove --force option from lvrename manpage. 2011-08-04 10:14:42 +00:00
Zdenek Kabelac
33d6fe9bd0 Add missing new line in lvrename help text. 2011-08-04 10:12:44 +00:00
Jonathan Earl Brassow
cac52ca4ce Add basic RAID segment type(s) support.
Implementation described in doc/lvm2-raid.txt.

Basic support includes:
- ability to create RAID 1/4/5/6 arrays
- ability to delete RAID arrays
- ability to display RAID arrays
Notable missing features (not included in this patch):
- ability to clean-up/repair failures
- ability to convert RAID segment types
- ability to monitor RAID segment types
2011-08-02 22:07:20 +00:00
Peter Rajnoha
c212019f3a Change DEFAULT_UDEV_SYNC to 1 so udev_sync is used even without any config.
This should be set by default! Normally we have "activation/udev_sync = 1"
in lvm.conf (example.conf.in). But if we use lvm2 without any config file
(or without a definition within '--config' option) the DEFAULT_UDEV_SYNC
is used instead. Together with verify_udev_operations=0 (when we rely on
udev fully), this can cause races as the node could be missing when needed.

(See also https://bugzilla.redhat.com/show_bug.cgi?id=723144)
2011-08-02 10:49:57 +00:00
Peter Rajnoha
395d204d9c Configure and makefile changes for newly added systemd unit files. 2011-07-28 12:57:26 +00:00
Zdenek Kabelac
830df40482 Compare also file size to detect changed config file
Clvmd detects modifed config file before it takes lv_lock.
If the config file is changed rapidly - the change was ignored within
a seocnd ranged.  This patch adds also compare of file size.
So change like some flag for 0 to 1 would pass unnoticed - but
it's quick fix for failing test suite.

FIXME: Implement inotify solution.
2011-07-21 13:23:48 +00:00
Alasdair Kergon
11853cd95a post-release 2011-07-08 19:57:32 +00:00
Alasdair Kergon
9f65343fa6 pre-release 2011-07-08 19:19:44 +00:00
Alasdair Kergon
1485b6fc93 Ignore activation/verify_udev_operations if dm kernel driver vsn < 4.18. 2011-07-08 16:49:04 +00:00
Milan Broz
d8ff1b1efb Fix warning for pvcreate over MD linear.
If MD linear device has set rounding (overload chunk size attribute),
the pvcreate command prints this warning:

  /dev/md0 sysfs attr level not in expected format: linear
2011-07-08 15:53:59 +00:00
Alasdair Kergon
c9ff339c23 Move snapshot removal activation logic into lib/activate. 2011-07-08 12:49:50 +00:00
Alasdair Kergon
f5f3defc02 Cope with a PV only discovered missing when creating deptree. 2011-07-06 00:29:44 +00:00
Alasdair Kergon
86b15c7c90 Abort operation if dm_tree_node_add_target_area fails. 2011-07-05 23:10:14 +00:00
Alasdair Kergon
2243718fae Add framework for validation of ioctls. Doesn't do any checks yet.
dmsetup --checks
libdevmapper: dm_task_enable_checks()
lvm.conf: activation/checks=1
2011-07-01 14:09:19 +00:00
Alasdair Kergon
0f2a4ca2b5 When suspending, automatically preload newly-visible existing LVs
Let's find out if this makes things better or worse overall...
2011-06-30 18:25:18 +00:00
Zdenek Kabelac
812e10ac60 Report internal error when parameters are missing on table load
When some target is passing empty parameters to some dm target,
report this as an internal error to better catch some broken
table construction (some mirror conversions seem to be doing
this for now).
2011-06-30 09:24:58 +00:00
Alasdair Kergon
181b1f9fec teardown stray filesystems too 2011-06-30 09:15:53 +00:00