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

1739 Commits

Author SHA1 Message Date
Mike Snitzer
beacd0b303 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.
2010-01-11 19:08:18 +00:00
Peter Rajnoha
a750353641 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.
2010-01-11 15:40:03 +00:00
Mike Snitzer
b422bb2187 remove unused variable 'i' that was recently introduced in lv_add_segment 2010-01-10 20:44:09 +00:00
Jonathan Earl Brassow
23f4aabd69 update comment 2010-01-08 23:06:36 +00:00
Jonathan Earl Brassow
77dd1c0e5f 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>
2010-01-08 22:32:35 +00:00
Jonathan Earl Brassow
72e0743621 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>
2010-01-08 22:00:31 +00:00
Zdenek Kabelac
56bb994166 orig_status preserves 64bit status. 2010-01-08 10:50:11 +00:00
Peter Rajnoha
cda69e17ef Add activation/udev_rules config option in lvm.conf.
Add dm_tree_add_dev_with_udev_flags to provide wider support for udev flags.
2010-01-07 19:54:21 +00:00
Zdenek Kabelac
387f47078c Add few const modifiers. 2010-01-07 14:47:57 +00:00
Zdenek Kabelac
a362bb23c0 Use macro outsize() with check for error return value. 2010-01-07 14:46:51 +00:00
Zdenek Kabelac
ea8acabe26 Export function out_text_with_comment() and add outfc() macro that checks
for error.
2010-01-07 14:45:28 +00:00
Zdenek Kabelac
1e13fa7a6a Add macros outsize() for out_size() and outhint() for out_hint() that check
for errors in a similar way as outf() for out_text().
2010-01-07 14:40:46 +00:00
Zdenek Kabelac
c75550f5ba Use offsetof() macro and avoid defining dummy static union for FIELD() macro.
Makes it compilable by clang compiler.
2010-01-07 14:37:11 +00:00
Zdenek Kabelac
f760f97a1f Just add '.' at the end of error message. 2010-01-07 14:29:53 +00:00
Milan Broz
03984e05a3 Rename mirror_device_fault_policy to mirror_image_fault policy 2010-01-06 13:27:06 +00:00
Milan Broz
5d196aa430 Use fixed buffer to prevent stack overflow in persistent filter dump. 2010-01-06 13:25:36 +00:00
Mike Snitzer
5b7f6ad698 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>
2010-01-05 21:14:04 +00:00
Mike Snitzer
56b3d20462 Add missing 'stack;' for all activate_lv and deactivate_lv callers.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
2010-01-05 21:08:34 +00:00
Mike Snitzer
df13cf08d5 Add missing 'stack;' for all suspend_lv and resume_lv callers.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
2010-01-05 21:07:31 +00:00
Mike Snitzer
7a8fa6aaab 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>
2010-01-05 20:56:51 +00:00
Milan Broz
0e06c92fdf 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.
2010-01-05 16:09:33 +00:00
Milan Broz
c9118a1d20 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.
2010-01-05 16:07:56 +00:00
Milan Broz
d37be0b865 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.
2010-01-05 16:06:42 +00:00
Milan Broz
d7f44761ab 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).
2010-01-05 16:03:37 +00:00
Milan Broz
4b1687fb74 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).
2010-01-05 16:01:22 +00:00
Milan Broz
60494fe74b 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.)
2010-01-05 15:58:11 +00:00
Milan Broz
cfe30f1df3 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.
2009-12-18 12:45:41 +00:00
Milan Broz
aa02928ff7 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.
2009-12-18 12:44:20 +00:00
Petr Rockai
fbcb06145b Revert another unintended change that snuck in. 2009-12-17 15:59:53 +00:00
Petr Rockai
dff5da2d64 Fix removal of multiple devices from a mirror (+ regression test). 2009-12-17 15:38:29 +00:00
Petr Rockai
207542b40e Revert unintended change that slipped in with last checkin. 2009-12-16 19:26:20 +00:00
Petr Rockai
550cae2340 #define an INTERNAL_ERROR macro and use it throughout LVM. 2009-12-16 19:22:11 +00:00
Zdenek Kabelac
b1ebf028de Cleanup returns for void functions. 2009-12-11 13:16:37 +00:00
Zdenek Kabelac
735308699c Destroy allocated mempool in _vg_read_orphans() error path. 2009-12-11 13:14:44 +00:00
Milan Broz
34de60e4d4 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.)
2009-12-09 19:53:39 +00:00
Milan Broz
adee669441 Use more descriptive variable name for temporary layer lv. 2009-12-09 19:43:39 +00:00
Milan Broz
0fa0e6addf 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).
2009-12-09 19:29:04 +00:00
Milan Broz
7251c8f3a5 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.)
2009-12-09 18:28:27 +00:00
Milan Broz
f9f8cd08b3 Get rid of hardcoded 0xffdf cluster lock flag.
There is hidded change - the upper flags (0xffff0000)
and now not cleared, but there are unused anyway.
2009-12-09 18:16:38 +00:00
Milan Broz
f72a06ccf7 Remove newly created log volume if initial deactivation fails.
If there is problem deactivate LV and
_init_mirror_log is called with remove_on_failure = 1,
remove the newly created log LV from metadata.

(This can happen if there is active device with the same name
but different UUID.)

The main reason for this "workaround" patch is to
 - do not keep _mlog volume in metadata, so user can repeat the action
 - print better error message describing the real problem

# lvcreate -m 2 -n lv1 -l 1 --nosync vg_bar
  WARNING: New mirror won't be synchronised. Don't read what you didn't write!
  /dev/vg_bar/lv1_mlog: not found: device not cleared
  Aborting. Failed to wipe mirror log.
  Error locking on node bar-01: Input/output error
  Unable to deactivate mirror log LV. Manual intervention required.
  Failed to create mirror log.

# lvcreate -m 2 -n lv1 -l 1 --nosync vg_bar
  WARNING: New mirror won't be synchronised. Don't read what you didn't write!
  Aborting. Unable to deactivate mirror log.
  Failed to initialise mirror log.
2009-12-09 18:09:52 +00:00
Dave Wysochanski
59baeb838c Update a few more uint64_t's related to the 64-bit status change.
At this point they probably do not matter but going forward they
may - depends on future patches for replicator, etc.  I think
these probably got missed because they were 'flags' so I changed
the name to 'status' to be consistent.  So the on-disk
things 'flags' and the in structure 'status' (bits).
NOTE: WHATS_NEW already has entry for this in current release.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Acked-by: Mike Snitzer <snitzer@redhat.com>
2009-12-04 17:48:32 +00:00
Milan Broz
63ae0d1464 Fix memory lock imbalance in lv_suspend if already suspended.
pvmove suspends all moved LVs + pvmoveX mirrored LV itself.

This suspends even underlying pvmoveX and following explicit
suspend call is just noop.

But in resume the pvmoveX volume is no longer underlying
device for moved LVs, so it performs full resume with memlock
decrease.

Code must call memlock_inc() if suspend is requested, volume
is already suspended and error is not requested.
2009-12-03 19:23:40 +00:00
Milan Broz
fec4de9563 Fix tools to report error when stopped by user.
(And do not produce internal error message.)
2009-12-03 19:18:33 +00:00
Zdenek Kabelac
60184834b5 minor indent change 2009-12-03 10:01:30 +00:00
Zdenek Kabelac
6c8ffd0362 skip cast from (void*) 2009-12-03 09:59:54 +00:00
Zdenek Kabelac
08e64ce5e9 minor whitespace indentation 2009-12-03 09:58:30 +00:00
Dave Wysochanski
c053fb62bc Fix setting of readahead in lvcreate.
The default comes from the configuration settings, with possible
commandline override.
2009-12-03 01:47:33 +00:00
Milan Broz
0548bcc2dc Fix memory leak in lv_info_by_lvid
The lv_from_lvid calls internally vg_read(),
we must release vg structure afterwards.

Code is called only from clvmd.
2009-12-01 19:10:23 +00:00
Petr Rockai
f1a4ec40fc If aborting due to an internal error, always print the message causing this. 2009-12-01 13:54:27 +00:00
Petr Rockai
99a304bc17 Optionally abort on internal errors (and leverage this option in the
testsuite). (This is showing a problem in the pvmove test for me, so I expect
the tests to start failing -- this needs to be fixed separately though.)
2009-11-30 17:17:11 +00:00