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

11950 Commits

Author SHA1 Message Date
David Teigland
931fede81b hash: change name of new lookup function 2015-11-17 11:59:44 -06:00
David Teigland
4d37db123d lvmetad: improve error message for VGs with same name 2015-11-17 10:35:42 -06:00
David Teigland
485d2ca945 lvmetad: different style for hash functions
In lookup, return a count of entries with the
same key rather than the value from a second
entry with the same key.

Using some slightly different names.
2015-11-17 10:27:16 -06:00
David Teigland
d42cedae58 lvmetad: add error explaining duplicate VG names
When a VG name lookup fails because the name matches
multiple VGs, return an explanatory error.
2015-11-16 16:25:49 -06:00
David Teigland
7d1c9e1d5a lvmetad: fix some error logging
For some errors old_meta may not be set, so
check before logging it.
2015-11-16 15:13:26 -06:00
David Teigland
68c386cce7 lvmetad: use lookup_withval in another location
Simply use lookup_withval right away rather than doing a
standard lookup, checking for the wrong mapping, then
repeating with lookup_withval to get the right mapping.
2015-11-16 15:13:22 -06:00
David Teigland
4a984cabc4 lvmetad: remove unneeded FIXME
This case is now handled correctly.
2015-11-16 13:44:57 -06:00
David Teigland
920a281994 hash: add comment about multiple values 2015-11-16 11:02:25 -06:00
Zdenek Kabelac
b6a45963e3 libdm: fix check of pointer
Ahhh being blind here - wanted to check the pointer before dereference
not a dereferenced one.
2015-11-16 13:10:24 +01:00
Zdenek Kabelac
2a2487f02f libdm: better error reporting from dm_split_lvm_name
Report errors from all error paths correctly.
Validate passed args before dereferencing them.
2015-11-16 13:09:53 +01:00
Zdenek Kabelac
5d4f5873a9 coverity: model FD_ZERO
Coverity is not able to understand assembly language in
system's header file, so provide model for such macro.

Note: to really see model in-use: #nodef FD_ZERO model_FD_ZERO
need to go to coverity/config/user_nodefs.h
2015-11-16 01:16:11 +01:00
Zdenek Kabelac
8ebf2b0611 debug: lvconvert add missing display_lvname
Add missing display_lvname in _lvconvert_merge_thin_snapshot().

Also when we detect missing origin, report Internal error,
which would likely be the primary fault here
(and avoid dereft of NULL origin as noticed by Coverity).
2015-11-16 01:16:11 +01:00
Zdenek Kabelac
0f4d96f1bd cleanup: just alphabetically sort links 2015-11-16 01:16:11 +01:00
Zdenek Kabelac
dccbc3b621 cleanup: simplify dev_cache_exit
Just set whole _cache struct into unitialized state just
like with lib init start usage.
Lists are initialized with dev_cache_init().
2015-11-16 01:16:11 +01:00
Zdenek Kabelac
5a4676fea9 cleanup: add _free on error path
Just like with failing allocation above also _free(dev).

TODO: rework this to always use mempool and drop unneeded
comlexity we have in this function.
2015-11-16 01:16:11 +01:00
Zdenek Kabelac
c3b292a4a9 format-text: ensure no division by zero
Coverity likes here to be 100% sure no division by zero is possible.
Add check for alignment !=0 which is made on other code paths here.
2015-11-16 01:16:11 +01:00
Zdenek Kabelac
193e7f5973 config: check vdef pointer before dereference
Coverity notices we check for v_def != NULL elsewhere, so it thinks
it may be possibly NULL also here.
2015-11-16 01:16:11 +01:00
Zdenek Kabelac
96d73dc6ea libdm: check for passed custom time value
Coverity reports custom should be checked before derefernce.
2015-11-16 01:16:11 +01:00
Zdenek Kabelac
d4288c9bdf libdm: check for null from pool strdup
Unlikely to happen, but Coverity shown we may have possible
derefer NULL pointer.
2015-11-16 01:16:09 +01:00
Zdenek Kabelac
422c7474ca libdm: check if passed return pointer is not NULL
Coverity: before storing return value, check passed space will
not dereference NULL pointer.
2015-11-16 01:15:04 +01:00
Stéphane Aulery
dd9a05b5ae man: improve cmirrord.8 manpage
- Keywords in bold
- Add syslog and signal ref.
- Sort see also sections

Signed-off-by: Stéphane Aulery <saulery@free.fr>
2015-11-16 01:15:03 +01:00
Stéphane Aulery
376892ddf8 clvmd: remove -v option from getopt
-V is documented, not -v.

Signed-off-by: Stéphane Aulery <saulery@free.fr>
2015-11-16 01:15:03 +01:00
Zdenek Kabelac
e31f4b76f4 cache: handle older metadata format
When reading older lvm2 metadata for cache-pool - we now handle more
extended syntax - basically we want to enter most setting when
actually creating cached LV.

For this new validation code has been added. However older metadata
without new settings set is now found as invalid.

Fix it by adding default settings for  cache policy  mq
and cache mode  writethrough.
2015-11-16 01:12:57 +01:00
David Teigland
d9295410e9 lvmetad: change the new hash to take data len
If the data len is passed into the hash table
and saved there, then the hash table internals
do not need to assume that the data value is
a string at any point.
2015-11-13 16:54:22 -06:00
David Teigland
e425bce281 tests: allow lvmetad tests with duplicate VG names 2015-11-13 15:09:26 -06:00
David Teigland
46193f4a59 lvmetad: handle duplicate VG names
New hash table functions are added that allow for
multiple entries with the same key.  Use of the
vgname_to_vgid hash table is converted to these
new functions since there are multiple entries
in vgname_to_vgid that have the same key (vgname).

When multiple VGs with the same name exist, commands
that reference only a VG name will fail saying the
VG could not be found (that error message could be
improved.)  Any command that works with the select
option can access one of the VGs with -S vg_uuid=X.
vgrename is a special case that allows the first VG
name arg to be replaced by a uuid, which also works.

(The existing hash table implementation is not well
suited for handling this case, but it works ok with
the new extensions.  Changing lvmetad to use its own
custom hash tables may be preferable at some point.)
2015-11-13 14:56:35 -06:00
Alasdair G Kergon
970a428909 pvmove: Remove unused find_pvmove_lv_from_pvname. 2015-11-13 18:06:08 +00:00
Zdenek Kabelac
b2e13ac552 coverity: add few internal errors
Mark impossible paths with internal errors.
Also replace 'strcmp() with more readable seg_is...()
2015-11-13 11:18:27 +01:00
Zdenek Kabelac
3089f5ab15 coverity: model some function
Reduce number of false-positives and model functions in a way
Coverity is able to understand it.
2015-11-13 11:18:27 +01:00
Zdenek Kabelac
8d258c7df4 coverity: hint
Here Coverity cannot see the pointer cannot be NULL in this
code path - opened coverity case #00531860.

We could make a model to avoid seeing related reports,
but then we loose coverage for modeled function.

So decided to add minor hint for this case.
2015-11-13 11:18:27 +01:00
Zdenek Kabelac
ea1814cea8 tests: without delay_dev skip some checks
When delay_dev is missing these tests are just racy.
2015-11-13 11:17:07 +01:00
Zdenek Kabelac
6dadebb1e4 cleanup: better error message
Use display_lvname.
2015-11-13 11:17:06 +01:00
Zdenek Kabelac
1f2a42c7b7 cleanup: check LVs in one statement
Use a single statement to check all LVs we want to
deref via  get_only_segment_using_this_lv().
2015-11-13 11:17:06 +01:00
Zdenek Kabelac
70af08122e cleanup: missing check for PV2
Patch missed also check this pointer dereference.
2015-11-13 11:17:06 +01:00
Zdenek Kabelac
e0828e885b cleanup: drop unneded check for mem
Revert missed to drop this extra check.
2015-11-13 11:17:06 +01:00
Zdenek Kabelac
112c0592ad debug: put stack on error path
At least check result and trace it.
However we may need better error reaction in this case.
2015-11-13 11:17:06 +01:00
Zdenek Kabelac
007be91e3d raid: ensure area_count is at least 2
Enusure we will not divide by 0.
2015-11-13 11:17:06 +01:00
Zdenek Kabelac
d74e1291cd libdm: put in secure check
Coverity complains about NULL deref - while this cannot currently
happen, put in secure INTERNAL_ERROR.
2015-11-13 11:17:05 +01:00
Zdenek Kabelac
0128770d6d reporter: add missing stack trace
Use goto_out on error paths.
2015-11-13 11:17:05 +01:00
David Teigland
43777b551d lvmetad: tail chasing to shut up coverity 2015-11-12 09:35:41 -06:00
Zdenek Kabelac
058725c721 dmeventd: fix check for failing open.
Recent change 2c8d6f5c90
actually droped restart when the reason of failing open is missing
device completely - check for ENOENT now as another reason
to start new dmeventd server  (when there is no systemd to maintain it).
2015-11-11 19:54:55 +01:00
Peter Rajnoha
1e729c47d2 str_list: do not support str lists without mempools
Do not support str lists without mempools. Instead, create temporary
mempool where necessary (currently only _get_report_options fn).
2015-11-11 16:09:52 +01:00
Peter Rajnoha
b8779e706e configure: check for udev_device_get_is_initialized is available
The udev_device_get_is_initialized is available since libudev version
165. Older versions are still used somewhere (e.g. RHEL6). So better
check for this fn and use it only if it's available.
2015-11-11 15:15:50 +01:00
Peter Rajnoha
f82e0210b7 dev-ext: issue error if external_device_info_source=udev and udev db record incomplete
Udev db records are marked as not initialized (incomplete) on timeout.
Issue an error message whenever LVM finds such records so users are
aware that something's going wrong with udev db.

This is important in case we use devices/external_device_info_source="udev"
where udev database records are used to do various filtering decisions.

For example:

udev log of timed out worker:

Nov 11 13:02:25 raw.virt systemd-udevd[607]: seq 1997 '/devices/virtual/block/dm-2' is taking a long time
Nov 11 13:04:25 raw.virt systemd-udevd[607]: seq 1997 '/devices/virtual/block/dm-2' killed
Nov 11 13:04:25 raw.virt systemd-udevd[607]: worker [11221] terminated by signal 9 (Killed)
Nov 11 13:04:25 raw.virt systemd-udevd[607]: worker [11221] failed while handling '/devices/virtual/block/dm-2'
...

LVM also issues error message visibly if incomplete udev db record is found,
devices/external_device_info_source="udev" is set:

$ pvs
  Udev database has incomplete information about device /dev/dm-2.
  Failed to get external handle for device /dev/dm-2 [udev].
  ...
2015-11-11 13:14:07 +01:00
Zdenek Kabelac
6d0db97163 libdm: reorder error path
Coverity noticed recent fix of an error path missed to
release 'dmt' - reoder code to ensure 'dmt' is released.
2015-11-10 21:41:47 +01:00
Zdenek Kabelac
a45cc0fe14 raid: fix the string compare
Coverity noticed this condition is always false and the error
path could never be visited.

So check for all mismatches of supported messages
and actually mark log_error as internal error.
2015-11-10 21:40:28 +01:00
Alasdair G Kergon
59905100d1 coverity: Add placeholder modelling file. 2015-11-10 01:37:11 +00:00
Zdenek Kabelac
fb59847a0f libdm: replace assign with increment
Coverity didn't liked assign with && expression, so use trick.
It does not complain against this prefix incremenent operation.
2015-11-09 22:51:48 +01:00
David Teigland
7ec61cd5b9 vgrename: check if new and old names match
When the first arg is a UUID and vgrename translates
that UUID to a current VG name, the old and new VG
names are not being checked for equality.  If they
are equal, it produces an internal error rather than
a proper error.
2015-11-09 13:23:59 -06:00
David Teigland
cd937efa77 lvmetad: change recent cleanups
with better alternatives.
2015-11-09 12:18:43 -06:00