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

2127 Commits

Author SHA1 Message Date
Zdenek Kabelac
f1f42ab732 Add all exclusive locks to clvmd restart option args
Fix bug when only every even lock has been passed.

Warning: currently -E causes clvmd to exit with usage text being printed.
2011-09-22 09:45:24 +00:00
Milan Broz
f5d39ec97a Always sent the whole command header in restart/reload clvmd commands.
(Newly added check catch this as invalid packet.)

(N.B. that code is so fragile that it need full rewrite soon:-)
2011-09-21 13:40:46 +00:00
Zdenek Kabelac
d9bba4f16f Check for failing 'stat' and skip this loop iteration
(since data in statbuf are invalid).

Check whether sysconf managed to find _SC_PAGESIZE.

Report at least debug warning about failing unlink
(logging scheme here seems to be a different then in lvm).

Duplicate terminal FDs and use similar code as is made in clvmd
and cleanup warns about missing open/close tests.
FIXME: Looks like we already have 3 instancies of the same code in lvm repo.
2011-09-21 10:42:53 +00:00
Zdenek Kabelac
da1350d420 Add missing log_error() to lvresize command when fsadm tool fails
Also add test case
2011-09-21 10:39:47 +00:00
Zdenek Kabelac
8f8c5580fd Add support for DM_DEV_DIR
Follow other commands support this directory setting.
Useful for test suite.
2011-09-19 19:36:52 +00:00
Zdenek Kabelac
ce840163c0 Revert patch
Caller of exec must report log_error when rstatus is passed.
2011-09-19 18:38:43 +00:00
Zdenek Kabelac
4eeff46bf2 Use log_error instead of log_verbose when executed command fails 2011-09-19 14:54:23 +00:00
Zdenek Kabelac
13e3c25ade Add support for non /dev devices
Since test suite is not using /dev - add support for such dirs into fsadm.
2011-09-19 14:52:33 +00:00
Zdenek Kabelac
53c09bce42 Support different PATH setting
When fsadm is test - it needs to execute lvm and fsadm from non-standard path
setting.   So adding a support in fsadm script when user set LVM_BINARY, then
the lvm command invoced from fsadm will have the same PATH setting as before
entering  fsadm command.

Needed for testing.
2011-09-19 13:51:09 +00:00
Zdenek Kabelac
d2010960c9 Surround all executed commands with quotes
In case someone would use filename paths with spaces when changing
this script surround commands with '"'.

With default settings there is no change in behavior.
2011-09-19 13:47:37 +00:00
Zdenek Kabelac
dd96ceda43 Fix missing '$' in test 2011-09-19 13:43:50 +00:00
Zdenek Kabelac
5f3f06db66 Move debug message
so it does not look like we are executing command in the middle of
critical_section in log trace.
2011-09-19 12:48:02 +00:00
Milan Broz
63b8ed7c37 Fix clvmd processing of invalid request on local socket. (rommer)
Code now detects small packet and wrong arglen and reply with
error intead of infinite loop.

https://bugzilla.redhat.com/show_bug.cgi?id=738484
2011-09-16 14:40:06 +00:00
Zdenek Kabelac
bf93b4ddfe Fix command line option decoding
LVM has huge set of options now - it's approaching 60 short-arg less options
and we get interesting case of misdetection for 'merge' option which has been
put into the middle of options with 'short_arg' - thus certainly past 65. (ASCII 'A').

To avoid confusion of short_arg with long_opt number - add  '128' to all such
non-short-arg options.
2011-09-16 12:10:02 +00:00
Zdenek Kabelac
b91e3e9083 Update 2011-09-16 12:01:48 +00:00
Petr Rockai
22ff84ca31 Update WHATS_NEW. 2011-09-16 10:02:14 +00:00
Petr Rockai
fd84d71122 Update WHATS_NEW. 2011-09-15 20:01:21 +00:00
Milan Broz
b18e1fd50e Fix possible overflow of size if %FREE or %VG is used.
https://bugzilla.redhat.com/show_bug.cgi?id=737087
2011-09-15 15:26:40 +00:00
Milan Broz
89880365fc Fix vgchange activation of snapshot with virtual origin. 2011-09-14 18:20:03 +00:00
Milan Broz
c81a322337 Activate virtual snapshot origin exclusively (only on local node in cluster). 2011-09-14 14:20:16 +00:00
Zdenek Kabelac
886d005616 LVM_WRITE and LVM_READ are 64bit constants
Revert John patch, which fixed only 1 place where ~LVM_WRITE was in use and
convert ommited LVM_READ/WRITE flags to 64bit constants as well.
(Since both 'status' flags for LV and VG are 64bit.)
2011-09-14 09:57:35 +00:00
Jonathan Earl Brassow
9cb27929e9 Fix for bug 734252 - problem up converting striped mirror after image failure
lv_mirror_count was not able to handle mirrors of stripes properly.  When a
failed device is removed, the MIRRORED status flag is removed from the LV
conditionally based on the results of lv_mirror_count.  However, lv_mirror_count
trusted the MIRRORED flag - thinking any such LV must be mirrored.  It would
happily assign first_seg(lv)->area_count as the number of mirrors, but when
a mirrored striped LV was reduced to a simple striped LV area_count would be
the number of /stripes/ not the number of /mirrors/.  A result higher than 1
would be returned from lv_mirror_count, the MIRRORED flag would not be cleared,
and the LV would fail to be up-converted properly in lvconvert_mirrors_aux
because of it.
2011-09-14 02:45:36 +00:00
Jonathan Earl Brassow
46f0efbfce Fix bug 733400 - Mirror down conversion when specifying the secondary leg is broke
The operation of deactivating the residual error target LV after removing a
mirror layer can cause a "device in-use" conflict with udev.  Giving udev a
poke before calling deactivate_lv eliminates the conflict.  The stick used
to poke udev is 'sync_local_dev_names'.
2011-09-13 21:13:33 +00:00
Jonathan Earl Brassow
c94c47abd7 Fix for bug 737200 - Can't create mirrored-log mirror on a VG with small extents
Kernel requires a mirror to be at least 1 region large.  So,
if our mirror log is itself a mirror, it must be at least
1 region large.  This restriction may not be necessary for
non-mirrored logs, but we apply the rule anyway.

(The other option is to make the region size of the log
mirror smaller than the mirror it is acting as a log for,
but that really complicates things.  It's much easier to
keep the region_size the same for both.)
2011-09-13 18:42:57 +00:00
Jonathan Earl Brassow
0c89ef513a Changing RAID status flags to 64-bit broke some binary flag operations.
LVM_WRITE is a 32-bit flag.  Now that RAID[_IMAGE|_META] are 64-bit,
and'ing a RAID LV's status against LVM_WRITE can reset the higher order
flags.

A similar thing will affect thinp flags if not careful.
2011-09-13 16:33:21 +00:00
Jonathan Earl Brassow
cc9dc919e6 Fix for bug 737125 - unable to create mirror on 1K extent size VG
_alloc_init calculates the number of necessary log extents via
'mirror_log_extents'.  'mirror_log_extents' takes 3 arguments: region_size,
pe_size, and size of the mirror LV.  Unfortunately, _alloc_init is guessing at
the mirror size by using 'ah->new_extents / ah->area_multiple' - the number of
extents that the mirror images have.  However, this is /always/ wrong when
allocating the log separately.  Further, the log is always allocated separately
unless we are up-converting the mirror at the same time.  It was by luck alone
that a default value of '1' reflects what we want in most cases.

In order to get a decent value computed, we need to pass in the 'lv' argument
to allocate_extents.  This would normally imply a desire for cling/contiguous
allocation to the given LV, but since we are not allocating any parallel
extents and only log extents, it works fine.
2011-09-13 14:37:48 +00:00
Jonathan Earl Brassow
6d0aa801a0 Fix for bug 733114.
When an image is split from a 2-way mirror, the original mirror is converted to
a linear device.  To do this, the top "layer" must be removed.  The segments
are transferred from the sub-lv to the top-level LV and the link is severed.
The former sub-lv - having its segments transferred - now contains a temporary
error target.

When the original LV is resumed, the old sub-lv that now contains an error
segment is activated and scanned.  This is what causes the I/O error messages.
There are three ways to fix this problem:

1) Do not set the sub-lv which contains the error target as "visible" before
suspending the original LV.  This way, when the original is resumed, the sub-lv
device node is not created and it is not scanned - avoiding the error messages.
 The problem with this approach is that if the machine crashes after the
resume, it leaves the *hidden* LV in place and the user has a more difficult
time noticing that it needs to be cleaned up.  Thus, this type of processing is
frowned upon.

2) Do like _remove_mirror_images does and suspend the original, then suspend
the sub-lv (the error target), then resume the sub-lv, and finally resume the
original LV.  This seems like extra pointless operations to me, but it does not
produce the error message (although, I'm not sure why) and it allows us to
leave the visible flag in place.

3) Flag the sub-lv (error target) with a "do not scan" flag.  This seems like
the cleanest approach, but I have been unable to find the method for doing
this.  LVs get tagged in such a way by _get_udev_flags, but in this case the
resume of the original LV also resumes the error target LV without running it
through _get_udev_flags (likely because they are no longer linked).  Could
there be something wrong in resume_lv?

Option #2 was chosen to fix this bug, but it seems like more of a workaround
for now.
2011-09-13 13:59:19 +00:00
Alasdair Kergon
52e3f9dd5e Add 7th lv_attr char to show the related kernel target.
Add thin volume types to lv_attr.
2011-09-08 20:55:39 +00:00
Alasdair Kergon
1abaaab1bc Terminate pv_attr field correctly. (2.02.86) 2011-09-07 13:42:00 +00:00
Zdenek Kabelac
8010df8b8a Fix typo 2011-09-07 09:48:49 +00:00
Zdenek Kabelac
59cf7b6f6c Improve man page style
Only reformat man pages.
2011-09-07 08:50:35 +00:00
Zdenek Kabelac
4144938350 Support break for vgchange and vgrefresh operation
Allow to break some lengthy vgchange and vgrefresh operation.
2011-09-07 08:41:47 +00:00
Zdenek Kabelac
f32b76a193 Minor change for pv_create api
Switch int to unsigned type.
2011-09-07 08:34:21 +00:00
Zdenek Kabelac
77f771ebc3 Replace char class :space: with explicit chars
Some major distributions are still using 'mawk' and they are not using
the latest version - we end here with hidden dependency on the latest
version of mawk (1.3.4) while i.e. Debian Lenny seems to stay with 1.3.3.
So we end with completely broken  vgimportclone script on such system.

We would need to check for proper support of :space: and abort build if
it doesn't work or simplier replace [:space:] with [ \t] which seems
sufficient to make it work (as can be seen in this patch)

A better fix would be to use command line parameter override - leaving
as FIXME comment.

This patch makes t-vgimportclone.sh test passing on Lenny.
2011-09-07 08:31:16 +00:00
Alasdair Kergon
2ef5b7cca6 Start using 64-bit status flags - most of the code already handles them.
tdata -> tpool
remove commented out definitions from metadata.h
formatting clean-ups
2011-09-06 18:49:31 +00:00
Zdenek Kabelac
e9047f4f9c Detect sscanf recovering_region input error
Missing check for sscanf found by static analyzer.
2011-09-06 18:24:27 +00:00
Zdenek Kabelac
b647de3e07 Fix memory leak of allocated bitmap in error path
Found by static analyzer.
2011-09-06 18:15:43 +00:00
Zdenek Kabelac
7b83071708 Log unlink() error 2011-09-06 18:11:21 +00:00
Alasdair Kergon
58366c058e Remove incorrect requirement for -j or -m from lvchange error message. 2011-09-05 12:54:29 +00:00
Jonathan Earl Brassow
da23255cc9 Fix for bug 732142: Unsafe table load during mirror image split
There was a bad sequence:
*) Make changes to LV layout to split images (e.g. 4-way -> 2-way/2-way)
1) vg_write, suspend_lv(original_mirror), vg_commit
2) activate_lv(newly_split_lv)
3) resume_lv(original_mirror)

Step #2 is not allowed.  However, without it, the resume of the original
mirror will also resume its former sub-LVs - making it impossible to
activate the newly split LV due to the changes in layering, pointers, and
names that had already been made.  Additionally, the resume or the original
brings the sub-lv's online with names that differ from the metadata on disk -
also a no-no.  Thus, the split must be done in stages such that the active LVs
always reflect what is in the committed LVM metadata.

First, alter the original mirror by releasing the images.  The images are made
visible and independent as an intermediate stage.  (This way, we can have
consistency between LVM metadata and active LVs.)  The second stage collects
the recently split LVs, deactivates them, forms them into a mirror if necessary,
and then activates them.  It is a bit of a circuitous method, but it is the only
way to split a mirror from a mirror and obey these general rules:
1) Never [de]activate sub-lvs when the top-level LV is suspended
2) Avoid having active LVs that differ from the description in the LVM metadata

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
2011-09-01 19:22:11 +00:00
Zdenek Kabelac
3caa77f831 Use size_t return type
Since these function returns buffer size - use size_t type for them.
2011-09-01 10:25:22 +00:00
Petr Rockai
c0de52fd2d Mention --enable-lvmetad in WHATS_NEW. 2011-08-31 12:47:59 +00:00
Zdenek Kabelac
68e89ab2d2 Update for resource leak 2011-08-31 08:23:33 +00:00
Peter Rajnoha
d35188058b Directly allocate buffer memory in a pvck scan instead of using a mempool.
There's a very high memory usage when calling _pv_analyse_mda_raw (e.g. while
executing pvck) that can end up with "out of memory".

_pv_analyse_mda_raw scans for metadata in the MDA, iteratively increasing the
size to scan with SECTOR_SIZE until we find a probable config section or we're
at the edge of the metadata area. However, when using a memory pool, we're also
iteratively chasing for bigger and bigger mempool chunk which can't be found
and so we're always allocating a new one, consuming more and more memory...

This patch just changes the mempool to direct memory allocation in this
problematic part of the code.
2011-08-29 13:37:36 +00:00
Alasdair Kergon
f9b92564a7 Fix raid shared lib segtype registration (2.02.87). 2011-08-24 13:41:46 +00:00
Alasdair Kergon
c544c6b07e . 2011-08-19 23:01:20 +00:00
Alasdair Kergon
2df01a9d3f post-release 2011-08-19 19:42:39 +00:00
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