1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-27 07:22:49 +03:00
Commit Graph

558 Commits

Author SHA1 Message Date
Peter Rajnoha
09c6b90d76 Use dm_strdup/dm_free instead of strdup/free. 2010-11-01 13:50:51 +00:00
Peter Rajnoha
032a206a83 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
Zdenek Kabelac
abf79b3678 Use static indentifier for internal functions
Functions _align_chunk() and  _new_chunk() are used only internally inside
pool-fast.c - so keep them static inside this object file.
2010-10-26 08:59:05 +00:00
Zdenek Kabelac
fba05d7ba1 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
45f69c7d5f Use a more-generic name for the new kernel flag so list_devices can share it. 2010-10-25 11:44:20 +00:00
Petr Rockai
3cfab15e8a Implement dmeventd -R, allowing dmeventd to be restarted without losing
monitoring state.
2010-10-20 15:12:12 +00:00
Alasdair Kergon
5426e85284 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
a65df0e598 Add dm_zalloc and use it and dm_pool_zalloc throughout. 2010-09-30 21:06:50 +00:00
Dave Wysochanski
350582bc7b Add macro definitions to report infrastructure for character array length.
Rather than hard code the size of the field, use a #define, so we can re-use.
The #define will be needed in a future patch when we extend the reporting
infrastructure to have 'get' and 'set' functions for each field, allowing
lvm2app functions which query any report field.  In order to provide a
generic lookup based on the field id, we will define a type containing this
field id, and thus, we will need to re-use the length of this string as
it's defined inside libdevmapper.h.
2010-08-20 12:44:30 +00:00
Peter Rajnoha
e2bc7a277e 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
Peter Rajnoha
19934a59b2 dm-mod autoloading support is in kernel 2.6.36 actually. 2010-08-16 11:13:18 +00:00
Joe Thornber
40f03c4c2c [REGEX] fix a long standing off-by-one error (found by valgrind-pool) 2010-08-09 10:58:27 +00:00
Joe Thornber
1aaf8d589f [MM] Make valgrind aware of the pool allocators
./configure with --enable-valgrind-pool to enable this.
2010-08-09 10:56:01 +00:00
Joe Thornber
1b87c6ade7 [REGEX] fix bug in matcher that was causing segfault with chars of 0x80 and over. 2010-08-09 10:30:52 +00:00
Joe Thornber
d52e9c7704 [REGEX] Parse regexes that contain chars with value > 0x80
This is a long standing issue.  Fixed by casting a char value to
unsigned char before using it as an index into a bitset.
2010-08-09 10:29:42 +00:00
Zdenek Kabelac
7c1903a0c3 Fix 'void*' arithmetic warnings in dbg_malloc.c.
Use more readable char[idx] access instead of *char+idx access.
2010-08-03 13:24:07 +00:00
Zdenek Kabelac
c8563cac0a Fix 'void*' arithmetic warning in some functions from libdm-iface.c. 2010-08-03 13:16:21 +00:00
Zdenek Kabelac
5cd2cfc203 Use void parameter for function definition. 2010-08-03 13:06:35 +00:00
Zdenek Kabelac
f562bcedef Clean generated files .exported_symbols_generated, example.conf for distclean. 2010-08-03 13:00:45 +00:00
Peter Rajnoha
d33d0b01bf 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
Peter Rajnoha
472bd55757 Revert unsuccessful table load preparation in combined "create, load and resume" scenario.
There was missing "revert" call in _create_and_load_v4 fn while the preparation
for table load ends up with failure in create/load/resume sequence. Otherwise
we could end up with a device being created, but not table-loaded nor resumed.

Even though the table is not loaded and the device is not resumed at this
stage, we still need to synchronize with udev when calling the revert
"remove" ioctl - there's still a remove uevent generated! The "revert"
code does exactly that.
2010-07-28 10:30:28 +00:00
Alasdair Kergon
5f9d855d3e Fix dm_create_lockfile error paths - incorrectly unlinked in-use lockfile.
(Jan Friesse)
2010-07-27 21:56:14 +00:00
Jonathan Earl Brassow
56fe3c6176 It's not enough to check for the kernel module in the case of cluster
mirrors, we must also check that the log daemon (cmirrord) is running.
The log module can be auto-loaded, but the daemon cannot be
"auto-started".  Failing to check for the daemon produces cryptic
messages that customers have a hard time deciphering.  (The system
messages do report that the log daemon is not running, but people
don't seem to find this message easily.)

Here are examples of what is printed when the module is available,
but the log daemon has not been started.

[root@bp-01 LVM2]# lvcreate -m1 -l1 -n lv vg
  Shared cluster mirrors are not available.

[root@bp-01 LVM2]# lvcreate -m1 -l1 -n lv vg -v
    Setting logging type to disk
    Finding volume group "vg"
    Archiving volume group "vg" metadata (seqno 3).
    Creating logical volume lv
    Executing: /sbin/modprobe dm-log-userspace
    Cluster mirror log daemon is not running
  Shared cluster mirrors are not available.
    Creating volume group backup "/etc/lvm/backup/vg" (seqno 4).
2010-07-21 13:40:21 +00:00
Joe Thornber
ad37ab272a [REGEX] calculate dfa states on demand 2010-07-21 12:09:12 +00:00
Joe Thornber
d5feddb0a0 [REGEX] remove the state_queue structure.
Instead we just have a 'next' field in the dfa_state.
2010-07-21 12:02:51 +00:00
Joe Thornber
88ae26178c [REGEX] factor _calc_state() out of _calc_states() 2010-07-21 12:00:53 +00:00
Joe Thornber
e06357084e [REGEX] reduce the number of charset nodes that are produced 2010-07-21 11:58:49 +00:00
Joe Thornber
78f321b32c [REGEX] add a fingerprinting facility to allow test code to compare dfas 2010-07-20 15:32:07 +00:00
Fabio M. Di Nitto
e34342c1f3 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
Alasdair Kergon
2d3164a59f Use __attribute__ consistently throughout. 2010-07-09 15:34:40 +00:00
Zdenek Kabelac
f3953f9a15 Minor optimalization of _test_word.
Skip ffs() if  (test >> bit) is 0.
2010-07-08 12:16:16 +00:00
Alasdair Kergon
431ca070a4 Add parentheses to some libdevmapper.h macro arguments. 2010-07-05 22:22:43 +00:00
Alasdair Kergon
ed2630dce5 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
1c78aa19ff Generate liblvm2app and libdevmapper exported symbols from header files.
Detection is simply by prefix - dm_ or lvm_ - and any additional symbols needed
but not detected this way are placed in .exported_symbols.
2010-06-25 18:17:38 +00:00
Alasdair Kergon
1a6159aca5 In some C++ standards, typeof is not reserved. 2010-06-23 17:03:14 +00:00
Zdenek Kabelac
7d62ac4b34 Fix typo: "INTERNAL ERROR" -> "INTERNAL_ERROR"
Author: Xinwei Hu
        xwhu at novell dot com
2010-06-23 12:54:46 +00:00
Milan Broz
88880e1f89 Use flexible data[] in cmirrord request to prevent abort in runtime size checks. 2010-06-22 13:11:29 +00:00
Peter Rajnoha
44a82780b9 Use early udev synchronisation and update of dev nodes for clustered mirrors.
When using clustered mirrors, we need device nodes to be created during
processing of device tree, not at its end like we normally do (we need to
access the nodes in cmirror prematurely). Therefore we use a new flag called
"immediate_dev_node" stored in deptree's load_properties struct to instruct the
device tree processing code to immediately synchronize with udev and flush all
stacked node operations so the nodes are prepared for use.

For now, the immediate_dev_node is used for clustered mirrors during
processing the dm_tree_preload_children code only. We can add more later if
needed.
2010-06-21 08:54:32 +00:00
Milan Broz
0e93522190 Remove C++ private keyword from headers.
Add extern C definition for libdevmapper, lvm2app and lvm2cmd.
2010-06-16 13:01:25 +00:00
Peter Rajnoha
9dbad2f74d 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
Peter Rajnoha
60af6fb0a2 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
Zdenek Kabelac
333cf73ceb Fix copy&paste detection of kernel release version.
Add log_error to avoid return_0 without log_error.
2010-05-25 08:40:36 +00:00
Alasdair Kergon
bc653452a7 Replace strncmp kernel version number checks with proper ones 2010-05-24 23:11:34 +00:00
Alasdair Kergon
fa7fa300e3 Choose between clustered log versions based on kernel version.
Add fixmes for broken strcmp.
2010-05-24 17:46:47 +00:00
Zdenek Kabelac
c4655582e6 Update Copyright date for resently modifed files 2010-05-24 09:04:27 +00:00
Zdenek Kabelac
bc1024812a Replicator: check open_count for parents of presuspend_node
For deactivation of Replicator check in advance that all heads
have open_count == 0. For this presuspend_node is used as all
head nodes are linking this control node.
2010-05-21 12:30:35 +00:00
Zdenek Kabelac
451be927a8 Replicator: support deactivate of replicator-dev nodes
Introducing dm_tree_node_set_presuspend_node() for presuspending child
node (i.e. replicator control target) before deactivation of parent node
(i.e. replicator-dev target).

This patch presents no functional change to current dtree - only
replicator target currently sets presuspend node for dev nodes.
2010-05-21 12:27:02 +00:00
Zdenek Kabelac
4839e5d913 Replicator: libdm support
Introducing new API calls:
dm_tree_node_add_replicator_target()
dm_tree_node_add_replicator_dev_target().

Define new typedef dm_replicator_mode_t.
2010-05-21 12:24:15 +00:00
Milan Broz
8cf86745c2 Do not print encryption key in message debug output. 2010-05-13 13:31:30 +00:00
Zdenek Kabelac
81c155b465 Add pkgconfigdir for placement of .pc files
Use easily overideable make install pkgconfigdir variable.
2010-05-11 08:57:02 +00:00
Zdenek Kabelac
ae11cc6731 Switch to use Requires.private for devmapper.pc and lvm2app.pc
Use Requires.private: instead of Libs.private:
Use UDEV_PC and SELINUX_PC for Require.private:

It looks like usage of Requires.private is prefered from Libs.private.
However pkg-config documentation is really poor here. But here is
short outcome:

There is a difference in Libs.private: and Requires.private: where
we specify libselinux instead of  -lselinux -lsepol.

We leave resolving of query like 'pkg-config --libs --static devmapper'
on taking proper selinux and udev libs to their .pc files instead of
hardcoding them into our .pc file which is might give incorrect answer.
- i.e. dependency of libselinux package might change and we may return
wrong list of linked libraries.

http://bugs.freedesktop.org/show_bug.cgi?id=4738
http://err.no/personal/blog/tech/2008-03-25-18-07_pkg-config,_sonames_and_Requires.private
2010-05-11 08:54:11 +00:00
Zdenek Kabelac
4c449886f6 Add dm_list_splice() to join two lists. 2010-05-06 10:10:15 +00:00
Peter Rajnoha
20399b50d6 Specify exactly which ioctl doesn't have a cookie set (for better debugging). 2010-05-03 22:08:38 +00:00
Peter Rajnoha
93c1312901 Synchronize "remove" dm task while reverting unsuccessful "create" dm task
(with table provided).

This remove ioctl generates udev events like any other hence it needs to be
synchronized properly as well. Also, add dm task type in debug log when
setting a cookie (for better debugging).
2010-05-03 21:06:53 +00:00
Peter Rajnoha
68c7b86df1 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
532834cbc2 Also include udev libs in libdevmapper.pc when udev_sync is enabled. 2010-04-26 09:05:50 +00:00
Alasdair Kergon
a32e8441d0 don't optimise anything with TARGET_TRANS to avoid intefering with the matcher's counting 2010-04-22 23:09:18 +00:00
Alasdair Kergon
4d6089c042 Cache bitset locations to speed up _calc_states. (kabi) 2010-04-22 20:35:24 +00:00
Alasdair Kergon
7929929979 avoid ORs rightmost 2010-04-22 20:15:00 +00:00
Alasdair Kergon
9ba50046cf Move regex printing code from test to main tree (may use in debug messages).
Yet another optimiser fix attempt.
2010-04-22 17:42:38 +00:00
Alasdair Kergon
5ce8c9ae77 Don't walk rightmost through NULL pointers. 2010-04-22 14:33:14 +00:00
Alasdair Kergon
9d8d6b1d18 Fix rightmost rotation, and use LEFT and RIGHT to make symmetry more obvious. 2010-04-22 13:42:34 +00:00
Alasdair Kergon
52b8978a47 fix leftmost rotation 2010-04-22 13:18:27 +00:00
Alasdair Kergon
4c952f0af4 Still not satisfactory... 2010-04-22 03:24:24 +00:00
Alasdair Kergon
23dd4773d4 Add a regex optimisation pass for shared character prefixes. 2010-04-20 22:31:22 +00:00
Alasdair Kergon
ea04c0775c Add dm_bitset_equal to libdevmapper. 2010-04-20 13:58:22 +00:00
Alasdair Kergon
2eb4099563 missed files from last commit 2010-04-20 10:58:18 +00:00
Alasdair Kergon
1f9d50fa3f Add dm_bit_and. (ejt) 2010-04-19 21:23:01 +00:00
Alasdair Kergon
be29e5ab62 fix last commit 2010-04-19 21:10:20 +00:00
Alasdair Kergon
24d8818933 Simplify dm_bitset_create. (ejt) 2010-04-19 21:08:32 +00:00
Alasdair Kergon
803380c203 Speed up dm_bit_get_next with ffs(). 2010-04-19 17:17:55 +00:00
Zdenek Kabelac
2db34bd266 INSTALL rules updates
Patch is inspired by Debian's extra patch.

- removes OWNER & GROUP make vars they are parts of INSTALL command.
- adds INSTALL_PROGRAM for executable, uses $(INSTALL)
- adds INSTALL_DATA for non-executable data, uses ($INSTALL)
- adds INSTALL_WDATA for writable non-executable data, uses ($INSTALL)
- adds configure option --enable-write_install - to support
  installatin of writable files used by distribution
- replaces usage of ifeq @LIB_SUFFIX@ with $(LIB_SUFFIX)
- installs .a files from static builds without executable flag
- installs .a files to $(usrlibdir) instead of $(libdir)
- installs all static binaries to $(staticdir)
- create .so links for devel package in $(usrlibdir) instead of
  $(libdir)
- makes .so and .so.LIB_VERSION files within builddir
- removes VERSIONED_SHLIB and created versioned LIB_SHARED automagicaly
- install LIB_SHARED via install_lib_shared target
- install plugins via install_lib_shared_plugin target
- prints whole 'install' command during installation instead of less
  informative "Installing  $(something) $(somewhere)"
- install multiple man pages with one INSTALL command
- use DISTCLEAN_TARGETS instead of creating multiple distclean targets
2010-04-09 21:42:48 +00:00
Zdenek Kabelac
f3491d93a0 Use vpath instead of VPATH.
Usage of VPATH makes troubles when used within $(builddir).
Not only source files are being found through VPATH,
but targets as well. (make --debug=v)

Thus if user builds the code in $(srcdir) and also in some $(builddir)
he gets mangled results as some generated files (i.e. .export.sym)
are 'reused' from $(srcdir) instead of $(builddir).

This patch switches to use vpath were we could explicitly name
suffixes that should be looked via vpath - we must take care,
we do not generate files with these suffixes:
.c, .in, .po, .exported_symbols
2010-04-09 21:34:25 +00:00
Alasdair Kergon
adc1729212 Only fail if the top-level LV fails to be deactivated - allow deactivation
of its dependencies to fail.
2010-04-07 23:51:34 +00:00
Alasdair Kergon
fdef9679b6 Issue a message if the new type of deactivation failure happens.
If this can happen during 'normal' operations, I need to know.
2010-04-07 21:25:09 +00:00
Alasdair Kergon
687603a144 Fix incorrect removal of symlinks after LV deactivation fails. 2010-04-07 20:04:41 +00:00
Milan Broz
7b030379ec Wipe dm-ioctl parameters in memory after use. 2010-04-07 15:57:20 +00:00
Zdenek Kabelac
f293d0b951 Fixing another set of distclean problems where we left some generated files
in clvmd, dmevend, man, tests.

Don't include dependency files for clow and cscope.out targets

Improve dependency tracking for dmeventd and liblvm2cmd sources.
2010-03-29 14:17:59 +00:00
Zdenek Kabelac
1967fd2429 Update cflow file generation - support build dir and use $(top_srcdir)
to obtain sources. Create make.tmpl target for
simplier generation of cflow files with the help of
CFLOW_LIST, CFLOW_LIST_TARGET, CFLOW_TARGET.
Still cflow usage is not perfect.
2010-03-29 14:11:17 +00:00
Alasdair Kergon
d01de820d7 Use INTERNAL_ERROR definition consistently in internal error messages. 2010-03-25 18:22:04 +00:00
Peter Rajnoha
940c32c5dd 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
14ad41a065 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
zkabelac
f2a6d937a6 Use UDEV_LIBS, and link -ludev only when needed. 2010-03-04 12:12:34 +00:00
zkabelac
5451f79f55 This patch add SELINUX_LIBS and STATIC_LIBS variables.
For static builds dependency for SELinux libs is not handled by 'ar'.
Till better solution is found, for static builds STATIC_LIBS is used.

Patch updates SELinux detection to use 3rd & 4th parameter for Success/Fail.
Also removes detection of pthread from this check as we know which
version of libdevmapper we are going to link with lvm after merge.

SELinux header check moved to the SELinux test code.
2010-03-04 12:08:26 +00:00
zkabelac
3fdc1390fe This patch moves inclusion of the make.tmpl before DEFS modification,
so it goes in the same order on the compilation line.
(i.e. HAVE_CONFIG_H goes first)
2010-03-04 09:56:56 +00:00
zkabelac
0f878a226d Use $(top_builddir) for inclusion of make.tmpl in Makefiles. 2010-03-04 09:51:37 +00:00
zkabelac
f1acefd241 Fix dm_report_field_uint64 to really use 64bit.
(function is currently not in use)
2010-02-15 18:36:48 +00:00
zkabelac
14258c93de * add more 'const' - fixes gcc constness warning 2010-02-15 18:34:00 +00:00
Peter Rajnoha
276d32973f 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
befef6eb00 remove no-longer-used header 2010-01-19 17:04:05 +00:00
Alasdair Kergon
162224979d remove no-longer-used files 2010-01-19 17:01:17 +00:00
Alasdair Kergon
f8ff64c87e more build fixes 2010-01-19 01:10:46 +00:00
Jonathan Earl Brassow
827f1a3d30 Off-by-one count was causing not all the mirror table parameters
that were necessary to be passed on to userspace.

The cluster mirror table (log portion only) used to look like this:
        clustered-disk <parm_count> <disk> <region_size> <uuid> \
                        [[no]sync] [block_on_error]
Now it looks like this:
        userspace <parm_count> <uuid> clustered-disk <disk> <region_size> \
                        [[no]sync]

So, there is one extra argument in the latter case - this was
unaccounted for.

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
2010-01-15 16:00:23 +00:00
zkabelac
44e17e2aa9 Cleanup gcc warning: cast discards qualifiers from pointer target type
API of the library should remain the same as the 'const' is not
mangled into the function name in C.
2010-01-14 10:15:23 +00:00
zkabelac
84758667c1 Cleanup gcc warning: cast from function call of type 'struct dm_list *'
to non-matching type 'long unsigned int'

Casting pointer to long and back to pointer could be easily
handled with just pointer arithmetic.
2010-01-14 10:12:44 +00:00
Mike Snitzer
82d3ee5454 Add support for "snapshot-merge" target.
Introduces new libdevmapper function dm_tree_node_add_snapshot_merge_target

Verifies that the kernel (dm-snapshot) provides the 'snapshot-merge'
target.

Activate origin LV as snapshot-merge target.  Using snapshot-origin
target would be pointless because the origin contains volatile data
while a merge is in progress.

Because snapshot-merge target is activated in place of the
snapshot-origin target it must be resumed after all other snapshots
(just like snapshot-origin does) --- otherwise small window for data
corruption would exist.

Ideally the merging snapshot would not be activated at all but if it is
to be activated (because snapshot was already active) it _must_ be done
after the snapshot-merge.  This insures that DM's snapshot-merge target
will perform exception handover in the proper order (new->resume before
old->resume).  DM's snapshot-merge does support handover if the reverse
sequence is used (old->resume before new->resume) but DM will fail to
resume the old snapshot; leaving it suspended.

To insure the proper activation sequence dm_tree_activate_children() was
updated to accommodate an additional 'activation_priority' level.  All
regular snapshots are 0, snapshot-merge is 1, and merging snapshot is 2.
2010-01-13 01:39:44 +00:00
Alasdair Kergon
42783a54db 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
8e7c6b60fb 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
e829c626da 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
zkabelac
835b0d9f62 Error message prints unrecognized key. 2010-01-07 14:32:44 +00:00
zkabelac
9fea2798e3 Show all fields for 'dmsetup info -c -o all'. 2010-01-07 14:30:47 +00:00
Mike Snitzer
9935d1183a Return error to dm_tree_deactivate_children() callers.
Otherwise deactivate_lv can fail silently.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
2010-01-05 21:06:26 +00:00
Mike Snitzer
aff8e77bec Return error to dm_tree_suspend_children() callers.
Otherwise suspend_lv and its variants can fail silently.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
2010-01-05 21:05:40 +00:00
Mike Snitzer
c9fd743c65 Return error to dm_tree_preload_children() and
dm_tree_activate_children() callers.

Otherwise resume_lv and its variants can fail silently.

Catching these failures is especially important now that dm targets like
crypt and snapshot-merge can fail in .preresume

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
2010-01-05 21:04:37 +00:00
zkabelac
b1f8076da0 Cleanup returns for void functions. 2009-12-11 13:16:37 +00:00
zkabelac
5a5fed28fa minor whitespace indentation 2009-12-03 09:58:30 +00:00
Dave Wysochanski
032c2cb462 Remove unnecessary / duplicate dm_list macros and functions.
These are no longer used by anyone.  The dm_list defines are all in
libdevmapper.h and libdm/datastruct/list.c contains any function definitions.
There is some code in "old-tests" that still use this but this code is not
being maintained.

Thanks to Zdenek for spotting this.
2009-11-25 20:44:07 +00:00
Peter Rajnoha
88b0c82a0d 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
01d3349587 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
21ed352ac5 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
20faa956a8 Fix hash lookup segfault when keys compared are different lengths. 2009-11-03 00:45:35 +00:00
Peter Rajnoha
10fffe842b Cleanup of previous commit with latest changes in udev support code. 2009-10-26 21:38:35 +00:00
Peter Rajnoha
0f64ddf2fb Several changes to udev support code:
- we have these levels when the udev rules are processed:
   10-dm.rules --> [11-dm-<subsystem>.rules] --> [12-dm-permissions.rules] -->
   13-dm-disk.rules --> [...all the other foreign rules...] --> 95-dm-notify.rules

 - each level can be disabled now by
   DM_UDEV_DISABLE_{DM, SUBSYSTEM, DISK, OTHER}_RULES_FLAG

 - add DM_UDEV_DISABLE_DM_RULES_FLAG to disable 10-dm.rules

 - add DM_UDEV_DISABLE_OTHER_RULES_FLAG to disable all the other (non-dm) rules.
   We cutoff these rules by using the 'last_rule', so this one should really be
   used with great care and in well-founded situations. We use this for lvm's
   hidden and layer devices now.

 - add a parameter for add_dev_node, rm_dev_node and rename_dev_node so it's
   possible to switch on/off udev checks

 - use DM_UDEV_DISABLE_DM_RULES_FLAG and DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG
   if there's no cookie set and we have resume, remove and rename ioctl.
   This could happen when someone uses the libdevmapper that is compiled with
   udev_sync but the software does not make use of it. This way we can switch
   off the rules and fallback to libdevmapper node creation so there's no
   udev/libdevmapper race.
2009-10-26 14:29:33 +00:00
Peter Rajnoha
9359586fde Use udev flags support in LVM and provide dm_tree_add_new_dev_with_udev_flags wrapper for dm_tree_add_new_dev. 2009-10-22 13:00:07 +00:00
Peter Rajnoha
68069c70e1 Add udev flags support in libdevmapper and provide 'dmsetup udevflags' command to decode them. 2009-10-22 12:55:47 +00:00
fabbione
1dbfe1e856 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
e0559e4fda Only include selinux libs in libdevmapper.pc when selinux build enabled. 2009-10-05 12:11:30 +00:00
Alasdair Kergon
eeefbfd38d Allow for a build directory separate from the source. 2009-10-02 19:10:31 +00:00
Alasdair Kergon
a99a30d720 missing dm_snprintf 2009-09-25 19:06:05 +00:00
Alasdair Kergon
0670c8f60f pre-release 2009-09-25 18:30:27 +00:00
Alasdair Kergon
bc9b5706e9 ensure dm_strdup succeeds 2009-09-25 18:19:09 +00:00
Alasdair Kergon
64c37a20d1 remove unused var & rename fn 2009-09-25 18:13:17 +00:00
Alasdair Kergon
6d2d4f72ac Handle any path supplied to dm_task_set_name() by looking up in /dev/mapper. 2009-09-25 18:08:04 +00:00
Peter Rajnoha
4c151970e6 Use the same default umask for /dev dirs (DM_DEV_DIR_UMASK). 2009-09-25 11:58:00 +00:00
Jonathan Earl Brassow
db3fb23de4 '_emit_areas_line' returns 1 for success and 0 for failure. This always
confuses me, so I've added a comment at the top of the function to
remind me of this.

I also found that 'mirror_emit_segment_line' was returning 0 (return_0)
on failure /and/ success.  It now returns 1 for success and 0 for failure -
just like '_emit_areas_line' and its calling function, '_emit_segment_line'.
2009-09-22 16:26:59 +00:00
Alasdair Kergon
b1ce301520 dm release cleanup 2009-09-15 11:41:38 +00:00
Peter Rajnoha
106763ef9a Move dm_cookie_supported check into dm_udev_get_sync_supprt function.
We don't have to call dm_cookie_supported with dm_udev_get_sync_support
this way. Also, it's necessary for the current code to work properly on
systems without cookie support (older kernels).
2009-09-11 16:11:25 +00:00
Peter Rajnoha
aa8728a2ab Add one define that is necessary for older (experimental) libudev to work. 2009-09-11 15:57:51 +00:00
Peter Rajnoha
f2d3b3661b Check that udev is running and set internal state appropriately. 2009-09-11 15:56:06 +00:00
Dave Wysochanski
3d8e149668 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
ff17105386 Cluster log server (clogd): Add new build files.
Might be a good idea to add the new files to the repository.  :(
2009-08-13 20:51:41 +00:00
Jonathan Earl Brassow
9dd273626a Cluster log daemon (clogd): use LVM bitops in place of ext2 bitops
Eliminate dependency on outside library, since the same functionality
exists in our tree.

[It is important that the bitops work in the same way, as the bitmaps
must remain backwards compatible.  I haven't tested every architecture,
but the x86* archs work.  My test involved using the old ext2fsprogs
bitops, memcpy'ing the bits over to the LVM bitset array and ensuring
that only the bits set via the old methods were set.]
2009-08-13 16:31:01 +00:00
Alasdair Kergon
84b0920fe0 pre-release 2009-08-06 17:08:01 +00:00
Peter Rajnoha
886e528490 Add 'udevcomplete_all' command for dmsetup. Export DM_COOKIE_MAGIC in libdevmapper.h. 2009-08-06 15:04:30 +00:00
Peter Rajnoha
06691a0794 Fix failure situations in dm_task_run for udev sync. 2009-08-06 15:02:01 +00:00
Peter Rajnoha
c61da238e1 Detect udev problems in _rename_dev_node. 2009-08-06 15:00:25 +00:00
Alasdair Kergon
e07419b4ba Additional logging 2009-08-05 19:50:08 +00:00
Alasdair Kergon
32752bc3dd Add default udev rules.
Update dm-ioctl.h comments.
2009-08-03 18:44:54 +00:00
Alasdair Kergon
f1fd43b61c Add udev checks. 2009-08-03 18:33:08 +00:00
Alasdair Kergon
9abda62c5b Manage without dm_udev_cleanup? 2009-08-03 18:01:45 +00:00
Alasdair Kergon
bce8cac1f4 cleanup some ignored return values & 'stack's 2009-08-03 11:20:15 +00:00
Alasdair Kergon
4171d0c301 deal with error-related FIXMEs 2009-08-03 11:01:26 +00:00
Alasdair Kergon
39270f9647 Set cookies in activation code and wait for udev to complete processing. 2009-07-31 18:30:31 +00:00
Alasdair Kergon
3b6a147653 Add udevcomplete and --noudevwait to dmsetup. 2009-07-31 17:51:45 +00:00
Alasdair Kergon
fd69075a8b another fixme 2009-07-31 16:57:06 +00:00
Alasdair Kergon
dfed228991 Add libdevmapper functions to support synchronisation with udev. 2009-07-31 15:53:11 +00:00
Alasdair Kergon
5e3369aba3 Add log_errno to set a specific errno and replace log_error in due course. 2009-07-16 00:52:06 +00:00
Alasdair Kergon
7da36611dc Use log_error macro consistently throughout in place of log_err. 2009-07-15 20:02:46 +00:00
Alasdair Kergon
a06d6839e1 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
7e7274b002 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