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

512 Commits

Author SHA1 Message Date
Zdenek Kabelac
01fb91c615 Valgrind updates
Avoid locking sum testing with valgrind compilation.

Make memory unaccessible in the valgrind for dm_pool_abadon_object.

Valgrind hinting should not be needed in _free_chunk for dm_free.
2011-03-30 12:43:32 +00:00
Zdenek Kabelac
73b01e9660 Simplify pool debug initialization
zalloc pool structure and skip zeroing members.
2011-03-30 12:16:15 +00:00
Zdenek Kabelac
b8bdd780d8 Fix 2 signess warnings reported by gcc
Replace int with unsigned counter.
Replace snprintf with dm_snprintf.
2011-03-30 12:14:36 +00:00
Zdenek Kabelac
6460d5a405 Add attribute printf
gcc suggested to add these attributes to instrumentat
printf arguments. Adding it for internal functions as well.
2011-03-29 21:53:46 +00:00
Zdenek Kabelac
f77736cab5 Remove double braces
Clang gives notice about possible confusion as commonly double bracces are
used when some assignment is done inside them.
2011-03-29 20:19:03 +00:00
Alasdair Kergon
76c13d16eb Use hard-coded /dev/mapper/control details for 2.6.36+ kernels and simplify
associated code.  (Some obscure configurations that happened to work before
are no longer supported.)
2011-03-25 23:50:35 +00:00
Alasdair Kergon
129526b826 Fix last checkin - added error message text wrong. 2011-03-20 02:00:52 +00:00
Zdenek Kabelac
681858db90 Improve debug stack trace
dm_check_version reports log_error() - so use return_NULL.
2011-03-18 13:21:02 +00:00
Milan Broz
52a5cd31c4 Mitigate some warnings if running as non-root user.
LVM doesn't behave correctly if running as non-root user,
there is warning when it detects it.

Despite this, it produces many error messages, saying nothing.
See https://bugzilla.redhat.com/show_bug.cgi?id=620571

This patch fixes two things:
1) Removes eror message from device_is_usable() which has no
information value anyway (real warning is printed inside it).

2) it fixes device-mapper initialization, if we support
core dm module autoload and device node is present, it should
fail early and not try recreate existing and correct node.
(non-root == permission denied here)

N.B. In future code should support user roles, some more
drastic checks in code are probably contraproductive now.
2011-03-18 12:17:57 +00:00
Zdenek Kabelac
36b9ec636d Keep pool name also for pool-fast
It's cheap to keep this name - and it is useful for 'non pool debug code'
compilation.
2011-03-10 14:49:01 +00:00
Zdenek Kabelac
8b6ce11d02 Use void pointer instead of char for binary key
dm_hash binary functions takes void* key - so there is no need to cast
pointers to char* (also the hash key does not have trailing '\0').

This is slight API change, but presents no change for the API user side
it just allows to write code easier as the casting could be removed.
2011-03-10 12:48:40 +00:00
Zdenek Kabelac
e134ce7c3c Fix reading byte from char params[-1] position
When the ->params string is empty - memory access is made on the byte
before allocated buffer (catched by valgrind) - in the case it would
constain 0x20 - it would even overwrite this buffer.
So fix by checking len > 0 before doing such access.
Also slightly optimise this loop from repeated strlen call.
2011-03-08 22:43:19 +00:00
Milan Broz
688be28794 Move secure flag warning to verbose level.
This feature is not yet upstream and becuase cryptsetup in next version
uses this flag, it will cause a lot of noise on old kernels.
2011-03-05 21:17:19 +00:00
Peter Rajnoha
eb36643cb7 Lower severity of selabel_lookup and matchpathcon failure to log_debug. 2011-03-03 13:05:40 +00:00
Zdenek Kabelac
85a1ca1c4b Indent case part properly 2011-03-02 08:41:55 +00:00
Zdenek Kabelac
63284817c7 Add missing return 2011-03-02 08:40:28 +00:00
Alasdair Kergon
d0e3d474d1 Fix dm_udev_wait calls in dmsetup to occur before readahead display not after.
Include an implicit dm_task_update_nodes() within dm_udev_wait().
2011-03-02 00:29:57 +00:00
Alasdair Kergon
8f91593c25 Fix _create_and_load_v4 not to lose the --addnodeoncreate setting (1.02.62). 2011-03-01 23:27:06 +00:00
Zdenek Kabelac
9afafc7a3c Fix void pointer arithmetic warning in pool debug code 2011-02-28 19:54:30 +00:00
Mike Snitzer
7d9c99e8e7 Add inactive table query support for kernel driver >= 4.11.6 (RHEL 5.7). 2011-02-21 16:26:23 +00:00
Alasdair Kergon
a8d13f9499 Handle decimal digits with --units instead of ignoring them silently.
Fix remaining warnings and compile with -Wpointer-arith.
2011-02-18 23:09:55 +00:00
Zdenek Kabelac
eb4188830e Add debug message for open_count failure
Report  open_count problem as debug.

Function using _node_has_closed_parents decides whether
it's error or could be ignored.
2011-02-18 16:13:56 +00:00
Zdenek Kabelac
2f321615f2 API change - support more const arg
As dm_report_field_string() doesn't modify content of data pointer,
it can be marked as const.

It's slight API change - but doesn't require any change on the user side
and supports wider range of arguments without const casting.
(i.e. we may use as paramater const lv struct this way:  &lv->name)
2011-02-18 14:38:47 +00:00
Zdenek Kabelac
d5e9ddaaee Revert DEBUG_MEM cleanup commit
As functions compiled within this define are apparently stil part of the public API,
(though lvm2 code is never using them unless this define is used for compilation),
keep functions available in the code for now -> revert.
2011-02-08 15:52:00 +00:00
Alasdair Kergon
6c7b95f281 pre-release 2011-02-04 22:07:43 +00:00
Alasdair Kergon
fe7a45c331 Warn if secure data flag requested but not supported by kernel. 2011-02-04 21:26:33 +00:00
Zdenek Kabelac
880507498a Add --addnodeonresume, --addnodeoncreate
Add new function dm_task_set_add_node() to select between 2 types
of node creation in device directory.

DM_ADD_NODE_ON_RESUME is now default and ensures node is created on
resume. Old original behavior is accessible with DM_ADD_NODE_ON_CREATE.
In this case node would be created during dmsetup create --notable.

For the user 2 new options for dmsetup create are added:
[{--addnodeonresume | --addnodeoncreate }]

Properly working node creation on resume is needed for proper operation
stacking and ability to correctly check in which state the device should
after whole udev transation.
2011-02-04 19:33:53 +00:00
Zdenek Kabelac
f5f6dcbc62 Fix operation node stacking for consecutive dm ops
With the ability to stack many operations in one udev transaction -
in same cases we are adding and removing same device at the same time
(i.e. deactivate followed by activate).

This leads to a problem of checking stacked operations:
i.e. remove /dev/node1 followed by create /dev/node1

If the node creation is handled with udev - there is a problem as
stacked operation gives warning about existing node1 and will try to
remove it - while next operation needs to recreate it.

Current code removes all previous stacked operation if the fs op is
FS_DEL - patch adds similar behavior for FS_ADD - it will try to
remove any 'delete' operation if udev is in use.

For FS_RENAME operation it seems to be more complex. But as we
are always stacking FS_READ_AHEAD after FS_ADD operation -
should be safe to remove all previous operation on the node
when udev is running.

Code does same checking for stacking libdm and liblvm operations.

As a very simple optimization counters were added for each stacked ops
type to avoid unneeded list scans if some operation does not exists in
the list.

Enable skipping of fs_unlock() (udev sync) if only DEL operations are staked.
as we do not use lv_info for already deleted nodes.
2011-02-04 19:14:39 +00:00
Milan Broz
2b29daaaa6 Suport DM_SECURE_DATA_FLAG.
It will be user for cryptsetup to ensure buffers are properly
wiped when sending sensitive data (key).
2011-02-04 16:08:11 +00:00
Peter Rajnoha
1e88b1125a Add a debug message when uevent is not generated and we call udev_complete internally. 2011-01-31 11:54:55 +00:00
Zdenek Kabelac
bc49609c6f Compile code for memory debuging only with DEBUG_MEM
When it's not in use - do not compile this code.
Improves lcov code coverage results for this code a lot :)
2011-01-28 16:01:32 +00:00
Zdenek Kabelac
a5c6acf22a Skip NULL check before dm_free
dm_free checks for NULL itself.
2011-01-28 10:16:04 +00:00
Zdenek Kabelac
4b79aeb0ea Initialize pool object for each row
Fix assert abort of dmsetup (when compiled with pool debug)
dmsetup splitname --nameprefixes --noheadings --rows gvg-a2

Move pool begin in the inner loop - otherwise it would using
already 'ended' pool object.
2011-01-25 21:51:30 +00:00
Alasdair Kergon
a8de276520 Replace fs_unlock by sync_local_dev_names to notify local clvmd. (2.02.80)
Introduce sync_local_dev_names and CLVMD_CMD_SYNC_NAMES to issue fs_unlock.
2011-01-12 20:42:50 +00:00
Zdenek Kabelac
b3c6850b1c Define DM_COOKIE_AUTO_CREATE
TODO: Use it also for already written code.
2011-01-10 13:42:31 +00:00
Peter Rajnoha
8d5391f1c3 Export DM_CONTROL_NODE_UMASK and use it while creating /dev/mapper/control. 2011-01-04 14:43:53 +00:00
Zdenek Kabelac
9e06310aab Use const char* for offset calculation
As 'const' types are also passed to macro dm_list_struct_base -
keep offset calculation with const char pointers.
Fixes several gcc constness warnings.
2010-12-20 13:39:12 +00:00
Zdenek Kabelac
303923fbf1 Use const char* const * for dm_regex_create()
Change API interface to accept even completely const array patterns.

This should present no change for libdm users and allows to pass
pattern arrays without cast to const char **.
2010-12-20 13:23:11 +00:00
Peter Rajnoha
7e0db38528 HAVE_SELINUX again 2010-12-13 12:44:09 +00:00
Peter Rajnoha
cb12e3fc9f #ifdef HAVE_SELINUX and #ifdef HAVE_SELINUX_LABEL_H 2010-12-13 12:30:04 +00:00
Peter Rajnoha
c0920fbf2a Missing #elif HAVE_SELINUX 2010-12-13 12:18:38 +00:00
Peter Rajnoha
7dfce0e467 Add new dm_prepare_selinux_context fn to libdevmapper and use it throughout.
Detect existence of new SELinux selabel interface during configure.
Use new dm_prepare_selinux_context instead of dm_set_selinux_context.

We should set the SELinux context before the actual file system object creation.
The new dm_prepare_selinux_context function sets this using the selabel_lookup
fn in conjuction with the setfscreatecon fn. If selinux/label.h interface
(that should be a part of the selinux library) is not found during configure,
we fallback to the original matchpathcon function instead.
2010-12-13 10:43:56 +00:00
Zdenek Kabelac
8865a4c19e Add stack trace for error path
If dm_task_set_cookie() fails print stack trace, but keep going on.
2010-11-30 22:40:19 +00:00
Zdenek Kabelac
5b8abb1240 Add error path stack traces
Check for errors from dm_task_set_name() and dm_task_run().
Add stack traces for error paths.
Return 0 if some error is found.
2010-11-30 22:32:44 +00:00
Zdenek Kabelac
2e3be4f3fd Optimize lookup table read
Reread lookup table only when needed.
2010-11-29 14:25:13 +00:00
Zdenek Kabelac
4cb0f557d9 Remove dead assignment in _step_matcher
'ns' is not used after this assignment and it is reassigned with the following
code, so dropping this assignment.
2010-11-29 12:43:49 +00:00
Zdenek Kabelac
5f3325fcf1 Remove dead assignment in _mirror_emit_segment_line
Remove unused 'r' assignment.
2010-11-29 12:42:10 +00:00
Zdenek Kabelac
cbecd3cd11 Remove dead assignment in dm_tree_node_add_mirror_target_log
'seg' is never used - remove it.
2010-11-29 11:26:00 +00:00
Zdenek Kabelac
8661190736 Cleanup remove test for NULL
dm_free is testing NULL itself
2010-11-29 10:11:50 +00:00
Zdenek Kabelac
f46de65682 Do not call dm_task_destroy with NULL 2010-11-23 18:29:06 +00:00