summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* temp error to catch problemsdev-dct-lvmetad-vg-update-4David Teigland2016-06-091-0/+4
|
* vgsplit: fixes for lvmetad updateDavid Teigland2016-06-092-1/+13
|
* vgcfgrestore: improve lvmetad handlingDavid Teigland2016-06-097-33/+46
| | | | | | | | | | Previously, vgcfgrestore would attempt to vg_remove the existing VG from lvmetad and then vg_update to add the restored VG. But, if there was a failure in the command or with vg_update, the lvmetad cache would be left incorrect. Now, disable lvmetad before the restore begins, and then rescan to populate lvmetad from disk after restore has written the new VG to disk.
* lvmetad: two phase vg_removeDavid Teigland2016-06-093-8/+42
| | | | | | | | | | | Apply the same idea as vg_update. Before doing the VG remove on disk, invalidate the VG in lvmetad. After the VG is removed, remove the VG in lvmetad. If the command fails after removing the VG on disk, but before removing the VG metadata from lvmetad, then a subsequent command will see the INVALID flag and not use the stale metadata from lvmetad.
* lvmetad: two phase VG updateDavid Teigland2016-06-0924-77/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, a command sent lvmetad new VG metadata in vg_commit(). In vg_commit(), devices are suspended, so any memory allocation done by the command while sending to lvmetad, or by lvmetad while updating its cache could deadlock if memory reclaim was triggered. Now lvmetad is updated in unlock_vg(), after devices are resumed. The new method for updating VG metadata in lvmetad is in two phases: 1. In vg_write(), before devices are suspended, the command sends lvmetad a short message ("set_vg_info") telling it what the new VG seqno will be. lvmetad sees that the seqno is newer than the seqno of its cached VG, so it sets the INVALID flag for the cached VG. If sending the message to lvmetad fails, the command fails before the metadata is committed and the change is not made. If sending the message succeeds, vg_commit() is called. 2. In unlock_vg(), after devices are resumed, the command sends lvmetad the standard vg_update message with the new metadata. lvmetad sees that the seqno in the new metadata matches the seqno it saved from set_vg_info, and knows it has the latest copy, so it clears the INVALID flag for the cached VG. If a command fails between 1 and 2 (after committing the VG on disk, but before sending lvmetad the new metadata), the cached VG retains the INVALID flag in lvmetad. A subsequent command will read the cached VG from lvmetad, see the INVALID flag, ignore the cached copy, read the VG from disk instead, update the lvmetad copy with the latest copy from disk, (this clears the INVALID flag in lvmetad), and use the correct VG metadata for the command. (This INVALID mechanism already existed for use by lvmlockd.)
* lvmetad: remove unused code for other format typesDavid Teigland2016-06-091-7/+0
| | | | | lvmetad is no longer used at all with the lvm1 format, so the text format is the only one that uses lvmetad.
* lvmdump: also collect output from lsblk command when running lvmdump -sPeter Rajnoha2016-06-093-5/+16
| | | | | lsblk provides nice and quick overview of the storage/sysfs structure that is useful for debugging - collect its output when running lvmdump -s.
* vgcreate, pvcreate, vgextend: don't use a device with duplicatesDavid Teigland2016-06-073-0/+21
| | | | | If duplicate orphan PVs exist, don't allow one of them to be used for vgcreate/pvcreate/vgextend.
* lvmcache: fix duplicate handling with multiple scansDavid Teigland2016-06-073-11/+82
| | | | | | | | | | | | | | | | | Some commands scan labels to populate lvmcache multiple times, i.e. lvmcache_init, scan labels to fill lvmcache, lvmcache_destroy, then later repeat Each time labels are scanned, duplicates are detected, and preferred devices are chosen. Each time this is done within a single command, we want to choose the same preferred devices. So, check for existing preferences when choosing preferred devices. This also fixes a problem with the list of unused duplicate devs when run in an lvm shell. The devs had been allocated from cmd memory, resulting in invalid list entries between commands.
* lvmcache: add optional dev arg to lvmcache_info_from_pvidDavid Teigland2016-06-0710-41/+62
| | | | | | | | | | | | | | | | | | | | | | A number of places are working on a specific dev when they call lvmcache_info_from_pvid() to look up an info struct based on a pvid. In those cases, pass the dev being used to lvmcache_info_from_pvid(). When a dev is specified, lvmcache_info_from_pvid() will verify that the cached info it's using matches the dev being processed before returning the info. Calling code will not mistakenly get info for the wrong dev when duplicate devs exist. This confusion was happening when scanning labels when duplicate devs existed. label_read for the first dev would add an info struct to lvmcache for that dev/pvid. label_read for the second dev would see the pvid in lvmcache from first dev, and mistakenly conclude that the label_read from the second dev can be skipped because it's already been done. By verifying that the dev for the cached pvid matches the dev being read, this mismatch is avoided and the label is actually read from the second duplicate.
* lvmetad: handle update failuresDavid Teigland2016-06-073-127/+498
| | | | | | | | | | | | | If a command gets stuck during an lvmetad update, lvmetad will cancel that update after the timeout. The next command to check the lvmetad will see that lvmetad needs to be populated because lvmetad will return token of "none" after a timed out update (same as when lvmetad is not populated at all after starting.) If a command gets an error during an lvmetad update, it will now just quit and leave its updating token in place. That update will be cancelled after the timeout.
* lvmetad: remove disabled case for "scan error"David Teigland2016-06-073-14/+3
| | | | | Failures while populating lvmetad will be handling differently in a subsequent commit.
* lvmetad: define special update in progress stringDavid Teigland2016-06-072-6/+8
|
* blkdeactivate: fix regression in blkdeactivate causing dm and md devices to ↵Peter Rajnoha2016-06-062-4/+3
| | | | | | | | be skipped. Commit #5b3a4a9 caused the "name" variable to be cleared if declaration and assignment is on two lines so put it back so it's on one line for it to work again.
* post-releaseAlasdair G Kergon2016-06-034-2/+8
|
* pre-releasev2_02_155Alasdair G Kergon2016-06-034-4/+5
|
* pvmove: disallow tag argsDavid Teigland2016-06-033-1/+10
| | | | | | | | | | | | | | pvmove began processing tags unintentionally from commit, 6d7dc87cb pvmove: use toollib pvmove works on a single PV, but tags can match multiple PVs. If we allowed tags, but processed only the first matching PV, then the resulting PV would be unpredictable. Also, the current processing code does not allow us to simply report an error and do nothing if more than one PV matches the tag, because the command starts processing PVs as they are found, so it's too late to do nothing if a second PV matches.
* man: fixed typo in lvcreate.8Tobias Stoeckmann2016-06-031-1/+1
| | | | It's supposed to be "smaller than" instead of "smaller then".
* cleanup: compile fixes for --disable-devmapperZdenek Kabelac2016-06-033-15/+10
| | | | Make lvm2 compilable when configured with: --disable-devmapper.
* man: lvmconfig: add note about --type diff and --mergedconfigPeter Rajnoha2016-06-021-0/+1
|
* lvmconfig: fix lvmconfig --type diff to display complete diff if config ↵Peter Rajnoha2016-06-022-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cascade used If configuration consists of several sources in config cascade ("config cascade" defined in man lvmconfig(8)), lvmconfig displayed only difference from defaults of the topmost config in the cascade. Fix lvmconfig to display complete difference, considering all the configuration in the cascade. For example, before this patch: (use_lvmetad=0 set in lvm.conf which differs from defaults) $ lvmconfig --type diff global { use_lvmetad=0 } (compact_output=1 set on cmd line) $ lvmconfig --type diff --config report/compact_output=1 report { compact_output=1 } (headings=0 set in profile) $ lvmconfig --type diff --commandprofile test report { headings=0 } (difference in topmost configuration source is displayed) $ lvmconfig --type diff --commandprofile test --config report/compact_output=1 report { compact_output=1 } With this patch applied (the config cascade is merged before looking for difference from defaults in configuration): $ lvmconfig --type diff global { use_lvmetad=0 } $ lvmconfig --type diff --config report/compact_output=1 report { compact_output=1 } global { use_lvmetad=0 } $ lvmconfig --type diff --profile test report { headings=0 } global { use_lvmetad=0 } $ lvmconfig --type diff --profile test --config report/compact_output=1 report { headings=0 compact_output=1 } global { use_lvmetad=0 }
* make: add generated parts of lvmdbusd to DISTCLEAN_TARGETS for make distcleanPeter Rajnoha2016-06-022-0/+4
|
* cleanup: use display_nameZdenek Kabelac2016-06-012-5/+4
|
* tests: check losetup -P is correctly handledZdenek Kabelac2016-06-011-0/+63
| | | | Validate pvcreate will not overwrite partitioned loop device.
* tests: extend prepare_loopZdenek Kabelac2016-06-011-3/+4
| | | | Treat args after size as 'extra' params for losetup.
* devices: handle partscan loop devicesZdenek Kabelac2016-06-013-0/+45
| | | | | | | | | Treat loop device created with 'losetup -P' as regular partitioned device - so if it has partition table, prevent its usage in commands like 'pvcreate'. Before 'pvcreate /dev/loop0' could have erased and formated as PV, after this patch, device is filtered out and cannot be used.
* coverity: fix warnings about missing return value check for sscanfPeter Rajnoha2016-05-312-8/+8
| | | | | | | All the variables for sscanf in lvmlockctl.c and lvmlockd-sanlock.c are zeroed before sscanf call so the failure is detected by seeing the zero value instead of proper one in subsequent code - so use (void) for sscanf calls to ignore return value here.
* coverity: missing check for id_write_format return valuePeter Rajnoha2016-05-315-11/+22
|
* coverity: blkdeactivate: separate format and args for printf and declare and ↵Peter Rajnoha2016-05-311-3/+5
| | | | assign separately to avoid masking return values
* coverity: fix possible resource leak of descendants_buffer in ↵Peter Rajnoha2016-05-312-1/+2
| | | | _print_historical_lv fn
* tests: add dmstats to CLEAN_TARGETS for make cleanPeter Rajnoha2016-05-311-1/+1
|
* toollib: properly reset selection handle on selection failure in ↵Peter Rajnoha2016-05-311-12/+12
| | | | select_match_{pv,vg,lv}
* report: fix lvm devtypes internal error if -S is used with field name from ↵Peter Rajnoha2016-05-302-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pvs/vgs/lvs Before this fix, when reporting 'lvm devtypes', the report was initialized with incorrect reserved values - the ones used for pvs/vgs/lvs report were used instead of NULL value (because devtypes doesn't have any reserved values). For example, trying to (incorrectly) use lv_name for the -S|--select with lvm devtypes which doesn't have this field at all: Before this patch (internal error issued): $ lvm devtypes -S 'lv_name=lvol0' Internal error: _check_reserved_values_supported: field-specific reserved value of type 0x0 for field not supported Internal error: dm_report_init_with_selection: trying to register unsupported reserved value type, skipping report selection DevType MaxParts Description aoe 16 ATA over Ethernet ataraid 16 ATA Raid bcache 1 bcache block device cache ... With this patch applied (correct error displayed about unrecognized selection field): $ lvm devtypes -S 'lv_name=lvol0' Device Types Fields ------------------- devtype_name - Name of Device Type exactly as it appears in /proc/devices. [string] devtype_max_partitions - Maximum number of partitions. (How many device minor numbers get reserved for each device.) [number] devtype_description - Description of Device Type. [string] Special Fields -------------- selected - Set if item passes selection criteria. [number] help - Show help. [unselectable number] ? - Show help. [unselectable number] Unrecognised selection field: lv_name Selection syntax error at 'lv_name=lvol0'. Use 'help' for selection to get more help.
* toollib: simplify internal selection calls for non-reporting toolsPeter Rajnoha2016-05-304-48/+34
| | | | | Some of the variables were set superfluously - we can just use existing "struct processing_handle" which includes "struct selection_handle".
* tests: check thin is not flushed for statusZdenek Kabelac2016-05-271-0/+4
| | | | | We finally approach a moment where we generally avoid flushing thin-pool with every lvs command...
* snapshot: for invalid snapshot show 100%Zdenek Kabelac2016-05-271-1/+3
| | | | | Recent commit 92eba53a797a011d1ce6fbd7bef88eab41af2072 started to report empty "" data usage of invalid snapshot, restore 100% to be shown.
* tests: stacked snapshot mergeZdenek Kabelac2016-05-271-0/+85
|
* tests: check cache_mode change on cachepoolZdenek Kabelac2016-05-271-0/+20
|
* debug: use display_lvnameZdenek Kabelac2016-05-272-18/+21
|
* cache: add log_error on error pathZdenek Kabelac2016-05-272-7/+18
| | | | | Validate and report error when lv_cache_status is called for inactive LV, or pending delete or unused cache_pool.
* report: convert more options to use single statusZdenek Kabelac2016-05-273-66/+29
| | | | | | | | | | | | | | Convert fields into using a single status ioctl call per LV. This is a bit tricky since when there are more complicated stacks, at this moment its undefined which values should be shown. It's clear we need to cache more then single ioctl per LV, but also we need to define more explicitely relation between reported values for snapshots. This patch is not a final state, rather a transitional step. It should not be giving more 'worst' values then previous many-ioctl-calls-per-lv solution.
* snapshot: use seg_status for attrsZdenek Kabelac2016-05-271-7/+5
|
* lv: introduce lvseg_percent_with_info_and_seg_statusZdenek Kabelac2016-05-273-0/+92
| | | | | | | | | Add function to obtain percentage value for cache lv_seg_status. This API is rather evolving 'middle' step as the ultimate goal is segment API fuctionality. But first we need to be clear at reporting level which values are needed to be reported for which LVs and segments.
* lvstatus: enhance seg_status to handle snapshotZdenek Kabelac2016-05-273-12/+50
| | | | | | | | | | | | | | | | | | | | | | Add more code to properly store status for snapshot segment maintaining lvm2 fiction of COW and snapshot internal volumes. The key issue here is however not though-through reporting logic - as there is no single answer for whole line state. It not counting with layer and we may need few more ioctl to cover all reporting needs depending upon what is actually needed. In reality we need to 'cache' more ioctl status queries for individual LVs and their segments (so they checked at most once). The other 'hard' topic for conversion is mirror segment handling. Also we definitelly need to relocate some logic into segment's methods, yet it might be complex as we have not clear border between targets. TODO: define more clearly how are reporting fields defined in case we 'stack' volumes like - cache of stacked thin LV snapshot origin.
* refresh: call resume after failing suspendZdenek Kabelac2016-05-272-3/+5
| | | | | | | lv_refresh_suspend_resume() has escaped with fail ret code after failing suspend and could have left many volumes in suspend state. So always unconditionally call resume also when suspend has failed.
* cleanup: drop cmd and constify lv for lv_refresh_suspend_resume()Zdenek Kabelac2016-05-275-6/+8
| | | | | Like with most other lv_manip* functions take just LV arg and get cmd from embeded pointer when needed.
* cleanup: substract integersZdenek Kabelac2016-05-271-2/+2
| | | | | Instead of doing float arithmetic, do integer math first and convert result to float.
* cache: enhance lv_cache_wait_for_cleanZdenek Kabelac2016-05-272-12/+16
| | | | Handle passthrough mode when checking cache mode state explicitely.
* cache: call status only on cache pool in useZdenek Kabelac2016-05-274-5/+7
| | | | Check show cache status only for cache pool in use.
* setup_task: add with_flushZdenek Kabelac2016-05-274-38/+30
| | | | | | | | | | | To get better control when flushing is used add extra arg when setting up dm task. By default now check dm device status without flush. (At this moment this should effect only thin and cache volumes). Also switch dev_manager_thin_pool_status() to use more readable 'flush' parameter instead of 'no_flush'.