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

1660 Commits

Author SHA1 Message Date
David Teigland
a4c56a3bc3 lvmlockd: sscanf buffer size warnings 2021-01-08 12:13:05 -06:00
Zdenek Kabelac
bd272e3bce lvmcmdlib: lvm2_init_threaded
cmd context has 'threaded' value that used be set
by clvmd - and allowed proper memory locking management.
Reuse same bit for dmeventd.

Since dmeventd is using 300KiB stack per thread,
we will ignore any user settings for allocation/reserved_stack
until some better solution is find.
This avoids crashing of dmevend when user changes this value
and because in most cases lvm2 should work ok with 64K stack
size, this change should not cause any problems.
2020-10-20 22:22:52 +02:00
Zdenek Kabelac
740d5bf6cd cov: check sscanf result 2020-09-12 13:24:03 +02:00
Zdenek Kabelac
dbb19f6ace cleanup: matching declaration order
Cosmetic
2020-09-01 17:57:50 +02:00
Zdenek Kabelac
fd96f1014b gcc: zero-sized array to fexlible array C99
Switch remaining zero sized struct to flexible arrays to be C99
complient.

These simple rules should apply:

- The incomplete array type must be the last element within the structure.
- There cannot be an array of structures that contain a flexible array member.
- Structures that contain a flexible array member cannot be used as a member of another structure.
- The structure must contain at least one named member in addition to the flexible array member.

Although some of the code pieces should be still improved.
2020-09-01 17:57:50 +02:00
Zdenek Kabelac
19e9c88faf gcc: do not use return with void function
Follow C norm and do not use 'return' in void function to call other
functions.
2020-08-28 21:43:03 +02:00
Vojtech Trefny
d4d060acd5 lvmdbusd: Bump LVM DBus API version
So users can check for writecache support.
2020-08-06 13:54:45 -05:00
Vojtech Trefny
8f1068c02d lvmdbusd: Add support for LVM writecache 2020-08-06 13:54:34 -05:00
David Teigland
4667c4b35b lvmdbusd: recognize lv attr letter g for integrity 2020-07-15 10:07:28 -05:00
Zdenek Kabelac
deb5160181 list: use container_of
Reuse macro
2020-05-20 16:01:20 +02:00
David Teigland
5263551a2d lvmlockd: replace lock adopt info source
The lock adopt feature was disabled since it had used
lvmetad as a source of info.  This replaces the lvmetad
info with a local file and enables the adopt feature again
(enabled with lvmlockd --adopt 1).
2020-05-04 13:35:03 -05:00
Zdenek Kabelac
212cf8efbd dmeventd: enhance time waiting loop
dmeventd is 'scanning' statuses in loop (most usually in 10sec
intervals) - and meanwhile it sleeps within:
pthread_cond_timedwait()

However this function call tends to wakeup sometimes a short amount of
time sooner - and our code still believe the 'right time' has not yet
arrived and basically for a moment 'busy-looped' on calling this
function - so for systems with 'clock_gettime()' present we obtain
time and we go 10ms to the future second - this avoids unneeded
repeated invocation of our time scheduling loop.

TODO: monitoring during 1 hour 'time-change'...
2020-03-05 17:38:55 +01:00
Zdenek Kabelac
4791d0f035 dmeventd: nicer error path for reading pipe
When _daemon_read()/_client_read() fails during the read,
ensure memory allocated withing function is also release here
(so caller does not need to care). Also improve code readbility a bit
a for same functionality use more similar code.
2020-02-04 17:22:06 +01:00
Zdenek Kabelac
91d16fc049 lvmlockctl: use inline initilizers
clang: ensure r_name[] is in all possible paths defined.
2020-02-04 17:22:06 +01:00
Zdenek Kabelac
d01f27f411 lvmlockctl: ensure result value is always defined
Ensure passed pointer gets predefined value (instead of random stack
value).
2020-02-04 17:22:06 +01:00
Zdenek Kabelac
555d6d4e62 cov: check error code from mutex init 2020-02-04 17:22:06 +01:00
Vojtech Trefny
c496ba6505 lvmdbusd: Add function to convert LV into a VDO pool 2020-01-09 13:07:55 -06:00
Vojtech Trefny
c3ef41f620 lvmdbusd: Add VDO enable/disable compress & dedup
Added methods to vdo pool interface to allow enabling and
disabling of VDO:
 * Compression
 * Deduplication
2020-01-09 13:07:47 -06:00
Zdenek Kabelac
dccc50f6f6 revert "dmeventd: vdo plugin link lvm library"
This reverts commit cbabdf2fca.
and add extra comment why this code may look unused, but
in runtime is necessary.
2019-11-15 12:37:41 +01:00
Zdenek Kabelac
9ee3af7efc cov: more checks for failing syscalls 2019-11-14 18:06:42 +01:00
Zdenek Kabelac
cbabdf2fca dmeventd: vdo plugin link lvm library
Since we fixed linking of proper version of 'libdevmapper' with
linking lvm2 plugin correctly - we already have correct function
available linked with internal lvm library.
So drop unneeded include of parsing function.
2019-11-14 18:06:42 +01:00
Tony Asleson
1bbf977577 lvmdbusd: Debug msg. improvements. 2019-10-30 10:38:40 -05:00
Tony Asleson
4dcb36aba4 lvmdbusd: Fix model inconsistency when LV loses interface
When a LV loses an interface it ends up getting removed and recreated.
This happens after the VGs have been processed and updated.  Thus when
this happens we need to re-check the VGs.
2019-10-30 10:38:40 -05:00
Tony Asleson
f56b21ae2c lvmdbusd: Bug fix for activate/deactivate
Prevent the daemon from stalling when it gets stuck on a y/n prompt.
2019-10-30 10:38:40 -05:00
Tony Asleson
5971da2c72 lvmdbusd: VDO Pool LV representation
VDO pool LVs are represented by a new dbus interface VgVdo.  Currently
the interface only has additional VDO properties, but when the
ability to support additional LV creation is added we can add a method
to the interface.
2019-10-30 10:38:40 -05:00
Tony Asleson
df2292020b lvmdbusd: Prevent running --nojson with VDO support 2019-10-30 10:38:40 -05:00
Tony Asleson
6204955347 lvmdbusd: Add VgVdo class & assoc. interface
When VDO support is available we will create VG object instances
which will allow the API user to create VDO pool LVs.
2019-10-30 10:38:40 -05:00
Tony Asleson
9d2ef05c5d lvmdbusd: Add cfg.vdo_support
Will be used to add vdo interfaces on demand.
2019-10-30 10:38:40 -05:00
Tony Asleson
bafe5d15b1 lvmdbusd: Add check for reserved name '_vdata'
Added for vdo support.
2019-10-30 10:38:40 -05:00
Tony Asleson
b0286fa127 lvmdbusd: Add d and D to type map for VolumeType
These were added for vdo integration.
2019-10-30 10:38:40 -05:00
Tony Asleson
1839702cb4 lvmdbusd: Remove use of tmp variables
We can use tuple expansion from the command handler functions
directly.
2019-10-30 10:38:40 -05:00
Tony Asleson
df38eb49ab lvmdbusd: Remove duplicate error handling code
vg, lv, pv code had the same function for handling command execution.
Move to utility function and abstract the difference.
2019-10-30 10:38:40 -05:00
Zdenek Kabelac
ebc9274be0 cmirrord: deamon links libdm
Correct included header files for this outdated tool since
it's linked with libdm, it need to use header files from this dir.
2019-10-04 17:31:55 +02:00
Heinz Mauelshagen
6f355c6736 dmeventd: avoid bail out preventing repair in raid plugin but keep message
Followup patch mentioned in previous commit fe577f84cbf6bd7be76b457c9d54d0e54e57f93d.

Problem:
  even though dead raid component devices are detected, the
  raid plugin is bailing out thus preventing a repair attempt.

Rational:
  in case of component device errors, the MD resynchronization
  thread runs in parallel with the thrown event being processed
  by the raid plugin.  The plugin retrieves the raid device status
  but that still reflects insync regions as 0 (when it should
  already be total regions) because the MD thread didn't update it yet.

Solution:
  Remove the insync regions check but keep the informal message
  "waiting for resynchronization"  and let lvconvert carry out its
  pre-repair checks and optionally carry out a repair attempt.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1751887
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1560739
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1468590
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1654860
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1729303
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1741016
2019-09-20 17:53:20 +02:00
Heinz Mauelshagen
6fc46af8ec Revert "dmeventd: avoid bail out preventing repair in raid plugin"
This reverts commit ad560a286a.

The reverted patch also removed the warning which we realized we need
to keep as valuable process information (see related bugzilla below).

In a followup patch, we'll keep the message and avoid bailing out thus
always allowing lvconvert to try repairing if 'allocate' fault policy set.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1751887
2019-09-20 17:52:37 +02:00
David Teigland
6e1cf248d4 Revert "lvmlockd: use commonly used define NOTIFYDBUS_SUPPORT"
This reverts commit 71af650760.

It disabled sd_notify() which broke 'systemctl start lvmlockd'.
2019-09-16 11:44:42 -05:00
Vojtech Trefny
32a8865a27 Fix converting dbus.UInt types to string
With Python 3.8 converting these directly to string using str()
no longer works, we need to convert these to integer first.

On Python 3.8:

>>> str(dbus.Int64(1))
'dbus.Int64(1)'

On Python 3.7 (and older):
>>> str(dbus.UInt64(1))
'1'

This is probably related to removing __str__ function from method
from int (dbus.UInt is subclass of int) which happened in 3.8, see
https://docs.python.org/3.8/whatsnew/3.8.html

Signed-off-by: Vojtech Trefny <vtrefny@redhat.com>
2019-08-27 09:43:43 -05:00
Heinz Mauelshagen
ad560a286a dmeventd: avoid bail out preventing repair in raid plugin
Problem:
even though dead raid component devices are detected, the
raid plugin is bailing out thus preventing a repair attempt.

Rational:
in case of component device errors, the MD resynchronization
thread runs in parallel with the thrown event being processed
by the raid plugin.  The plugin retrieves the raid device status
but that still reflects insync regions as 0 (when it should
already be total regions) because the MD thread didn't update it yet.

Solution:
Remove the insync regions check and let lvconvert carry out its
pre-repair checks and optionally carry out a repair attempt.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1560739
Related:  https://bugzilla.redhat.com/show_bug.cgi?id=1468590
Related:  https://bugzilla.redhat.com/show_bug.cgi?id=1654860
Related:  https://bugzilla.redhat.com/show_bug.cgi?id=1729303
Related:  https://bugzilla.redhat.com/show_bug.cgi?id=1741016
2019-08-16 18:07:03 +02:00
David Teigland
81735b46d9 lvmlockd: fix snprintf warnings 2019-05-02 12:59:55 -05:00
Zdenek Kabelac
44cfa55843 libdaemon: use pselect to avoid condition checking race
To avoid tiny race on checking arrival of signal and entering select
(that can latter remain stuck as signal was already delivered) switch
to use  pselect().

If it would needed, we can eventually add extra code for older systems
without pselect(), but there are probably no such ancient systems in
use.
2019-04-16 12:18:34 +02:00
David Teigland
50800e33d5 lvextend: refresh shared LV without using select
Using select instead of normal args did not end
up being a help, so remove it.
2019-04-04 13:19:08 -05:00
David Teigland
27cfeb1d39 lvextend: refresh shared LV with vgname as arg
Update the previous commit to leave the vgname as
an arg instead of moving it into the select option,
(the compound select option rule is confusing the
dlm arg processing.)
2019-03-22 15:01:29 -05:00
David Teigland
86b96ede2a lvextend: refresh shared LV using select option
Using --select 'lvname=LV && vgname=VG' avoids the problem
of the lvchange exit code not distinguishing an actual error
result vs the VG or LV not existing.  (This is in case there
is an odd dlm/gfs2 setup where some nodes are running the dlm
but do not have access to the VG.)
2019-03-22 14:35:02 -05:00
David Teigland
85e68a8333 lvextend: refresh shared LV remotely using dlm/corosync
When lvextend extends an LV that is active with a shared
lock, use this as a signal that other hosts may also have
the LV active, with gfs2 mounted, and should have the LV
refreshed to reflect the new size.  Use the libdlmcontrol
run api, which uses dlm_controld/corosync to run an
lvchange --refresh command on other cluster nodes.
2019-03-21 12:38:20 -05:00
David Teigland
d369de8399 lvextend: allow on LV active with a shared lock
Detect when a shared lock exists, don't require the
normal exclusive lock, and allow the lvextend.
2019-03-21 12:38:20 -05:00
David Teigland
9b4926aaff warn about changes to an active lv with shared lock
When an LV is active with a shared lock, a command can be
run to change the LV with --lockopt skiplv (to override the
exclusive lock the command ordinarily requires which is not
compatible with the outstanding shared lock.)

In this case, other commands may have the LV active and may
need to refresh the LV, so print warning stating this.
2019-03-21 12:38:20 -05:00
Zdenek Kabelac
f3c52a515b vdo: enable dmeventd resize 2019-01-21 12:53:16 +01:00
Tony Asleson
0d142f6514 lvmdbusd: Use UUID instead of name for VG rename
Use the UUID to specify the VG to rename instead of the name as this
approach works when we have duplicate VG names.
2019-01-16 16:29:05 -06:00
Tony Asleson
f43b7bb461 lvmdbusd: Handle duplicate VG names
Lvm can at times have duplicate names.  When this happens the daemon will
internally use vg_name:vg_uuid as the name for lookups, but display just
the vg_name externally.  If an API user uses the Manager.LookUpByLvmId and
queries the vg name they will only get returned one result as the API
can only accommodate returning 1.  The one returned is the first instance
found when sorting the volume groups by UUID.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1583510
2019-01-16 16:29:05 -06:00
Tony Asleson
b4c3382990 lvmdbusd: Correct object manager lookups
When we have two logical volumes which switch their names at the
same time we are left with incorrect lookups.  Anytime we find
an entry by doing a lookup by UUID or by name we will ensure
that the lookups are indeed correct.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1642176
2019-01-16 16:29:05 -06:00