summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* lvconvert: rework routing of operationsdev-dct-lvconvert-cleanup-2David Teigland2016-06-281-0/+585
| | | | | | | | | | | | | | | | | | | | | | | | | Add new logic to identify each unique operation and route it to the correct function to perform it. The functions that perform the conversions remain unchanged. This new code checks every allowed combination of LV type and requested operation, and for each valid combination calls the function that performs that conversion. The first stage of option validation which checks for disallowed combinations of command line options, is done done before process_each is called. This is unchanged. (This new code would allow that first stage validation to be simplified in a future commit.) The second stage of checking options against the specific LV type is done by this new code. For each valid combination of operation + LV type, the new code calls an existing function that implements it. With this in place, the ad hoc checks for valid combinations of LV types and operations can be removed from the existing code in a future commit.
* lvmetad: two phase vg_removeDavid Teigland2016-06-273-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-2726-71/+181
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-271-7/+0
| | | | | lvmetad is no longer used at all with the lvm1 format, so the text format is the only one that uses lvmetad.
* WHATS_NEW: add recent changesDavid Teigland2016-06-271-0/+6
|
* lvmlockd: fix coverity reportDavid Teigland2016-06-271-0/+1
|
* libdm: report: fix field width calculation when using dm_report_column_headingsPeter Rajnoha2016-06-271-24/+41
| | | | | | | | | | | | | This fixes commit 0ba5f4b8e977a6f2f45f95777da508b42d84c01a which moved field recalculation (field width and sort position) from dm_report_object to dm_report_output but it didn't handle the case when dm_report_column_headings was used separately to report headings (before dm_report_outpout call) and hence we ended up with intial widths for fields in the headings. If we're using dm_report_column_headings, we need to recalculate fields if we haven't done so yet, the same way as we do in dm_report_output.
* reporter: simplify --configreport handling for -S|--select and fix an issue ↵Peter Rajnoha2016-06-273-35/+29
| | | | | | | | | | | | reported by coverity Simplify code around _do_get_report_selection - remove "expected_idxs[]" argument which is superfluous and add "allow_single" switch instead to allow for recognition of "--configreport <report_name> -S" as well as single "-S" if needed. Null pointer dereferences (FORWARD_NULL) /safe/guest2/covscan/LVM2.2.02.158/tools/reporter.c: 961 in _do_report_get_selection() Null pointer dereferences (FORWARD_NULL) Dereferencing null pointer "single_args".
* coverity: fix issues detected in recent codePeter Rajnoha2016-06-274-5/+5
| | | | | | | | | | | | | | Uninitialized variables (UNINIT) /safe/guest2/covscan/LVM2.2.02.158/tools/toollib.c: 3520 in _process_pvs_in_vgs() Uninitialized variables (UNINIT) Using uninitialized value "do_report_ret_code". Null pointer dereferences (REVERSE_INULL) /safe/guest2/covscan/LVM2.2.02.158/libdm/libdm-report.c: 4745 in dm_report_output() Null pointer dereferences (REVERSE_INULL) Null-checking "rh" suggests that it may be null, but it has already been dereferenced on all paths leading to the check. Incorrect expression (MISSING_COMMA) /safe/guest2/covscan/LVM2.2.02.158/lib/log/log.c: 280 in _get_log_level_name() Incorrect expression (MISSING_COMMA) In the initialization of "log_level_names", a suspicious concatenated string ""noticeinfo"" is produced. Null pointer dereferences (FORWARD_NULL) /safe/guest2/covscan/LVM2.2.02.158/tools/reporter.c: 816 in_get_report_options() Null pointer dereferences (FORWARD_NULL) Comparing "mem" to null implies that "mem" might be null.
* doc: Resync kernel docs.Alasdair G Kergon2016-06-258-52/+205
|
* man: lvs: move doc about --all so it's ordered alphabetically in the man pagePeter Rajnoha2016-06-241-10/+10
|
* man: document --configreport, --logonly, --reportformatPeter Rajnoha2016-06-2434-36/+182
|
* commands: help: add missing --reportformat referencesPeter Rajnoha2016-06-241-2/+5
|
* commands: fix typo in arg assignmentPeter Rajnoha2016-06-241-1/+1
|
* cleanup: clean warns from older gccZdenek Kabelac2016-06-241-2/+2
| | | | Don't report uninitialized use by older gcc.
* tests: update test for modified outputZdenek Kabelac2016-06-241-6/+6
| | | | We now print vg/lv for lv resized volume
* tests: smaller number of devs created to fill metadataZdenek Kabelac2016-06-241-1/+1
|
* cleanup: type cleanupZdenek Kabelac2016-06-241-1/+1
| | | | | Fix return code 1. Since we always check for !() - this fix has no other effect.
* lvresize: let pass even protected names like _tmetaZdenek Kabelac2016-06-241-1/+1
| | | | | Only later validation can decide if the volume is actually restricted from being resized (unlike in lvcreate time).
* lvresize: fixes for recent commitZdenek Kabelac2016-06-242-7/+6
| | | | Merging process and patch rework missed some bits - fix them.
* Revert "locking: trace errors from dir creation"Alasdair G Kergon2016-06-232-6/+3
| | | | | | | | | This reverts commit fa69ed0bc845df3d2c7ae68d03cdd4a3dec339d8. This code sometimes expects to be presented with a read-only filesystem (during some boot sequences for example) and copes appropriately with this and it should not lead to expected error messages that might cause unnecessary alarm.
* tests: aux prepare_thin_metadataZdenek Kabelac2016-06-233-36/+25
|
* cleanup: drop setting lv_nameZdenek Kabelac2016-06-232-2/+0
| | | | | | | lv_name arg is only used without known LV for resolving '*lv'. Once we know *lv, never use lv_name ever again. So setting it when passing *lv has not needed.
* cleanup: remove unused codeZdenek Kabelac2016-06-232-84/+0
|
* cleanup: remove unused sizearg variableZdenek Kabelac2016-06-235-5/+0
| | | | It's not used for anything now.
* lvresize: return 0/1Zdenek Kabelac2016-06-231-23/+11
| | | | Returning locking LV is no longer used from here, so return 1/0.
* lvresize: support more resized LVsZdenek Kabelac2016-06-232-102/+120
| | | | | | | | | | | | Add code to support more LVs to be resized through a same code path using a single lvresize_params struct. (Now it's used for thin-pool metadata resize, next user will be snapshot virtual resize). Update code to adjust percent amount resize for use_policies. Properly activate inactive thin-pool in case of any pool resize as the command should not 'deffer' this operation to next activation.
* lvresize: do not pass struct cmdZdenek Kabelac2016-06-235-31/+31
| | | | | | | | Use common API design and pass just LV pointer to lv_manip.c functions. Read cmd struct via lv->vg->cmd when needed. Also do not try to return EINVALID_CMD_LINE error when we have already openned VG - this error code can only be returned before locking VG.
* lvresize: pass only needed params to _fsadm_cmdZdenek Kabelac2016-06-231-12/+14
| | | | | Do not pass whole lvresize_params into _fsadm_cmd, and give it only needed args.
* lvresize: check pvh list is vg->pvsZdenek Kabelac2016-06-231-2/+2
| | | | | Instead of checking lp->argc for arg count, compare directly whether passed pvh is vg->pvs.
* lvresize: update lvresize_params structZdenek Kabelac2016-06-235-156/+126
| | | | | Reorganise struct lvresize_params to better fit lvresize needs to be able to resize more then just a single LV.
* cleanup: use display_lvnameZdenek Kabelac2016-06-233-42/+51
|
* cleanup: add dots to some messagesZdenek Kabelac2016-06-234-13/+14
| | | | Add missing dots and one comment.
* cleanup: code lines reoderedZdenek Kabelac2016-06-231-9/+7
|
* lvresize: drop extra sigint handlingZdenek Kabelac2016-06-231-2/+0
| | | | | yes_no_prompt() now already handles signal checking, so drop redundant test.
* lvresize: inform about ignored args with --use-policesZdenek Kabelac2016-06-231-0/+9
| | | | | When --use-polices is specified, all size args are meaningless, as the resize is based upon policy. So just keep user informed.
* lvresize: move and extend resizefs ignoring checkZdenek Kabelac2016-06-231-4/+11
| | | | | Move check for 'ignoring' --resizefs option and extend check for some more types.
* locking: trace errors from dir creationZdenek Kabelac2016-06-232-2/+5
|
* monitoring: preserve monitoring status during updateZdenek Kabelac2016-06-232-8/+14
| | | | Ignore monitoring during whole update (suspend/resume) of thin-pool.
* activation: _lv_active returns 0 on errorZdenek Kabelac2016-06-232-2/+5
| | | | | | | | We have only 2 users of _lv_active() - one was already checking for ==1 while the other use (_lv_is_active()) could have take '-1' as a sign of having an LV active. So return 0 and log_debug also the reason while detection has failed (i.e. in case --driverload n - it's kind of expectable, but might have confused user seeing just <backtrace>).
* activation: switch to warningZdenek Kabelac2016-06-232-2/+3
| | | | | Since this function does not have a way to return error use correct reporting level as warning.
* libdm: log: remove log_print_bypass_report calls and register new ↵Peter Rajnoha2016-06-235-18/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | print_log_libdm for libdm during lvm initialization instead This fixes commit f50d4011cdd3ef38c15b9dea05e73321592d93c2 which introduced a problem when using older lvm2 code with newer libdm. In this case, the old LVM didn't recognize new _LOG_BYPASS_REPORT flag that libdm-report code used. This ended up with no output at all from libdm where log_print_bypass_report was called because the _LOG_BYPASS_REPORT was not masked properly in lvm2's print_log fn which was called as callback function for logging. With this patch, the lvm2 registers separate print_log_libdm logging function for libdm instead. The print_log_libdm is exactly the same as print_log (used throughout lvm2 code) but it checks whether we're printing common line on output where "common" means not going to stderr, not a warning and not an error and if we are, it adds the _LOG_BYPASS_REPORT flag so the log_print goes directly to output, not to any log report. So this achieves the same goal as in f50d4011cdd3ef38c15b9dea05e73321592d93c2, just doing it in a way that newer libdm is still compatible with older lvm2 code (libdm-report is the only code using log_print). Looking at the opposite mixture - older libdm with newer lvm2 code, that won't be compilable because the new log report functionality that is in lvm2 also requires new dm_report_group_* libdm functions so we don't need to care here.
* log: move original print_log code to _vprint_log and make print_log a ↵Peter Rajnoha2016-06-231-7/+18
| | | | | | | | | wrapper over _vprint_log Move code from original print_log fn to a separate _vprint_log function that accepts va_list and make print_log a wrapper over _vprint_log. The print_log just initializes the va_list and uses it for _vprint_log call now. This way, we can reuse _vprint_log if needed.
* filters: add comments about internal filter position in filter chainPeter Rajnoha2016-06-231-2/+2
|
* lvconvert: Fix --stripes handling.Alasdair G Kergon2016-06-221-6/+5
| | | | | Only treat --stripes as meaning --type striped if no other type was first detected. If a segtype got selected, don't override it later.
* vgimportclone: add native commandDavid Teigland2016-06-2213-4/+493
| | | | | This is cleaner and more efficient than the script. The args and usage are unchanged.
* lvconvert: Refactor argument handling code.Alasdair G Kergon2016-06-224-107/+206
| | | | | Begin disentangling the different lvconvert modes of operation from each other.
* tools: Use arg_is_set instead of arg_count.Alasdair G Kergon2016-06-2129-432/+432
|
* vgcfgrestore: rescan to reenable lvmetad on error pathDavid Teigland2016-06-211-3/+8
| | | | | | In commit 6ae22125, vgcfgrestore began disabling lvmetad while running, and rescanned to enable it again at the end, but missed the rescanning/enabling in the error case.
* vgcfgrestore: check for missing deviceDavid Teigland2016-06-201-0/+5
| | | | | | The missing device will generally be seen earlier and cause the command to not reach this point, but check anyway for completeness.