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

4953 Commits

Author SHA1 Message Date
Zdenek Kabelac
eb166dbc88 Add coverage test for partition table scanning 2010-10-20 15:14:13 +00:00
Petr Rockai
d95a85ca36 Implement dmeventd -R, allowing dmeventd to be restarted without losing
monitoring state.
2010-10-20 15:12:12 +00:00
Zdenek Kabelac
f7311db64f Fix strict-aliasing compile warning in partition table scanning 2010-10-20 15:07:30 +00:00
Petr Rockai
8f1ead4640 Revert some debug statements that slipped in with last checkin. 2010-10-20 14:51:18 +00:00
Petr Rockai
d28c8ccfbd Fix a deadlock in clvmd.
The signalling code (pthread_cond_signal/pthread_cond_wait) in the
pre_and_post_thread was using the wait mutex (see man pthread_cond_wait)
incorrectly, and this could cause clvmd to deadlock when timing was
right. Detailed explanation of the problem follows.

There is a single mutex around (L for Lock, U for Unlock), a signal (S) and a
wait (W). C for pthread_create. Time flows from left to right, each arrow is a
thread.

So first the "naive" scenario, with no mutex (PPT = pre_and_post_thread, MCT =
main clvmd thread; well actually the thread that does read_from_local_sock). I
will also use X, for a moment when MCT actually waits for something to happen
that PPT was supposed to do.


MCT -----C ------S--X-----S----X----------------------S------XXXXXXXXX
         |                everything OK up to this --> <-- point...
PPT       -----WWW-----WWWW------------------------------WWWWWWWWWWWWW

Ok, so pthread API actually does not let you use W/S like that. It goes out of
its way to tell you that you need a mutex to protect the W so that the above
cannot happen. *But* if you are creative and just lock around the W's and S's,
this happens:

MCT ----C-----LSU----X-----LSU----X------------LSU------XXXXXXX
        |
PPT      ---LWWWU-------LWWWWU-----------------------LWWWWWWWWW

Ooops. Nothing changed (the above is what actually was done by clvmd before
this satch). So let's do it differently, holding L locked *all* the time in
PPT, unless we are actually in W (this is something that the pthread API does
itself, see the man page).

MCT ----C-----LSU------X---LSU---X-----LLLLLLLSU----X----
        |                             (and they live happily ever after)
PPT     L---WWWWW---------WWWW----------------W----------

So W actually ensures that L is unlocked *atomically* together with entering
the wait. That means that unless PPT is actually waiting, it cannot be
signalled by MCT. So if MCT happens to signal it too soon (it wasn't waiting
yet), it (MCT) will be blocked on the mutex (L), until PPT is actually ready to
do something.
2010-10-20 14:46:45 +00:00
Petr Rockai
123b90ce05 Avoid an extraneous orphans unlock in vgextend --restoremissing. 2010-10-18 17:27:10 +00:00
Petr Rockai
06ee3f7259 Update WHATS_NEW. 2010-10-15 17:04:02 +00:00
Petr Rockai
a341cab721 Implement automatic snapshot extension with dmeventd, and add two new options
to lvm.conf in the activation section: 'snapshot_autoextend_threshold' and
'snapshot_autoextend_percent', that define how to handle automatic snapshot
extension. The former defines when the snapshot should be extended: when its
space usage exceeds this many percent. The latter defines how much extra space
should be allocated for the snapshot, in percent of its current size.
2010-10-15 16:28:14 +00:00
Petr Rockai
501d5786a9 Fixes for the devices/disable_after_error_count documentation. 2010-10-15 16:24:00 +00:00
Zdenek Kabelac
5f13cafaca Update 2010-10-15 09:55:37 +00:00
Zdenek Kabelac
d1ad03efce Speedup memory un/locking
Move the call of find_config_tree_node() from inner loop to outer
section of maps scanning.
2010-10-15 09:48:23 +00:00
Zdenek Kabelac
78725dd13a Fix linking order for liblvm2cmd
Reorder linked libraries so we better support --as-needed linker flag used
by some distributions (i.e. Gentoo).

Patch suggested by Diego Elio Pettenò <flameeyes <at> gmail.com>
2010-10-15 09:41:21 +00:00
Alasdair Kergon
57a8279442 Add --setuuid to dmsetup rename.
Add dm_task_set_newuuid to set uuid of mapped device post-creation. (pjones)
2010-10-15 01:10:27 +00:00
Jonathan Earl Brassow
2c33c8b80c Fix for bug 637936: killing both redundant logs causes deadlock
Problem:
When both legs of a mirrored log fail, neither the log nor the parent
mirror can proceed.  The repair code must be careful to replace the
log with an error target before operating on the parent - otherwise,
the parent can get stuck trying to suspend because it can't push through
any writes.  The steps to replace the log device with an error target
were incomplete and resulted in the replacement not happening at all!

The code originally had all the necessary logic to complete the
replacement task, but was pulled out in a effort to clean-up that
section of code, while fixing another bug:
<offending commit msg>
In addition, I added following three changes.

- Removed tmp_orphan_lvs handling procedure
  It seems that _delete_lv() can handle detached_log_lv properly
  without adding mirror legs in mirrored log to tmp_orphan_lvs.
  Therefore, I removed the procedure.

- Removed vg_write()/vg_commit()
  Metadata is saved by vg_write()/vg_commit() just after detached_log_lv
  is handled. Therefore, I removed vg_write()/vg_commit().
</offending commit msg>

http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c?cvsroot=lvm2&f=h#rev1.130

I've reverted the "clean-up" changes associated with that fix, but not what
that commit was actually fixing.

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>
2010-10-14 20:03:12 +00:00
Petr Rockai
e3e64c8ea4 Add a VERBOSE option to make check (make check VERBOSE=1). 2010-10-14 14:36:26 +00:00
Mike Snitzer
9443b5d4cd Convey need for snapshot-merge target in lvconvert error message and man
page.

Add ->target_name to segtype_handler to allow a more specific target
name to be returned based on the state of the segment.

Result of trying to merge a snapshot using a kernel that doesn't have
the snapshot-merge target:

Before:
# lvconvert --merge vg/snap
  Can't expand LV lv: snapshot target support missing from kernel?
  Failed to suspend origin lv

After:
# lvconvert --merge vg/snap
  Can't process LV lv: snapshot-merge target support missing from kernel?
  Failed to suspend origin lv
  Unable to merge LV "snap" into it's origin.
2010-10-13 21:26:37 +00:00
Petr Rockai
336d41d685 Tweak WHATS_NEW for devices/disable_after_error_count. 2010-10-13 15:50:34 +00:00
Petr Rockai
2db2b7f1ca Tweak the lvm.conf comment about devices/disable_after_error_count. 2010-10-13 15:45:18 +00:00
Petr Rockai
0c59a030c3 Update WHATS_NEW. 2010-10-13 15:41:52 +00:00
Petr Rockai
976b95d929 Limit repeated accesses to broken devices.
Signed-off-by: Takahiro Yasui <takahiro.yasui@hds.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>
2010-10-13 15:40:38 +00:00
Petr Rockai
d9583b8708 Update WHATS_NEW. 2010-10-13 13:53:25 +00:00
Petr Rockai
042312952c Give correct error message when creating a too-small snapshot (BZ 587063) 2010-10-13 13:52:53 +00:00
Zdenek Kabelac
7c9fd3ea84 Don't use floor() in _bitset_with_random_bits
Use _even_rand() function instead of floor() in _bitset_with_random_bits().
floor() function is missing in dietlibc (on architectures other than x86).
Moreover using floor() to clip rand results does not assure even result
distribution. _even_rand() uses integer arithmetic only and is designed to
return evenly distributed results.

> Looks OK to me. It took a while to decipher what is the exact meaning of
> the loop in _even_rand (to a non-pseudorandomness-expert) but I am
> fairly comfortable with it now. If I understand this correctly, it
> rejects numbers that come from an "incomplete" slice of the RAND_MAX
> space (considering the number space [0, RAND_MAX] is divided into some
> "max"-sized slices and at most a single smaller slice, between [n*max,
> RAND_MAX] for suitable n -- numbers from this last slice are discarded
> because they could distort the distribution in favour of smaller
> numbers).

Signed-off-by: Przemyslaw Iskra <sparky <at> pld-linux.org>
Reviewed-by: Petr Rockai <prockai <at> redhat.com>
2010-10-13 12:18:53 +00:00
Petr Rockai
bbdd3d40bd Update WHATS_NEW. 2010-10-13 10:37:27 +00:00
Petr Rockai
b8281ca1e4 Add a test for vgextend --restoremissing. 2010-10-13 10:36:26 +00:00
Petr Rockai
49908a9a33 Implement vgextend --restoremissing (BZ 537913), which makes it possible to
re-add a physical volume that has gone missing previously, due to a transient
device failure, without re-initialising it.

Signed-off-by: Petr Rockai <prockai@redhat.com>
Reviewed-by: Alasdair Kergon <agk@redhat.com>
2010-10-13 10:34:31 +00:00
Zdenek Kabelac
7dddc57bde Skip fsadm testing until proper installation rules are commited in.
For now testing of fsadm is broken - as it's executing fsadm from system
and not from the package thus we get wrong results.
2010-10-13 09:44:52 +00:00
Dave Wysochanski
f70468ce0b Fix lv_modules_dup segfault. 2010-10-12 17:09:23 +00:00
Petr Rockai
98351ffbd5 Make lvconvert respect --yes/--force in the inactive log conversion
prompt. Fixes BZs 642055, 621281. Patch by Taka.

Signed-off-by: Takahiro Yasui <tyasui@redhat.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>
2010-10-12 16:41:17 +00:00
Dave Wysochanski
8b86e09ffa update WHATS_NEW 2010-10-12 16:17:50 +00:00
Petr Rockai
1c45bab17f Add an option to skip some tests in make check (regex based, like T=): eg.
$ sudo make check S='mirror-basic|fsadm'
2010-10-12 16:17:25 +00:00
Petr Rockai
613a177a6f test-utils: Fix a slight bug in the dmeventd-already-running error message. 2010-10-12 16:13:43 +00:00
Dave Wysochanski
2eba846043 Refactor and add code for (lv) 'modules' get function. 2010-10-12 16:13:06 +00:00
Dave Wysochanski
d88090b0ae Refactor and add code for (lv) 'mirror_log' get function.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Reviewed-By: Petr Rockai <prockai@redhat.com>
2010-10-12 16:12:50 +00:00
Dave Wysochanski
40c6c80723 Refactor and add code for (lv) 'lv_kernel_{major|minor}' get functions.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Reviewed-By: Petr Rockai <prockai@redhat.com>
2010-10-12 16:12:33 +00:00
Dave Wysochanski
e27833fb9c Refactor and add code for (lv) 'convert_lv' get function.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Reviewed-By: Petr Rockai <prockai@redhat.com>
2010-10-12 16:12:18 +00:00
Dave Wysochanski
af579eccc3 Refactor and add code for (lv) 'move_pv' get function.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Reviewed-By: Petr Rockai <prockai@redhat.com>
2010-10-12 16:12:02 +00:00
Dave Wysochanski
29636f38e3 Refactor and add code for (lv) 'origin_size' get function.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Reviewed-By: Petr Rockai <prockai@redhat.com>
2010-10-12 16:11:48 +00:00
Dave Wysochanski
802e252b29 Refactor and add code for (lv) 'lv_path' get function. 2010-10-12 16:11:34 +00:00
Dave Wysochanski
a88a278698 Add some lv 'get' functions that require no refactoring.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Reviewed-By: Petr Rockai <prockai@redhat.com>
2010-10-12 16:11:20 +00:00
Zdenek Kabelac
6a4b036c2f Update script for fsadm testing 2010-10-08 15:03:21 +00:00
Zdenek Kabelac
bd79af9f05 Add support for noninterctive shell execution
Try to distinguish between the case of  using interactive shell and non
interactive running - different combinations of  '-y' and '-p' option
needs to be used for fsck.
2010-10-08 15:02:05 +00:00
Zdenek Kabelac
01143a9313 Fix usage of --yes flag for ReiserFS resize
Put 'dry' before resize command - using dry for echo had no use.
2010-10-08 15:00:06 +00:00
Zdenek Kabelac
55b94bf393 Fix detection of mounted filesystem.
Update the way how fsadm detects mounted filesystem.
With udev /dev/dm-XXX paths are now returned - but mount or /proc/mounts
prints names in form of /dev/mapper/vg-lv - so the match was not found.
Fixex RHBZ #638050.

Current solution uses same trick as mount and detects vg-lv name through
/sys where available - this should be reasonable safe.

Instead of calling mount without parameter to get actual mount table,
switch to use /proc/mounts directly.
2010-10-08 14:55:19 +00:00
Zdenek Kabelac
0d9ed7ade3 Fix assignment of default LVM variable
Fix a typo which does not work in case LVM_BINARY is empty string.
Using proper :-  syntax.
2010-10-08 14:49:25 +00:00
Zdenek Kabelac
685940c01c Support for passing --yes flag recursively. 2010-10-08 13:49:20 +00:00
Zdenek Kabelac
fd86754329 Correctly respect --dry-run option for fsadm
Fix missing 'dry' execution of lvresize - fixing problem where resize
command were 'dry-run' executed - but lvresize has been executed for real.

Also adapt code slightly to support better recursive execution of fsadm
through lvresize call.
2010-10-08 13:47:10 +00:00
Zdenek Kabelac
829fe014a5 Fix a serious bug in the behavior of fasdm tool when breaked.
Under certain conditions it was possible to break (^C) fsadm before actually
resizing filesystem, but lvresize which executed fsadm will think resize
was succesful and shrinks partitions with unresized filesystem on it.

Fix by returning error (1) for this case - this stops lvresize from futher
proceding in resize operation.
2010-10-08 12:35:56 +00:00
Zdenek Kabelac
3a6e5f36f9 Replace "can not" with "cannot" 2010-10-08 11:18:29 +00:00
Alasdair Kergon
f42b2d4bbf Allow CC to be overridden at build time (for 'scan-build make'). 2010-10-07 16:33:34 +00:00