Patch fixes generation of coverage files for dmeventd and adds support for clvmd.
Path names are stripped, so the the html looks better.
Frames 'previews' is enabled for generated pages.
Using top_srcdir was wrong here - though we still can't easily use builddir.
Requiers using shell variables before execution of binaries build outside
of srcdir.
Milan Broz [Wed, 31 Mar 2010 17:23:56 +0000 (17:23 +0000)]
Always use blocking lock for VGs and orphan locks.
Because we have now strong rule for lock ordering:
- VG locks must be taken in alphabetical order
- ORPHAN locks must be the last
vgs_locked() is now not needed.
This fixes problem with orphan locking, e.g.
vgremove VG1 | vgremove VG2
lock(VG1) | lock(VG2)
lock(ORPHAN) | lock(ORPHAN) -> fail, non-blocking
Milan Broz [Wed, 31 Mar 2010 17:20:44 +0000 (17:20 +0000)]
Remove vg_validate call when parsing cached metadata.
vg_validate call is an adept to optimisation, it is very
ineeficient and slow.
Anyway, we should call it only before writing data to disk.
The call in lvmcache was just temporary validation,
we realy do not need to revalidate cached metadata
every time.
(Actually, I added that there just to prove that cache works
properly and forgot to remove it.)
Patch removes it from lvmcache completely, this can hit only
internal bug in export function (and this bug must
be detected in any vg_write call anyway before).
Mikulas Patocka [Wed, 31 Mar 2010 12:01:49 +0000 (12:01 +0000)]
Don't kill the parent if debugging.
If dmeventd runs with -d flag, it doesn't fork into backgroud.
The command kill(getppid(), SIGTERM) attempts to kill the parent dmeventd
process, however, if there is no parent, it kills whatever process spawned
dmeventd. In case of debugging with gdb, the parent is gdb, thus
kill(getppid(), SIGTERM) kills the debugger.
We only need one extent for the mirror log. So, when specifying
the devices on which to place the individual mirror parts, we can
specify the log devices as $dev:x instead of $dev:x-y.
For the mirror repair tests, we should use --ignoremonitoring because
we are running the repair manually. If we don't ignore, then dmeventd
and the manually run repair can collide. (We should still get clean
results in such a case, but it makes it harder to validate the test
results.)
Zdenek Kabelac [Tue, 30 Mar 2010 14:41:23 +0000 (14:41 +0000)]
Update memlock
Code moves initilization of stats values to _memlock_maps().
For dmeventd we need to use mlockall() - so avoid reading config value
and go with _use_mlockall code path.
Patch assumes dmeventd uses C locales!
Patch needs the call or memlock_inc_daemon() before memlock_inc()
(which is our common use case).
Some minor code cleanup patch for _un/_lock_mem_if_needed().
Zdenek Kabelac [Tue, 30 Mar 2010 14:37:28 +0000 (14:37 +0000)]
Fix resouce leak in error path
If the error path of _register_for_event() calls _free_thread_status()
_lib_put() call is missing.
To make thing simpler move this _lib_put() into common error path code.
Zdenek Kabelac [Tue, 30 Mar 2010 14:35:40 +0000 (14:35 +0000)]
Remove mlockall() form dmeventd
As the header file <sys/mman.h> was not included in dmeventd.c
thus missed definition of MCL_CURRENT so this patch only makes
it obvious we were not locking memory here.
This patch has no functional change.
Later part of this patch set handles mlockall() via memlock_inc_daemon().
Petr Rockai [Mon, 29 Mar 2010 16:50:27 +0000 (16:50 +0000)]
Work around a problem in t-mirror-lvconvert: different PV order on the
commandline of lvconvert can lead to allocation failures even if enough space
is available. A separate testcase demonstrating the problem will follow.
Mike Snitzer [Mon, 29 Mar 2010 16:09:40 +0000 (16:09 +0000)]
Do not allow {vg|lv}change --ignoremonitoring if on clustered VG.
clvmd does not propagate DMEVENTD_MONITOR_IGNORE.
Update get_activation_monitoring_mode() to check if the VG that the
LV is being activated in is clustered. If so, skip it.
Any get_activation_monitoring_mode() error will cause the associated LV
(or VG) to be skipped during activation. Both vgchange_single() and
lvchange_single(), which call get_activation_monitoring_mode(), are
called by their respective process_each_..() method.
Zdenek Kabelac [Mon, 29 Mar 2010 14:22:00 +0000 (14:22 +0000)]
Avoid modification of .in files outside man directory.
(i.e. this rule actually tried to change ../make.tmpl in some cases and
left this file completely broken)
Zdenek Kabelac [Mon, 29 Mar 2010 14:11:17 +0000 (14:11 +0000)]
Update cflow file generation - support build dir and use $(top_srcdir)
to obtain sources. Create make.tmpl target for
simplier generation of cflow files with the help of
CFLOW_LIST, CFLOW_LIST_TARGET, CFLOW_TARGET.
Still cflow usage is not perfect.
Zdenek Kabelac [Mon, 29 Mar 2010 14:09:25 +0000 (14:09 +0000)]
distclean fixes
Move daemons/ and lib/ subtargets to their Makefiles so we don't get
double cleanup error during execution of distclean target.
Instead of duplicating clean target inside distclean target,
just use it as a subtarget and avoid add duplicating code.
Add ability to create mirrored logs for mirror LVs.
This check-in enables the 'mirrored' log type. It can be specified
by using the '--mirrorlog' option as follows:
#> lvcreate -m1 --mirrorlog mirrored -L 5G -n lv vg
I've also included a couple updates to the testsuite. These updates
include tests for the new log type, and some fixes to some of the
*lvconvert* tests.
Mike Snitzer [Fri, 26 Mar 2010 15:40:13 +0000 (15:40 +0000)]
Fix clvmd cluster propagation of dmeventd monitoring mode.
clvmd's do_lock_lv() already properly controls dmeventd monitoring based
on LCK_DMEVENTD_MONITOR_MODE in lock_flags -- though one small fix was
needed for this to work: _lock_for_cluster() must treat
dmeventd_monitor_mode()'s return as a tri-state value.
Also cleanup do_lock_lv() to:
- explicitly init_dmeventd_monitor() based on LCK_DMEVENTD_MONITOR_MODE
- no longer reset init_dmeventd_monitor() to default at the end of
do_lock_lv() -- it is unnecessary
Alasdair Kergon [Thu, 25 Mar 2010 02:31:48 +0000 (02:31 +0000)]
Introduce pv_area_used into allocation algorithm and add debug messages.
This is the next preparatory step towards better --alloc anywhere
support and is not intended to break anything that currently works so
please report any problems - segfaults, bogus data in the new debug
messages, or if the code now chooses bizarre allocation layouts.
Mike Snitzer [Tue, 23 Mar 2010 22:30:18 +0000 (22:30 +0000)]
Improve activation monitoring option processing
. Add "monitoring" option to "activation" section of lvm.conf
. Have clvmd consult the lvm.conf "activation/monitoring" too.
. Introduce toollib.c:get_activation_monitoring_mode().
. Error out when both --monitor and --ignoremonitoring are provided.
. Add --monitor and --ignoremonitoring support to lvcreate. Update
lvcreate man page accordingly.
. Clarify that '--monitor' controls the start and stop of monitoring in
the {vg,lv}change man pages.
Peter Rajnoha [Tue, 23 Mar 2010 14:43:18 +0000 (14:43 +0000)]
Strictly require libudev if udev_sync is used.
This prevents some confusion when libudev was not found so udev_sync was disabled
automatically. Configure was successful though giving only a tiny warning.
Also, if "dmsetup udevcreatecookie" is used, never return 0x000000 as a result if
udev is not running and keep the output blank.
Peter Rajnoha [Tue, 23 Mar 2010 14:38:37 +0000 (14:38 +0000)]
Add support for ioctl's DM_UEVENT_GENERATED_FLAG.
We need to know whether we should wait for any uevent or not when
using udev_sync. A kernel patch was posted recently that changed the
way uevents are sent on dm device resume - it is sent only if the
device has been suspended before. There's also a new DM_UEVENT_GENERATED_FLAG
in the ioctl to notify userspace whether the event was generated.
If the uevent was not generated (e.g. the situation where the device is
*not* suspended and we call a resume), we just call dm_udev_complete
explicitly from within libdevmapper itself to prevent infinite waiting
while trying to synchronise with udev processing.
Mike Snitzer [Sat, 20 Mar 2010 03:44:04 +0000 (03:44 +0000)]
Don't allow resizing of internal logical volumes.
Prevent lvresize from being able to resize internal LVs: mirror legs
(*_mimage_*), mirror log (*_mlog), snapshot placeholder LVs (snapshot*)
and others. Resizing these would leads to unexpected metadata and
sometimes crashes (in case of growing snapshot*).
Dave Wysochanski [Thu, 18 Mar 2010 17:29:12 +0000 (17:29 +0000)]
Avoid scanning all pvs in the system if operating on a device with mdas.
When we pv_read() a device that has an orphan vgname, we might need to scan
the system to be sure this is true. However, if the PV has mdas, there's
no way possible for it to have an orphan vgname unless it is a true orphan.
Some areas of the code were optimized to take advantage of this fact, while
others were not (we would still do the expensive scan if a device had mdas
but had an orphan VG).
This patch unifies the code so that every place we are operating on such
a PV, we skip the expensive scan if there are mdas.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com> Acked-by: Petr Rockai <prockai@redhat.com> Acked-by: Alasdair G Kergon <agk@redhat.com>
Milan Broz [Wed, 17 Mar 2010 14:44:18 +0000 (14:44 +0000)]
Fix pvcreate device check.
If user try to vgcreate or vgextend non-existent VG,
these messages appears:
# vgcreate xxx /dev/xxx
Internal error: Volume Group xxx was not unlocked
Device /dev/xxx not found (or ignored by filtering).
Unable to add physical volume '/dev/xxx' to volume group 'xxx'.
Internal error: Attempt to unlock unlocked VG xxx.
(the same with existing VG and non-existing PV & vgextend)
# vgextend vg_test /dev/xxx
...
It is caused because code tries to "refresh" cache if
md filter is switched on using cache destroy.
But we can change filters and rescan even without this
machinery now, just use refresh_filters
(and reset md filter afterwards).
(Patch also discovers cache alias bug in vgsplit test,
fix it by using better filter line.)