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

166 Commits

Author SHA1 Message Date
Alasdair Kergon
f1aabd5c60 Set delay_resume_if_new on deptree snapshot origin.
(Must avoid activating snapshot origin more than once concurrently.)
2012-05-15 21:27:24 +00:00
Alasdair Kergon
61712a1f0d add major:minor to table size changed debug message 2012-05-15 20:03:12 +00:00
Alasdair Kergon
b96c213356 indicate when deptree detects but ignores size change in debug msg 2012-05-15 14:10:54 +00:00
Zdenek Kabelac
462de06d96 Return success for deactivation of thin pool
if the thin_check fail on thin pool - still return successful deactivation,
since lvremove would currently fail.

TODO: find some way to not run check with lvremove.
2012-03-04 17:36:23 +00:00
Zdenek Kabelac
b3103ef328 Remove part of FIXME
(and reindent a code below)
2012-03-04 16:05:42 +00:00
Zdenek Kabelac
7162a25b0b Support 16GB for thin pool metadata
Add some hack math to allow 16GB devices to be passed as thinpool metadata.
Since kernel has put in limit to not allow which are just bigger then
some predefined constant in kernel but not matching 16GB so any device bigger
is rejected.

FIXME: Current code still might need more tweaks to be more generic.
2012-03-02 21:53:17 +00:00
Zdenek Kabelac
4bcaf8086e Purge remaining trim bits from code 2012-03-02 21:43:26 +00:00
Zdenek Kabelac
7e35dfff3d Added dm_tree_node_set_callback() for preload and deactivation hooks
Run users hook after preload for the node is finished,
or after the node has been deactivated.
2012-03-02 17:31:21 +00:00
Zdenek Kabelac
6a5706a3a5 Remove support for TRIM message
It's been unsupporte for now - and it's not going to be
implemented for thin pool kernel driver - so dropping
appearence of TRIM from libdm and lvm.
2012-03-02 13:26:08 +00:00
Jonathan Earl Brassow
ad48a46fc9 Make conversion from a synced 'mirror' to 'raid1' not cause a full resync.
It was not possible to pass down the DM_[FORCE|NO]SYNC flags to
'dm_tree_node_add_raid_target'.  This meant that converting to 'raid1' from
'mirror' would cause a full resync.  (It also meant that '--nosync' was
ineffective when creating a 'raid1' LV.)

I've taken the 'reserved' parameter in 'dm_tree_node_add_raid_target' and
used it for the "flags" parameter.  Now it is possible to pass the sync
flags and any other flags that may come up.
2012-02-13 20:13:39 +00:00
Zdenek Kabelac
4d95ccc696 Check for deps pointer before dererence
As _deps() call may return NULL - check for it.
2012-02-10 14:48:28 +00:00
Zdenek Kabelac
3b5834d78b Add validation of name and uuid
Do not accept NULL pointers.
2012-02-10 14:42:28 +00:00
Zdenek Kabelac
a6292f2a6d Remove unneeded assignments
Variables have (or will have) those values set.
2012-02-08 11:36:18 +00:00
Zdenek Kabelac
fc5c61df97 Ensure whole info is initialised
Since _create_dm_tree_node is copying whole structure,
make sure all members are initialized.
2012-01-25 21:50:50 +00:00
Zdenek Kabelac
4173a22832 Thin send messages on activation resume code path
Using PRELOAD part would lead to problems when the problem
would happen before vg_write and vg_commit.
Also this change is necessary for snapshot creation sequence.
2012-01-25 08:46:21 +00:00
Alasdair Kergon
5c9eae9647 Reorder fns in libdm-deptree.
Tweak dm_config interface and remove FIXMEs.
2012-01-23 17:46:31 +00:00
Zdenek Kabelac
9568f1b5c3 Thin handle empty thin volume case
Report both values as 0 in case the volume is unused.
2012-01-19 15:22:32 +00:00
Zdenek Kabelac
5fd459f0ab Thin use consistentely metadata
Do not shortcut to 'meta' and stay with 'metadata'
Also matches kernel doc for dm API then.
2012-01-19 15:21:23 +00:00
Alasdair Kergon
2e5ff5d11c Add dm_uuid_prefix/dm_set_uuid_prefix for non-lvm users to override hard-coded
LVM- prefix.

Try harder not to leave stray empty devices around (locally or remotely) when
reverting changes after failures while there are inactive tables.
2012-01-10 02:03:31 +00:00
Zdenek Kabelac
077c4d1a35 Add Thin API for parsing thin status
Add dm_get_status_thin_pool and dm_get_status_thin functions to
parse 'params' argument which is received via dm_get_next_target.

Returns filed structure allocated from given mempool.
2011-12-21 12:52:38 +00:00
Zdenek Kabelac
6744c143a5 Thin remove unused define
Remove DM_THIN_ERROR_DEVICE_ID from API.
Remove API warning.
Drop code that was using DM_THIN_ERROR_DEVICE_ID (already commented)
Remove debug message which slipped in through some previous commit.
2011-11-12 22:44:10 +00:00
Zdenek Kabelac
19e3f8c30b Thin fix condition check for transation_id
id2 must be checked.
(missed in yesterday commit set).
2011-11-04 12:39:45 +00:00
Zdenek Kabelac
2e732e9628 Thin api change for passing message into libdm
Avoid exposing another struct to the libdm user and
use only simple dm_tree_node_add_thin_pool_message with
2 overloaded uint64_t values.
2011-11-03 14:45:01 +00:00
Zdenek Kabelac
4d25c81bdd Thin api change for dm_tree_node_add_thin_target
A little code shuffling and adding support for
DM_THIN_ERROR_DEVICE_ID which might be eventually be used
for activation of thin which is going to be deleted.
For now we do not need it lvm.
2011-11-03 14:43:21 +00:00
Zdenek Kabelac
25de9addb6 Thin fix compile warns
Test for dm_snprintf < 0.
Add header for moved backup.
2011-10-30 22:52:08 +00:00
Zdenek Kabelac
bbcd37e4b8 Thin segment transaction_id moved
Add a new node flag send_messages that is used to simplify
test when to call _node_send_messages().

Add call to _node_send_messages when pool is deeper in the tree.
2011-10-30 22:04:57 +00:00
Zdenek Kabelac
c590a9cdbc Thin error messages clenaup and some indent 2011-10-28 20:19:26 +00:00
Zdenek Kabelac
4ce43894d2 Trying to fix the retry logic
There should be no need for retry for our internal devices - it would be hinding
our own bug in the tree processing.
Update error messages to show also also device name.
No WHATS_NEW - in release fix.
2011-10-28 20:11:21 +00:00
Zdenek Kabelac
3d6782b3ff Just replace stack, return 0 with return_0 2011-10-20 10:39:07 +00:00
Zdenek Kabelac
ac08d9c028 Add last param 0 for thin-pool
So now the table suppression works for thin-pool.
2011-10-20 10:35:55 +00:00
Zdenek Kabelac
e9156c2bb9 Adapt to thin kernel target API
Since kernel target uses low_water_mark - use this name in libdm as well.
2011-10-20 10:33:30 +00:00
Zdenek Kabelac
7b199dc599 Use const pointers in thin API were appropriate 2011-10-20 10:31:27 +00:00
Zdenek Kabelac
3f53c059e9 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.
2011-10-20 10:28:41 +00:00
Zdenek Kabelac
2a0d806b3c Use structure copy
Since the code evolved a bit with current structures we could use C to
copy struct members.
2011-10-19 16:45:02 +00:00
Zdenek Kabelac
759b9592ba Update error message
Drop INTERNAL_ERROR from public API functions.
Improve some messages.
2011-10-19 16:42:14 +00:00
Zdenek Kabelac
11f64f0aeb 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.
2011-10-19 16:40:59 +00:00
Zdenek Kabelac
97d0f72c92 Just indent changes
Some tabs & spaces.
2011-10-19 16:36:39 +00:00
Zdenek Kabelac
660a42bc78 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.
2011-10-19 16:36:01 +00:00
Zdenek Kabelac
25e6ab87d8 Add thin_pool dm message support
Experimental support for kernel message via resume sequence.
2011-10-17 14:16:25 +00:00
Zdenek Kabelac
5668fe04d9 Add _thin_validate_device_id 2011-10-17 14:15:26 +00:00
Zdenek Kabelac
5668fd6a7a Swap parameters
Use metadata uuid first (match kernel target).
2011-10-17 14:15:01 +00:00
Zdenek Kabelac
df6b1b8fe6 Drop old check for transaction_id
(revert)
2011-10-17 14:14:33 +00:00
Milan Broz
ad2432dc68 Fix alignment warning in bitcount calculation for raid segment. 2011-10-17 13:15:35 +00:00
Zdenek Kabelac
0395dd2250 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.
2011-10-14 13:34:19 +00:00
Jonathan Earl Brassow
83c606ae30 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.
2011-10-06 14:45:40 +00:00
Zdenek Kabelac
565a4bfc49 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 ?
2011-10-06 11:05:56 +00:00
Zdenek Kabelac
460c599143 Name changes
typo zeroeing->zeroing
add size low_water_mark->low_water_mark_size so it's more obvious its sector
related variable.
2011-10-04 16:22:38 +00:00
Zdenek Kabelac
e0ea24be1f 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.
2011-10-03 18:34:52 +00:00
Zdenek Kabelac
a5a31ce947 Move priority check in front
Just a minor code mode - make a test for priority before
more complex uuid checks.
2011-10-03 18:29:48 +00:00
Zdenek Kabelac
9a8f192a38 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.
2011-10-03 18:28:25 +00:00