summaryrefslogtreecommitdiffstats
path: root/lib/activate
Commit message (Collapse)AuthorAgeFilesLines
...
* Drop pool memory allocated in lv_has_target_typeZdenek Kabelac2011-11-181-6/+5
| | | | | | | | | Remove FIXMES - there should not be any pool free call since the memory pool is from device manager, and pool is detroyed after the operation, so doing extra free here would not help here. However lv_has_target_type() is using cmd mempool so here the extra call for dm_pool_free makes sence.
* Replace dynamic buffer allocations for PATH_MAXZdenek Kabelac2011-11-182-8/+8
| | | | | | | | | | Use static buffer instead of stack allocated buffer. This reduces stack size usage of lvm tool and the change is very simple. Since the whole library is not thread safe - it should not add any new problems - and if there will be some conversion it's easy to convert this to use some preallocated buffer.
* Thin cleanZdenek Kabelac2011-11-151-7/+6
| | | | | Reuse seg pointer already set in _add_lv_to_dtree to have the value of first_seg(lv) (and is used in other parts of this function).
* Simplify iterationZdenek Kabelac2011-11-151-2/+2
| | | | | | Since nothing is removed in dm_list snapshot_segs during the loop, there is no reason to use _safe iteration, so switch to simplier dm_list_iterate().
* Thin fix tpool layerZdenek Kabelac2011-11-151-5/+5
| | | | | | | | | | Since we support snapshots of thin volumes, we could have more layers, so we have to check whether tpool layer is going to be inserted. As the _add_segment_to_dtree() is the only place that adds tpool segment, we may just check pointer (no strcmp for layer). Switch to use seg_is_ function instead of lv_is_.
* Remove unneeded parameter.Milan Broz2011-11-112-2/+2
|
* Fix function name in previous patch.Milan Broz2011-11-112-5/+5
|
* Do not scan device if it is part of active multipath.Milan Broz2011-11-112-0/+28
| | | | | | | | | | | | | | | | | | | Add filter which tries to check if scanned device is part of active multipath. Firstly, only SCSI major number devices are handled in filter. Then it checks if device has exactly one holder (in sysfs) and if it is device-mapper device and DM-UUID is prefixed by "MPATH-". If so, this device is filtered out. The whole filter can be switched off by setting mpath_component_detection in lvm.conf. https://bugzilla.redhat.com/show_bug.cgi?id=597010 Signed-off-by: Milan Broz <mbroz@redhat.com>
* Thin revert code for exclusive pool activationZdenek Kabelac2011-11-071-1/+1
| | | | | There are no limits on thin-pool activation now. Revert code that is no longer needed.
* Add -tpool layer in activation treeZdenek Kabelac2011-11-032-8/+18
| | | | | | | | | | Let's put the overlay device over real thin pool device. So we can get the proper locking on cluster. Overwise the pool LV would be activate once implicitely and in other case explicitely, confusing locking mechanism. This patch make the activation of pool LV independent on activation of thin LV since they will both implicitely use real -thin pool device.
* Avoid creation of /dev/vg/thinpoolZdenek Kabelac2011-10-281-1/+2
|
* Thin pool activation changeZdenek Kabelac2011-10-281-1/+1
| | | | | | | | | | | To ensure we properly handle LV cluster locking - explicitely do not allow to change the availability of the thin pool that is in use for some thin LV. As soon as the thin volume is created the only way to activate pool is via implicit dependency. Ignore thinpool open count for lv/vgchange operations.
* Drop messages from lvm app contextZdenek Kabelac2011-10-174-80/+0
| | | | | (revert) Thinp target uses activation context.
* Fix lv_info open_count testZdenek Kabelac2011-10-143-2/+13
| | | | | | | | | | 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.
* Use constant for the repeated dlid size specificationZdenek Kabelac2011-10-111-4/+5
|
* Use shorter way for if()Zdenek Kabelac2011-10-111-2/+1
|
* Skip backtrace after log_errorZdenek Kabelac2011-10-111-1/+1
|
* Replace with debugZdenek Kabelac2011-10-111-1/+1
| | | | | Since the dm_tree_create already reports reason of error, use log_debug for this message.
* Improve backtrace reportingZdenek Kabelac2011-10-111-6/+12
| | | | Add <backtrace> so the function appears logged for the fail path.
* Change message severityZdenek Kabelac2011-10-111-5/+3
| | | | | | 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.
* Skip r assignmentZdenek Kabelac2011-10-111-7/+4
| | | | | | 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.
* Fix splitmirror in cluster having different DM/LVM views of storage.Jonathan Earl Brassow2011-10-062-0/+18
| | | | | | | | | | | | | | | 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.
* This patch fixes issues with improper udev flags on sub-LVs.Jonathan Earl Brassow2011-10-061-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add lvm functions for sending messages.Zdenek Kabelac2011-10-034-0/+84
| | | | Functions are currently only needed for thin provissioning.
* Add preload support for thin and thin_poolZdenek Kabelac2011-10-031-0/+10
|
* Add experimental code for activation of thinp targetsZdenek Kabelac2011-09-291-0/+6
| | | | | No dm messages yes - just a base functionality in the steps of other targets. For now usable only for debugging and tracing.
* Introduce revert_lv for better pvmove cleanup.Alasdair Kergon2011-09-273-8/+12
| | | | (One further fix needed to remove the stray pvmove LVs left behind.)
* Add log_error even for general device in use when we can't do the sysfs checks.Peter Rajnoha2011-09-261-2/+9
|
* Add activation/retry_deactivation to lvm.conf to retry deactivation of an LV.Peter Rajnoha2011-09-221-0/+2
|
* Replace open_count check with holders/mounted_fs check on lvremove path.Peter Rajnoha2011-09-222-5/+31
| | | | | | | | | | | | | | | Before, we used to display "Can't remove open logical volume" which was generic. There 3 possibilities of how a device could be opened: - used by another device - having a filesystem on that device which is mounted - opened directly by an application With the help of sysfs info, we can distinguish the first two situations. The third one will be subject to "remove retry" logic - if it's opened quickly (e.g. a parallel scan from within a udev rule run), this will finish quickly and we can remove it once it has finished. If it's a legitimate application that keeps the device opened, we'll do our best to remove the device, but we will fail finally after a few retries.
* Move the core of the lib/config/config.c functionality into libdevmapper,Petr Rockai2011-08-302-12/+12
| | | | | | | leaving behind the LVM-specific parts of the code (convenience wrappers that handle `struct device` and `struct cmd_context`, basically). A number of functions have been renamed (in addition to getting a dm_ prefix) -- namely, all of the config interface now has a dm_config_ prefix.
* Add the ability to split an image from the mirror and track changes.Jonathan Earl Brassow2011-08-181-9/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ~> lvconvert --splitmirrors 1 --trackchanges vg/lv The '--trackchanges' option allows a user the ability to use an image of a RAID1 array for the purposes of temporary read-only access. The image can be merged back into the array at a later time and only the blocks that have changed in the array since the split will be resync'ed. This operation can be thought of as a partial split. The image is never completely extracted from the array, in that the array reserves the position the device occupied and tracks the differences between the array and the split image via a bitmap. The image itself is rendered read-only and the name (<LV>_rimage_*) cannot be changed. The user can complete the split (permanently splitting the image from the array) by re-issuing the 'lvconvert' command without the '--trackchanges' argument and specifying the '--name' argument. ~> lvconvert --splitmirrors 1 --name my_split vg/lv Merging the tracked image back into the array is done with the '--merge' option (included in a follow-on patch). ~> lvconvert --merge vg/lv_rimage_<n> The internal mechanics of this are relatively simple. The 'raid' device- mapper target allows for the specification of an empty slot in an array via '- -'. This is what will be used if a partial activation of an array is ever required. (It would also be possible to use 'error' targets in place of the '- -'.) If a RAID image is found to be both read-only and visible, then it is considered separate from the array and '- -' is used to hold it's position in the array. So, all that needs to be done to temporarily split an image from the array /and/ cause the kernel target's bitmap to track (aka "mark") changes made is to make the specified image visible and read-only. To merge the device back into the array, the image needs to be returned to the read/write state of the top-level LV and made invisible.
* Add missing checks for function return codes.Jonathan Earl Brassow2011-08-111-2/+3
| | | | Some functions were being called without having their return values checked.
* Add ability to down-convert RAID1 arrays.Jonathan Earl Brassow2011-08-112-0/+6
| | | | Also, add some simple RAID tests to testsuite.
* Add RAID metadata devices to considered devices in _add_lv_to_dtree.Jonathan Earl Brassow2011-08-111-3/+12
| | | | _add_lv_to_dtree must also add RAID metadata devices.
* Replace free_vg with release_vgZdenek Kabelac2011-08-101-7/+7
| | | | | | | | Move the free_vg() to vg.c and replace free_vg with release_vg and make the _free_vg internal. Patch is needed for sharing VG in vginfo cache so the release_vg function name is a better fit here.
* Add basic RAID segment type(s) support.Jonathan Earl Brassow2011-08-021-3/+19
| | | | | | | | | | | | | Implementation described in doc/lvm2-raid.txt. Basic support includes: - ability to create RAID 1/4/5/6 arrays - ability to delete RAID arrays - ability to display RAID arrays Notable missing features (not included in this patch): - ability to clean-up/repair failures - ability to convert RAID segment types - ability to monitor RAID segment types
* Need to snapshot lookup by uuid instead of name in case it's renamed.Alasdair Kergon2011-07-081-3/+3
|
* Move snapshot deactivation logic into lib/activate, fixing theAlasdair Kergon2011-07-081-5/+20
| | | | | | teardown sequence. (Previously the snapshot was deactivated while its origin was active and before its removal was committed to disk, so restarting after a crash at the point would leave corruption.)
* Cope with a PV only discovered missing when creating deptree.Alasdair Kergon2011-07-061-3/+11
|
* Abort operation if dm_tree_node_add_target_area fails.Alasdair Kergon2011-07-051-17/+12
|
* Always perform preload logic before suspending - not only in the case when weAlasdair Kergon2011-07-051-31/+29
| | | | | have precommitted metadata. (Necessary to avoid loading tables while suspend in lvchange --refresh.)
* Snapshots LVs are never loaded in their own right, only along with theirAlasdair Kergon2011-07-051-1/+1
| | | | origin.
* Fix conditions using no_merging: only those using lv_is_merging_cow() shouldAlasdair Kergon2011-07-051-2/+2
| | | | | have been converted, not pure lv_is_cow ones. (Merging has no impact on how the pre-merged cow segment itself is loaded.)
* reinstate accidentally-removed lines to fix pvmove againAlasdair Kergon2011-07-041-4/+0
|
* Add framework for validation of ioctls. Doesn't do any checks yet.Alasdair Kergon2011-07-012-0/+9
| | | | | | dmsetup --checks libdevmapper: dm_task_enable_checks() lvm.conf: activation/checks=1
* When suspending, automatically preload newly-visible existing LVsAlasdair Kergon2011-06-302-7/+40
| | | | Let's find out if this makes things better or worse overall...
* Fix issue preventing cluster mirror creation.Jonathan Earl Brassow2011-06-222-4/+3
| | | | | | | | | | | | | | | Mirrors used to be created by first creating a linear device and then adding the other images plus the log. Now mirrors are created by creating all the images in one go and then adding the log separately. The new way ran into the condition that cluster mirrors cannot change the log type (in the case of creation, from core -> disk) while the mirror is not active. (It isn't active because it is in the process of being created.) The reason this condition is in place is because a remote node may have the mirror active, and we don't want to alter the log underneath it. What we really needed was a way of checking if the mirror was active remotely but not locally, and in that case do not allow a change of the log. I've added this check, and cluster mirrors can now be created again.
* Disable udev fallback by default and add activation/udev_fallback to lvm.conf.Peter Rajnoha2011-06-171-0/+15
| | | | | | | | | | | | | | | | | | | We've used udev fallback code till now to check whether udev created/removed the entries in /dev correctly and if not, a repair was done (giving a warning messagea about that). This patch adds a possibility to enable this additional check and subsequent fallback only when required (debugging purposes mostly) and trust udev completely. So let's disable the fallback code by default and add a new configuration option "activation/udev_fallback". (The original code for creating the nodes will still be used in case the device directory that is set in lvm.conf differs from the one that udev uses and also when activation/udev_rules is set to 0 - otherwise we would end up with no nodes/symlinks at all)
* Remove unused internal flag ACTIVATE_EXCL from the codeZdenek Kabelac2011-06-171-8/+0
|