]> sourceware.org Git - lvm2.git/log
lvm2.git
11 years agorefactor: rename embedding area -> bootloader area
Peter Rajnoha [Tue, 28 May 2013 10:37:22 +0000 (12:37 +0200)]
refactor: rename embedding area -> bootloader area

11 years agosnapshot: skip monitor for large cows
Zdenek Kabelac [Mon, 27 May 2013 08:20:06 +0000 (10:20 +0200)]
snapshot: skip monitor for large cows

If snapshot cow device is already big enough to
cover whole origin, do not monitor it.

11 years agosnapshot: add lv_is_cow_covering_origin
Zdenek Kabelac [Mon, 27 May 2013 08:18:20 +0000 (10:18 +0200)]
snapshot: add lv_is_cow_covering_origin

Add function to check is size of cow is already big enough
to cover whole origin.

11 years agodmeventd: use dm_get_status_snapshot()
Zdenek Kabelac [Sun, 26 May 2013 15:07:08 +0000 (17:07 +0200)]
dmeventd: use dm_get_status_snapshot()

Switch to use libdm dm_get_status_snapshot() function for
reading status info.
This fixes bug, where the code was using 32bit integers,
while the snapshot target is able to return 64bit sizes.
However this also means, someone is using >1TB snapshot
cow devices, which is actually very bad idea anyway, since the
perfomance and memory usage in this case is very bad.

11 years agosnapshot: use dm_get_status_snapshot()
Zdenek Kabelac [Sun, 26 May 2013 15:04:14 +0000 (17:04 +0200)]
snapshot: use dm_get_status_snapshot()

Replace code with libdm call to dm_get_status_snapshot().

11 years agolibdm: free mem pool on err path
Zdenek Kabelac [Sun, 26 May 2013 15:00:14 +0000 (17:00 +0200)]
libdm: free mem pool on err path

Since we use get_status also in dmeventd, which may use one pool
for a single device, in case it would be repeatedly returning error,
it may not be freeing the pool and would cause slow but steady growth.
To stay safe in the error path release any allocated memory.

11 years agolibdm: add dm_get_status_snapshot
Zdenek Kabelac [Sun, 26 May 2013 14:57:50 +0000 (16:57 +0200)]
libdm: add dm_get_status_snapshot

Add dm_get_status_snapshot() for parsing snapshot status.

11 years agocleanup: drop backtrace
Zdenek Kabelac [Thu, 23 May 2013 14:17:08 +0000 (16:17 +0200)]
cleanup: drop backtrace

After log_error/log_warn there is no point to show <backtrace>
in debug log trace from the next code line.

11 years agocleanup: use last_seg
Zdenek Kabelac [Wed, 22 May 2013 13:04:51 +0000 (15:04 +0200)]
cleanup: use last_seg

Use function to obtain last segment type.

11 years agolv_manip: use lv_is_active
Zdenek Kabelac [Thu, 16 May 2013 21:12:39 +0000 (23:12 +0200)]
lv_manip: use lv_is_active

Updated reverted commit.
The usage of lv_is_active() is needed here, so the
(!lv_is_active_exclusive_locally) gives the correct
report.

11 years agovgchange: check for mounted fs
Zdenek Kabelac [Thu, 8 Mar 2012 22:43:28 +0000 (23:43 +0100)]
vgchange: check for mounted fs

Check for mounted fs also for vgchange command, not just lvchange.

NOTE: Code is using lv_info() just like lvs_in_vg_opened().
It should be probably converted into  lv_is_active_locally().

11 years agodmeventd: use dm_mountinfo_read
Zdenek Kabelac [Mon, 20 May 2013 11:10:07 +0000 (13:10 +0200)]
dmeventd: use dm_mountinfo_read

Reuse mountinfo reading code from libdm.

11 years agolibdm: improve detection of mounted fs
Zdenek Kabelac [Thu, 16 May 2013 09:55:51 +0000 (11:55 +0200)]
libdm: improve detection of mounted fs

To detect mounted device, use also /proc/self/mountinfo
as so far the check was only able to detect ext4 mounted filesystem.

TODO:
Once proper testing for this feature is added, it may appear,
mountinfo check is enough and covers all cases and sysfs check
could be removed.

11 years agolibdm: introduce dm_mountinfo_read
Zdenek Kabelac [Thu, 16 May 2013 09:34:26 +0000 (11:34 +0200)]
libdm: introduce dm_mountinfo_read

Add function for parsing /proc/self/mountinfo entries.
This can be used to detected mounted device.

11 years agoioctl: add DM_DATA_OUT_FLAG to dm-ioctl.h
Alasdair G Kergon [Fri, 17 May 2013 16:06:40 +0000 (17:06 +0100)]
ioctl: add DM_DATA_OUT_FLAG to dm-ioctl.h

11 years agodoc: update dm kernel files to 3.10-rc1
Alasdair G Kergon [Fri, 17 May 2013 15:05:17 +0000 (16:05 +0100)]
doc: update dm kernel files to 3.10-rc1

11 years agoClean-up: Replace 'lv_is_active' with more correct/specific variants
Jonathan Brassow [Thu, 16 May 2013 15:36:56 +0000 (10:36 -0500)]
Clean-up: Replace 'lv_is_active' with more correct/specific variants

There are places where 'lv_is_active' was being used where it was
more correct to use 'lv_is_active_locally'.  For example, when checking
for the existance of a kernel instance before asking for its status.
Most of the time these would work correctly.  (RAID is only allowed on
non-clustered VGs at the moment, which means that 'lv_is_active' and
'lv_is_active_locally' would give the same result.)  However, it is
more correct to use the proper variant and it helps with future
scenarios where targets might be allowed exclusively (or clustered) in
a cluster VG.

11 years agoWHATS_NEW: bad day
Peter Rajnoha [Thu, 16 May 2013 09:02:18 +0000 (11:02 +0200)]
WHATS_NEW: bad day

11 years agoWHATS_NEW: for commit 4f6c2951d6495ee335ab69da44ae2647cd341276
Peter Rajnoha [Thu, 16 May 2013 06:38:27 +0000 (08:38 +0200)]
WHATS_NEW: for commit 4f6c2951d6495ee335ab69da44ae2647cd341276

11 years agolvconvert: check for snapshot-merge support before merge init
Peter Rajnoha [Thu, 16 May 2013 06:21:57 +0000 (08:21 +0200)]
lvconvert: check for snapshot-merge support before merge init

11 years agosnapshot: fix check for snapshot-merge target presence
Peter Rajnoha [Thu, 16 May 2013 06:12:37 +0000 (08:12 +0200)]
snapshot: fix check for snapshot-merge target presence

If calling _snap_target_present on 2nd and later call and for
a segment with MERGING flag set, we must return the status of
snapshot as well as snapshot-merge target presence, not just
the snapshot one.

11 years agoactivation: fix lv_is_active regressions
Alasdair G Kergon [Wed, 15 May 2013 01:13:31 +0000 (02:13 +0100)]
activation: fix lv_is_active regressions

Try to fix commit bf2741376d47411994d4065863acab8e405ff5c7.

lv_is_active is not the same as lv_info(cmd, org, 0, &info, 0, 0).

Introduce and use lv_is_active_locally.

11 years agorephrasing: miscellaneous changes
Alasdair G Kergon [Wed, 15 May 2013 00:50:42 +0000 (01:50 +0100)]
rephrasing: miscellaneous changes

Miscellaneous changes to messages, man pages, comments and WHATS_NEW.

11 years agomake: fix exported symbols regex for non-GNU sed
Alasdair G Kergon [Tue, 14 May 2013 18:29:26 +0000 (19:29 +0100)]
make: fix exported symbols regex for non-GNU sed

Remove a couple of incorrect backslashes from expressions used to
generate lists of exported symbols so it works with busybox sed.
[John Spencer]

11 years agocommands: accept --yes globally
Alasdair G Kergon [Tue, 14 May 2013 17:45:37 +0000 (18:45 +0100)]
commands: accept --yes globally

Accept --yes on all commands, even ones that don't today have prompts,
so that test scripts that don't care about interactive prompts no
longer need to deal with them.

But continue to mention --yes only in the command prototypes that
actually use it.

11 years agoFix alignment of PV data area if detected alignment less than 1 MB
Mike Snitzer [Mon, 13 May 2013 19:56:47 +0000 (15:56 -0400)]
Fix alignment of PV data area if detected alignment less than 1 MB

This fixes a long standing regression since LVM2 2.02.74 (commit 4efb1d9c,
"Update heuristic used for default and detected data alignment.")

The default PE alignment could be used (via MAX()) even if it was
determined that the device's MD stripe width, or minimal_io_size or
optimal_io_size were not factors of the default PE alignment (either 64K
or the newer default of 1MB, etc).  This bug would manifest if the
default PE alignment was larger than the overriding hint that the
device provided (e.g. default of 1MB vs optimal_io_size of 768K).

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
11 years agothin: limited support for -l%FREE allocation
Zdenek Kabelac [Mon, 13 May 2013 11:03:04 +0000 (13:03 +0200)]
thin: limited support for -l%FREE allocation

This is just a temporary fix to support allocation of -l%FREE.

The number of free extent serves to calculate estimated metadata
size. This value is then substracted twice to keep some
free space for recover.

11 years agomm: fix leak in fail path
Zdenek Kabelac [Mon, 13 May 2013 10:59:38 +0000 (12:59 +0200)]
mm: fix leak in fail path

If the dm_realloc would fail, the already allocate _maps_buffer
memory would have been lost (overwritten with NULL).
Fix this by using temporary line buffer.

Also add a minor cleanup to set end of buffer to '\0',
only when we really know the file size fits the preallocated buffer.

11 years agoman: updates
Zdenek Kabelac [Sun, 5 May 2013 19:38:44 +0000 (21:38 +0200)]
man: updates

11 years agotoolcontext: check dm version lazily for udev_fallback setting
Peter Rajnoha [Mon, 13 May 2013 09:46:24 +0000 (11:46 +0200)]
toolcontext: check dm version lazily for udev_fallback setting

Setting the cmd->default_settings.udev_fallback also requires DM
driver version check. However, this caused useless mapper/control
access with ioctl if not needed actually. For example if we're not
using activation code, we don't need to know the udev_fallback as
there's no node and symlink processing.

For example, this premature mapper/control access caused problems
when using lvm2app even when no activation happens - there are
situations in which we don't need to use mapper/control, but still
need some of the lvm2app functionality. This is also the case for
lvm2-activation systemd generator which just needs to look at the
lvm2 configuration, but it shouldn't touch mapper/control.

11 years agolv: fix typedef
Zdenek Kabelac [Fri, 3 May 2013 14:02:43 +0000 (16:02 +0200)]
lv: fix typedef

Since older gcc is not accepting duplication of same typedef,
stay with predeclared enum type.

11 years agotest: wait for pid removal
Zdenek Kabelac [Fri, 3 May 2013 13:21:11 +0000 (15:21 +0200)]
test: wait for pid removal

11 years agocleanup: shift line down
Zdenek Kabelac [Thu, 2 May 2013 16:05:42 +0000 (18:05 +0200)]
cleanup: shift line down

For better look of  lvs -o help
Though we may need to decide whether to use  'lv_active' or some other
name.

11 years agocleanup: simplify
Zdenek Kabelac [Mon, 29 Apr 2013 10:33:38 +0000 (12:33 +0200)]
cleanup: simplify

Use simplier sprintf.

11 years agocleanup: improve previous patch
Zdenek Kabelac [Mon, 29 Apr 2013 11:50:26 +0000 (13:50 +0200)]
cleanup: improve previous patch

Make the test earlier, before any dereference of 'argv' pointer.

11 years agoreport: improve reporting of active state
Zdenek Kabelac [Thu, 2 May 2013 16:06:50 +0000 (18:06 +0200)]
report: improve reporting of active state

For reporting stacked or joined devices properly in cluster,
we need to report their activation state according the lock,
which activated this device tree.

This is getting a bit complex - current code tries simple approach -

For snapshot - return status for origin.
For thin pool - return status of the first known active thin volume.
For the rest of them - try to use dependency list of LVs and skip
known execptions.  This should be able to recursively deduce top level
device for given LV.

(in release fix)

11 years agolv: add lv_active_change
Zdenek Kabelac [Mon, 29 Apr 2013 12:04:38 +0000 (14:04 +0200)]
lv: add lv_active_change

Make a separate /lib function for the change of activation state
of the LV.

(in release update)

11 years agopvscan: missing test for id_read_format
Zdenek Kabelac [Mon, 29 Apr 2013 10:34:50 +0000 (12:34 +0200)]
pvscan: missing test for id_read_format

(in release fix)

11 years agoconfig: fix bitfield for section
Zdenek Kabelac [Mon, 29 Apr 2013 10:38:56 +0000 (12:38 +0200)]
config: fix bitfield for section

Since the cfg_def_type_t is used as bitfield in some tests,
use bitshifting to create valid bit sequence.

(in release fix)

11 years agoudev: fire pvscan --cache properly on CHANGE event for MD devices
Peter Rajnoha [Fri, 3 May 2013 11:20:07 +0000 (13:20 +0200)]
udev: fire pvscan --cache properly on CHANGE event for MD devices

Commit 756bcabbfe297688ba240a880bc2b55265ad33f0 restricted the
situations at which the LVM autoactivation fires - only on ADD
event for devices other than DM. However, this caused a problem
for MD devices...

MD devices are activated in a very similar way as DM devices:
the MD dev is created on first appeareance of MD array member
(ADD event) and stays *inactive* until the array is complete.
Just then the MD dev turns to active state and this is reported
to userspace by CHANGE event.

Unfortunately, we can't differentiate between the CHANGE event
coming from udev trigger/WATCH rule and CHANGE event coming from
the transition to active state - MD would need to add similar logic
we already use to detect this in DM world. For now, we just have
to enable pvscan --cache on *all* CHANGE events for MD so the
autoactivation of the LVM volumes on top of MD works.

A downside of this is that a spurious CHANGE event for MD dev
can cause the LVM volumes on top of it to be automatically activated.
However, one should not open/change the device underneath until
the device above in the stack is removed! So this situation should
only happen if one opens the MD dev for read-write by mistake
(and hence firing the CHANGE event because of the WATCH udev rule),
or if calling udev trigger manually for the MD dev.

(No WHATS_NEW here as this fixes the commit mentioned
above and which has not been released yet.)

11 years agoudev: add a few comments about variables used to recognize events
Peter Rajnoha [Fri, 3 May 2013 09:01:57 +0000 (11:01 +0200)]
udev: add a few comments about variables used to recognize events

11 years agocleanup: use dm_list_iterate_items
Zdenek Kabelac [Thu, 25 Apr 2013 09:46:17 +0000 (11:46 +0200)]
cleanup: use dm_list_iterate_items

11 years agolvchange: use vg mempool
Zdenek Kabelac [Thu, 25 Apr 2013 08:15:13 +0000 (10:15 +0200)]
lvchange: use vg mempool

Using vg mempool for vg related data. Since we have VG in write mode,
prefer to use this mempool instead of cmd mempool.

11 years agodmeventd: return error if device is not found
Zdenek Kabelac [Thu, 25 Apr 2013 08:17:22 +0000 (10:17 +0200)]
dmeventd: return error if device is not found

Do not return 'ok' status if we have failed to found device.
(Since it looks like the device is monitored)

11 years agoreport: show active state of LV
Zdenek Kabelac [Thu, 25 Apr 2013 10:12:05 +0000 (12:12 +0200)]
report: show active state of LV

For non clustered VG - show  "active"/""

For clustered VG its more complex:

"local exclusive"
"remote exclusive"
"locally"
"remotely"

11 years agoreport: show dmeventd monitoring status
Zdenek Kabelac [Thu, 25 Apr 2013 10:07:57 +0000 (12:07 +0200)]
report: show dmeventd monitoring status

Add new lvs segment field 'Monitor' showing 3 states:

"monitored" - LV is monitored by dmeventd.

"not monitored" - LV is currently not being monitored by dmeventd

"" (empty) - LV does not support monitoring, or dmeventd support
             is not compiled in.

11 years agoman: lvextend --use-policies
Zdenek Kabelac [Wed, 24 Apr 2013 21:41:05 +0000 (23:41 +0200)]
man: lvextend --use-policies

Add missing man info.

11 years agosnapshot: rework cluster creation and removal
Zdenek Kabelac [Sun, 21 Apr 2013 08:37:52 +0000 (10:37 +0200)]
snapshot: rework cluster creation and removal

Support for exclusive activation of snapshots revealed some problems.

When snapshot is created, COW LV is activated first (for clearing) and
then it's transformed into snapshot's COW LV, but it has left the lock
for such LV active in cluster and this lock could not have been removed
from dlm, unless snapshot has been removed within same dlm session.

If the user tried to remove snapshot after rebooting node, the lock was
missing, and COW LV could not have been detached.

Patch modifes the approach in this way:

Always deactivate COW LV for clustered vg  after clearing (so it's
activated again via imlicit snapshot activation rule when snapshot is activated).

When snapshot is removed, activate COW LV as independend LV, so the lock
will exist for such LV, but only when the snapshot is active.

Also add test case for testing snapshot removal after cluster reboot.

11 years agoclvmd: avoid pretesting of dev availability
Zdenek Kabelac [Sun, 21 Apr 2013 08:11:29 +0000 (10:11 +0200)]
clvmd: avoid pretesting of dev availability

Patch fixes hidden problem with lvm metadata caching.

When the pretest was made, only the commited data have been cached back
since the call lv_info_by_lvid() triggers mda read operation.
However call of lv_suspend_if_active() also reads precommited metadata.
The problem is visible in this sequence of calls:

vg_write(), suspend_lv(), vg_commit(), resume_lv()

which may end with leaving outdated mda in lvm cache, since vg_write()
drops cached metadata and vg_commit() only transforms precommited
to commited metadata, but in the case of pretesting we have
no precommited mda available so the cache will continue to use
old metadata. This happens, when suspend LV is inactive.

11 years agotest: correct order
Zdenek Kabelac [Tue, 23 Apr 2013 15:05:19 +0000 (17:05 +0200)]
test: correct order

Call notify after resume (like in enable_dev()).

11 years agotest: do not break test if there is no .cache
Zdenek Kabelac [Tue, 23 Apr 2013 12:36:27 +0000 (14:36 +0200)]
test: do not break test if there is no .cache

When running test on read /dev, we obtain devices from udev,
and there is no .cache file, so do not stop test if the file
is missing.

11 years agotest: fix filter
Zdenek Kabelac [Tue, 23 Apr 2013 12:28:27 +0000 (14:28 +0200)]
test: fix filter

Fix filter for use with real /dev

11 years agotest: new test new fail
Zdenek Kabelac [Tue, 23 Apr 2013 12:15:04 +0000 (14:15 +0200)]
test: new test new fail

Do not hide new features into old test files.

11 years agoraid: remove wrong pool free
Zdenek Kabelac [Tue, 23 Apr 2013 12:06:40 +0000 (14:06 +0200)]
raid: remove wrong pool free

No, we cannot free pool members here.

11 years agocleanup: type
Zdenek Kabelac [Tue, 23 Apr 2013 10:35:10 +0000 (12:35 +0200)]
cleanup: type

oops another type inserted.

11 years agoconfig: merge timestamps
Zdenek Kabelac [Tue, 23 Apr 2013 10:24:17 +0000 (12:24 +0200)]
config: merge timestamps

Merging multiple config files together needs to know newest (highest)
timestamp of merged files. Persistent cache file is being used
only in case, the config file is older then .cache file.

11 years agocleanup: improve messages
Zdenek Kabelac [Tue, 23 Apr 2013 09:58:50 +0000 (11:58 +0200)]
cleanup: improve messages

Add verbose message when we will not obtain devices from udev
(i.e. testing is using different udev dir, and the log was
giving misleading info about using udev)

Add proper error message if zalloc from pull would have failed.

Fix typo obolete -> obsolete

11 years agocleanup: drop zeroing of zallocated data
Zdenek Kabelac [Tue, 23 Apr 2013 09:52:17 +0000 (11:52 +0200)]
cleanup: drop zeroing of zallocated data

11 years agoformat1: add workaround for vg_set_fid
Zdenek Kabelac [Sun, 21 Apr 2013 21:53:53 +0000 (23:53 +0200)]
format1: add workaround for vg_set_fid

Since we want to set fid just before return of vg,
add this termporary workaround.

11 years agotest: singlenode minor cleanups
Zdenek Kabelac [Thu, 18 Apr 2013 16:01:52 +0000 (18:01 +0200)]
test: singlenode minor cleanups

Move unnecessary code out of locks.

11 years agocleanup: drop unwanted ';'
Zdenek Kabelac [Sun, 21 Apr 2013 20:32:43 +0000 (22:32 +0200)]
cleanup: drop unwanted ';'

11 years agocleanup: use proper activation_change_t
Zdenek Kabelac [Sun, 21 Apr 2013 10:49:58 +0000 (12:49 +0200)]
cleanup: use proper activation_change_t

11 years agocleanup: add printf attribute
Zdenek Kabelac [Sat, 20 Apr 2013 18:56:07 +0000 (20:56 +0200)]
cleanup: add printf attribute

Add gcc attribute for printf for daemon_logf().

11 years agocleanup: cast to len's type
Zdenek Kabelac [Sat, 20 Apr 2013 18:55:10 +0000 (20:55 +0200)]
cleanup: cast to len's type

Cleanup different signess gcc warning.

11 years agocleanup: convert set of strncat into a single printf
Zdenek Kabelac [Fri, 19 Apr 2013 19:24:51 +0000 (21:24 +0200)]
cleanup: convert set of strncat into a single printf

Use single snprintf for better control of used bufsize,
and also increased buffer to 128char to ensure all
chars will always fit.

11 years agocleanup: add some FIXMEs
Zdenek Kabelac [Fri, 19 Apr 2013 19:16:08 +0000 (21:16 +0200)]
cleanup: add some FIXMEs

11 years agocleanup: explicit check for nonnull pointer
Zdenek Kabelac [Fri, 19 Apr 2013 19:10:19 +0000 (21:10 +0200)]
cleanup: explicit check for nonnull pointer

Since execvp requires nonnull args - add explicit check.

11 years agocleanup: drop unused assignment
Zdenek Kabelac [Fri, 19 Apr 2013 19:09:28 +0000 (21:09 +0200)]
cleanup: drop unused assignment

Assigned values are unused.

11 years agovgread: fix fid transfer for lvm1 and pool format
Zdenek Kabelac [Sun, 21 Apr 2013 19:36:08 +0000 (21:36 +0200)]
vgread: fix fid transfer for lvm1 and pool format

Assign fid as the last step before returning VG.
Make the format reader for 'lvm1' and 'pool' equal to 'lvm2' format reader.

It has caused memory corruption to lvmetad as it later calls
destroy_instance() to allocated fid. This patch should fix problems
with crashing test lvmetad-lvm1.sh.

11 years agolv_manip: check remove_seg_from_segs_using_this_lv()
Zdenek Kabelac [Sun, 21 Apr 2013 11:18:53 +0000 (13:18 +0200)]
lv_manip: check remove_seg_from_segs_using_this_lv()

Add missing check for result of remove_seg_from_segs_using_this_lv().
Failure is reported as internal error.

11 years agolibdm: improve check in dm_split_lvm_name
Zdenek Kabelac [Sun, 21 Apr 2013 10:48:24 +0000 (12:48 +0200)]
libdm: improve check in dm_split_lvm_name

We support both type of call - with or without mem pool.
So ensure we will not use NULL vgname also when mem is given.

11 years agothin: fix resource leak in err path
Zdenek Kabelac [Sun, 21 Apr 2013 10:19:25 +0000 (12:19 +0200)]
thin: fix resource leak in err path

If the devices list could not have been obtained, FILE* was leaked.

11 years agothin: explicitly avoid pvmove operation
Zdenek Kabelac [Sun, 21 Apr 2013 06:49:17 +0000 (08:49 +0200)]
thin: explicitly avoid pvmove operation

So far we do not support pvmove for thin volumes
and thin pools.

11 years agothin: fix cut&paste bug
Zdenek Kabelac [Fri, 19 Apr 2013 19:03:38 +0000 (21:03 +0200)]
thin: fix cut&paste bug

Use proper external_lv.
(In release fix)

11 years agoraid: test for target_pvs
Zdenek Kabelac [Sun, 21 Apr 2013 10:53:04 +0000 (12:53 +0200)]
raid: test for target_pvs

If target_pvs is NULL do not call lv_is_on_pvs()

11 years agoraid: read segment only for known LV
Zdenek Kabelac [Sun, 21 Apr 2013 06:47:59 +0000 (08:47 +0200)]
raid: read segment only for known LV

Avoid reading first_seg() on unknown LV and find it only when needed.

11 years agothin: lvcreate better support for AAY
Zdenek Kabelac [Fri, 12 Apr 2013 09:51:46 +0000 (11:51 +0200)]
thin: lvcreate better support for AAY

Test rather for changes which are deactivating.

11 years agolvmetad: fix error paths
Zdenek Kabelac [Fri, 19 Apr 2013 19:19:54 +0000 (21:19 +0200)]
lvmetad: fix error paths

Also add missing goto out on error.
Error path missed return NULL leading to double free of enc_value.

11 years agolvmetad: cleanup
Zdenek Kabelac [Fri, 19 Apr 2013 18:52:38 +0000 (20:52 +0200)]
lvmetad: cleanup

Move individual assignments to simplier structure setup.

11 years agodmeventd: cleanup
Zdenek Kabelac [Fri, 19 Apr 2013 18:50:46 +0000 (20:50 +0200)]
dmeventd: cleanup

Drop unneeded reset of data pointer to NULL, since this if() code path
is executed when data is NULL.

11 years agodmeventd: prevent double free
Zdenek Kabelac [Fri, 19 Apr 2013 18:49:57 +0000 (20:49 +0200)]
dmeventd: prevent double free

Since device.name is relased on more places, mark already
released name with NULL.

11 years agodmeventd: convert union to struct members
Zdenek Kabelac [Fri, 19 Apr 2013 18:44:20 +0000 (20:44 +0200)]
dmeventd: convert union to struct members

Sharing char* with field has a problem in error path,
when we allocate event, but fail to allocate timeout string.
Instead of creating complicated error paths to resolve
it individually stop using unions, and let the resource
to be released in a simple _free_message().

11 years agodmeventd: check for msg.data nonnull
Zdenek Kabelac [Fri, 19 Apr 2013 15:03:50 +0000 (17:03 +0200)]
dmeventd: check for msg.data nonnull

Ensure we will not use  msg.data as NULL for strchr.

11 years agoconfig: check for hash success
Zdenek Kabelac [Sun, 21 Apr 2013 11:12:58 +0000 (13:12 +0200)]
config: check for hash success

Hash insert may fail.

11 years agoclvmd: avoid logging in signal handler
Zdenek Kabelac [Wed, 17 Apr 2013 21:16:30 +0000 (23:16 +0200)]
clvmd: avoid logging in signal handler

debuglog in the main thread.

11 years agoclvmd: use pclose
Zdenek Kabelac [Sun, 21 Apr 2013 09:30:50 +0000 (11:30 +0200)]
clvmd: use pclose

For popened FILE use pclose.

11 years agoclvmd: preserve foreground mode across restart
Zdenek Kabelac [Sat, 20 Apr 2013 20:23:36 +0000 (22:23 +0200)]
clvmd: preserve foreground mode across restart

Keep clvmd in foreground when restarted.
Useful for testing.

11 years agoclmvd: fix responce status
Zdenek Kabelac [Fri, 19 Apr 2013 19:11:32 +0000 (21:11 +0200)]
clmvd: fix responce status

Failing status code is expected to be 0.
Also do not return '*response' as pointer which has been already free().

11 years agoudev: also autoactivate on coldplug
Peter Rajnoha [Fri, 19 Apr 2013 10:17:53 +0000 (12:17 +0200)]
udev: also autoactivate on coldplug

Commit 756bcabbfe297688ba240a880bc2b55265ad33f0 fixed autoactivation
to not trigger on each uevent for a PV that appeared in the system
most notably the events that are triggered artificially (udevadm
trigger or as the result of the WATCH udev rule being applied that
consequently generates CHANGE uevents). This fixed a situation in
which VGs/LVs were activated when they should not.

BUT we still need to care about the coldplug used at boot to
retrigger the ADD events - the "udevadm trigger --action=add"!

For non-DM-based PVs, this is already covered as for these we
run the autoactivation on ADD event only.

However, for DM-based PVs, we still need to run the
autoactivation even for the artificial ADD event, reusing
the udev DB content from previous proper CHANGE event that
came with the DM device activation.

Simply, this patch fixes a situation in which we run extra
"udevadm trigger --action=add" (or echo add > /sys/block/<dev>/uevent)
for DM-based PVs (cryptsetup devices, multipath devices, any
other DM devices...).

Without this patch, while using lvmetad + autoactivation,
any VG/LV that has a DM-based PV and for which we do not
call the activation directly, the VG/LV is not activated.

For example a VG with an LV with root FS on it which is directly
activated in initrd and then missing activation of the rest
of the LVs in the VG because of unhandled uevent retrigger on
boot after switching to root FS (the "coldplug").

(No WHATS_NEW here as this fixes the commit mentioned
above and which was not released yet.)

11 years agoconfig_def_check: fix memory leak
Tony Asleson [Tue, 16 Apr 2013 08:42:03 +0000 (10:42 +0200)]
config_def_check: fix memory leak

There is no need to strdup a key when inserting into
the hash table as the table allocates memory and copies
the string.  This was causing memory to be lost.

11 years agoRAID: Add writemostly/writebehind support for RAID1
Jonathan Brassow [Mon, 15 Apr 2013 18:59:46 +0000 (13:59 -0500)]
RAID:  Add writemostly/writebehind support for RAID1

'lvchange' is used to alter a RAID 1 logical volume's write-mostly and
write-behind characteristics.  The '--writemostly' parameter takes a
PV as an argument with an optional trailing character to specify whether
to set ('y'), unset ('n'), or toggle ('t') the value.  If no trailing
character is given, it will set the flag.
Synopsis:
        lvchange [--writemostly <PV>:{t|y|n}] [--writebehind <count>] vg/lv
Example:
        lvchange --writemostly /dev/sdb1:y --writebehind 512 vg/raid1_lv

The last character in the 'lv_attr' field is used to show whether a device
has the WriteMostly flag set.  It is signified with a 'w'.  If the device
has failed, the 'p'artial flag has priority.

Example ("nosync" raid1 with mismatch_cnt and writemostly):
[~]# lvs -a --segment vg
  LV                VG   Attr      #Str Type   SSize
  raid1             vg   Rwi---r-m    2 raid1  500.00m
  [raid1_rimage_0]  vg   Iwi---r--    1 linear 500.00m
  [raid1_rimage_1]  vg   Iwi---r-w    1 linear 500.00m
  [raid1_rmeta_0]   vg   ewi---r--    1 linear   4.00m
  [raid1_rmeta_1]   vg   ewi---r--    1 linear   4.00m

Example (raid1 with mismatch_cnt, writemostly - but failed drive):
[~]# lvs -a --segment vg
  LV                VG   Attr      #Str Type   SSize
  raid1             vg   rwi---r-p    2 raid1  500.00m
  [raid1_rimage_0]  vg   Iwi---r--    1 linear 500.00m
  [raid1_rimage_1]  vg   Iwi---r-p    1 linear 500.00m
  [raid1_rmeta_0]   vg   ewi---r--    1 linear   4.00m
  [raid1_rmeta_1]   vg   ewi---r-p    1 linear   4.00m

A new reportable field has been added for writebehind as well.  If
write-behind has not been set or the LV is not RAID1, the field will
be blank.
Example (writebehind is set):
[~]# lvs -a -o name,attr,writebehind vg
  LV            Attr      WBehind
  lv            rwi-a-r--     512
  [lv_rimage_0] iwi-aor-w
  [lv_rimage_1] iwi-aor--
  [lv_rmeta_0]  ewi-aor--
  [lv_rmeta_1]  ewi-aor--

Example (writebehind is not set):
[~]# lvs -a -o name,attr,writebehind vg
  LV            Attr      WBehind
  lv            rwi-a-r--
  [lv_rimage_0] iwi-aor-w
  [lv_rimage_1] iwi-aor--
  [lv_rmeta_0]  ewi-aor--
  [lv_rmeta_1]  ewi-aor--

11 years agolibdaemon: Print a diagnostic when we fail to lock the pidfile.
Petr Rockai [Mon, 15 Apr 2013 07:43:30 +0000 (09:43 +0200)]
libdaemon: Print a diagnostic when we fail to lock the pidfile.

11 years agoRevert "cleanup: simplify option matching function"
Alasdair G Kergon [Sat, 13 Apr 2013 01:26:37 +0000 (02:26 +0100)]
Revert "cleanup: simplify option matching function"

This reverts commit 0396ade38b88431d959ce02fac689306a2c47786.

The original code also handled len==1, which the new code doesn't.
Press <TAB> in the lvm shell to get a list of the possible
flag completions for a single hyphen.

11 years agoCLEAN-UP: Better string checking to avoid substring matches
Jonathan Brassow [Fri, 12 Apr 2013 16:30:04 +0000 (11:30 -0500)]
CLEAN-UP:  Better string checking to avoid substring matches

Commit 9fd7ac7d035f0b2f8dcc3cb19935eb181816bd76 introduced a way a
method of avoiding reading from mirrors with a device failure.  If
a device was found to be dead, the mapping table was checked for
'handle_errors' or 'block_on_error'.  These strings were checked for
in the table string via 'strstr', which could also match on strings
like, 'no_handle_errors' or 'no_block_on_error'.  No such strings
exist, but we don't want to have problems in the future if they do.
So, we check for ' <string>{'\0'|' '}'.

11 years agodmsetup: check for strncpy
Zdenek Kabelac [Fri, 10 Feb 2012 17:34:12 +0000 (18:34 +0100)]
dmsetup: check for strncpy

Test whether device name fits into a given buffer.

11 years agotools: add common lv_change_activate
Zdenek Kabelac [Thu, 11 Apr 2013 11:51:08 +0000 (13:51 +0200)]
tools: add common lv_change_activate

Move common code for changing activation state from
vgchange and lvchange to one function.

Fix the order of checks - so we always implicitelly
activate snapshots and thin volumes in exclusive mode,
and we do not allow local deactivation for them.

11 years agocleanup: add gcc attribute for printf parameter
Zdenek Kabelac [Thu, 11 Apr 2013 11:49:13 +0000 (13:49 +0200)]
cleanup: add gcc attribute for printf parameter

11 years agocleanup: remove unused lvl_idx
Zdenek Kabelac [Thu, 11 Apr 2013 11:48:23 +0000 (13:48 +0200)]
cleanup: remove unused lvl_idx

11 years agolvmcache: keep sp_count unsigned
Zdenek Kabelac [Thu, 11 Apr 2013 11:46:47 +0000 (13:46 +0200)]
lvmcache: keep sp_count unsigned

11 years agoWHATS_NEW: Add WHATS_NEW entry for previous commit.
Jonathan Brassow [Thu, 11 Apr 2013 21:03:24 +0000 (16:03 -0500)]
WHATS_NEW:  Add WHATS_NEW entry for previous commit.

This page took 0.06871 seconds and 5 git commands to generate.