Petr Rockai [Wed, 17 Nov 2010 22:26:42 +0000 (22:26 +0000)]
The _free_vg that is created as a placeholder when reporting segments in pvs
was lacking the (vgmem) pool. We now create that pool. There is at least one
more such VG (_dummy_vg) which is pool-less. I am not sure what is the right
way to go about this, but this is currently necessary to fix a segfault
introduced by using vgmem in the reporter in Dave's lvseg lvm2app patches.
Petr Rockai [Wed, 17 Nov 2010 19:15:10 +0000 (19:15 +0000)]
Add generic infrastructure to internal library to 'set' a property.
Similar to 'get' property internal functions.
Add specific 'set' function for vg_mda_copies.
Signed-off-by: Dave Wysochanski <wysochanski@pobox.com> Reviewed-by: Petr Rockai <prockai@redhat.com>
Alasdair Kergon [Thu, 11 Nov 2010 17:29:05 +0000 (17:29 +0000)]
Support repetition of --addtag and --deltag arguments.
Add infrastructure for specific cmdline arguments to be repeated in groups.
Split the_args cmdline arguments and values into arg_props and arg_values.
Zdenek Kabelac [Wed, 10 Nov 2010 16:14:02 +0000 (16:14 +0000)]
fsadm fix for downsize of unmounted fs
Fix for the last commit as $MOUNTED is not only used as bool flag,
but also store mounted location for remount - so parsing output
from mount differently then from /proc/mounts.
Prefix calls of 'tunefs' tools with LANG=C to be sure we always do get
some nonlocalized strings.
Avoid using forced 'resize2fs' for cleanly unmounted filesystems and
run regular fsck -f for this case as required by resize2fs.
'fsadm check' uses date difference for extX filesystems between
the last mount and last check of 'fsck -f' execution and if the mount
was later run 'fsck' with -f so resize2fs is happy and user does not
need to pass '-f' flag.
Zdenek Kabelac [Wed, 10 Nov 2010 10:03:07 +0000 (10:03 +0000)]
Scan also 'mount' output for mounted filesystem.
As util-linux package seems to give all the time different names,
try harder to figure out, where is the given lv possible mounted
and scan /proc/mounts and if not found there, test also 'mount' output.
/dev/dm-xxx
/dev/mapper/vg-lv
/dev/vg/lv
All of them could be used different combination in /proc/mount and mount output.
Patch fixes regression for older systems where new detection code failed to
find valid combination.
Zdenek Kabelac [Fri, 5 Nov 2010 16:18:38 +0000 (16:18 +0000)]
Add OCF support
Updated patch from Florian Haas from Linux-HA project.
User needs to 'configure --enable-ocf' to get file installed
by 'make install' target by default.
User can also use 'make install_ocf' to get only ocf files installed.
With disabled (default) ocf support - no ocf files are installed.
FIXME: ocf installation path needs to be kept in sync with pacemaker.
find better way and possible also better location.
Zdenek Kabelac [Mon, 1 Nov 2010 14:17:35 +0000 (14:17 +0000)]
Use new status code from fsadm check
Patch updates exec_cmd() and adds 3rd parameter with pointer for
status value, so caller might examine returned status code.
If the passed pointer is NULL, behavior is unmodified.
Patch allows to confinue with lvresize if the failure from fsadm check is
caused by mounted filesystem as many of filesystem resize tools do support
online filesystem resize. (originally user had to use flag '-n' to bypass
this filesystem check)
Peter Rajnoha [Mon, 1 Nov 2010 13:31:55 +0000 (13:31 +0000)]
Allocate buffer for reporting functions dynamically to support long outputs.
Fix memory leak of field_id in _output_field function.
There's been a patch added recently to use dynamic allocation for metadata
tags buffer to remove the 4k limit (for writing metadata out). However, when
using reporting commands like vgs and lvs, we still need to fix libdm reporting
functions themselves to support such long outputs. So the buffer used in those
reporting functions is dynamic now.
The patch also includes a fix for field_id memory leak which was found in
the _output_field function.
Alasdair Kergon [Fri, 29 Oct 2010 21:15:23 +0000 (21:15 +0000)]
Update VG metadata only once in vgchange when making multiple changes.
Allow independent vgchange arguments to be used together.
(Still more inconsistencies to iron out here.)
Petr Rockai [Wed, 27 Oct 2010 11:40:14 +0000 (11:40 +0000)]
Alasdair correctly pointed out that if the two closes are concurrent (I haven't
checked, so they *might*), there is still a race possibility with the last
fix. This patch fixes that.
Petr Rockai [Wed, 27 Oct 2010 09:13:37 +0000 (09:13 +0000)]
Fix a double close in clvmd.
The management threads (main_loop, the socket thread) could close a single fd
twice in a row sometimes. At least one other thread can be running at the same
time as the threads doing the double close. That one running thread also
happens to do some IO (namely, open /proc/devices, read from it, close it). If
there was enough "demand" for the local socket, this could happen:
- a connection to clvmd is about to finish, let's say the fd is 13 (it often
happens to be in my test script, don't ask why)
- the local_sock thread calls close(13)
- the lvm thread calls open("/proc/devices"...) and gets 13
- the main_loop thread calls close(13) [OOPS!]
- new connection arrives, and is accept'd by a (new) local_sock thread
- the accept gives an fd of 13 (since it's the lowest free fd at this point)
- the lvm thread gets around to read from it's /proc/devices handle... 13,
again
- the lvm thread hangs forever trying to read from the socket instead of
/proc/devices
Signed-off-by: Petr Rockai <prockai@redhat.com> Reviewed-by: Milan Broz <mbroz@redhat.com>
Zdenek Kabelac [Tue, 26 Oct 2010 10:14:41 +0000 (10:14 +0000)]
Add missing return for NULL passed buffer
Function pull_stateo() checks for NULL 'buf' - but return for this error
path was missing. cmirror code never calls this function with NULL 'buf',
so this fix has no effect on current code base, but makes clang happier.
Zdenek Kabelac [Tue, 26 Oct 2010 09:57:03 +0000 (09:57 +0000)]
Hotfix usage of __builtin_unreachable()
It's quite new feature which is not supported by older compilers.
So until some better macros are introduced into LVM code - hotfix current
compilation problems and compile this code only for __clang__ defining compilers.
Dave Wysochanski [Mon, 25 Oct 2010 14:09:08 +0000 (14:09 +0000)]
Add lvm_lv_get_property() generic function to obtain value of any lv propert
Add a generic LV property function to lvm2app, similar to VG function.
Return lvm_property_value and require caller to check 'is_valid' flag
and lvm_errno() for API error.
Dave Wysochanski [Mon, 25 Oct 2010 14:08:55 +0000 (14:08 +0000)]
Add lvm_pv_get_property() generic function to obtain value of any pv property.
Add a generic PV property function to lvm2app, similar to VG function.
Return lvm_property_value and require caller to check 'is_valid' flag
before using the value. If 'is_valid' is not set, then lvm_errno()
should be used to obtain the specific error.
Add a generic VG property function to lvm2app. Call the internal library
vg_get_property() function. Strings are dup'd internally.
Rework lvm_vg_get_property to return lvm_property_value and require caller
to check 'is_valid' flag. If !is_valid, the caller can check lvm_errno()
for the specific error.
Create a 'get_property' function, local to lvm2app, that factors out
most of the common code that copies the components of lvm_property_type
into lvm_property_value. This allows for a 1-line function for each
of the generic property functions exported by lvm2app.
Zdenek Kabelac [Mon, 25 Oct 2010 12:57:00 +0000 (12:57 +0000)]
Fix potential NULL pointer dereference
Makes clang happier as it covers all code paths and avoids NULL pointer
dereference through the 'com' pointer (which is NULL by default static
initialisation).