1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
Commit Graph

1299 Commits

Author SHA1 Message Date
Zdenek Kabelac
60b61f2db3 libdm-stats: correct checking of dm_snprintf error
Function dm_snprintf returns -1 on error, while 0 is still
considered valid result code so correcting error path testing.
2018-02-12 22:13:57 +01:00
Zdenek Kabelac
4d4d5bf323 libdm: accept mirror status with userspace word in the line
Just making sure the parser will not stop - although greater level of
support needs to be added (Describing doc seems to be missing however).
2018-02-01 21:56:07 +01:00
Alasdair G Kergon
e4e2abc8bc libdm: Fix a size_t in _dm_malloc_aligned_aux message. 2018-01-12 00:42:53 +00:00
Alasdair G Kergon
ea96381534 libdm: Introduce dm_malloc_aligned 2018-01-10 15:48:03 +00:00
Zdenek Kabelac
4c88c4626d debug: update debug msg
Use _node_name.
2017-12-07 21:00:39 +01:00
Zdenek Kabelac
717714b24f cleanup: use log_warn 2017-12-07 21:00:39 +01:00
Zdenek Kabelac
820b1b98fc libdm: drop extra structure copy
When doing resume, directly pass location where new updated info
needs to be stored.

_resume_node() ensures the info is ONLY updated when the function
is successful and never changes it on error path.
2017-12-07 21:00:39 +01:00
Zdenek Kabelac
82ae02bc6a libdm: use delay_resume_if_extended
Update the logic towards more explicit logic.

Preload tree normally does not want to resume, only
in certain cases of extension or new loaded nodes can be
resumed. So introduce new internal variable delay_resume_if_extended
controlable by target.

Patch itself is not changing current existing behaviour,
and rather documents existing problem in more readable way.

lvm2 needs to introduce explicit mechanism how to support more
fain-grained (and safe) logic to i.e. resize thin-pool which
can be sitting on cached raid volume.
2017-12-07 21:00:39 +01:00
Zdenek Kabelac
297d5915c3 libdm: avoid checking status on activation
Variable props.send_messages has 3 states and was not used properly
here.  Activation in this moment does not need to verify thin-pool status
as that has been already checked on preload.
So only if there are some real messages (value 2) call function
for sending them.
2017-12-07 21:00:36 +01:00
Zdenek Kabelac
4a4ea47f70 libdm: add help func _get_last_load_segment
Share code for same functionality.
2017-12-07 20:59:37 +01:00
Zdenek Kabelac
c3e224ad0e thin: missing type is error 2017-12-07 20:59:37 +01:00
Zdenek Kabelac
2208ebfe16 thin: always clear memory before parsing status
Ensure there cannot be 'reused' any data from some previous call.
2017-12-07 20:59:28 +01:00
Zdenek Kabelac
406b566cfc cleanup: drop unneeded check
Code already has dereferenced UUID before this point,
and its already given we require name & uuid when ading new node
(although uuid could be empty string).
2017-12-04 15:45:49 +01:00
Zdenek Kabelac
5abf6b7c21 cleanup: messsage cleanup 2017-12-04 15:38:50 +01:00
Zdenek Kabelac
1f73cadd2d cleanup: use log_warn
Fucntion is not failing execution -> log_warn.
2017-12-04 15:38:50 +01:00
Zdenek Kabelac
76322d3b3e clenaup: use log_warn
Avoid logging error when function is not failing.
Technically can't really happen ATM anyway.
2017-12-04 15:38:50 +01:00
Zdenek Kabelac
2a01e3d4ca cleanup: use _node_name
Use existing internal method for create 'name (major:minor)' string
for debug messages and reduce some messages.
2017-12-04 15:38:50 +01:00
Zdenek Kabelac
925fec6ecb cleanup: stack tracing 2017-12-04 15:38:50 +01:00
Zdenek Kabelac
e3366787b6 cleanup: mark success at the end
Simplify setting 'success' return value and use common use-pattern
for handling return code.
2017-12-04 15:38:50 +01:00
Zdenek Kabelac
10f37345eb cleanup: drop impossible test case
This test can never be true since info is embeded struct.
2017-12-04 15:38:50 +01:00
Zdenek Kabelac
1f6d79ab48 cleanup: simplier error message
Use single 'error' message just with different reason.
2017-12-04 15:38:50 +01:00
Zdenek Kabelac
7379a2624b cleanup: futher code reduction
Just like everywhere else - use single if() for major:minor setup
(it basically can't fail as of today anyway)

Always leave funtion with correctly set pointers even on error path.
2017-12-04 15:38:50 +01:00
Zdenek Kabelac
e447d7ca5e libdm: support for replicator target is dropped
Replicator never really existed in upstream kernel and its support
got deprecated.

Also its support never got finished so no code is supposed to be
using it anyway.

Libdm symbols are remaining, just the implementation will always
return failure - so any user of:

dm_tree_node_add_replicator_dev_target()
dm_tree_node_add_replicator_target().

will now always recieve error message.
2017-12-04 15:38:50 +01:00
Zdenek Kabelac
63368a5064 libdm: watch for failing _info_by_dev
Separate handling of error code from _info_by_dev.
This error can only happeng when we are running out of memory.
In such case there is urgent need to stop any futher proceeding
of command and run to error ASAP.
2017-12-04 15:38:50 +01:00
Zdenek Kabelac
0e177cc7c9 cleanup: simplify _deps code
Make _deps to always return name & uuid,
and postpone duplication of name and uuid into _create_dm_tree_node().
Saves some duplicated code.
2017-12-01 12:19:09 +01:00
Zdenek Kabelac
f70404addb pvmove: enhance delayed_resume logic
ATM we want to support delayed resume purely in pvmove case.
So have libdm logic internal to recognize difference beween
pvmove and other targets that do use delayed resume.

This fixes problem introduced with commit aa68b898ff
for mirror-on-mirror or snapshot-on-mirror problem.

TODO: likely added new API call and let libdm user select
delayed nodes explicitely.
2017-11-26 00:36:48 +01:00
Zdenek Kabelac
aa68b898ff libdm: preload propagates delayed resume
Propagate delayed resume at least for preload case in a simple way.
Currently  PVMOVE depends on internal logic where 'mirror' with
corelog is 'possible' PVMOVE. In such case resume of 'created'
node is 'delayed'.

This is mostly an ugly internal hack - but for the moment being when we
add propagation for preload - it does work reasonable.

TODO: provide standard API and avoid this internal 'guessing'.
2017-11-24 16:05:21 +01:00
Zdenek Kabelac
0c9e3e8df2 coverity: add some initilizers
Coverity cannot do a deeper analyzis so let's make just reports
go away and initialize them to 0.
2017-11-07 21:26:11 +01:00
Alasdair G Kergon
f1cc5b12fd tidy: Add missing underscores to statics. 2017-10-18 15:58:13 +01:00
Zdenek Kabelac
327d9d59be libdm: fix typo in libdevmapper.pc
Fixing name for RT libraries and using RT_LIBS.
2017-10-18 00:04:06 +02:00
Zdenek Kabelac
a02db1c45a libdm: fix parentheses in assignment + comparison
As reported, fix incorrect placement of parentheses.
TODO: add testing code.
2017-09-20 15:14:16 +02:00
Alasdair G Kergon
29834b6e91 kernel: Refresh dm-ioctl.h
Adds DM_DEV_ARM_POLL
2017-09-14 17:50:56 +01:00
Zdenek Kabelac
539a48a328 debug: add stack trace point 2017-08-22 10:23:31 +02:00
Zdenek Kabelac
0e42b31dc3 libdm: fix errpath for control node creation
When control node failure happens, umask was not restored.
Fix it by using common exit path.
2017-08-22 10:23:29 +02:00
Alasdair G Kergon
e6afe9e782 ioctl: Allow minor without major.
There's no need to insist on a major number being supplied when the
code's going to override it if it's wrong anyway.
2017-08-04 14:45:20 +01:00
Zdenek Kabelac
92b53a8077 configure: improve test for realtime clock
Check first if we need to even link -lrt  - since clock functions
are normally emebeded with recent  glibc (>=2.17)
Use standard  RT_LIBS name.
Avoid duplicate test for realtime clock with lvmlockd
Show better error message when realtime clock support is missing or
disabled.
Link  RT_LIBS explicitely with lvmlockd and lvmetad.
2017-08-01 14:03:54 +02:00
Zdenek Kabelac
2232e82d25 makefiles: fixing linking
Avoid adding -g more then once for debug builds.
Avoid enabling  DEBUG_MEM when we build multithreaded tools.
Link executables with -fPIE -pie and --export-dynamic LDFLAGS
Introduce PROGS_FLAGS to add option to pass flags for external libs.
Link  lvm2 internally library only when really used.
Link DAEMON_LIBS with daemons.
Pass VALGRIND_CFLAGS internally
Set shell failure mode on couple places.
2017-08-01 11:53:30 +02:00
Zdenek Kabelac
57727bb4eb makefiles: RT_LIB
Link -lrt directly only with  libdevmapper.
All other users get dependency transiently.
2017-08-01 11:53:13 +02:00
Zdenek Kabelac
2593777f65 libdm: log_warn
No real effect anyway - function returs '1' in all paths,
but just make sure we do not have 'log_error()' on non-error path.
2017-08-01 11:53:12 +02:00
Zdenek Kabelac
0bf836aa14 tidy: prefer not using else after return
clang-tidy: avoid using  'else' after return - give more readable code,
and also saves indention level.
2017-07-20 11:18:29 +02:00
Zdenek Kabelac
0d0a3397c2 cleanup: add braces in macro 2017-07-20 11:18:29 +02:00
Zdenek Kabelac
b37e4e3f90 cleanup: constify used parameter 2017-07-20 11:18:29 +02:00
Zdenek Kabelac
f7e62bc55c cleanup: drop extra compare
dm_free() already validates for NULL itself.
2017-07-17 12:32:18 +02:00
Zdenek Kabelac
ba9820b142 numbers: strtod or strtoul need reset of errno
API for strtod() or strtoul() needs reset of errno, before it's being
called. So add missing resets in missing places and some also some
errno validation for out-of-range numbers.
2017-07-17 12:32:18 +02:00
Eric Ren
7617e08c03 cleanup: fix some typos
form -> from
accomodate -> accommodate

Signed-off-by: Eric Ren <zren@suse.com>
2017-07-10 14:58:33 +02:00
Zdenek Kabelac
5ff6260071 coverity: move initilization of count variable
Make code more understandble for Coverity, so it sees connection
between 'extents' and 'count' and in fact code is more readable.
2017-06-27 12:16:33 +02:00
Zdenek Kabelac
4e4067dd94 libdm: fix initialization of head for reused structure
Dmeventd reuses  'dm_task' struct for some STATUS operation, but due to
missing reinitization of dm_task target list, it has caused misprocesing
of recieved events as the parsed target has been simply added to the
list of existing status and cause multiple actions being called for
single event.
2017-06-26 19:45:11 +02:00
Zdenek Kabelac
feed61f3fa libdm: use rounded float for percent print
Use new added  dm_percent_to_round_float to enhance print
of percentage values.
2017-06-24 17:44:42 +02:00
Zdenek Kabelac
2ef8da61eb libdm: implement dm_percent_to_round_float
Add function to adjust printing of percent values in better way.
Rounding here is going along following rules:

0% & 100% are always clearly reported with  .0 decimal points.

Values slightly above 0% we make sure a nearest bigger
non zero value with given precission is printed
(i.e. 0.01  for  %.2f  will be shown)

For values closely approaching 100% we again detect and adjust value
that is less then 100 when printed.
(i.e. 99.99  for %.2f will be shown).

For other values we are leaving them with standard rounding mechanism
since we care mainly about corner values 0 & 100 which need to be
printed precisely.
2017-06-24 17:44:40 +02:00
Zdenek Kabelac
529dcaf6a3 libdm: workarounds reported raid status info
Current existing kernels reports status sometimes in weird form.

Instead of showing what is the exact progress, we need to estimate
this in-sync state from several surrounding states.

Main reason here is to never report 100% sync state for a raid device
which will be undergoing i.e. recovery.
2017-06-16 17:04:00 +02:00