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

712 Commits

Author SHA1 Message Date
Zdenek Kabelac
f857b3064f Cleanup backtraces
Make sure stacks are at the right places when something goes wrong here.
2011-10-20 10:38:04 +00:00
Milan Broz
ad2432dc68 Fix alignment warning in bitcount calculation for raid segment. 2011-10-17 13:15:35 +00:00
Zdenek Kabelac
0395dd2250 Use pool for dm_tree allocation
Using the same pool allocation strategy as we use for vg,
so dm_tree structure is part of the pool itself.
2011-10-14 13:34:19 +00:00
Zdenek Kabelac
9a8f192a38 Update error path tracing for _resume_node
dm_task_create & dm_task_set_name produces it's own log_error
Add missing stacks for dm_task_set_cookie, dm_task_run,
dm_task_get_info.
2011-10-03 18:28:25 +00:00
Zdenek Kabelac
4251236efc Add supporting function for thinp
New dm_tree_node_add_thin_pool_target() and  dm_tree_node_add_thin_target()
This API is highly experimental and unstable for now.
2011-09-29 08:53:48 +00:00
Zdenek Kabelac
f45106b726 Use NULL for pointers 2011-09-25 19:38:59 +00:00
Zdenek Kabelac
766d22825b Update dmsetup man page
While dmsetup command properly shows all dmsetup resume supported options,
man page missed to document it.
2011-09-23 09:51:37 +00:00
Zdenek Kabelac
598c92ff5c Build all man pages
When running plain 'make' in man dir - do also those for device-mapper target.
2011-09-23 09:48:21 +00:00
Peter Rajnoha
787200efd6 Add dm_tree_retry_remove to use retry logic for device removal in a dm_tree. 2011-09-22 17:36:50 +00:00
Peter Rajnoha
14254bd0be Add dm_device_has_holders fn to to check use of the device by another device.
Add dm_device_has_mounted_fs fn to check mounted filesystem on a device.

This requires sysfs directory to be correctly set via dm_set_sysfs_dir
(/sys by default). If sysfs dir is not used or it's set incorrectly,
dm_device_has_{holders,mounted_fs} will return 0!
2011-09-22 17:23:35 +00:00
Peter Rajnoha
07e237d6f4 Add dm_set_sysfs_dir to libdevmapper to set sysfs location.
Add dm_sysfs_dir to libdevmapper to retrieve sysfs location thas is set.
2011-09-22 17:17:07 +00:00
Peter Rajnoha
047e4cd2f5 Add --retry option for dmsetup remove to retry removal if not successful. 2011-09-22 17:12:28 +00:00
Peter Rajnoha
355b2224b2 Add dm_task_retry_remove fn to use retry logic for device removal.
This call ensures that the dm device removal is retried several
times before failing.
2011-09-22 17:09:48 +00:00
Peter Rajnoha
8171b93700 Retry DM_DEVICE_REMOVE ioctl if device is busy.
This is a workaround for long-lasting problem with using the WATCH udev
rule. When trying to remove a DM device, this one can still be opened
while processing the event in parallel (generated based on the WATCH
udev rule).

Let's use this until we have a proper solution.
2011-09-13 15:13:41 +00:00
Zdenek Kabelac
beecb1e160 Remove unused passed parameters 2011-09-07 08:37:48 +00:00
Alasdair Kergon
fe8f5dbeb7 Comments, FIXMEs, name changes. 2011-09-01 21:04:14 +00:00
Zdenek Kabelac
2d70959c86 Mark unreleased memory pools as internal error 2011-09-01 10:19:01 +00:00
Alasdair Kergon
2df01a9d3f post-release 2011-08-19 19:42:39 +00:00
Alasdair Kergon
499091c061 pre-release 2011-08-19 16:31:00 +00:00
Alasdair Kergon
415c0690af restrict dm_tree_node_add_null_area 2011-08-19 16:26:02 +00:00
Alasdair Kergon
4536abf08a post-release 2011-08-12 02:34:08 +00:00
Alasdair Kergon
34ae78d203 pre-release 2011-08-12 01:34:11 +00:00
Zdenek Kabelac
5bedb7a5e0 Fix memleak of geometry buffer
Looks like this function is not used too often - thus leak was discovered
by static analyzis (Coverity).
2011-08-11 20:49:33 +00:00
Zdenek Kabelac
ed463ccf51 Add memory pool locking functions
Adding debuging functionality to lock and unlock memory pool.

2 ways to debug code:
crc - is default checksum/hash of the locked pool.
      It gets slower when the pool is larger - so the check is only
      made when VG is finaly released and it has been used more then
      once.Thus the result is rather informative.

mprotect - quite fast all the time - but requires more memory and
           currently it is using posix_memalign() - this could be
	   later modified to use dm_malloc() and align internally.
           Tool segfaults when locked memory is modified and core
	   could be examined for faulty code section (backtrace).

Only fast memory pools could use mprotect for now -
so such debug builds cannot be combined with DEBUG_POOL.
2011-08-11 17:29:04 +00:00
Milan Broz
2836eabc9e Remove dev name prefix from dmsetup line output if major and minor is used. 2011-08-11 17:06:24 +00:00
Alasdair Kergon
2061c0ec24 Remove support for the original dm ioctl interface version 1.
Leave the basic support for multiple versions in case we have a new version
in future.
2011-08-09 17:56:47 +00:00
Zdenek Kabelac
b23975ee28 Add missing check for allocation failure
Static analyzer discovered missing check.
2011-08-04 17:56:11 +00:00
Peter Rajnoha
3c614ef1c1 Add support for systemd file descriptor handover in dmeventd.
Systemd preloads file descriptors for us and passes them in for
newly spawned daemon when using on-demand fifo (or socket)
based activation.

This patch adds checks for file descriptors preloaded by
systemd and uses them instead of opening the FIFOs again
to properly support on-demand FIFO-based activation.

(We'll change FIFOs to sockets soon - but still this
part of the code will stay almost the same.)
2011-07-28 13:06:50 +00:00
Peter Rajnoha
7d47d109b9 Add support for new oom killer adjustment interface (oom_score_adj).
The filename to adjust the oom score was changed in 2.6.36.
We should use oom_score_adj instead of oom_adj (which is still
there under /proc, but it's scheduled for removal in August 2012).

New oom_score_adj uses a range from -1000 (OOM_SCORE_ADJ_MIN,
disable oom killing) to 1000 (OOM_SCORE_ADJ_MAX).
2011-07-28 13:03:37 +00:00
Peter Rajnoha
5071d9eceb Add systemd unit files for dmeventd. 2011-07-28 12:54:28 +00:00
Alasdair Kergon
d3efe22fa2 Fix read-only identical table reload supression. 2011-07-24 23:59:03 +00:00
Alasdair Kergon
11853cd95a post-release 2011-07-08 19:57:32 +00:00
Alasdair Kergon
9f65343fa6 pre-release 2011-07-08 19:19:44 +00:00
Alasdair Kergon
3151e0995a Remove dev name prefix from dmsetup line output if exactly one dev requested. 2011-07-08 17:08:19 +00:00
Alasdair Kergon
ba45e1fdee Report internal error if suspending a device using an already-suspended dev.
This catches the recent pvmove problem trapping I/O between layers.
2011-07-02 01:17:09 +00:00
Alasdair Kergon
2243718fae Add framework for validation of ioctls. Doesn't do any checks yet.
dmsetup --checks
libdevmapper: dm_task_enable_checks()
lvm.conf: activation/checks=1
2011-07-01 14:09:19 +00:00
Alasdair Kergon
f96cf55d36 Add age filter to dmsetup udevcomplete_all to minimise concurrency problems. 2011-06-29 21:56:46 +00:00
Alasdair Kergon
0437bccc3c Move udev_only logic inside stacked node op code.
(We still need to treat add+readhead+del as a no-op.)
Rename udev_fallback to verify_udev_operations.
Rename --udevfallback to --verifyudev
2011-06-27 21:43:58 +00:00
Alasdair Kergon
f4249251cb Return immediately dm_lib_exit() if called more than once.
(Avoiding calling it twice would involve some untangling.)
Decrement the new suspended_counter if removing a suspended device.
2011-06-24 19:33:41 +00:00
Peter Rajnoha
b1db4dd13e Disable udev fallback and add --udevfallback option to dmsetup. 2011-06-17 14:55:51 +00:00
Alasdair Kergon
1840aa0974 Maintain a count of the number of suspended devices in libdevmapper
and use this for the LVM critical section logic.  Also report an error if
code tries to load a table while any device is known to be in the
suspended state.
(If the variety of problems these changes are showing up can't be fixed
before the next release, the error messages can be reduced to debug
level.)
2011-06-13 03:32:45 +00:00
Alasdair Kergon
83e797bc52 Fix 'pvs -o pv_all' to include label fields. (Also removed recursion.) 2011-06-12 19:49:40 +00:00
Alasdair Kergon
df390f1799 Major pvmove fix to issue ioctls in the correct order when multiple LVs
are affected by the move.  (Currently it's possible for I/O to become
trapped between suspended devices amongst other problems.

The current fix was selected so as to minimise the testing surface.  I
hope eventually to replace it with a cleaner one that extends the
deptree code.

Some lvconvert scenarios still suffer from related problems.
2011-06-11 00:03:06 +00:00
Milan Broz
fa380602cf Accept kernel version 3 (3.0-rc and similar). 2011-06-09 15:07:40 +00:00
Alasdair Kergon
20ffd91347 test 2011-04-29 19:05:11 +00:00
Alasdair Kergon
e93eb11d92 test 2011-04-29 19:01:59 +00:00
Alasdair Kergon
213e1a2113 test 2011-04-29 18:57:09 +00:00
Alasdair Kergon
a086d55ba8 post-release 2011-04-29 17:05:20 +00:00
Alasdair Kergon
c0a1ec237f pre-release 2011-04-29 16:12:21 +00:00
Alasdair Kergon
919ab56b6d pre-release clean-ups 2011-04-29 00:21:13 +00:00
Peter Rajnoha
71b29ddcc4 Require libudev >= 143 when compiling with udev support.
Old versions of libudev < 143 were experimental and unstable. Require recent
and stable versions only (version 143 is old enough anyway).
2011-04-22 11:56:41 +00:00
Zdenek Kabelac
197b5e6dc7 Word alignment for strings
Align strdup char* allocation just on 2 bytes.
It looks like wasting space to align strings on 8 bytes.
(Could be even 1byte - but for hashing it might eventually get better
perfomance - but probably hardly measurable).

TODO: check on various architectures it's not making any problems.
2011-03-30 12:57:03 +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
36089b2236 Const warning fixes
With recent update of dm_report_field_string() API call to accept
completely const objects - we no longer need loose constness here
and keep it forwarding.
2011-03-29 21:49:18 +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
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
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
Peter Rajnoha
eb36643cb7 Lower severity of selabel_lookup and matchpathcon failure to log_debug. 2011-03-03 13:05:40 +00:00
Alasdair Kergon
11bffd7d25 Accept multiple mapped device names on many dmsetup command lines. 2011-03-02 02:44:56 +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
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
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
Alasdair Kergon
7ad6a7d911 post-release 2011-02-09 12:11:21 +00:00
Alasdair Kergon
db76c0d09e pre-release 2011-02-09 12:04:39 +00:00
Alasdair Kergon
0ea1e5c109 post-release 2011-02-04 22:46:18 +00:00
Alasdair Kergon
a74fe591c9 pre-release 2011-02-04 22:35:29 +00:00
Alasdair Kergon
6c7b95f281 pre-release 2011-02-04 22:07:43 +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
7fa7632dc7 Set DM_UDEV_DISABLE_OTHER_RULES_FLAG for suspended DM devices in udev rules.
This is to avoid any scanning and processing of DM devices while they are in
suspended state (e.g. a rename while the device is suspended - a CHANGE event
is generated!). Otherwise, any scanning in the rules could end up with locking
the calling process until the device is resumed and so we don't receive a
notification about udev rules completion until then (and that effectively
locks out the process awaiting the notification!).

However, we still keep 'disk' and any 'subsystem' related udev rules running.
We trust these and these should check themselves whether a device is suspended
or not, not trying to run any scanning if it is.
2011-01-28 11:41:51 +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
0825c244dd post-release 2011-01-10 14:51:33 +00:00
Alasdair Kergon
606d085835 pre-release 2011-01-10 14:28:17 +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
Alasdair Kergon
c37f0c7d7c post-release 2010-12-21 21:08:51 +00:00
Alasdair Kergon
ad18cacfa9 pre-release 2010-12-21 01:08:29 +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
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
Alasdair Kergon
122ba73eaf post-release 2010-12-06 22:13:10 +00:00
Alasdair Kergon
9d03132282 pre-release 2010-12-06 17:57:14 +00:00
Alasdair Kergon
ea7c621b0a Fix debug logging of derived flag LCK_CACHE in clvmd. 2010-12-06 17:37:09 +00:00
Alasdair Kergon
1415afcdba Fix memory leak when VG allocation policy in metadata is invalid.
Ignore unrecognised allocation policy found in metadata instead of aborting.
Fix another missing vg_release() in _vg_read_by_vgid.
2010-11-29 18:35:37 +00:00
Alasdair Kergon
663886b954 post-release 2010-11-22 18:37:56 +00:00
Alasdair Kergon
2151f044e8 pre-release 2010-11-22 14:25:22 +00:00
Alasdair Kergon
ef3d8e18d3 Fix _output_field crash from field_id free with DEBUG_MEM. (Phillip Susi) 2010-11-19 13:17:27 +00:00
Alasdair Kergon
ae1a833000 post-release 2010-11-09 02:58:06 +00:00
Alasdair Kergon
962e678174 pre-release 2010-11-08 19:37:40 +00:00
Peter Rajnoha
a83c7816e4 Allocate buffer for reporting functions dynamically to support long outputs.
Fix memory leak of field_id in _output_field function.

There's been a patch added recently to use dynamic allocation for metadata
tags buffer to remove the 4k limit (for writing metadata out). However, when
using reporting commands like vgs and lvs, we still need to fix libdm reporting
functions themselves to support such long outputs. So the buffer used in those
reporting functions is dynamic now.

The patch also includes a fix for field_id memory leak which was found in
the _output_field function.
2010-11-01 13:31:55 +00:00
Alasdair Kergon
779c11004a post-release 2010-10-25 16:38:20 +00:00
Alasdair Kergon
2aa06d73ca pre-release 2010-10-25 13:54:29 +00:00
Zdenek Kabelac
a636bccaba Use const pointer for return value of dm_basename
Fix return pointer to const as it is created from passed input const pointer.
2010-10-25 13:13:53 +00:00
Alasdair Kergon
57a8279442 Add --setuuid to dmsetup rename.
Add dm_task_set_newuuid to set uuid of mapped device post-creation. (pjones)
2010-10-15 01:10:27 +00:00
Alasdair Kergon
44a31a9c2f Speed up CRC32 calculations by using a larger lookup table.
Use -DDEBUG_CRC32 to revert to old function and check new one gives same result.
2010-09-27 19:09:34 +00:00
Alasdair Kergon
87368c35b9 pre-release 2010-09-24 16:24:57 +00:00
Alasdair Kergon
a171bb6e85 Track recursive filter iteration to avoid refreshing while in use. (2.02.56) 2010-09-22 01:36:13 +00:00
Alasdair Kergon
7dbfd06d99 post-release 2010-08-19 22:33:14 +00:00
Alasdair Kergon
523fad915b pre-release 2010-08-18 20:57:10 +00:00
Peter Rajnoha
88b97d8f30 Fix dm-mod autoloading logic to not assume control node is set correctly.
We can't rely on the fact that udev should prepare the node with right major
and minor number to trigger the module autoloading. We have to take into
account that the node could be missing or it could exist with improper
major and minor number assigned (e.g. from previous kernel versions in
an environment with static nodes and without udev). Make any corrections
if needed!
2010-08-18 13:11:56 +00:00
Alasdair Kergon
d1e8046f56 Various small cleanups and fixes related to monitoring. 2010-08-16 22:54:35 +00:00
Alasdair Kergon
470c18847d Remove superfluous NULL pointer tests before dm_free from dmeventd. 2010-08-16 18:19:46 +00:00
Peter Rajnoha
f069a14ca7 WHATS_NEW_DM 2010-08-16 11:22:08 +00:00
Peter Rajnoha
a6a66e7c83 Fix udev rules to support udev database content generated by older rules.
This can happen with older rules (without support for synthesized events)
that are still part of initrd while using new udev rules in the system itself.

The consequence was that new udev rules incorrectly assumed that not having
DM_UDEV_PRIMARY_SOURCE_FLAG set always means the uevent is synthesized and
inappropriate (device is still not properly activated) and so it should be
ignored. However, initrd is not updated automatically while updating the
libdevmapper/udev rules in the system and so we end up with the rules not
detecting and setting crucial parts in the initrd environment and the rules
in the system that rely on the information that should have been stored in
udev db (which is incorrect in this configuration, of course).

The overall consequence is that the update of libdevmapper/lvm2 without
regenerating the initrd could end up with a boot failure! Ignoring the event
means removing any existing symlinks in /dev!

To fix this, increase udev rules version to make a difference. So from now on,
mark rules without proper support for synthesized events as
DM_UDEV_RULES_VSN="1" and 2 (or higher) if that support is included.
2010-08-12 13:41:18 +00:00
Peter Rajnoha
b045f4fe9a Reinstate detection of inappropriate uevent with DISK_RO set and suppress it.
We still need to detect this one! We're not so strict with CHANGE events as
with the ADD events while applying filters in the rules so this one would
pass and it would process the rules prematurely (because it appears *before*
the actual CHANGE event used when resuming a DM device while setting read-only
state at the same time).
2010-08-12 13:07:08 +00:00
Peter Rajnoha
dc39d2a66e WHATS_NEW_DM 2010-08-11 13:12:31 +00:00
Peter Rajnoha
97df4e4675 Use built-in rules for device aliases: block/ < dm- < disk/ < mapper/ < other. 2010-08-03 13:39:27 +00:00
Zdenek Kabelac
0a89c2307e Wait for node creation before displaying debug info in dmsetup.
Readahead check needs to see created node - so wait till udev gets in sync.
2010-08-03 13:04:32 +00:00
Zdenek Kabelac
c8675c4933 Fix return status 0 for "dmsetup info -c -o help".
Solution returns success for _report_init when help is passed,
and caller needs to check for _report existance.
2010-08-03 12:56:00 +00:00
Peter Rajnoha
d87427446c Add check for kernel semaphore support and disable udev_sync if not available.
udev_sync feature requires semaphores (part of System V IPC) to be configured
in kernel (CONFIG_SYSVIPC). Check whether it is supported and if not, give
a warning message and disable udev synchronisation code automatically to
avoid any further error states and associated problems.

One should use the kernel with System V IPC support enabled or libdevmapper
with udev_sync feature disabled.
2010-08-03 07:56:03 +00:00
Alasdair Kergon
e9438785b1 post-release 2010-07-28 21:58:08 +00:00
Alasdair Kergon
cdb675c02b day+1 2010-07-28 11:49:42 +00:00
Alasdair Kergon
e12a5243c9 . 2010-07-28 10:44:29 +00:00
Alasdair Kergon
111c120e00 pre-release 2010-07-27 22:52:19 +00:00
Alasdair Kergon
09ba95b266 . 2010-07-27 21:57:37 +00:00
Fabio M. Di Nitto
8c4e8a185a Add dm_create_lockfile to libdm to handle pidfiles for all daemons.
Switch dmeventd to use dm_create_lockfile and drop duplicate code.
Allow clvmd pidfile to be configurable.
Switch cmirrord and clvmd to use dm_create_lockfile.
2010-07-13 13:51:01 +00:00
Zdenek Kabelac
14db805f14 Revert previous commit as it would return also for incorrect syntax. 2010-07-08 14:29:26 +00:00
Zdenek Kabelac
da038ccb4b Update for dmsetup 2010-07-08 13:35:55 +00:00
Peter Rajnoha
02adb0cd9d Use "nowatch" udev rule for known inappropriate devices.
For now, this is just a precaution. Normally, all the other (non-dm) rules
should check DM_UDEV_DISABLE_OTHER_RULES_FLAG and therefore avoid setting
any inotify watches as well. But let's make sure.

Support for final assignment of the "nowatch" rule (the use of ":=") will
appear in next udev release, v160. This should also work in previous udev
versions but the setting won't be sealed so any further OPTIONS="watch" will
always prevail there.

We may want to add more specific "nowatch" rules later if needed.
2010-07-07 11:22:46 +00:00
Alasdair Kergon
6aecef2c04 post-release 2010-07-07 02:37:28 +00:00
Alasdair Kergon
9a54c1a79b pre-release 2010-07-06 16:49:38 +00:00
Alasdair Kergon
8c54f1a949 Fix dmlosetup snprintf %llu compiler warning. 2010-07-05 22:56:31 +00:00
Alasdair Kergon
44cd0f4780 Add parentheses to some libdevmapper.h macro arguments. 2010-07-05 22:22:43 +00:00
Alasdair Kergon
db3c1ac1c8 Add printf format attributes to yes_no_prompt & dm_{sn,as}printf and fix a calle 2010-07-02 21:16:50 +00:00
Alasdair Kergon
22a8592301 Move dmeventd man page from install_lvm2 to install_device-mapper. (1.02.50) 2010-07-01 10:57:03 +00:00
Alasdair Kergon
c304818d39 post-release 2010-06-30 14:50:32 +00:00
Alasdair Kergon
4e11851795 pre-release 2010-06-30 14:04:15 +00:00
Alasdair Kergon
1ed3c7cc63 post-release 2010-06-23 19:35:11 +00:00
Alasdair Kergon
d2cd8375ff pre-release 2010-06-23 17:48:41 +00:00
Alasdair Kergon
85691c0afb In some C++ standards, typeof is not reserved. 2010-06-23 17:03:14 +00:00
Peter Rajnoha
acc70bce86 Fix udev rules to handle spurious events properly.
We can use DM_UDEV_PRIMARY_SOURCE_FLAG to identify the spurious events
and use it as an indication that the device has already been activated before
(and hence we can find this property in udev database).

WARNING: This change requires udev startup script to preserve udev database
from initrd. All the information stored there during activation of devices
is important for the initial "udevadm trigger --action=add" call that is
used in udev startup script. If not done this way, udev startup script needs
to define DM_UDEV_PRIMARY_SOURCE_FLAG=1 property for any ADD events it uses.
2010-06-23 17:00:32 +00:00
Milan Broz
c9c7d25c35 Remove C++ private keyword from headers.
Add extern C definition for libdevmapper, lvm2app and lvm2cmd.
2010-06-16 13:01:25 +00:00
Alasdair Kergon
a5e1488414 post-release 2010-06-07 10:25:43 +00:00
Alasdair Kergon
1a526b3c9d pre-release 2010-06-04 17:23:49 +00:00
Peter Rajnoha
ee83186ecc Add support for dm-mod module autoload.
A kernel patch is on its way for 2.6.35 adding support for dm-mod module
autoload. Udev v155 and higher is able to read static node information given
in modules.devname (extracted by depmod before) and will create such nodes
at its start. The first access to such node will load the module automatically
(directly in kernel) before the actual read/write operation is processed.
2010-06-01 16:08:13 +00:00
Mike Snitzer
1a3b58545b Add --type parameter description to the lvcreate man page. 2010-05-28 03:50:15 +00:00
Peter Rajnoha
c0ea4c94a1 Use expected union semun for arguments in selected semaphore operations.
This is standard and expected use. It also prevents errors related with
misalignment of the arguments for semaphore operations on some architectures.
2010-05-27 15:02:56 +00:00
Alasdair Kergon
ead120ebee post-release 2010-05-20 23:21:53 +00:00
Alasdair Kergon
0506f410ea pre-release 2010-05-20 22:27:26 +00:00
Alasdair Kergon
350232370f post-release 2010-05-17 20:18:13 +00:00
Alasdair Kergon
a988efda46 pre-release 2010-05-17 18:39:01 +00:00
Alasdair Kergon
bdadde2f7a Use -d to control level of messages sent to syslog by dmeventd.
Change -d to -f to run dmeventd in foreground.
(mornfall)
2010-05-14 14:56:39 +00:00
Milan Broz
b1d188894e Do not print encryption key in message debug output. 2010-05-13 13:31:30 +00:00
Alasdair Kergon
bde29bc4fa post-release 2010-04-30 15:48:38 +00:00
Alasdair Kergon
3ceb76089c pre-release 2010-04-30 14:49:42 +00:00
Alasdair Kergon
9783e5ae7b . 2010-04-29 01:48:19 +00:00
Peter Rajnoha
942d6ef29f Add support for new IMPORT{db} udev rule.
This rule appeared in udev v152 and it helps us to support spurious events
where we didn't have any flags set (events originated in udevadm trigger
or the watch rule). These flags are important to direct the rule application.
Now, with the help of this rule, we can regenerate old udev db content.
To implement this correctly, we need to flag all proper DM udev events with
DM_UDEV_PRIMARY_SOURCE_FLAG. That happens automatically for all ioctls
generating events originated in libdevmapper.
2010-04-28 13:37:36 +00:00
Peter Rajnoha
257848229d Also include udev libs in libdevmapper.pc when udev_sync is enabled. 2010-04-26 09:05:50 +00:00
Alasdair Kergon
e07803f976 Cache bitset locations to speed up _calc_states. (kabi) 2010-04-22 20:35:24 +00:00
Alasdair Kergon
b2bd4e2d8d Add a regex optimisation pass for shared character prefixes. 2010-04-20 22:31:22 +00:00
Alasdair Kergon
49ada7a2c3 Add dm_bitset_equal to libdevmapper. 2010-04-20 13:58:22 +00:00
Alasdair Kergon
2b707b6806 Add dm_bit_and. (ejt) 2010-04-19 21:23:01 +00:00
Alasdair Kergon
175b8684a0 fix last commit 2010-04-19 21:10:20 +00:00
Alasdair Kergon
72ab7270e0 Speed up dm_bit_get_next with ffs(). 2010-04-19 17:17:55 +00:00
Alasdair Kergon
adfdf8bb1e post-release 2010-04-14 21:47:48 +00:00
Alasdair Kergon
2e79014bbe pre-release 2010-04-14 17:50:49 +00:00
Alasdair Kergon
f55021f487 Fix incorrect removal of symlinks after LV deactivation fails. 2010-04-07 20:04:41 +00:00
Milan Broz
fb3bcb9f74 Wipe dm-ioctl parameters in memory after use. 2010-04-07 15:57:20 +00:00
Peter Rajnoha
91345610f8 Strictly require libudev if udev_sync is used.
This prevents some confusion when libudev was not found so udev_sync was disabled
automatically. Configure was successful though giving only a tiny warning.

Also, if "dmsetup udevcreatecookie" is used, never return 0x000000 as a result if
udev is not running and keep the output blank.
2010-03-23 14:43:18 +00:00
Peter Rajnoha
ac3691f70e Add support for ioctl's DM_UEVENT_GENERATED_FLAG.
We need to know whether we should wait for any uevent or not when
using udev_sync. A kernel patch was posted recently that changed the
way uevents are sent on dm device resume - it is sent only if the
device has been suspended before. There's also a new DM_UEVENT_GENERATED_FLAG
in the ioctl to notify userspace whether the event was generated.

If the uevent was not generated (e.g. the situation where the device is
*not* suspended and we call a resume), we just call dm_udev_complete
explicitly from within libdevmapper itself to prevent infinite waiting
while trying to synchronise with udev processing.
2010-03-23 14:38:37 +00:00
Alasdair Kergon
75b8a10e4a post-release 2010-03-09 14:01:47 +00:00
Alasdair Kergon
ba8fd82a9c pre-release 2010-03-09 13:13:07 +00:00
Milan Broz
c948101ccd Add --help dmsetup option as the synonym for help command. 2010-03-08 16:05:07 +00:00
Milan Broz
ab5933d4ac Add --showkeys parameter description into dmsetup man page.
Also fix minor warning (-c is parameter) in man page formatting.
2010-03-08 16:04:32 +00:00
Alasdair Kergon
9e7b0091bb post-release 2010-02-16 00:27:01 +00:00
Alasdair Kergon
c97cbf8c08 pre-release 2010-02-15 23:53:15 +00:00
Peter Rajnoha
f0e073fcdc Several changes in dmsetup and libdevmapper:
- add DM_UDEV_DISABLE_LIBRARY_FALLBACK udev flag to rely on udev only

 - export dm_udev_create_cookie function to create new cookies on demand

 - add --udevcookie, udevcreatecookie and udevreleasecookie for dmsetup
   (to support "udev transactions" where one cookie value can be used for
    several dmsetup calls)

 - don't use DM_UDEV_DISABLE_CHECKING env. var. anymore and set the state
   automatically (based on udev and libdevmapper dev path comparison)
2010-02-15 16:21:33 +00:00
Alasdair Kergon
46cabd8a2e Remove pointless versioned symlinks to dmeventd plugin libraries. 2010-02-02 14:09:17 +00:00
Alasdair Kergon
30265f6ad2 Fix dmeventd snapshot plugin build dependency. 2010-02-02 14:03:50 +00:00
Alasdair Kergon
635983c449 pre-release 2010-01-23 02:14:30 +00:00
Alasdair Kergon
59dd86581a post-release 2010-01-22 01:09:09 +00:00
Alasdair Kergon
1014cf876a pre-release 2010-01-21 23:55:17 +00:00
Jonathan Earl Brassow
ed2bef01e5 udpate WHATS_NEW* 2010-01-15 16:18:14 +00:00
Alasdair Kergon
80b664f571 post-release 2010-01-14 14:42:06 +00:00
Alasdair Kergon
73c47fae21 pre-release 2010-01-14 14:02:34 +00:00
Mike Snitzer
5eb7dfddeb update WHATS_NEW and WHATS_NEW_DM to include snapshot-merge changes 2010-01-13 21:48:39 +00:00
Alasdair Kergon
726355fef0 post-release 2010-01-12 14:46:59 +00:00
Alasdair Kergon
b6baf165c7 pre-release 2010-01-12 14:39:07 +00:00
Alasdair Kergon
f3ac7d1b82 Revert so-called "redundant" log until after next release. 2010-01-12 14:00:51 +00:00
Alasdair Kergon
3f5cc86aa4 . 2010-01-11 21:44:36 +00:00
Alasdair Kergon
12b646541b Add missing items to WHATS_NEW files.
Continue to use 'field' to describe reporting elements.
2010-01-11 21:28:04 +00:00
Peter Rajnoha
4df024c40c Define {DM, LVM}_UDEV_DISABLE_CHECKING=1 env. variables for tests.
We need to disable udev checking for our tests since they use their own
location for device nodes and symlinks.
2010-01-11 15:48:49 +00:00
Peter Rajnoha
0366ff6fb0 Enable udev_sync and udev_rules in lvm.conf by default while running tests. 2010-01-11 15:43:19 +00:00
Peter Rajnoha
d2b43c4b34 Add support to disable udev checking: DM_UDEV_DISABLE_CHECKING=1 env. variable.
Sometimes it is really needed to switch off udev checking and the warnings we show when
we detect that udev has not done its job right - the messages like "Udev should have done
this and that. Falling back to direct node creation/removal. " etc.

This would be especially handy while setting DM_DEV_DIR env var that could be set to a
different location than standard /dev (udev can't create nodes/symlinks out of that one
directory that is configured into udevd). The exact same situation happens while we're
running our tests.
2010-01-11 15:36:24 +00:00
Peter Rajnoha
cda69e17ef Add activation/udev_rules config option in lvm.conf.
Add dm_tree_add_dev_with_udev_flags to provide wider support for udev flags.
2010-01-07 19:54:21 +00:00
Peter Rajnoha
4998a0041f Add --noudevrules option for dmsetup to disable /dev node management by udev. 2010-01-07 19:45:12 +00:00
Zdenek Kabelac
2c352d7b1e Show all fields for 'dmsetup info -c -o all'. 2010-01-07 14:30:47 +00:00
Mike Snitzer
255fc32087 update WHATS_NEW and WHATS_NEW_DM with previous commits' changes 2010-01-05 21:32:59 +00:00
Zdenek Kabelac
685be1dc7a Fix unlocking vg in some pvresize and toollib error paths. 2009-12-11 13:11:56 +00:00
Peter Rajnoha
0d408f0c43 Disable udev rules on change event with DISK_RO=1.
There's a new change udev event generated since kernel 2.6.32 that
notifies userspace about a change in read-only attribute for block
devices (with DISK_RO=1 environment variable set).

We need to detect this and disable the rule application so the
meaning of this change event is not interchanged with the regular
change event used while resuming/renaming DM devices.

If there's anybody awaiting this notification in foreign rules,
he can still check for this env var and do the appropriate actions
separately.
2009-12-07 12:03:47 +00:00
Alasdair Kergon
b1bee9cd52 Post-release.
Fingers crossed this one's more successful that the last one!
2009-11-24 19:04:23 +00:00
Alasdair Kergon
2b2c5617d6 pre-release 2009-11-24 18:26:08 +00:00
Alasdair Kergon
b315fcaba6 post-release 2009-11-19 19:53:58 +00:00
Alasdair Kergon
938cf35994 . 2009-11-19 19:42:57 +00:00
Alasdair Kergon
31b2e7ed94 pre-release 2009-11-19 19:00:34 +00:00
Milan Broz
f145ddc9e7 Fix install_device-mapper Makefile target to not build dmeventd plugins. 2009-11-13 12:48:01 +00:00
Peter Rajnoha
584d1fb7d1 Support udev flags even when udev_sync is disabled or not compiled in.
This provides better support for environments where udev rules are installed
but udev_sync is not compiled in (however, using udev_sync is highly
recommended). It also provides consistent and expected functionality even
when '--noudevsync' option is used.

There is still requirement for kernel >= 2.6.31 for the flags to work though
(it uses DM cookies to pass the flags into the kernel and set them in udev
event environment that we can read in udev rules).
2009-11-13 12:43:21 +00:00
Peter Rajnoha
9c20c7af59 Remove 'last_rule' from udev rules.
'last_rule' option has been removed from udev (version >= 147).

From now on, we require foreign rules to check and honor
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG} instead. Foreign
rules should be skipped totally when this flag is set.
2009-11-13 12:33:27 +00:00
Alasdair Kergon
9abf5e70be Add support for querying a device's inactive table.
Currently this data is invisible to userspace.
Requires dm >= 4.16 (likely to be in linux 2.6.33).
2009-11-06 00:43:08 +00:00
Alasdair Kergon
a8fb89adaf Tidy some uses of arg_count and introduce arg_is_set. 2009-11-03 15:50:42 +00:00
Alasdair Kergon
cf177380b5 post-release 2009-10-27 01:13:20 +00:00
Alasdair Kergon
178dcb065e . 2009-10-27 00:52:45 +00:00
Alasdair Kergon
ebc9a27ad5 pre-release 2009-10-26 21:56:23 +00:00
Peter Rajnoha
772f7d4188 Use udev flags in the rules and cleanup the rules:
- remove default permissions set in 95-dm-notify.rules (and add a hint in 12-dm-permissions.rules to set it by the user directly)
 - add multipath DM_ACTION=="PATH_FAILED" filter
 - remove unnecessary filters in the headers of the rules (we can simply use DM_UDEV_RULES_VSN instead)
 - fix symlink priorities in /dev/disk/ (snapshot volumes have low priority for FS UUID symlinks so it will not overwrite symlinks for the origin)
2009-10-22 13:11:33 +00:00
Peter Rajnoha
5f1f31f942 Add udev flags support in libdevmapper and provide 'dmsetup udevflags' command to decode them. 2009-10-22 12:55:47 +00:00
Fabio M. Di Nitto
2cec0e4562 Merge Debian patch 05 debian: keep libdm-abi consistent.
This appears to be the only user visible feature that can change libdm ABI
at build time.

Thanks to Bastian Blank for the patch.
2009-10-12 04:06:42 +00:00
Alasdair Kergon
ec0b34a9ca post-release 2009-09-26 00:42:47 +00:00
Alasdair Kergon
536f0e0881 pre-release 2009-09-25 18:30:27 +00:00
Alasdair Kergon
9bc9dacc1e pre-release 2009-09-25 18:30:26 +00:00
Alasdair Kergon
1178220354 Handle any path supplied to dm_task_set_name() by looking up in /dev/mapper. 2009-09-25 18:08:04 +00:00
Alasdair Kergon
786e32bfa0 post-release 2009-09-15 13:54:28 +00:00
Alasdair Kergon
6087b1581d dm release cleanup 2009-09-15 11:41:38 +00:00
Alasdair Kergon
4b7033d3f1 pre-release 2009-09-15 10:57:16 +00:00
Peter Rajnoha
9a9026c29f Add y|--yes option for dmsetup to provide a default 'YES' answer to questions. 2009-09-11 15:53:57 +00:00
Peter Rajnoha
3649fa9e41 Fix Makefile to take into account dmsetup's reconfiguration. 2009-09-11 15:52:22 +00:00
Dave Wysochanski
5f1c57d008 Restore umask when device node creation fails.
Author: Florian Zumbiehl <florz@florz.de>
Acked-by: Dave Wysochanski <dwysocha@redhat.com>
2009-09-03 21:51:26 +00:00
Jonathan Earl Brassow
03c65b7ade mirror table generating code: Properly handle 'block_on_errors' and 'cluster' features
The device-mapper mirror CTR table has been changing over time.  This has
now been corrected to handle the old and new methods for invoking the
'block_on_errors' and 'cluster' features.  (The code that does this was
accidentally committed in the previous check-in.  This check-in finishes
the job.)
2009-08-13 19:36:04 +00:00
Alasdair Kergon
adfb0e348d post-release 2009-08-06 19:32:26 +00:00
Alasdair Kergon
79e5594fe5 pre-release 2009-08-06 16:30:34 +00:00
Alasdair Kergon
bd90c6b2c2 Set cookies in activation code and wait for udev to complete processing. 2009-07-31 18:30:31 +00:00
Alasdair Kergon
28ae3fe772 post-release 2009-07-28 20:47:40 +00:00
Alasdair Kergon
d49aa42eec pre-release 2009-07-28 17:22:07 +00:00
Alasdair Kergon
26d7762bda post-release 2009-07-15 15:38:41 +00:00
Alasdair Kergon
eac6599c5e New LOG_MESG macro to fix file/line number logging for memory leaks after
LOG_LINENO macro was added.
2009-07-15 14:18:38 +00:00
Alasdair Kergon
9386a68477 pre-release 2009-07-15 13:20:06 +00:00
Alasdair Kergon
a9cb6969b0 Add dm_log_with_errno and dm_log_with_errno_init, deprecating the old
Change plog to use dm_log_with_errno unless deprecated dm_log_init was used.
Rename plog macro to LOG_LINE and use in dm_dump_memory_debug.
2009-07-10 09:59:37 +00:00
Alasdair Kergon
503f62808e . 2009-07-07 17:19:38 +00:00
Alasdair Kergon
4b2cae463e Add device number to more log messages during activation. 2009-07-03 12:45:55 +00:00
Alasdair Kergon
4397ad387e post-release 2009-07-01 09:31:46 +00:00
Alasdair Kergon
e50c61d8fa update date 2009-06-30 18:41:47 +00:00
Alasdair Kergon
476d463348 pre-release tidy up 2009-06-30 18:39:31 +00:00
Alasdair Kergon
4f9012704c pre-release 2009-06-26 10:57:30 +00:00
Milan Broz
6391d03f54 Fix backward compatibility for major:minor query.
Is an application uses query and set major:minor
to device, it should not fallback to default major by default.

Add new function whoich allows that (and use it in lvm2).
2009-06-17 20:55:24 +00:00
Milan Broz
01fb9ca9a0 Do not fork daemon when dmeventd cannot be found. 2009-06-15 12:29:41 +00:00
Milan Broz
12ca060e9f Support crypt segment in libdevmapper tree.
- it can support multiple segments, but note that
to work properly, correct IV (initialization vector)
offset parameter must be set properly.

Because most usage of IV start offset is when we join
several crypto segments together (so iv_offset is the segment
start offset), DM_CRYPT_IV_DEFAULT is defined to simplify
the process.

Function accepts the string in cipher agrument (already
including chainmode and iv type; chainmode and iv parameters are NULL
in this case) or user can provide split parameters which will
join into dm-crypt cipher specification "cipher-chainmode-iv".

All these parameters must be supplied in correct dm-crypt format.
2009-06-09 16:10:20 +00:00
Alasdair Kergon
6f4a82b3f4 test commit 2009-06-04 13:23:10 +00:00
Alasdair Kergon
f91635a1bd test commit 2009-06-04 13:16:49 +00:00
Alasdair Kergon
9c155e14a2 test commit 2009-06-04 13:11:58 +00:00
Alasdair Kergon
896fc66e32 Add splitname. 2009-06-03 20:44:42 +00:00
Alasdair Kergon
9767eb448d Add subsystem, vg_name, lv_name, lv_layer fields to dmsetup reports. 2009-06-03 18:35:39 +00:00
Alasdair Kergon
c9ee46569c Make mempool optional in dm_split_lvm_name() 2009-06-03 11:40:23 +00:00
Alasdair Kergon
49c27642d4 post-release 2009-05-22 15:23:10 +00:00
Alasdair Kergon
25a2e7b80e Pre-release cleanups. 2009-05-21 03:04:52 +00:00
Alasdair Kergon
58e57a05c0 Missing entries. 2009-05-20 22:44:10 +00:00
Peter Rajnoha
2dce31a16a Fix segfault when using -U, -G and -M options in dmsetup. 2009-04-24 11:30:49 +00:00
Alasdair Kergon
ab5be5f065 post-release 2009-03-03 18:25:05 +00:00
Alasdair Kergon
3361724033 pre-release 2009-03-03 13:03:03 +00:00
Alasdair Kergon
0f817d38f7 If kernel supports only one dm major number, use in place of any supplied.
No longer require kernel and metadata major numbers to match.
2009-02-12 20:42:07 +00:00