]> sourceware.org Git - lvm2.git/log
lvm2.git
14 years agoMerge on activate support.
Mike Snitzer [Wed, 13 Jan 2010 01:54:34 +0000 (01:54 +0000)]
Merge on activate support.

If either the origin or snapshot that is to be merged is open the merge
will not start; only the merge metadata will be written.  The merge will
start on the next activation of the origin (or via lvchange --refresh)
IFF both the origin and snapshot are closed.

Merge on activate is particularly important if we want to merge over a
mounted filesystem that cannot be unmounted (until next boot) --- for
example root.

14 years agoWhen turning merging origin into non-merging origin, there is bad sequence:
Mike Snitzer [Wed, 13 Jan 2010 01:52:58 +0000 (01:52 +0000)]
When turning merging origin into non-merging origin, there is bad sequence:
snapshots are suspended, new origin is created, snapshots are resumed, new
origin is resumed.  So it allocates memory while suspended.

To fix it, move vg_commit after suspend_lv, so that the suspend code will
treat it as precommitted vg and will preload new origin prior to suspend.

NOTE: agk doesn't like this "hack"; need to revisit and fix

14 years agoReload origin if merging has stopped.
Mike Snitzer [Wed, 13 Jan 2010 01:51:45 +0000 (01:51 +0000)]
Reload origin if merging has stopped.

14 years agoStart background polling of merging stores on:
Mike Snitzer [Wed, 13 Jan 2010 01:50:34 +0000 (01:50 +0000)]
Start background polling of merging stores on:
- lvchange -ay or vgchange -ay.
- lvchange --refresh or vgchange --refresh.

14 years agoBackground poll for lvconvert --merge command.
Mike Snitzer [Wed, 13 Jan 2010 01:49:52 +0000 (01:49 +0000)]
Background poll for lvconvert --merge command.
The merging snapshot is removed when the merge finishes.

14 years agoWhen there is merging snapshot, report percentage on the origin LV.
Mike Snitzer [Wed, 13 Jan 2010 01:49:22 +0000 (01:49 +0000)]
When there is merging snapshot, report percentage on the origin LV.
Because the snapshot LV will be hidden this is needed so the user can
see merging progress with "lvs" command.

14 years agoReport merging snapshot as 'S' instead of 's':
Mike Snitzer [Wed, 13 Jan 2010 01:48:38 +0000 (01:48 +0000)]
Report merging snapshot as 'S' instead of 's':
This is useful for when the snapshot is still active and merging hasn't
started yet; it shows a merge is pending.  Once merging starts the
merging snapshot will be hidden but can still be displayed with 'lvs -a'

Report snapshot origin with merging snapshot as 'O' instead of 'o':
Before merge starts this shows that a merge is pending.  While merging
the snapshot will be hidden, 'O' enables a user to see that there is a
snapshot merging.

14 years agoDo not allow merging over mounted logical volumes.
Mike Snitzer [Wed, 13 Jan 2010 01:47:18 +0000 (01:47 +0000)]
Do not allow merging over mounted logical volumes.
When preserving origin, check that the snapshot is not mounted.

14 years agoAdd --merge support to lvconvert to start merging a snapshot into its
Mike Snitzer [Wed, 13 Jan 2010 01:45:15 +0000 (01:45 +0000)]
Add --merge support to lvconvert to start merging a snapshot into its
origin, example usage:  lvconvert --merge vg/snaplv

14 years agoMerging device is loaded with "-cow" suffix and with base name of the
Mike Snitzer [Wed, 13 Jan 2010 01:44:37 +0000 (01:44 +0000)]
Merging device is loaded with "-cow" suffix and with base name of the
origin.  This is needed so that "-cow" device can be found and removed
when lvremove is performed.

14 years agoConditionally push down either the "snapshot-origin" or
Mike Snitzer [Wed, 13 Jan 2010 01:43:32 +0000 (01:43 +0000)]
Conditionally push down either the "snapshot-origin" or
"snapshot-merge" target based on whether the LV is a merging snapshot.

When activating a snapshot-merge target do not attempt to monitor the
LV for events; the polldaemon will monitor the snapshot as it is
merged.

Allow "snapshot-merge" target's usage to be parsed via standard
"snapshot" methods.

NOTE: follow on fixes to the _percent_run change are still needed

14 years agoAdd support for "snapshot-merge" target.
Mike Snitzer [Wed, 13 Jan 2010 01:39:44 +0000 (01:39 +0000)]
Add support for "snapshot-merge" target.

Introduces new libdevmapper function dm_tree_node_add_snapshot_merge_target

Verifies that the kernel (dm-snapshot) provides the 'snapshot-merge'
target.

Activate origin LV as snapshot-merge target.  Using snapshot-origin
target would be pointless because the origin contains volatile data
while a merge is in progress.

Because snapshot-merge target is activated in place of the
snapshot-origin target it must be resumed after all other snapshots
(just like snapshot-origin does) --- otherwise small window for data
corruption would exist.

Ideally the merging snapshot would not be activated at all but if it is
to be activated (because snapshot was already active) it _must_ be done
after the snapshot-merge.  This insures that DM's snapshot-merge target
will perform exception handover in the proper order (new->resume before
old->resume).  DM's snapshot-merge does support handover if the reverse
sequence is used (old->resume before new->resume) but DM will fail to
resume the old snapshot; leaving it suspended.

To insure the proper activation sequence dm_tree_activate_children() was
updated to accommodate an additional 'activation_priority' level.  All
regular snapshots are 0, snapshot-merge is 1, and merging snapshot is 2.

14 years agoAdd 'SNAPSHOT_MERGE' lv_segment 'status' flag.
Mike Snitzer [Wed, 13 Jan 2010 01:35:49 +0000 (01:35 +0000)]
Add 'SNAPSHOT_MERGE' lv_segment 'status' flag.

Make 'merging_snapshot' pointer that points from the origin to the
segment that represents the merging snapshot.

Import/export 'merging_store' metadata.

Do not allow creating snapshots while another snapshot is merging.
Snapshot created in this state would certainly contain invalid data.

NOTE: patches at the end of this series will remove 'merging_snapshot'
and will introduce helpful wrappers and cleanups.

14 years agoFix allocation code not to stop at the first area of a PV that fits.
Alasdair Kergon [Tue, 12 Jan 2010 20:53:20 +0000 (20:53 +0000)]
Fix allocation code not to stop at the first area of a PV that fits.

This spurious 'break' has been here since this code was first committed
in June 2005 and stopped the algorithm behaving as described in the
comment above it and rendered the variable 'already_found_one' useless.

14 years agopost-release
Alasdair Kergon [Tue, 12 Jan 2010 14:46:59 +0000 (14:46 +0000)]
post-release

14 years agopre-release
Alasdair Kergon [Tue, 12 Jan 2010 14:39:07 +0000 (14:39 +0000)]
pre-release

14 years agodisable 'redundant' tests
Alasdair Kergon [Tue, 12 Jan 2010 14:19:46 +0000 (14:19 +0000)]
disable 'redundant' tests

14 years agoRevert so-called "redundant" log until after next release.
Alasdair Kergon [Tue, 12 Jan 2010 14:00:51 +0000 (14:00 +0000)]
Revert so-called "redundant" log until after next release.

14 years ago.
Alasdair Kergon [Mon, 11 Jan 2010 21:44:36 +0000 (21:44 +0000)]
.

14 years agoAdd missing items to WHATS_NEW files.
Alasdair Kergon [Mon, 11 Jan 2010 21:28:04 +0000 (21:28 +0000)]
Add missing items to WHATS_NEW files.
Continue to use 'field' to describe reporting elements.

14 years agoAdd new test cases for mirrors that are under snapshots.
Jonathan Earl Brassow [Mon, 11 Jan 2010 21:27:49 +0000 (21:27 +0000)]
Add new test cases for mirrors that are under snapshots.

14 years agoTestsuite updates and fixes for recently added features.
Jonathan Earl Brassow [Mon, 11 Jan 2010 21:20:19 +0000 (21:20 +0000)]
Testsuite updates and fixes for recently added features.

1. Found bug in 'redundant log' implementation that caused
   problems when converting a linear that spanned multiple
   devices to a mirror (wasn't checking for NULL value of
   provided parameter in _alloc_parallel_area)

2. Testsuite was failing to perform tests when 'not' modifier
   was used.  This allowed a couple issues to slip through.
   Added a 'not_sh' modifier that negates tests performed by
   functions defined in the shell source file.

3. Was initializing a variable to far down, which cause
   previously set value to be overridden.  (This was the
   result of the collision of the "redundant log" and
   lvconvert fix patches.)

14 years agoUse _LOG_FATAL when aborting on an internal error.
Alasdair Kergon [Mon, 11 Jan 2010 20:41:39 +0000 (20:41 +0000)]
Use _LOG_FATAL when aborting on an internal error.

14 years agoInternal errors triggering abort cannot be suppressed. (kabi)
Alasdair Kergon [Mon, 11 Jan 2010 20:30:32 +0000 (20:30 +0000)]
Internal errors triggering abort cannot be suppressed. (kabi)

14 years agoOnly allow one return from poll_daemon(). If a child polldaemon was
Mike Snitzer [Mon, 11 Jan 2010 19:19:17 +0000 (19:19 +0000)]
Only allow one return from poll_daemon().  If a child polldaemon was
successfully created it must _exit() once it completes.

Update _become_daemon() to differentiate between a failed fork() and a
successful fork().

Added lvm_return_code() to lvmcmdline.[ch]

14 years agoremove errant comment fragment
Mike Snitzer [Mon, 11 Jan 2010 19:12:25 +0000 (19:12 +0000)]
remove errant comment fragment

14 years agoReset _vgs_locked in lvmcache_init()
Mike Snitzer [Mon, 11 Jan 2010 19:08:18 +0000 (19:08 +0000)]
Reset _vgs_locked in lvmcache_init()

Upon successful fork(), _become_daemon() must assert that the locks that
are currently held belong to the parent, not the child.  All of the
child's internal state saying 'this process holds a lock' has to be
reset.

A proper lvmcache_locking_reset() should follow later.

14 years agoFound 2 problems with my previous check-in:
Jonathan Earl Brassow [Mon, 11 Jan 2010 17:13:45 +0000 (17:13 +0000)]
Found 2 problems with my previous check-in:

 date: 2010/01/07 20:42:55;  author: jbrassow;  state: Exp;  lines: +11 -0
 The patch fixes some lvconvert issues (WRT mirror <-> mirror).

1) 'exisiting_mirrors' and 'lp->mirrors' where taken to be in 'n-1'
   notation (i.e a 2-way mirror is '1' and a linear is '0'), but the
   variables were in 'n' notation.
2) After adding the redundant mirror log support, I was calculating
   log_count by looking at the mirror log LV, but didn't take into
   account the fact that there could be no mirror log!

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
14 years agoSubstitute UDEV_SYNC value for use in the other files and show a warning message...
Peter Rajnoha [Mon, 11 Jan 2010 15:59:54 +0000 (15:59 +0000)]
Substitute UDEV_SYNC value for use in the other files and show a warning message when libudev not found and using udev_sync.

14 years agoShow a warning message when libudev not found and we're using --enable-udev_sync.
Peter Rajnoha [Mon, 11 Jan 2010 15:51:44 +0000 (15:51 +0000)]
Show a warning message when libudev not found and we're using --enable-udev_sync.

Just to emphasize what one can expect - we won't be able to get udev state
and we will consider that udev is not running at all.

14 years agoDefine {DM, LVM}_UDEV_DISABLE_CHECKING=1 env. variables for tests.
Peter Rajnoha [Mon, 11 Jan 2010 15:48:49 +0000 (15:48 +0000)]
Define {DM, LVM}_UDEV_DISABLE_CHECKING=1 env. variables for tests.

We need to disable udev checking for our tests since they use their own
location for device nodes and symlinks.

14 years agoEnable udev_sync and udev_rules in lvm.conf by default while running tests.
Peter Rajnoha [Mon, 11 Jan 2010 15:43:19 +0000 (15:43 +0000)]
Enable udev_sync and udev_rules in lvm.conf by default while running tests.

14 years agoAdd support to disable udev checking: LVM_UDEV_DISABLE_CHECKING=1 env. var.
Peter Rajnoha [Mon, 11 Jan 2010 15:40:03 +0000 (15:40 +0000)]
Add support to disable udev checking: LVM_UDEV_DISABLE_CHECKING=1 env. var.

LVM_UDEV_DISABLE_CHECKING=1 applies for /dev/<vgname> content only.
We still need to define DM_UDEV_DISABLE_CHECKING=1 for /dev/mapper content.

14 years agoAdd support to disable udev checking: DM_UDEV_DISABLE_CHECKING=1 env. variable.
Peter Rajnoha [Mon, 11 Jan 2010 15:36:24 +0000 (15:36 +0000)]
Add support to disable udev checking: DM_UDEV_DISABLE_CHECKING=1 env. variable.

Sometimes it is really needed to switch off udev checking and the warnings we show when
we detect that udev has not done its job right - the messages like "Udev should have done
this and that. Falling back to direct node creation/removal. " etc.

This would be especially handy while setting DM_DEV_DIR env var that could be set to a
different location than standard /dev (udev can't create nodes/symlinks out of that one
directory that is configured into udevd). The exact same situation happens while we're
running our tests.

14 years agoremove unused variable 'i' that was recently introduced in lv_add_segment
Mike Snitzer [Sun, 10 Jan 2010 20:44:09 +0000 (20:44 +0000)]
remove unused variable 'i' that was recently introduced in lv_add_segment

14 years agoupdate comment
Jonathan Earl Brassow [Fri, 8 Jan 2010 23:06:36 +0000 (23:06 +0000)]
update comment

14 years agoAdd the new mirror log type "redundant". The options are now:
Jonathan Earl Brassow [Fri, 8 Jan 2010 22:32:35 +0000 (22:32 +0000)]
Add the new mirror log type "redundant".  The options are now:
--mirrorlog core: in-memory log
--mirrorlog disk: persistent log
--mirrorlog redundant: redundant persistent log

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
14 years agoudpate WHATS_NEW file for --splitmirror checkin
Jonathan Earl Brassow [Fri, 8 Jan 2010 22:28:54 +0000 (22:28 +0000)]
udpate WHATS_NEW file for --splitmirror checkin

14 years agoThis patch adds the capability to split off a mirror legs.
Jonathan Earl Brassow [Fri, 8 Jan 2010 22:00:31 +0000 (22:00 +0000)]
This patch adds the capability to split off a mirror legs.
It is pretty much the same as reducing the number of
mirror legs, but we just don't delete them afterwards.

The following command line interface is enforced:
  prompt> lvconvert --splitmirror <n> -n <name> <VG>/<LV>
where 'n' is the number of images to split off, and
where 'name' is the name of the newly split off logical volume.

If more than one leg is split off, a new mirror will be the
result.  The newly split off mirror will have a 'core' log.
Example:
[root@bp-01 LVM2]# !lvs
lvs -a -o name,copy_percent,devices
  LV            Copy%  Devices
  lv            100.00 lv_mimage_0(0),lv_mimage_1(0),lv_mimage_2(0),lv_mimage_3(0)
  [lv_mimage_0]        /dev/sdb1(0)
  [lv_mimage_1]        /dev/sdc1(0)
  [lv_mimage_2]        /dev/sdd1(0)
  [lv_mimage_3]        /dev/sde1(0)
  [lv_mlog]            /dev/sdi1(0)
[root@bp-01 LVM2]# lvconvert --splitmirrors 2 --name split vg/lv /dev/sd[ce]1
  Logical volume lv converted.
[root@bp-01 LVM2]# !lvs
lvs -a -o name,copy_percent,devices
  LV               Copy%  Devices
  lv               100.00 lv_mimage_0(0),lv_mimage_2(0)
  [lv_mimage_0]           /dev/sdb1(0)
  [lv_mimage_2]           /dev/sdd1(0)
  [lv_mlog]               /dev/sdi1(0)
  split            100.00 split_mimage_0(0),split_mimage_1(0)
  [split_mimage_0]        /dev/sde1(0)
  [split_mimage_1]        /dev/sdc1(0)

It can be seen that '--splitmirror <n>' is exactly the same
as '--mirrors -<n>' (note the minus sign), except there is the
additional notion to keep the image being detached from the
mirror instead of just throwing it away.

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
14 years agoChange background polldaemon's process name to "(lvm2)".
Mike Snitzer [Fri, 8 Jan 2010 21:53:07 +0000 (21:53 +0000)]
Change background polldaemon's process name to "(lvm2)".

Made .update_metadata optional in 'struct poll_functions' definitions;
eliminated _update_lvconvert_mirror() stub.

Tweak a mirror-specific error message in the generic polldaemon code.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
14 years agoAllow vgremove of a VG with PVs missing.
Petr Rockai [Fri, 8 Jan 2010 14:03:54 +0000 (14:03 +0000)]
Allow vgremove of a VG with PVs missing.

14 years agoIn lvconvert --repair --use-policies, for the allocate policies, return success
Petr Rockai [Fri, 8 Jan 2010 13:04:10 +0000 (13:04 +0000)]
In lvconvert --repair --use-policies, for the allocate policies, return success
even if allocation fails, as long as the downconversion or corelog conversion
succeeded.

14 years agoorig_status preserves 64bit status.
Zdenek Kabelac [Fri, 8 Jan 2010 10:50:11 +0000 (10:50 +0000)]
orig_status preserves 64bit status.

14 years ago- forgot to update WHATS_NEW along with bug fix for keeping
Jonathan Earl Brassow [Thu, 7 Jan 2010 20:55:01 +0000 (20:55 +0000)]
- forgot to update WHATS_NEW along with bug fix for keeping
  log type consistent when using lvconvert to change the
  number of mirror images.

14 years agoThe patch fixes some lvconvert issues (WRT mirror <-> mirror).
Jonathan Earl Brassow [Thu, 7 Jan 2010 20:42:55 +0000 (20:42 +0000)]
The patch fixes some lvconvert issues (WRT mirror <-> mirror).

The default log option for a mirror is 'disk'.  If the log
type is not explicitly stated on the command line when
converting from an X-way mirror to a Y-way mirror, 'disk'
is chosen.  So, if you have a 'core' log mirror and you
convert, your result will contain a 'disk' log.

This patch remembers what the old log type was.  If the
user is merely trying to switch the number of mirror
images, the log type is now kept the same.

There is one historical behaviour I left in place...
If you have a 2-way, core-log mirror and you use lvconvert to
specify you want a 2-way mirror - without specifying the
log type - you will get a 2-way, disk-log mirror.

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
Informal-IRC-ACK-by: agk
14 years agoAlways set environment variables for an LVM2 device in 11-dm-lvm.rules.
Peter Rajnoha [Thu, 7 Jan 2010 20:01:55 +0000 (20:01 +0000)]
Always set environment variables for an LVM2 device in 11-dm-lvm.rules.

This way we can still use DM_LV_NAME, DM_VG_NAME and DM_LV_LAYER in all
the other rules.

14 years agoAdd activation/udev_rules config option in lvm.conf.
Peter Rajnoha [Thu, 7 Jan 2010 19:54:21 +0000 (19:54 +0000)]
Add activation/udev_rules config option in lvm.conf.
Add dm_tree_add_dev_with_udev_flags to provide wider support for udev flags.

14 years agoAdd --noudevrules option for dmsetup to disable /dev node management by udev.
Peter Rajnoha [Thu, 7 Jan 2010 19:45:12 +0000 (19:45 +0000)]
Add --noudevrules option for dmsetup to disable /dev node management by udev.

14 years agoAdd few const modifiers.
Zdenek Kabelac [Thu, 7 Jan 2010 14:47:57 +0000 (14:47 +0000)]
Add few const modifiers.

14 years agoUse macro outsize() with check for error return value.
Zdenek Kabelac [Thu, 7 Jan 2010 14:46:51 +0000 (14:46 +0000)]
Use macro outsize() with check for error return value.

14 years agoExport function out_text_with_comment() and add outfc() macro that checks
Zdenek Kabelac [Thu, 7 Jan 2010 14:45:28 +0000 (14:45 +0000)]
Export function out_text_with_comment() and add outfc() macro that checks
for error.

14 years agoAdd macros outsize() for out_size() and outhint() for out_hint() that check
Zdenek Kabelac [Thu, 7 Jan 2010 14:40:46 +0000 (14:40 +0000)]
Add macros outsize() for out_size() and outhint() for out_hint() that check
for errors in a similar way as outf() for out_text().

14 years agoUse offsetof() macro and avoid defining dummy static union for FIELD() macro.
Zdenek Kabelac [Thu, 7 Jan 2010 14:37:11 +0000 (14:37 +0000)]
Use offsetof() macro and avoid defining dummy static union for FIELD() macro.
Makes it compilable by clang compiler.

14 years agoError message prints unrecognized key.
Zdenek Kabelac [Thu, 7 Jan 2010 14:32:44 +0000 (14:32 +0000)]
Error message prints unrecognized key.

14 years agoShow all fields for 'dmsetup info -c -o all'.
Zdenek Kabelac [Thu, 7 Jan 2010 14:30:47 +0000 (14:30 +0000)]
Show all fields for 'dmsetup info -c -o all'.

14 years agoJust add '.' at the end of error message.
Zdenek Kabelac [Thu, 7 Jan 2010 14:29:53 +0000 (14:29 +0000)]
Just add '.' at the end of error message.

14 years agoFix typo fsdam -> fsadm (closes bug 552721)
Zdenek Kabelac [Thu, 7 Jan 2010 09:42:51 +0000 (09:42 +0000)]
Fix typo  fsdam -> fsadm   (closes bug 552721)

14 years ago. update documentation for --poll in the vgchange and lvchange man pages
Mike Snitzer [Wed, 6 Jan 2010 19:08:58 +0000 (19:08 +0000)]
. update documentation for --poll in the vgchange and lvchange man pages
. add high-level --poll FIXMEs to vgchange.c and lvchange.c

14 years agoRename mirror_device_fault_policy to mirror_image_fault policy
Milan Broz [Wed, 6 Jan 2010 13:27:06 +0000 (13:27 +0000)]
Rename mirror_device_fault_policy to mirror_image_fault policy

14 years agoRemove empty "repaired" devices if empty in lvconvert.
Milan Broz [Wed, 6 Jan 2010 13:26:21 +0000 (13:26 +0000)]
Remove empty "repaired" devices if empty in lvconvert.

The logic was that lvconvert repair volumes, marking
PV as MISSING and following vgreduce --removemissing
removes these missing devices.

Previously dmeventd mirror DSO removed all LV and PV
from VG by simply relying on
vgreduce --removemissing --force.

Now, there are two subsequent calls:
lvconvert --repair --use-policies
vgreduce --removemissing

So the VG is locked twice, opening space for all races
between other running lvm processes. If the PV reappears
with old metadata on it (so the winner performs autorepair,
if locking VG for update) the situation is even worse.

Patch simply adds removemissing PV functionality into
lvconcert BUT ONLY if running with --repair and --use-policies
and removing only these empty missing PVs which are
involved in repair.
(This combination is expected to run only from dmeventd.)

14 years agoUse fixed buffer to prevent stack overflow in persistent filter dump.
Milan Broz [Wed, 6 Jan 2010 13:25:36 +0000 (13:25 +0000)]
Use fixed buffer to prevent stack overflow in persistent filter dump.

14 years agoupdate WHATS_NEW and WHATS_NEW_DM with previous commits' changes
Mike Snitzer [Tue, 5 Jan 2010 21:32:59 +0000 (21:32 +0000)]
update WHATS_NEW and WHATS_NEW_DM with previous commits' changes

14 years agoUse snapshot metadata usage to determine if snapshot is empty
Mike Snitzer [Tue, 5 Jan 2010 21:14:04 +0000 (21:14 +0000)]
Use snapshot metadata usage to determine if snapshot is empty

Version >= 1.8.0 of the DM snapshot target appends metadata sectors used
to a snapshot's status.  This patch allows LVM2 to accurately determine
if the snapshot store is empty.  Knowing when a snapshot store is empty
is important in the context of snapshot-merge (means merge is complete).

Also update LVM2 to be aware of the possibility for "Merge failed" in
the snapshot-merge target's status.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
14 years agoAdd missing 'stack;' for all activate_lv and deactivate_lv callers.
Mike Snitzer [Tue, 5 Jan 2010 21:08:34 +0000 (21:08 +0000)]
Add missing 'stack;' for all activate_lv and deactivate_lv callers.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
14 years agoAdd missing 'stack;' for all suspend_lv and resume_lv callers.
Mike Snitzer [Tue, 5 Jan 2010 21:07:31 +0000 (21:07 +0000)]
Add missing 'stack;' for all suspend_lv and resume_lv callers.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
14 years agoReturn error to dm_tree_deactivate_children() callers.
Mike Snitzer [Tue, 5 Jan 2010 21:06:26 +0000 (21:06 +0000)]
Return error to dm_tree_deactivate_children() callers.

Otherwise deactivate_lv can fail silently.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
14 years agoReturn error to dm_tree_suspend_children() callers.
Mike Snitzer [Tue, 5 Jan 2010 21:05:40 +0000 (21:05 +0000)]
Return error to dm_tree_suspend_children() callers.

Otherwise suspend_lv and its variants can fail silently.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
14 years agoReturn error to dm_tree_preload_children() and
Mike Snitzer [Tue, 5 Jan 2010 21:04:37 +0000 (21:04 +0000)]
Return error to dm_tree_preload_children() and
dm_tree_activate_children() callers.

Otherwise resume_lv and its variants can fail silently.

Catching these failures is especially important now that dm targets like
crypt and snapshot-merge can fail in .preresume

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
14 years agoAdd a [--poll {y|n}] flag to vgchange and lvchange to control whether
Mike Snitzer [Tue, 5 Jan 2010 20:56:51 +0000 (20:56 +0000)]
Add a [--poll {y|n}] flag to vgchange and lvchange to control whether
the background polldaemon is allowed to start.  It can be used
standalone or in conjunction with --refresh or --available y.

Control over when the background polldaemon starts will be particularly
important for snapshot-merge of a root filesystem.

Dracut will be updated to activate all LVs with: --poll n

The lvm2-monitor initscript will start polling with: --poll y

NOTE: Because we currently have no way of knowing if a background
polldaemon is active for a given LV the following limitations exist and
have been deemed acceptable:
1) it is not possible to stop an active polldaemon; so the lvm2-monitor
   initscript doesn't stop running polldaemon(s)
2) redundant polldaemon instances will be started for all specified LVs
   if vgchange or lvchange are repeatedly used with '--poll y'

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
14 years agoPropagate commit and revert metadata event to other nodes in cluster.
Milan Broz [Tue, 5 Jan 2010 16:09:33 +0000 (16:09 +0000)]
Propagate commit and revert metadata event to other nodes in cluster.

This patch tries to correctly track changes in lvmcache related to commit/revert.

For vg_commit: if there is cached precommitted metadata, after successfull commit
these metadata must be tracked as committed.

For vg_revert: remote nodes must drop precommitted metadata and its flag in lvmcache.

(N.B. Patch do not touch LV locks here in any way.)

All this machinery is needed to properly solve remote node cache invalidaton which
cause several problems recently observed.

14 years agoProper mask lock mode for vg lock.
Milan Broz [Tue, 5 Jan 2010 16:07:56 +0000 (16:07 +0000)]
Proper mask lock mode for vg lock.

Lock mode is int masked by LCK_TYPE_MASK, always.

Patch also remove uneccessary masking lock flag on sender side,
if masking is needed, it is don on client side already.

14 years agoAdd possibility to handle precommitted metadata in lvmcache.
Milan Broz [Tue, 5 Jan 2010 16:06:42 +0000 (16:06 +0000)]
Add possibility to handle precommitted metadata in lvmcache.

 - Add drop_precommitted flag to force drop precommitted metadata
 - add lvmcache_commit_metadata() which upgrades precommitted metadata in cache

No functional change in this patch - just preparation for following change.

14 years agoMove processing of VG locks to separate function (similar to LV locks).
Milan Broz [Tue, 5 Jan 2010 16:05:12 +0000 (16:05 +0000)]
Move processing of VG locks to separate function (similar to LV locks).

And print some debugging info.

No functional change in this patch.

14 years agoProperly decode flags even for VG locks.
Milan Broz [Tue, 5 Jan 2010 16:03:37 +0000 (16:03 +0000)]
Properly decode flags even for VG locks.

And decode flags in humar readable form in client.
And clean some trailing whitespaces.

No functional change in this patch (only debugging messages changed).

14 years agoDo not set precommitted flag in cache when precommitted metadata does not exist.
Milan Broz [Tue, 5 Jan 2010 16:01:22 +0000 (16:01 +0000)]
Do not set precommitted flag in cache when precommitted metadata does not exist.

The use_precommitted flag indicates, that we want to use precommitted metadata
(used in suspend call to preload table with precommitted data).

But if there are no such data, committed metadata are read but the cache
still contains that precommitted flag.

(The problem is that later possible drop_metadata call will not invalidate
device in cache.)

The wrong precommitted state is stored in on remote nodes during normal
suspend/resume cycle _without_ vg_write/commit.

Use the PRECOMMITTED status flag here instead (which is always set if using
precommited metadata here).

14 years agoResume volumes in reverse order to preserve memlock pairing.
Milan Broz [Tue, 5 Jan 2010 15:58:11 +0000 (15:58 +0000)]
Resume volumes in reverse order to preserve memlock pairing.

If renaming snapshot with virtual origin, the origin is renamed too.
But the code must resume LVs in reverse order to properly
pair memlock (in cluster locking).

(The resume of snapshot resumes origin too and later resume
is ignored otherwise.)

14 years agoFix previous vgcreate commit to not call unpaired unlock.
Milan Broz [Mon, 28 Dec 2009 18:34:45 +0000 (18:34 +0000)]
Fix previous vgcreate commit to not call unpaired unlock.

14 years agoExplicitly use non-clustered vgcreate in test.
Milan Broz [Mon, 28 Dec 2009 18:33:04 +0000 (18:33 +0000)]
Explicitly use non-clustered vgcreate in test.
(So the tests can run under cluster locking and do not require
cluster mirror or snapshots.)

Add vgscan before block device readahead change
(flush long running process - clvmd - dev cache.)

14 years agoDrop metadata cache after device was autorepaired and removed from VG.
Milan Broz [Fri, 18 Dec 2009 12:45:41 +0000 (12:45 +0000)]
Drop metadata cache after device was autorepaired and removed from VG.

All long running processes must reload metadata when some
device becomes orphan after repair.

14 years agoRemove missing flag if PV reappeared and is empty.
Milan Broz [Fri, 18 Dec 2009 12:44:20 +0000 (12:44 +0000)]
Remove missing flag if PV reappeared and is empty.

When PV device reappears with old metadata, it is
always updated to new version byt atutomatic metadata
repair.

Remove missing flag if device is empty.

If device contains allocated extents, issue warning that
user must remove volumes and re-add this PV before
manipulating with this volume.

This partially solves bug 547842 when one PV (log) is failed,
dmeventd removes that device and later this device reappears and
is wrongly added into VG marked missing.

14 years agoRevert another unintended change that snuck in.
Petr Rockai [Thu, 17 Dec 2009 15:59:53 +0000 (15:59 +0000)]
Revert another unintended change that snuck in.

14 years agoFix removal of multiple devices from a mirror (+ regression test).
Petr Rockai [Thu, 17 Dec 2009 15:38:29 +0000 (15:38 +0000)]
Fix removal of multiple devices from a mirror (+ regression test).

14 years agoAlso clean up MISSING devices in --removemissing --force in vgreduce.
Petr Rockai [Thu, 17 Dec 2009 13:54:46 +0000 (13:54 +0000)]
Also clean up MISSING devices in --removemissing --force in vgreduce.

14 years agoRevert unintended change that slipped in with last checkin.
Petr Rockai [Wed, 16 Dec 2009 19:26:20 +0000 (19:26 +0000)]
Revert unintended change that slipped in with last checkin.

14 years ago#define an INTERNAL_ERROR macro and use it throughout LVM.
Petr Rockai [Wed, 16 Dec 2009 19:22:11 +0000 (19:22 +0000)]
#define an INTERNAL_ERROR macro and use it throughout LVM.

14 years agoCleanup returns for void functions.
Zdenek Kabelac [Fri, 11 Dec 2009 13:16:37 +0000 (13:16 +0000)]
Cleanup returns for void functions.

14 years agoDestroy allocated mempool in _vg_read_orphans() error path.
Zdenek Kabelac [Fri, 11 Dec 2009 13:14:44 +0000 (13:14 +0000)]
Destroy allocated mempool in _vg_read_orphans() error path.

14 years agoFix unlocking vg in some pvresize and toollib error paths.
Zdenek Kabelac [Fri, 11 Dec 2009 13:11:56 +0000 (13:11 +0000)]
Fix unlocking vg in some pvresize and toollib error paths.

14 years agoFix coredump and memory leak for 'dmsetup help -c'
Zdenek Kabelac [Fri, 11 Dec 2009 13:04:30 +0000 (13:04 +0000)]
Fix coredump and memory leak for 'dmsetup help -c'

14 years agos/=/==/ Typo was causing sub test to always return success.
Jonathan Earl Brassow [Thu, 10 Dec 2009 22:06:15 +0000 (22:06 +0000)]
s/=/==/  Typo was causing sub test to always return success.

14 years agoCall explicitly suspend for temporary mirror layer.
Milan Broz [Wed, 9 Dec 2009 19:53:39 +0000 (19:53 +0000)]
Call explicitly suspend for temporary mirror layer.

The memlock_inc() fix is wrong, memlock count is not
propagated to long living process (clvmd) and just
it underflow there.
Also suspend is needed to pre-load precommited metadata
on other nodes (remapping to error taget in this case).

With explicit suspend we generate lock request and code
can update memlock count.

(Infinitely "locked" memory caused that fs_unlock() was not
called properly and on cluster nodes remains
old links in /dev/mapper for not active devices.)

(N.B. failing of suspend call here is not handled as fatal
error - the LV is going to be removed later anyway.)

14 years agoUse more descriptive variable name for temporary layer lv.
Milan Broz [Wed, 9 Dec 2009 19:43:39 +0000 (19:43 +0000)]
Use more descriptive variable name for temporary layer lv.

14 years agoFix missing include.
Milan Broz [Wed, 9 Dec 2009 19:30:56 +0000 (19:30 +0000)]
Fix missing include.

14 years agoAllow manipulation with precommited metadata even when a PV is missing.
Milan Broz [Wed, 9 Dec 2009 19:29:04 +0000 (19:29 +0000)]
Allow manipulation with precommited metadata even when a PV is missing.

The new recovery code first tries to repair LV and then removes failed PV
from VG. It means that during operation there can be VG with PV missing,
and vg_read code handles it like not consistent VG.

We already allows returning "inconsistent" commited metadata,
for mirror repair we need this for precommited too.
(The suspend call prepares precommited metadata to inactive table on
other cluster nodes.)

"Inconsistent" here means - correct metadata, just with some metadata areas
not found (obviously on missing or failed PVs).

14 years agoAdd memlock information to do_lock_lv debug output.
Milan Broz [Wed, 9 Dec 2009 19:01:27 +0000 (19:01 +0000)]
Add memlock information to do_lock_lv debug output.

This helps a lot to detect that something strange happened.

14 years agoNever ever use distributed lock for LV in non-clustered VG.
Milan Broz [Wed, 9 Dec 2009 19:00:16 +0000 (19:00 +0000)]
Never ever use distributed lock for LV in non-clustered VG.

The LV locks make sense only for clustered LVs.

Properly check cluster flag and never issue cluster lock here.

There are several places in code, where it is already checked, this
patch add this check to all needed calls.

In previous code the lock behaviour was inconsistent,
for example, the pre/post callback can take lock even for local volume,
but deactivate call do not released this lock and it remains held forever.

The local LV lock request now just let run the underlying activation code
on local node, the same process like in local locking.

(Again, this is important for new mirror repair calls, here for local
mirrors but with cluster locking enabled.)

14 years agoAllow implicit lock conversion for pre/post callbacks.
Milan Broz [Wed, 9 Dec 2009 18:55:53 +0000 (18:55 +0000)]
Allow implicit lock conversion for pre/post callbacks.

This is unnoticed regression from commit 31672ff60e405795cad70d6d7888ac011f5373ce

The pre/post callback need to convert lock always, local node
is going to modify metadata in this case, it it fails conversion,
the call is ignored.

Also it fixes bug when the lock is not yet held, we cannot set LKF_CONVERT
in this case, it will fail because this lock do not exist.

Note that the automatic conversion is still disabled in activate
call, so the original fix (reactivation of exlusive LV) should
be still in place.

14 years agoAllow implicit "convert" to the same lock mode.
Milan Broz [Wed, 9 Dec 2009 18:45:12 +0000 (18:45 +0000)]
Allow implicit "convert" to the same lock mode.

(Code already not fail if unlocking not locked resource.)

This is needed in pre/post lock_lv call, where we can
request the same lock on local node becuase of suspend call.

14 years agoGet rid of magic masks in cluster locking code - clvmd part.
Milan Broz [Wed, 9 Dec 2009 18:42:02 +0000 (18:42 +0000)]
Get rid of magic masks in cluster locking code - clvmd part.

- do_command and lock_vg expect flags (no change here)

Bug fixes:
- lock_vg should check for NONBLOCK on lock_cmd, flags have this bit masked-out

- do_pre/post_command expect do not mask flag at all, this causes that
the code inside is never run! (see following patches, these functions
expect plain command without flags)

14 years agoGet rid of magic masks in cluster locking code.
Milan Broz [Wed, 9 Dec 2009 18:28:27 +0000 (18:28 +0000)]
Get rid of magic masks in cluster locking code.

Patch should not cause any problems, only real change is
removing LCK_LOCAL bit from lock type flag, it is never used there.
(LCK_LOCAL is part arg[1] bits anyway.)

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