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

705 Commits

Author SHA1 Message Date
Peter Rajnoha
fea8abe56a systemd: use RemoveOnStop for dm-event.socket and lvm2-lvmetad.socket
Systemd version 214 introduced new "RemoveOnStop" option for socket
units to remove the socket/FIFO when the particular unit is stopped.

Also https://bugzilla.redhat.com/show_bug.cgi?id=802748.
2014-06-13 15:45:25 +02:00
Zdenek Kabelac
93c2614e56 man: document DM_DEFAULT_NAME_MANGLING_MODE
Document DM_DEFAULT_NAME_MANGLING_MODE environmental variable.
(its default setting is build time configurable)
2014-06-05 17:47:21 +02:00
Zdenek Kabelac
3cb2658fb7 dmsetup: add warning
Warn when --udevcookie/DM_UDEV_COOKIE is used with 'dmsetup remove --force'.

When command is doing multiple ioctl operations on a single device,
it may invoke udev activity, that is colliding with further ioctl commands.
The result of such operation becomes unpredictable.
Use of --retry could partially help...
2014-05-26 22:56:30 +02:00
Peter Rajnoha
7c86131233 report: export DM_REPORT_FIELD_RESERVED_NAME_{HELP,HELP_ALT} and show help on '<lvm_command> -O help'
Share DM_REPORT_FIELD_RESERVED_NAME_{HELP,HELP_ALT} between libdm and
any libdm user to handle reserved field names, in this case the virtual
field name to show help instead of failing on unrecognized field.
The libdm user also needs to check the field name so it can fire
proper code in this case (cleanup, exit etc.).
2014-05-15 10:58:14 +02:00
Peter Rajnoha
4360fdf89c libdevmapper: add dm_units_to_factor for size unit parsing
Actually moving the existing code from LVM to libdm for reuse.
2014-04-28 10:25:43 +02:00
Zdenek Kabelac
0b6d6bfb77 thin: dmeventd plugins support more minors
Kernel supports upto 1M (20bit) minors.
TODO: convert to hash to reduce memory requirements
2014-04-18 16:38:47 +02:00
Alasdair G Kergon
6320c3b905 post-release 2014-04-10 17:13:27 +01:00
Alasdair G Kergon
2043f8c729 pre-release 2014-04-10 16:28:28 +01:00
Zdenek Kabelac
6d3d2d5e3d libdm: check for _build_dev_path failure
Enhance internal function _build_dev_path for failure
if buffer would be too small.
Use memcpy instead printf for a single string.
2014-04-08 11:00:13 +02:00
Zdenek Kabelac
2c28197630 libdm: check for size when opening control node
Use dm_snprintf() to detect fail if open_control node would
not have fit into buffer.
2014-04-08 11:00:13 +02:00
Zdenek Kabelac
583fbdba84 libdm: fail if buffer for version is to short
Return fail error code, if supplied buffer is too small.
2014-04-08 11:00:12 +02:00
Zdenek Kabelac
f0003d3be5 libdm: always dm_lib_init mangling mode
If there ever would be a second call to dm_lib_init()
and envvar would be improperly set, some last set value
would be used while it should reset to default mangling mode.
2014-04-08 11:00:12 +02:00
Zdenek Kabelac
bd2500e62e libdm: track implicit dependecies
When the node enters dtree with implicit dependency, it
automatically has udev flags from parent node
and could not be changed later when the node has been
entered again via i.e lvm's preload tracking.

Resolve this by tracking whether the node has been
created by implicit dependency tracking or has been
entered explicitely. Implicit node could be later
upgraded by an explicit _add_dev() with proper udev_flags.

For implicit devices add special udev flags to avoid
any scan and udev rule processing if we resume such device.

Patch allows easier removing of orphan nodes.
2014-04-08 11:00:12 +02:00
Zdenek Kabelac
7a6c0e2425 dmeventd: wakeup timeout thread earlier
When the last entry in the timeout queue is unregistered,
wakeup sleeping condition, so the thread is deleted earlier.
So the thread resource is release earlier.

Also when monitored with tools like valgrind this eliminites reported
leak.
2014-03-10 12:24:07 +01:00
Zdenek Kabelac
2a9b62c7f9 dmeventd: remember number of log disablings
Individual events are handled through separate threads,
so once we have more then a single thread in this eventwait
sleeping, we got race on the dm_log setting, since
if one event is timeout out on alarm, while another is still waiting,
then dm log has been restored to NULL and the next sigalarm
has been reported as error.

Fix it by introducing counter which is protected via mutex,
and only when the last event is released, logging is restored.

TODO: libdm seems to have some static vars which may audit
for this type of use.
2014-03-10 12:22:47 +01:00
Zdenek Kabelac
203affffc7 libdm: enhance thin transaction_id validation
Reuse _node_send_messages for just checking
for valid transaction_id with preload.

This allows earlier detection of incosistent thin pool.

Code does the same thing, except for sending messages.
2014-02-24 21:06:31 +01:00
Zdenek Kabelac
c7b7cb60e4 libdm: hardening transaction_id validation
Improve testing of transation_id to not allow other difference
then either kernel TID is equal or is lower by oned and there
are queued messages for transaction.

Mark messages as submitted if the transaction_id is already matching.

Do not try to deactivate node on failure here and leave it on
proper error path of the caller.
2014-02-24 21:04:50 +01:00
Zdenek Kabelac
1911c61639 libdm: call preload callback only when success
Do not call node's preload callback, if there is
any failure during preload.
2014-02-24 21:01:13 +01:00
Zdenek Kabelac
8346f106b4 libdm: internal is_selinux_enabled wrapper
There is no point to call this external function more then once.
(As suggested by selinux developer)
2014-02-24 20:58:41 +01:00
Zdenek Kabelac
7ec8e691c4 libdm: use 64bit type for raid index
Used properly signed 64bit constant for shifting.
2014-02-15 11:36:37 +01:00
Peter Rajnoha
290e58b0b6 WHATS_NEW: latest commits 2014-02-06 18:19:24 +01:00
Peter Rajnoha
34e6d59bba WHATS_NEW: be more specific about cryptsetup version that sets the udev flags 2014-01-22 15:48:40 +01:00
Peter Rajnoha
36a09cf463 udev: drop cryptsetup specific rules from 10-dm.rules
These udev flags are set directly in cryptsetup for some
time now so there's no need to have it in our rules then.

See also:
https://code.google.com/p/cryptsetup/source/detail?spec=svn4f14b43a3d3e7310465005c401f37e19f8cb85e6&r=4f14b43a3d3e7310465005c401f37e19f8cb85e6
2014-01-22 15:18:57 +01:00
Alasdair G Kergon
899a079c8f post-release 2014-01-20 19:41:30 +00:00
Alasdair G Kergon
aa21e79991 pre-release 2014-01-20 19:22:56 +00:00
Zdenek Kabelac
5f90353636 libdm: WHATSNEW 2014-01-17 11:02:29 +01:00
Zdenek Kabelac
7c5feaed3b dmeventd: prevent busy looping on CPU
Use usleep when looping on DM_WAIT_RETRY.
2013-12-12 13:40:55 +01:00
Zdenek Kabelac
b87c148499 dmeventd: change locking code
Ensure global lock is being hold when working with thread->.
2013-12-12 13:38:55 +01:00
Zdenek Kabelac
4fc97980b6 dmeventd: drop taking timeout mutex
Taking _timeout_mutex is not needed when registering and unregistering.
Global mutex is already being hold for this case.
2013-12-12 13:32:49 +01:00
Alasdair G Kergon
b6d3fd62fc libdm: prevent empty config file section names
Change c353949597 to use existing
_dup_string_tok().  alloca() doesn't fail cleanly (and needs
replacing.)
2013-12-05 01:09:03 +00:00
Zdenek Kabelac
b3679590df dmeventd: simplify error path
Use common 'bad:' label for exit error path where
fifo is closed before exit().
2013-11-28 12:45:02 +01:00
Zdenek Kabelac
6fa95d17ee dmeventd: move format text to printf
Instead of passing argument with format string to printf(),
put the string as arg directly.
Also move there remains args to make the code shorter.
2013-11-22 21:00:51 +01:00
Zdenek Kabelac
eb4b03768f libdm: catch wrongly reported values
Add internal error warning when string value is used
as sort value for numerical field.

Using log_warn since the function itself does not return error,
so we do not confuse log_error() checker.
2013-11-15 12:38:37 +01:00
Alasdair G Kergon
322e7b3060 post-release 2013-11-13 14:11:11 +00:00
Alasdair G Kergon
77a1efeb8e release 2.02.104
87 files changed, 1207 insertions(+), 294 deletions(-)
2013-11-13 14:02:34 +00:00
Zdenek Kabelac
52f41baedb dmsetup: report error on stderr
Send error message on stdout, since after _display_info_long()
command return errors.

Patch makes consistent behavior for command:

dmsetup info -c non-existing-dev
&
dmsetup info non-existing-dev

Now both commands report error on stderr when they return error status
for non-existing device.
2013-11-01 13:05:03 +01:00
Mikulas Patocka
ed30145f4a libdm: fix races with udev
On modern systems udev manages nodes in /dev/mapper directory.
It creates, deletes and renames the nodes according to the
state of the kernel driver.

When the dmsetup is compiled without udev support (--enable-udev_sync)
and runs on the system with running udevd it tries to manage nodes in
/dev/mapper too, so it can race with udev.
dmsetup checks if the node was created/deleted/renamed with the stat
syscall, and skips the operation if it was. However, if udev
creates/deletes/renames the node after the stat syscall and before the
mknod/unlink/rename syscall, dmsetup reports an error.

Since in the system everything happened as expected, skip reporting
error for such case.

These races can be easily provoked by inserting sleep at appropriate
places.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
2013-10-17 11:57:33 +02:00
Zdenek Kabelac
3ac7f927e1 libdm: do not show holders missing error
On older system this may not be present, so skip this error message.
2013-10-17 11:55:21 +02:00
mpatocka@redhat.com
efd1dc6bd3 headers: use __linux__ instead of linux
This file may be included by other programs, so it should be compliant
with the C standard.

* use __linux__ instead of linux - __linux__ is always defined, linux is
  not defined when gcc runs in standard-compliant mode (with -std=c89 or
  -std=c99) because the C standard doesn't allow polluting namespace
  with arbitrary defines.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
2013-10-17 11:54:44 +02:00
Alasdair G Kergon
761b524519 post-release 2013-10-04 14:41:32 +01:00
Alasdair G Kergon
04d9a52684 release 2.02.103
52 files changed, 598 insertions(+), 264 deletions(-)
2013-10-04 14:32:23 +01:00
Peter Rajnoha
23ce3352d7 libdm: export DM_UDEV_SUBSYSTEM_FLAG names for subystem udev flags
Just like we have symbolic names assigned to general DM udev flags
(DM_UDEV_* flags), we have the same for any subsystem flags now
(DM_SUBSYSTEM_UDEV_FLAG*), making it easier to use.
2013-09-30 11:19:09 +02:00
Peter Rajnoha
ec9b3dcecc udev: make subsystem rules responsible for importing subsystem flags
Each subsystem rule that needs to import any of DM_SUBSYSTEM_UDEV_FLAG*
flags is responsible for doing so. This simply moves control of these
flags from general 10-dm.rules to any subsystem rule using these flags
as each subsystem knows better how to handle these flags on its own.
2013-09-30 11:11:18 +02:00
Alasdair G Kergon
229e0752f1 post-release 2013-09-23 15:55:11 +01:00
Alasdair G Kergon
c8057aec36 release 2.02.102
18 files changed, 137 insertions(+), 203 deletions(-)
2013-09-23 15:43:37 +01:00
Alasdair G Kergon
bd75844024 release 2.02.101
112 files changed, 4131 insertions(+), 1312 deletions(-)
2013-09-20 13:56:29 +01:00
Alasdair G Kergon
68f841fcda dmsetup: Detect invalid sector supplied to message.
atoll doesn't check for errors, so invalid sector numbers were silently
accepted in the "dmsetup message" command.

(Mikulas)
2013-09-18 01:24:19 +01:00
Alasdair G Kergon
a0ca2c11ee libdm: avoid leak if dm_task_set_* fn called again
(Mikulas)
2013-09-18 01:13:06 +01:00
Zdenek Kabelac
350cf7968c libdm: new name can't be empty
Do not allow passing '' names to kernel.

This test was missing also in kernel, so it has allowed
to create device with '' name.  This then confused dmsetup tool,
since such name is unexpected and unsupported. To remove
such name from table, user has to use -j -m to specify which device
should be removed.

This patch fixes the posibility to run this operation:

dmsetup rename existingdev ''

after this operation commands like  'dmsetup table' are failing.
This patch prohibits to use such name.
2013-08-31 21:40:28 +02:00
Alasdair G Kergon
d8b781e8ab dmsetup: display any message output from kernel
Recent kernels allow messages to respond with a string.
Add dm_task_get_message_response() to libdevmapper to perform some
basic sanity checks and return this.
Have 'dmsetup message' display any response.

DM statistics will make extensive use of this.

(From Mikulas.)
2013-08-16 15:25:39 +01:00