]> sourceware.org Git - lvm2.git/log
lvm2.git
12 years agoRemove unused file from tree
Zdenek Kabelac [Thu, 20 Oct 2011 13:23:52 +0000 (13:23 +0000)]
Remove unused file from tree

12 years agoJust replace stack, return 0 with return_0
Zdenek Kabelac [Thu, 20 Oct 2011 10:39:07 +0000 (10:39 +0000)]
Just replace stack, return 0  with  return_0

12 years agoCleanup backtraces
Zdenek Kabelac [Thu, 20 Oct 2011 10:38:04 +0000 (10:38 +0000)]
Cleanup backtraces

Make sure stacks are at the right places when something goes wrong here.

12 years agoAdd last param 0 for thin-pool
Zdenek Kabelac [Thu, 20 Oct 2011 10:35:55 +0000 (10:35 +0000)]
Add last param 0 for thin-pool

So now the table suppression works for thin-pool.

12 years agoEnsure right activation order
Zdenek Kabelac [Thu, 20 Oct 2011 10:35:14 +0000 (10:35 +0000)]
Ensure right activation order

Couple FIXMEs put into the code for parts of the code which may be
improved later, since we might be able to add 'lazy' device creation later.
For now require exclusive activation.

12 years agoAdapt to thin kernel target API
Zdenek Kabelac [Thu, 20 Oct 2011 10:33:30 +0000 (10:33 +0000)]
Adapt to thin kernel target API

Since kernel target uses low_water_mark - use this name in libdm as well.

12 years agoReindent code
Zdenek Kabelac [Thu, 20 Oct 2011 10:32:29 +0000 (10:32 +0000)]
Reindent code

Avoid 1 indent level and use check for empty list only for
add of transaction_id message.

12 years agoUse const pointers in thin API were appropriate
Zdenek Kabelac [Thu, 20 Oct 2011 10:31:27 +0000 (10:31 +0000)]
Use const pointers in thin API were appropriate

12 years agoPrint low_water_mark only when it has some value
Zdenek Kabelac [Thu, 20 Oct 2011 10:30:39 +0000 (10:30 +0000)]
Print low_water_mark only when it has some value

Do not expose low_water_mark in mda yet, if it has no use.
We do not allow to be set via current lvm tool code.
Usage needs to be clarified first.

12 years agoAdd _BLOCK_ to define
Zdenek Kabelac [Thu, 20 Oct 2011 10:28:41 +0000 (10:28 +0000)]
Add _BLOCK_ to define

Use DM_THIN_MIN_DATA_BLOCK_SIZE and
DM_THIN_MAX_DATA_BLOCK_SIZE to make it more obvious, for which
this define is useful in thin API.

12 years agoImprove lvcreate man page
Zdenek Kabelac [Wed, 19 Oct 2011 16:49:13 +0000 (16:49 +0000)]
Improve lvcreate man page

Split syntax for thin-pool since it cannot be fully matched with snapshot.
So to avoid more confusion - take thin support into separate line.

Though still significant updates are needed for thin provisioning.

12 years agoAdd few more protected names
Zdenek Kabelac [Wed, 19 Oct 2011 16:45:35 +0000 (16:45 +0000)]
Add few more protected names

12 years agoUse structure copy
Zdenek Kabelac [Wed, 19 Oct 2011 16:45:02 +0000 (16:45 +0000)]
Use structure copy

Since the code evolved a bit with current structures we could use C to
copy struct members.

12 years agoUpdate error message
Zdenek Kabelac [Wed, 19 Oct 2011 16:42:14 +0000 (16:42 +0000)]
Update error message

Drop INTERNAL_ERROR from public API functions.
Improve some messages.

12 years agoUse generic name for message sending function
Zdenek Kabelac [Wed, 19 Oct 2011 16:40:59 +0000 (16:40 +0000)]
Use generic name for message sending function

Drop _thin_pool prefix for _node_send_message so it could be extended later.
Replace current_id with trans_id name.

12 years agoSimple validation of messages in mda
Zdenek Kabelac [Wed, 19 Oct 2011 16:39:09 +0000 (16:39 +0000)]
Simple validation of messages in mda

Check we do not combine multiple messages for same LV target
and switch to use  'delete_id' to make it clear for what this device_id
is being used.

12 years agoDrop messages referencing deleted LV
Zdenek Kabelac [Wed, 19 Oct 2011 16:37:30 +0000 (16:37 +0000)]
Drop messages referencing deleted LV

lvremove may remove problematic LV for thin target.

12 years agoJust indent changes
Zdenek Kabelac [Wed, 19 Oct 2011 16:36:39 +0000 (16:36 +0000)]
Just indent changes

Some tabs & spaces.

12 years agoAdd internal expected_errno dm_tast var
Zdenek Kabelac [Wed, 19 Oct 2011 16:36:01 +0000 (16:36 +0000)]
Add internal expected_errno dm_tast var

Certain errno codes could be expected in some situations thus
add experimental support for them.

When expected errno is set after ioctl error - function skips error
printing and exits succefully.

Currently only useful for thin pool messages.

12 years agoRemove test for thin_pool
Zdenek Kabelac [Wed, 19 Oct 2011 16:32:34 +0000 (16:32 +0000)]
Remove test for thin_pool

Since both functions are called during mda read - we don't have full LV info
at this moment.

12 years agoRemove a redundant (and in some cases, misleading) message about snapshot
Petr Rockai [Wed, 19 Oct 2011 14:31:49 +0000 (14:31 +0000)]
Remove a redundant (and in some cases, misleading) message about snapshot
extension, in the snapshot dmeventd plugin. The reporting is done as needed by
the LVM command nowadays.

12 years agoNew.
Petr Rockai [Wed, 19 Oct 2011 09:01:03 +0000 (09:01 +0000)]
New.

12 years agoKeep the LVM-based dmeventd plugins from trying to manipulate the dmeventd
Petr Rockai [Wed, 19 Oct 2011 08:46:26 +0000 (08:46 +0000)]
Keep the LVM-based dmeventd plugins from trying to manipulate the dmeventd
monitoring state of the logical volumes they are currently acting on.

Until now, every time a logical volume has been changed by a dmeventd plugin,
this plugin would have called back to dmeventd through the external FIFO
mechanism. I am fairly sure this was superfluous, inefficient and possibly even
dangerous.

12 years agoFix bad lvconvert help output.
Jonathan Earl Brassow [Tue, 18 Oct 2011 16:27:45 +0000 (16:27 +0000)]
Fix bad lvconvert help output.

The '--merge' option to lvconvert works on snapshots and RAID1.  The man
pages correctly reflect this, but the CLI help output still used the term,
'SnapshotLogicalVolume'.

12 years agoUse zalloc for malloc,memset
Zdenek Kabelac [Mon, 17 Oct 2011 14:36:06 +0000 (14:36 +0000)]
Use zalloc for malloc,memset

12 years agoDrop messages from lvm app context
Zdenek Kabelac [Mon, 17 Oct 2011 14:18:07 +0000 (14:18 +0000)]
Drop messages from lvm app context

(revert)
Thinp target uses activation context.

12 years agoIndent debug message
Zdenek Kabelac [Mon, 17 Oct 2011 14:17:30 +0000 (14:17 +0000)]
Indent debug message

12 years agoMessage support for thin provisiong
Zdenek Kabelac [Mon, 17 Oct 2011 14:17:09 +0000 (14:17 +0000)]
Message support for thin provisiong

lvm part of messaging.

Each message is now stored it's own thin pool section:

message1 {
create = lv
}

Messages are queued to thin pool dm target when this target
is going to be resumed or used through some dependency.

Currently  'delete' message are purely queued and processed
with next thin pool resume operation (i.e. create_thin).

WARNING - thin provisioning support is developmental code.

12 years agoAdd thin_pool dm message support
Zdenek Kabelac [Mon, 17 Oct 2011 14:16:25 +0000 (14:16 +0000)]
Add thin_pool dm message support

Experimental support for kernel message via resume sequence.

12 years agoAdd _thin_validate_device_id
Zdenek Kabelac [Mon, 17 Oct 2011 14:15:26 +0000 (14:15 +0000)]
Add _thin_validate_device_id

12 years agoSwap parameters
Zdenek Kabelac [Mon, 17 Oct 2011 14:15:01 +0000 (14:15 +0000)]
Swap parameters

Use metadata uuid first (match kernel target).

12 years agoDrop old check for transaction_id
Zdenek Kabelac [Mon, 17 Oct 2011 14:14:33 +0000 (14:14 +0000)]
Drop old check for transaction_id

(revert)

12 years agoFix alignment warning in bitcount calculation for raid segment.
Milan Broz [Mon, 17 Oct 2011 13:15:35 +0000 (13:15 +0000)]
Fix alignment warning in bitcount calculation for raid segment.

12 years agoUse a more correct macro for 'seg_is_linear'
Jonathan Earl Brassow [Fri, 14 Oct 2011 14:21:32 +0000 (14:21 +0000)]
Use a more correct macro for 'seg_is_linear'

It is better to check 'seg->area_count == 1' than '!seg->stripe_size'.

12 years agocmirrord now returns log name to kernel in CTR so it can be registered
Jonathan Earl Brassow [Fri, 14 Oct 2011 14:18:49 +0000 (14:18 +0000)]
cmirrord now returns log name to kernel in CTR so it can be registered

Version 2 of the userspace log protocol accepts return information during the
DM_ULOG_CTR exchange.  The return information contains the name of the log
device that is being used (if there is one).  The kernel can then register the
device via 'dm_get_device'.  Amoung other things, this allows for userspace to
assemble a correct dependency tree of devices - critical for LVM handling of
suspend/resume calls.

Also, update dm-log-userspace.h to match the kernel header associated with
this protocol change.  (Includes a version inc.)

12 years agoUpdate stale libdm/misc/dm-log-userspace.h
Jonathan Earl Brassow [Fri, 14 Oct 2011 14:04:05 +0000 (14:04 +0000)]
Update stale libdm/misc/dm-log-userspace.h

The upstream kernel version that this file mirrors has changed, here is the
commit message:

commit 86a54a4802df10d23ccd655e2083e812fe990243
Author: Jonathan Brassow <jbrassow@redhat.com>
Date:   Thu Jan 13 19:59:52 2011 +0000

    dm log userspace: add version number to comms

    This patch adds a 'version' field to the 'dm_ulog_request'
    structure.

    The 'version' field is taken from a portion of the unused
    'padding' field in the 'dm_ulog_request' structure.  This
    was done to avoid changing the size of the structure and
    possibly disrupting backwards compatibility.

    The version number will help notify user-space daemons
    when a change has been made to the kernel/userspace
    log API.

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
12 years agoUse pool for dm_tree allocation
Zdenek Kabelac [Fri, 14 Oct 2011 13:34:19 +0000 (13:34 +0000)]
Use pool for dm_tree allocation

Using the same pool allocation strategy as we use for vg,
so dm_tree structure is part of the pool itself.

12 years agoFix lv_info open_count test
Zdenek Kabelac [Fri, 14 Oct 2011 13:23:47 +0000 (13:23 +0000)]
Fix lv_info open_count test

When verify_udev_operations was disable, code for stacking fs operation for
lvm links was completely disable - but this code was also used for collecting
information, that a new node is being created.

Add a new flag which is set when a creation of lv symlinks is requested which
should restore old behaviour of lv_info function, that has called fs_sync()
before quere for open count on device.

12 years agoRemove unused variables
Zdenek Kabelac [Tue, 11 Oct 2011 10:06:57 +0000 (10:06 +0000)]
Remove unused variables

12 years agoUse constant for the repeated dlid size specification
Zdenek Kabelac [Tue, 11 Oct 2011 10:02:28 +0000 (10:02 +0000)]
Use constant for the repeated dlid size specification

12 years agoAdd some fixme locking
Zdenek Kabelac [Tue, 11 Oct 2011 09:56:44 +0000 (09:56 +0000)]
Add some fixme locking

Code here is using thread write protected variable without locking.
So add locking, for proper synchronization and a FIXME, since the
code needs closer look.

12 years agoSimplify worker loop
Zdenek Kabelac [Tue, 11 Oct 2011 09:54:39 +0000 (09:54 +0000)]
Simplify worker loop

Do not reacquire mutex several times without a real reason.
Code readability is also better.

12 years agoUse barrier instead of mutex
Zdenek Kabelac [Tue, 11 Oct 2011 09:26:04 +0000 (09:26 +0000)]
Use barrier instead of mutex

Barrier is supposed to be used in situation like this
and replace tricky mutex usage, where mutex has been unlocked
by a different thread than the locking thread.

12 years agoAdd FIXMEs for init_test
Zdenek Kabelac [Tue, 11 Oct 2011 09:23:48 +0000 (09:23 +0000)]
Add FIXMEs for init_test

Usage of thread unprotected init_test is not correct and needs probably lvm lock
since it part of lvm library. Current implementation may probably fail with
test mode and actually create something unexpectedly (and vice versa).

12 years agoUpdate
Zdenek Kabelac [Tue, 11 Oct 2011 09:20:17 +0000 (09:20 +0000)]
Update

12 years agoLimit thread stack
Zdenek Kabelac [Tue, 11 Oct 2011 09:18:49 +0000 (09:18 +0000)]
Limit thread stack

Since default thread stack size is around 8MB and clvmd creates for now thread
for message, clvmd may easily reach multi GB size of in-memory locked pages
(runs with mlockall()).

This patch significantly reduces memory usage to just tens of MB,
and now different reasons are the cause of server overloading.
Now we are running out of free file descriptors mostly.

12 years agoUpdate whats new
Zdenek Kabelac [Tue, 11 Oct 2011 09:14:51 +0000 (09:14 +0000)]
Update whats new

12 years agoReduce preallocated stack size
Zdenek Kabelac [Tue, 11 Oct 2011 09:13:39 +0000 (09:13 +0000)]
Reduce preallocated stack size

Go with just 64KiB for stack.

Closer inspection should be made, whether we actually need to play with
settings at all.

Since default stack size is 8MB and gets mapped via page locking thus,
it seems there is no big help with preallocation of stack to some value.

12 years agoCheck for refresh_filter failure
Zdenek Kabelac [Tue, 11 Oct 2011 09:09:00 +0000 (09:09 +0000)]
Check for refresh_filter failure

Properly detect if the filters were refreshed properly.

(May needs few more fixes ??)

Filter refresh may fail because it may be out of free file descriptors
when clvmd gets overloaded.

12 years agoAdd missing log_error for alloc failure
Zdenek Kabelac [Tue, 11 Oct 2011 09:06:09 +0000 (09:06 +0000)]
Add missing log_error for alloc failure

12 years agoUse condition instead of sleep
Zdenek Kabelac [Tue, 11 Oct 2011 09:05:20 +0000 (09:05 +0000)]
Use condition instead of sleep

Replace usleep with pthread condition to increase speed testing
(for simplicity just 1 condition for all locks).

Use thread mutex also for unlock resource (so it wakes up awaiting
threads)

Better check some error states and return error in fail case with
unlocked mutex.

12 years agoUse shorter way for if()
Zdenek Kabelac [Tue, 11 Oct 2011 09:03:33 +0000 (09:03 +0000)]
Use shorter way for if()

12 years agoSkip backtrace after log_error
Zdenek Kabelac [Tue, 11 Oct 2011 09:02:20 +0000 (09:02 +0000)]
Skip backtrace after log_error

12 years agoReplace with debug
Zdenek Kabelac [Tue, 11 Oct 2011 09:01:38 +0000 (09:01 +0000)]
Replace with debug

Since the dm_tree_create already reports reason of error,
use log_debug for this message.

12 years agoImprove backtrace reporting
Zdenek Kabelac [Tue, 11 Oct 2011 08:59:42 +0000 (08:59 +0000)]
Improve backtrace reporting

Add <backtrace> so the function appears logged for the fail path.

12 years agoChange message severity
Zdenek Kabelac [Tue, 11 Oct 2011 08:57:13 +0000 (08:57 +0000)]
Change message severity

Using log_warn to report missing symlinks as warning, since the command
itself returns as successful, we should not produce log_error().
log_warn is better fit here.

12 years agoSkip r assignment
Zdenek Kabelac [Tue, 11 Oct 2011 08:54:01 +0000 (08:54 +0000)]
Skip r assignment

Cosmetic, since r is already 0 for the error path, no need to assign it there,
and r is assigned to 1 after switch command.
Also makes the code more readable.

12 years agoReindent some thin functions
Zdenek Kabelac [Tue, 11 Oct 2011 08:51:56 +0000 (08:51 +0000)]
Reindent some thin functions

12 years agoRemove test for first_time with FIXME
Zdenek Kabelac [Tue, 11 Oct 2011 08:51:02 +0000 (08:51 +0000)]
Remove test for first_time with FIXME

Workaround for the current code with big FIXME,
since proper solution for pvmove needs to be developed.

Commiting this only for the purpose to get cluster testing covered.

12 years agoAdd the ability to convert LVs of "mirror" segtype to "raid1" segtype.
Jonathan Earl Brassow [Fri, 7 Oct 2011 14:56:01 +0000 (14:56 +0000)]
Add the ability to convert LVs of "mirror" segtype to "raid1" segtype.

Example:
~> lvconvert --type raid1 vg/mirror_lv

Steps to convert "mirror" to "raid1"
1) Allocate a RAID metadata LV for each mirror image from the same PVs
   on which they are located.
2) Clear the metadata LVs.  This involves writing LVM metadata, so we don't
   change any aspects of the mirror LV before this so that the user can easily
   remove LVs from the failed convert attempt while retaining the original
   mirror.
3) Remove the mirror log, if it exists.
4) Add metadata LVs to mirror LV
5) Rename mirror sub-lvs (s/mimage/rimage/)
6) Change flags and segtype from mirror to raid1

12 years agoAdd the ability to convert linear LVs to RAID1
Jonathan Earl Brassow [Fri, 7 Oct 2011 14:52:26 +0000 (14:52 +0000)]
Add the ability to convert linear LVs to RAID1

Example:
~> lvconvert --type raid1 -m 1 vg/lv

The following steps are performed to convert linear to RAID1:
1) Allocate a metadata device from the same PV as the linear device
   to provide the metadata/data LV pair required for all RAID components.
2) Allocate the required number of metadata/data LV pairs for the
   remaining additional images.
3) Clear the metadata LVs.  This performs a LVM metadata update.
4) Create the top-level RAID LV and add the component devices.

We want to make any failure easy to unwind.  This is why we don't create the
top-level LV and add the components until the last step.  Should anything
happen before that, the user could simply remove the unnecessary images.  Also,
we want to ensure that the metadata LVs are cleared before forming the array to
prevent stale information from polluting the new array.

A new macro 'seg_is_linear' was added to allow us to distinguish linear LVs
from striped LVs.

12 years agoAllow 'nosync' extension of mirrors.
Jonathan Earl Brassow [Thu, 6 Oct 2011 15:32:26 +0000 (15:32 +0000)]
Allow 'nosync' extension of mirrors.

This patch allows a mirror to be extended without an initial resync of the
extended portion.  It compliments the existing '--nosync' option to lvcreate.
This action can be done implicitly if the mirror was created with the '--nosync'
option, or explicitly if the '--nosync' option is used when extending the device.

Here are the operational criteria:
1) A mirror created with '--nosync' should extend with 'nosync' implicitly
[EXAMPLE]# lvs vg; lvextend -L +5G vg/lv ; lvs vg
  LV   VG   Attr     LSize Pool Origin Snap%  Move Log     Copy%  Convert
  lv   vg   Mwi-a-m- 5.00g                         lv_mlog 100.00
  Extending 2 mirror images.
  Extending logical volume lv to 10.00 GiB
  Logical volume lv successfully resized
  LV   VG   Attr     LSize  Pool Origin Snap%  Move Log     Copy%  Convert
  lv   vg   Mwi-a-m- 10.00g                         lv_mlog 100.00

2) The 'M' attribute ('M' signifies a mirror created with '--nosync', while 'm'
signifies a mirror created w/o '--nosync') must be preserved when extending a
mirror created with '--nosync'.  See #1 for example of 'M' attribute.

3) A mirror created without '--nosync' should extend with 'nosync' only when
'--nosync' is explicitly used when extending.
[EXAMPLE]# lvs vg; lvextend -L +5G vg/lv; lvs vg
  LV   VG   Attr     LSize  Pool Origin Snap%  Move Log     Copy%  Convert
  lv   vg   mwi-a-m- 20.00m                         lv_mlog 100.00
  Extending 2 mirror images.
  Extending logical volume lv to 5.02 GiB
  Logical volume lv successfully resized
  LV   VG   Attr     LSize Pool Origin Snap%  Move Log     Copy%  Convert
  lv   vg   mwi-a-m- 5.02g                         lv_mlog   0.39
vs.
[EXAMPLE]# lvs vg; lvextend -L +5G vg/lv --nosync; lvs vg
  LV   VG   Attr     LSize  Pool Origin Snap%  Move Log     Copy%  Convert
  lv   vg   mwi-a-m- 20.00m                         lv_mlog 100.00
  Extending 2 mirror images.
  Extending logical volume lv to 5.02 GiB
  Logical volume lv successfully resized
  LV   VG   Attr     LSize Pool Origin Snap%  Move Log     Copy%  Convert
  lv   vg   Mwi-a-m- 5.02g                         lv_mlog 100.00

4) The 'm' attribute must change to 'M' when extending a mirror created without
'--nosync' is extended with the '--nosync' option.  (See #3 examples above.)

5) An inactive mirror's sync percent cannot be determined definitively, so it
must not be allowed to skip resync.  Instead, the extend should ask the user if
they want to extend while performing a resync.
[EXAMPLE]# lvchange -an vg/lv
[EXAMPLE]# lvextend -L +5G vg/lv
  Extending 2 mirror images.
  Extending logical volume lv to 10.00 GiB
  vg/lv is not active.  Unable to get sync percent.
Do full resync of extended portion of vg/lv?  [y/n]: y
  Logical volume lv successfully resized

6) A mirror that is performing recovery (as opposed to an initial sync) - like
after a failure - is not allowed to extend with either an implicit or
explicit nosync option.  [You can simulate this with a 'corelog' mirror because
when it is reactivated, it must be recovered every time.]
[EXAMPLE]# lvcreate -m1 -L 5G -n lv vg --nosync --corelog
  WARNING: New mirror won't be synchronised. Don't read what you didn't write!
  Logical volume "lv" created
[EXAMPLE]# lvs vg
  LV   VG   Attr     LSize Pool Origin Snap%  Move Log Copy%  Convert
  lv   vg   Mwi-a-m- 5.00g                             100.00
[EXAMPLE]# lvchange -an vg/lv; lvchange -ay vg/lv; lvs vg
  LV   VG   Attr     LSize Pool Origin Snap%  Move Log Copy%  Convert
  lv   vg   Mwi-a-m- 5.00g                               0.08
[EXAMPLE]# lvextend -L +5G vg/lv
  Extending 2 mirror images.
  Extending logical volume lv to 10.00 GiB
  vg/lv cannot be extended while it is recovering.

7) If 'no' is selected in #5 or if the condition in #6 is hit, it should not
result in the mirror being resized or the 'm/M' attribute being changed.

NOTE:  A mirror created with '--nosync' behaves differently than one created
without it when performing an extension.  The former cannot be extended when
the mirror is recovering (unless in-active), while the latter can.  This is
a reasonable thing to do since recovery of a mirror doesn't take long (at
least in the case of an on-disk log) and it would cause far more time in
degraded mode if the extension w/o '--nosync' was allowed.  It might be
reasonable to add the ability to force the operation in the future.  This
should /not/ force a nosync extension, but rather force a sync'ed extension.
IOW, the user would be saying, "Yes, yes... I know recovery won't take long
and that I'll be adding significantly to the time spent in degraded mode, but
I need the extra space right now!".

12 years agoFix splitmirror in cluster having different DM/LVM views of storage.
Jonathan Earl Brassow [Thu, 6 Oct 2011 14:55:39 +0000 (14:55 +0000)]
Fix splitmirror in cluster having different DM/LVM views of storage.
This patch also does some clean-up of the splitmirrors code.

I've attempted to clean-up the splitmirrors code to make it easier to
understand with fewer operations.  I've tried to reduce the number of
metadata operations without compromising the intermediate stages which
are necessary for easy clean-up in the even of failure.

These changes now correctly handle cluster situations - including exclusive
cluster mirrors.  Whereas before, a splitmirror operation would result in
remote nodes having LVM commands report the newly split LV with a proper
name while DM commands would report the old (pre-split) names of the device.
IOW, there was a kernel/userspace mismatch.

12 years agoRevert initial solution to bug 733114 - I/O error message during splitmirror
Jonathan Earl Brassow [Thu, 6 Oct 2011 14:49:16 +0000 (14:49 +0000)]
Revert initial solution to bug 733114 - I/O error message during splitmirror

The original commit comments can be located via this git commit ID:
7d8e615c0b30fc2ef300c90378a51f01c328128c

There were three possible solutions to the original problem proposed in the
initial check-in.  The one chosen was as follows:
    2) Do like _remove_mirror_images does and suspend the original, then suspend
    the sub-lv (the error target), then resume the sub-lv, and finally resume the
    original LV.  This seems like extra pointless operations to me, but it doesn't
    produce the error message (although, I'm not sure why) and it allows us to
    leave the visible flag in place.
Turns out, the cluster also views the extra suspend/resume operations as
pointless too and ignores them.  So, this solution doesn't work in a cluster.
Further, I've noticed that in addition to the remote cluster nodes still getting
I/O errors from scanning the error target, they also have a different LVM and
DM views of the same LV.  IOW, while the LVM level (gotten from the LVM metadata)
sees the correct name for the newly split LV, device-mapper still maintains the
old names.

Because the original fix failed to completely fix the problem (or work-around it)
and because a better solution must be found to address the additional cluster
issue of device renaming, I am reverting the above mentioned commit.

12 years agoThis patch fixes issues with improper udev flags on sub-LVs.
Jonathan Earl Brassow [Thu, 6 Oct 2011 14:45:40 +0000 (14:45 +0000)]
This patch fixes issues with improper udev flags on sub-LVs.

The current code does not always assign proper udev flags to sub-LVs (e.g.
mirror images and log LVs).  This shows up especially during a splitmirror
operation in which an image is split off from a mirror to form a new LV.

A mirror with a disk log is actually composed of 4 different LVs: the 2
mirror images, the log, and the top-level LV that "glues" them all together.
When a 2-way mirror is split into two linear LVs, two of those LVs must be
removed.  The segments of the image which is not split off to form the new
LV are transferred to the top-level LV.  This is done so that the original
LV can maintain its major/minor, UUID, and name.  The sub-lv from which the
segments were transferred gets an error segment as a transitory process
before it is eventually removed.  (Note that if the error target was not put
in place, a resume_lv would result in two LVs pointing to the same segment!
If the machine crashes before the eventual removal of the sub-LV, the result
would be a residual LV with the same mapping as the original (now linear) LV.)
So, the two LVs that need to be removed are now the log device and the sub-LV
with the error segment.  If udev_flags are not properly set, a resume will
cause the error LV to come up and be scanned by udev.  This causes I/O errors.
Additionally, when udev scans sub-LVs (or former sub-LVs), it can cause races
when we are trying to remove those LVs.  This is especially bad during failure
conditions.

When the mirror is suspended, the top-level along with its sub-LVs are
suspended.  The changes (now 2 linear devices and the yet-to-be-removed log
and error LV) are committed.  When the resume takes place on the original
LV, there are no longer links to the other sub-lvs through the LVM metadata.
The links are implicitly handled by querying the kernel for a list of
dependencies.  This is done in the '_add_dev' function (which is recursively
called for each dependency found) - called through the following chain:
_add_dev
dm_tree_add_dev_with_udev_flags
<*** DM / LVM divide ***>
_add_dev_to_dtree
_add_lv_to_dtree
_create_partial_dtree
_tree_action
dev_manager_activate
_lv_activate_lv
_lv_resume
lv_resume_if_active
When udev flags are calculated by '_get_udev_flags', it is done by referencing
the 'logical_volume' structure.  Those flags are then passed down into
'dm_tree_add_dev_with_udev_flags', which in turn passes them to '_add_dev'.
Unfortunately, when '_add_dev' is finding the dependencies, it has no way to
calculate their proper udev_flags.  This is because it is below the DM/LVM
divide - it doesn't have access to the logical_volume structure.  In fact,
'_add_dev' simply reuses the udev_flags given for the initial device!  This
virtually guarentees the udev_flags are wrong for all the dependencies unless
they are reset by some other mechanism.  The current code provides no such
mechanism.  Even if '_add_new_lv_to_dtree' were called on the sub-devices -
which it isn't - entries already in the tree are simply passed over, failing
to reset any udev_flags.  The solution must retain its implicit nature of
discovering dependencies and be able to go back over the dependencies found
to properly set the udev_flags.

My solution simply calls a new function before leaving '_add_new_lv_to_dtree'
that iterates over the dtree nodes to properly reset the udev_flags of any
children.  It is important that this function occur after the '_add_dev' has
done its job of querying the kernel for a list of dependencies.  It is this
list of children that we use to look up their respective LVs and properly
calculate the udev_flags.

This solution has worked for single machine, cluster, and cluster w/ exclusive
activation.

12 years agoFix vgsplit when there are mirrors that have mirrored logs.
Jonathan Earl Brassow [Thu, 6 Oct 2011 14:17:45 +0000 (14:17 +0000)]
Fix vgsplit when there are mirrors that have mirrored logs.

The problem as reported by "ben <benscott@nwlink.com>" on lvm-devel:

vgsplit fails with mirrored mirror log

#lvs --all -o lv_name,lv_attr,devices
LV                       Attr   Devices
MyMirror                 mwi--
[MyMirror_mimage_0]      Iwi--- /dev/sdq(0)
[MyMirror_mimage_1]      Iwi--- /dev/sdo(0)
[MyMirror_mimage_2]      Iwi--- /dev/sdi(0)
[MyMirror_mlog]          mwi---
[MyMirror_mlog_mimage_0] Iwi--- /dev/sds(0)
[MyMirror_mlog_mimage_1] Iwi--- /dev/sde(0)

#vgsplit -v "TestA" "TestB" "/dev/sdq" "/dev/sdo" "/dev/sdi" "/dev/sds"
"/dev/sde"
  Checking for volume group "TestA"
  Checking for new volume group "TestB"
  Archiving volume group "TestA" metadata (seqno 213).
Can't split mirror MyMirror between two Volume Groups

AFTER FIX:

[root@bp-01 ~]# lvs -a -o name,vg_name,devices vg new
  Volume group "new" not found
  Skipping volume group new
  LV                 VG   Devices
  lv                 vg   lv_mimage_0(0),lv_mimage_1(0)
  [lv_mimage_0]      vg   /dev/sdb1(0)
  [lv_mimage_1]      vg   /dev/sdc1(0)
  [lv_mlog]          vg   lv_mlog_mimage_0(0),lv_mlog_mimage_1(0)
  [lv_mlog_mimage_0] vg   /dev/sdh1(0)
  [lv_mlog_mimage_1] vg   /dev/sdi1(0)
[root@bp-01 ~]# vgsplit vg new /dev/sd[bchi]1
  New volume group "new" successfully split from "vg"
[root@bp-01 ~]# lvs -a -o name,vg_name,devices vg new
  LV                 VG   Devices
  lv                 new  lv_mimage_0(0),lv_mimage_1(0)
  [lv_mimage_0]      new  /dev/sdb1(0)
  [lv_mimage_1]      new  /dev/sdc1(0)
  [lv_mlog]          new  lv_mlog_mimage_0(0),lv_mlog_mimage_1(0)
  [lv_mlog_mimage_0] new  /dev/sdh1(0)
  [lv_mlog_mimage_1] new  /dev/sdi1(0)

12 years agoAdd more validation to config parser
Zdenek Kabelac [Thu, 6 Oct 2011 11:06:36 +0000 (11:06 +0000)]
Add more validation to config parser

Do not leave it for vgvalidate().

12 years agoMove defines to header
Zdenek Kabelac [Thu, 6 Oct 2011 11:05:56 +0000 (11:05 +0000)]
Move defines to header

Make limits for thin data_block_size and device_id part of public API.

FIXME: read them possible from some kernel header file in the future ?
But we may need to support different values for different versions ?

12 years agoClarify multi-name device filter pattern matching explanation in lvm.conf.5.
Alasdair Kergon [Tue, 4 Oct 2011 20:49:24 +0000 (20:49 +0000)]
Clarify multi-name device filter pattern matching explanation in lvm.conf.5.

12 years agoClarify multi-name device filter pattern matching explanation in lvm.conf.5.
Alasdair Kergon [Tue, 4 Oct 2011 20:45:36 +0000 (20:45 +0000)]
Clarify multi-name device filter pattern matching explanation in lvm.conf.5.

12 years agoName changes
Zdenek Kabelac [Tue, 4 Oct 2011 16:22:38 +0000 (16:22 +0000)]
Name changes

typo zeroeing->zeroing
add size low_water_mark->low_water_mark_size so it's more obvious its sector
related variable.

12 years agoUse capital letters
Zdenek Kabelac [Tue, 4 Oct 2011 12:39:59 +0000 (12:39 +0000)]
Use capital letters

12 years agoMissed rename pool->thin_pool
Zdenek Kabelac [Mon, 3 Oct 2011 19:10:52 +0000 (19:10 +0000)]
Missed rename pool->thin_pool

Fix compilation

12 years agoAdd code to activate thin target
Zdenek Kabelac [Mon, 3 Oct 2011 18:43:39 +0000 (18:43 +0000)]
Add code to activate thin target

Code to zero pool metadata lv when pool is created.
Add code to create thin target via message sending.

(Revert is missing)

12 years agoAdd simple function for lookup of some free device_id
Zdenek Kabelac [Mon, 3 Oct 2011 18:39:17 +0000 (18:39 +0000)]
Add simple function for lookup of some free device_id

Initial simple implementation for finding some free device_id.

12 years agoAdd lvm functions for sending messages.
Zdenek Kabelac [Mon, 3 Oct 2011 18:37:47 +0000 (18:37 +0000)]
Add lvm functions for sending messages.

Functions are currently only needed for thin provissioning.

12 years agoAdd intial code to check transaction_id
Zdenek Kabelac [Mon, 3 Oct 2011 18:34:52 +0000 (18:34 +0000)]
Add intial code to check transaction_id

Fix typy in transaction_id.
Add this as node property, so it could be easily checked on resume.

Code is not yet finished.

12 years agoDisplay transaction_id for thin_pool
Zdenek Kabelac [Mon, 3 Oct 2011 18:31:03 +0000 (18:31 +0000)]
Display transaction_id for thin_pool

12 years agoMove priority check in front
Zdenek Kabelac [Mon, 3 Oct 2011 18:29:48 +0000 (18:29 +0000)]
Move priority check in front

Just a minor code mode - make a test for priority before
more complex uuid checks.

12 years agoUpdate error path tracing for _resume_node
Zdenek Kabelac [Mon, 3 Oct 2011 18:28:25 +0000 (18:28 +0000)]
Update error path tracing for _resume_node

dm_task_create & dm_task_set_name produces it's own log_error
Add missing stacks for dm_task_set_cookie, dm_task_run,
dm_task_get_info.

12 years agoTransaction_id is property of thin_pool
Zdenek Kabelac [Mon, 3 Oct 2011 18:26:07 +0000 (18:26 +0000)]
Transaction_id is property of thin_pool

Remove Transaction_id from thin target.
Store device_id for thin target.

12 years agoAdd preload support for thin and thin_pool
Zdenek Kabelac [Mon, 3 Oct 2011 18:24:47 +0000 (18:24 +0000)]
Add preload support for thin and thin_pool

12 years agoFix bad error message for thinp validation
Zdenek Kabelac [Thu, 29 Sep 2011 09:03:36 +0000 (09:03 +0000)]
Fix bad error message for thinp validation

12 years agoLet the utils to prepare PVs
Zdenek Kabelac [Thu, 29 Sep 2011 08:58:27 +0000 (08:58 +0000)]
Let the utils to prepare PVs

12 years agoTypo in debug message
Zdenek Kabelac [Thu, 29 Sep 2011 08:57:21 +0000 (08:57 +0000)]
Typo in debug message

12 years agoAdd experimental code for activation of thinp targets
Zdenek Kabelac [Thu, 29 Sep 2011 08:56:38 +0000 (08:56 +0000)]
Add experimental code for activation of thinp targets

No dm messages yes - just a base functionality in the steps of other targets.
For now usable only for debugging and tracing.

12 years agoAdd supporting function for thinp
Zdenek Kabelac [Thu, 29 Sep 2011 08:53:48 +0000 (08:53 +0000)]
Add supporting function for thinp

New dm_tree_node_add_thin_pool_target() and  dm_tree_node_add_thin_target()
This API is highly experimental and unstable for now.

12 years agoJust add warning about potential problem exteding dm_segtypes
Zdenek Kabelac [Thu, 29 Sep 2011 08:50:54 +0000 (08:50 +0000)]
Just add warning about potential problem exteding dm_segtypes

Since raid target is using now dm_segtypes also for search purpose.

12 years agoNew handy gdb debugging function, "dm_list_size"
Jonathan Earl Brassow [Wed, 28 Sep 2011 16:32:22 +0000 (16:32 +0000)]
New handy gdb debugging function, "dm_list_size"

Example:
(gdb) dm_list_size &split_images
1 list items

12 years agoIntroduce revert_lv for better pvmove cleanup.
Alasdair Kergon [Tue, 27 Sep 2011 22:43:40 +0000 (22:43 +0000)]
Introduce revert_lv for better pvmove cleanup.
(One further fix needed to remove the stray pvmove LVs left behind.)

12 years agoReplace incomplete pvmove activation failure recovery code with a message.
Alasdair Kergon [Tue, 27 Sep 2011 17:29:33 +0000 (17:29 +0000)]
Replace incomplete pvmove activation failure recovery code with a message.

As it stands, the recovery code can make things worse sometimes so it's
better to insist on a proper 'pvmove --abort' cleanup.

12 years agoAbort if _finish_pvmove suspend_lvs fails instead of cleaning up incompletely.
Alasdair Kergon [Tue, 27 Sep 2011 17:09:42 +0000 (17:09 +0000)]
Abort if _finish_pvmove suspend_lvs fails instead of cleaning up incompletely.
Change suspend_lvs to call vg_revert internally.
Change vg_revert to void and remove superfluous calls after failed vg_commit.

12 years agobetter -m0 error message, but there's an internal logic error to fix instead
Alasdair Kergon [Tue, 27 Sep 2011 12:37:07 +0000 (12:37 +0000)]
better -m0 error message, but there's an internal logic error to fix instead

12 years agotypo
Alasdair Kergon [Tue, 27 Sep 2011 12:34:14 +0000 (12:34 +0000)]
typo

12 years agocorrect thin_pool width
Alasdair Kergon [Tue, 27 Sep 2011 12:33:36 +0000 (12:33 +0000)]
correct thin_pool width

12 years agoShow some Thin related info in lvdisplay
Zdenek Kabelac [Mon, 26 Sep 2011 13:11:02 +0000 (13:11 +0000)]
Show some Thin related info in lvdisplay

12 years agoAdd log_error even for general device in use when we can't do the sysfs checks.
Peter Rajnoha [Mon, 26 Sep 2011 10:17:51 +0000 (10:17 +0000)]
Add log_error even for general device in use when we can't do the sysfs checks.

12 years agoUse execvp for clvmd restart
Zdenek Kabelac [Mon, 26 Sep 2011 07:51:23 +0000 (07:51 +0000)]
Use execvp for clvmd restart

Since execve passed only NULL as environ, we had lost all environment vars on
restart - thus actually running  'different' clvmd then the one at start.

Preserving environ allows to restart clvmd with the same settings
(i.e. LD_LIBRARY_PATH)

Add test for second restart.

12 years agoRemove test for NULL
Zdenek Kabelac [Sun, 25 Sep 2011 19:45:40 +0000 (19:45 +0000)]
Remove test for NULL

Since it's internal function and we always check for NULL value
before call - this is safe.

Just for case add nonnull attribute so analyzer might better
catch error.

12 years agoAdd missing log_error messages
Zdenek Kabelac [Sun, 25 Sep 2011 19:43:43 +0000 (19:43 +0000)]
Add missing log_error messages

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