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

183 Commits

Author SHA1 Message Date
Peter Rajnoha
26a3549fa0 Move dm_task_set_newname from libdm-iface.c to libdm-common.c 2012-01-17 14:36:58 +00:00
Zdenek Kabelac
044abcf91b Use sysfs to set/get of read-ahead
If we know major:minor number of device (which is known after resume) we will
try to use  sysfs to set/get read ahead parameters of device.
This avoid potential problem of blocking commands like 'dmsetup info' awaiting
for device being usable for open/close - i.e. overfilled thin pool may block
such command.
2012-01-09 12:26:14 +00:00
Jonathan Earl Brassow
0c506d9a40 Support the ability to replace specific devices in a RAID array.
RAID is not like traditional LVM mirroring.  LVM mirroring required failed
devices to be removed or the logical volume would simply hang.  RAID arrays can
keep on running with failed devices.  In fact, for RAID types other than RAID1,
removing a device would mean substituting an error target or converting to a
lower level RAID (e.g. RAID6 -> RAID5, or RAID4/5 to RAID0).  Therefore, rather
than removing a failed device unconditionally and potentially allocating a
replacement, RAID allows the user to "replace" a device with a new one.  This
approach is a 1-step solution vs the current 2-step solution.

example> lvconvert --replace <dev_to_remove> vg/lv [possible_replacement_PVs]

'--replace' can be specified more than once.

example> lvconvert --replace /dev/sdb1 --replace /dev/sdc1 vg/lv
2011-11-30 02:02:10 +00:00
Zdenek Kabelac
5392675f4c Check target type name for DM_MAX_TYPE_NAME length
Avoid creation of target type name when it's longer then
DM_MAX_TYPE_NAME (noticed by static analyzer where the
sp.target_type might be missing '\0' at the end.)

Before patch:

$> dmsetup create long
0 1000 looooooooooooooooooooooooooong
^D
device-mapper: reload ioctl failed: Invalid argument

After patch:

$> dmsetup create xxx
0 1000 looooooooooooooooooooooooooong
Target type name looooooooooooooooooooooooooong is too long.
Command failed
2011-11-18 19:34:02 +00:00
Mike Snitzer
eeaf162626 Add missing free() for line that is malloc()'d by getline(). 2011-11-08 19:02:21 +00:00
Mike Snitzer
52f3043f15 Fix _get_proc_number to be tolerant of malformed /proc/misc entries.
Fixes issue reported here: http://lkml.org/lkml/2011/11/8/190
2011-11-08 17:32:10 +00:00
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
Zdenek Kabelac
660a42bc78 Add internal expected_errno dm_tast var
Certain errno codes could be expected in some situations thus
add experimental support for them.

When expected errno is set after ioctl error - function skips error
printing and exits succefully.

Currently only useful for thin pool messages.
2011-10-19 16:36:01 +00:00
Zdenek Kabelac
41f09f7124 Use zalloc for malloc,memset 2011-10-17 14:36:06 +00:00
Alasdair Kergon
349b204bc2 explain why we may now retry 2011-09-23 17:16:28 +00:00
Peter Rajnoha
a54dbfb2b3 Initialize 'retryable' variable. 2011-09-22 17:59:58 +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
Alasdair Kergon
40e5fd8b3a spaces->tabs 2011-08-19 17:02:48 +00:00
Alasdair Kergon
c3d985c3ad revert incomplete inconsistent log message change for now 2011-08-19 16:49:00 +00:00
Jonathan Earl Brassow
a2facf4ad4 Add ability to merge back a RAID1 image that has been split w/ --trackchanges
Argument layout is very similar to the merge command for snapshots.
2011-08-18 19:43:08 +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
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
Alasdair Kergon
d3efe22fa2 Fix read-only identical table reload supression. 2011-07-24 23:59:03 +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
7cc4a70487 debug log readonly flag with ioctls 2011-06-29 16:08:33 +00:00
Alasdair Kergon
600dc4168c Remove temporary failures now, but continue to give INTERNAL_ERROR. 2011-06-29 11:36:37 +00:00
Alasdair Kergon
9591e7ede1 Temporary conversion to internal error and failure, to see how many
instances of this problem this flushes out.
2011-06-29 08:54:13 +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
Alasdair Kergon
98a0fa72be Fix fields in warning message. 2011-06-13 03:53:02 +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
Milan Broz
fa380602cf Accept kernel version 3 (3.0-rc and similar). 2011-06-09 15:07:40 +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
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
Zdenek Kabelac
85a1ca1c4b Indent case part properly 2011-03-02 08:41:55 +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
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
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
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
a5c6acf22a Skip NULL check before dm_free
dm_free checks for NULL itself.
2011-01-28 10:16:04 +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
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
Alasdair Kergon
1b7750c4bd Use a more-generic name for the new kernel flag so list_devices can share it. 2010-10-25 11:44:20 +00:00