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

3720 Commits

Author SHA1 Message Date
Zdenek Kabelac
d4d8060ff4 cleanup: do include lvm headers in libdm build
Relocate some defines from lvm headers to those
few shared between libdm and lib code.
2014-04-08 11:00:15 +02:00
Zdenek Kabelac
5553a099d1 cleanup: use DM_ARRAY_SIZE
More use of libdevmapper macro
2014-04-08 11:00:15 +02:00
Zdenek Kabelac
56175f6ba9 cleanup: refactor apply_lvname_restrictions
Split apply_lvname_restrictions into 2 internal
function:

_lvname_has_reserved_prefix()
_lvname_has_reserved_string()
2014-04-08 11:00:15 +02:00
Zdenek Kabelac
9eab84aa2b debug: catch invalid request for tree
In general for non-toplevel LVs we shouldn't allow any _tree_action.
For now error on request for cache_pool activation which
doesn't even exist in dm-table.
2014-04-08 11:00:15 +02:00
Zdenek Kabelac
2868d897da lvm-string: add cdata/cmeta as reserved name 2014-04-08 11:00:14 +02:00
Zdenek Kabelac
700b4bfc94 log: skip repeated hashing when logging once
When a message is already found in the hash, no need to hash it again.
2014-04-08 11:00:14 +02:00
Zdenek Kabelac
96cf9dc017 raid: use internal variables for array alloc
Don't use passed pointer when allocating policies' array.
(In case policy_argc would be NULL, this would have caused
NULL dereference).
2014-04-08 11:00:13 +02:00
Zdenek Kabelac
89615af349 exec_cmd: skip fork when argv[0] is null
Skip whole fork code path if the arg would be null.
2014-04-08 11:00:13 +02:00
Alasdair G Kergon
4d0c3ed0f8 configure: regenerate
Used rhel7 autoreconf.
2014-04-04 02:36:47 +01:00
Alasdair G Kergon
5d7614fcf9 format_text: Report failed close. 2014-04-04 02:28:10 +01:00
Alasdair G Kergon
cc72f340d7 thin: Support thin_check --clear-needs-check-flag.
Update thin provisioning tools to version 0.3.2 or later!
2014-04-04 02:22:40 +01:00
Alasdair G Kergon
b38a3d8c85 lvmetad: Update retry logic vars and comments.
Avoid using variables with same name as functions.
Use lvm_even_rand for random numbers.
2014-04-04 01:46:53 +01:00
Alasdair G Kergon
3f0f558786 dev-cache: Improve open device check messages. 2014-04-04 01:39:42 +01:00
Alasdair G Kergon
12ddaa5f10 lib: Share lvm_even_rand for random numbers. 2014-04-04 01:26:19 +01:00
Jonathan Brassow
6c6468f91d RAID: Improve an error message
When down-converting a RAID1 LV, if the user specifies too few devices,
they will get a confusing message.
Ex:
[root]# lvcreate -m 2 --type raid1 -n raid -L 500M taft
  Logical volume "raid" created

[root]# lvconvert -m 0 taft/raid /dev/sdd1
  Unable to extract enough images to satisfy request
  Failed to extract images from taft/raid

This patch makes the error message a bit clearer by telling the user
the count they are trying to remove and the number of devices they
supplied.

[root@bp-01 lvm2]# lvcreate --type raid1 -m 3 -L 200M -n lv vg
  Logical volume "lv" created

[root@bp-01 lvm2]# lvconvert -m -3 vg/lv /dev/sdb1
  Unable to remove 3 images:  Only 1 device given.
  Failed to extract images from vg/lv

[root@bp-01 lvm2]# lvconvert -m -3 vg/lv /dev/sd[bc]1
  Unable to remove 3 images:  Only 2 devices given.
  Failed to extract images from vg/lv

[root@bp-01 lvm2]# lvconvert -m -3 vg/lv /dev/sd[bcd]1
[root@bp-01 lvm2]# lvs -a -o name,attr,devices vg
  LV   Attr       Devices
  lv   -wi-a----- /dev/sde1(1)

This patch doesn't work in all cases.  The user can specify the right
number of devices, but not a sufficient amount of devices from the LV.
This will produce the old error message:
[root@bp-01 lvm2]# lvconvert -m -3 vg/lv /dev/sd[bcf]1
  Unable to extract enough images to satisfy request
  Failed to extract images from vg/lv
However, I think this error message is sufficient for this case.
2014-04-03 16:57:41 -05:00
Zdenek Kabelac
c2876ee1c9 cache: enforce local exlusive activation
For cache flushing local exlusive activation is needed.
2014-04-01 21:29:28 +02:00
Zdenek Kabelac
dc5a3c9964 debug: add internal error for passed LV
TODO: in fact we should parameter LV.
2014-04-01 20:54:09 +02:00
Zdenek Kabelac
9cb053339e cleanup: cache updates messages
Passing non cached device is an internal error.
Print messages at non-error level.
Shorten sleep delay for cache flush.
2014-04-01 20:54:09 +02:00
Zdenek Kabelac
e2ea3cd7ba cleanup: cache use const char policy
Policy should be const char pointer.
2014-04-01 20:54:09 +02:00
Zdenek Kabelac
d58cc2c0fc cleanup: cache reuse code for pool test
Using same error message for pool associated devices.
2014-04-01 20:18:05 +02:00
Zdenek Kabelac
e72dea55bf cache: fix order of metadata change
Start to change metadata after they are archived.
And since cache_pool is virtual skip deactivation
call for this LV.
2014-04-01 20:17:10 +02:00
Zdenek Kabelac
d3004479cc cache: use remove_layer_from_lv
Since the usability problem were fixed, we can use this function.
Cleanup orphan LVs with TEMPORARY flags
(reduces couple blkid error reports, but couple of them
is still left...)
2014-04-01 20:17:10 +02:00
Zdenek Kabelac
0a15a210a5 cache: cache segment is non-discardable
Since cache segment is purely virtual mapping, it has nothing for
discard. Discardable is cache origin here which is now
properly removed on 'delete' phase.

Plain lv_empty() call needs to only detach cache origin and leave
origin unchanged.
2014-04-01 20:17:10 +02:00
Zdenek Kabelac
a018c57f0b cache: never activate cache pool
Since cache-pool is purely lvm abstraction layer LV, it never
need any device node, so do not add even 'error' device for it.
2014-04-01 20:17:10 +02:00
Petr Rockai
d5682ccbac lvm-wrappers: Remove spurious #include <libudev.h>. 2014-04-01 15:26:26 +02:00
Peter Rajnoha
68bb639a08 config: fix compile error in config-settings.h if using --disable-dmeventd
config/config_settings.h:257:102: error: 'DMEVENTD_PATH' undeclared here (not in a function)
2014-03-31 15:57:42 +02:00
Zdenek Kabelac
84beba5d7f vg_validate: check size of lv_name + vg_name
Since the whole dm device name may not exceed 127 characters,
validate no LV names is bigger then this limit.
2014-03-31 12:05:32 +02:00
Zdenek Kabelac
6570d36ad5 lv_rename: resume fail is certainly error
Failing resume path means command has failed,
even when commit was ok.
2014-03-31 12:03:25 +02:00
Zdenek Kabelac
c7a89323f5 fix spurios char
Mistyped char left in code.
2014-03-27 13:49:24 +01:00
Zdenek Kabelac
fc8185601d cleanup: indent change 2014-03-27 13:13:09 +01:00
Zdenek Kabelac
356fdda46d lv_manip: drop cmd pointer from for_each_sub_lv
Drop unused passed cmd pointer from function.

TODO:

We have two similar functions (though not identical)

lv_manip.c: for_each_sub_lv()
metadata.c: _lv_each_dependency()

They seem to not always match - we should probably convert
to use only a single function.
2014-03-27 13:10:13 +01:00
Zdenek Kabelac
22579b4451 lv_rename: validate renamed sublv
Use proper vgmem memory pool for allocation of LV name in the vg
and check if new renamed LV is a valid name.

TODO: validation should really use also VG name, othewise we are not
able to tell "vgname-lvname" will be valid.
2014-03-27 13:06:23 +01:00
Zdenek Kabelac
2a93eba68e cleanup: easier casting
Use 32bit for extent calcs.
Drop uneeded implicit case.
2014-03-26 14:11:37 +01:00
Zdenek Kabelac
0499e87ace cleanup: simplify pv name size estimation
Reuse buffer with size of 2 * PATH_MAX to handle worst case escape
and avoid extra calculation of espaced len.
2014-03-26 14:11:37 +01:00
Petr Rockai
a3615f3149 lvmetad: Fix an endless wait loop introduced in c13f5dbb. 2014-03-26 11:45:28 +01:00
Petr Rockai
c13f5dbb25 lvmetad: Wait at least 80s for the initial scan. 2014-03-25 16:38:35 +01:00
Zdenek Kabelac
65bbfdf74d lvmetad: add missing dev_close in error path
Fixes missing dev_close() in dev_read error path
introduced in commit
a368698672
3e5bec37e9

(in-release fix)
2014-03-25 14:55:58 +01:00
Zdenek Kabelac
13258d6e96 debug: add proper backtrace debug
When failure happens inside refresh, print proper debug backtrace.
2014-03-25 11:22:59 +01:00
Zdenek Kabelac
89575d6895 cleanup: drop init of already zalloced mem 2014-03-25 11:22:59 +01:00
Zdenek Kabelac
406ec4162f cleanup: use dm_free without extra test
It's ok to free(NULL).
2014-03-25 11:22:59 +01:00
Zdenek Kabelac
4a6f05e420 cleanup: use trigraph 2014-03-25 11:22:58 +01:00
Zdenek Kabelac
68d13b2517 dev-cache: fix mem corruption on refresh context
When lvm2 command works with clvmd and uses locking in wrong way,
it may 'leak' certain file descriptors in opened (incorrect) state.

dev_cache_exit then destroys memory pool of cached devices, while
_open_devices list in dev-io.c was still referencing them if they
were still opened.

Patch properly calls _close() function to 'self-heal' from this
invalid state, but it will report internal error (so execution
with abort_on_internal_error causes immediate death). On the
normal 'execution', error is only reported, but memory state is
corrected, and linked list is not referencing devices from
released mempool.

For crash see: https://bugzilla.redhat.com/show_bug.cgi?id=1073886
2014-03-25 11:22:57 +01:00
Peter Rajnoha
9446978e64 config: define default value for global/thin_disabled_features as NULL instead
Before:
  thin_disabled_features = ""
Now:
  thin_disabled_features = []

Which is a more correct and consistent way of specifying void array
though parses can handle both forms.
2014-03-24 16:31:27 +01:00
Peter Rajnoha
4e47c34ffc config: also check empty arrays for difference against default values 2014-03-24 16:30:47 +01:00
Peter Rajnoha
5dcec1734e dumpconfig: add dumpconfig --type diff to show differences from defaults 2014-03-24 15:35:54 +01:00
Peter Rajnoha
76ff38fa5c config: add support for comparing used config values with default ones 2014-03-24 15:35:47 +01:00
Peter Rajnoha
630e0af14e cleanup: move _get_def_array_values fn
So we can use reuse it for the code that will follow...
2014-03-24 15:20:19 +01:00
Zdenek Kabelac
c595b20e56 dev-swap: use SECTOR_SHIFT 2014-03-22 20:43:05 +01:00
Zdenek Kabelac
936bfeb8de dev-swap: detect swap signature on devices smaller then 2MB
Smallest supported size for swap device is 40KB, however current
test skipped devices smaller then 4096 sectors (2MB).

Since page is in bytes, convert it to sectors before comparing
with device size (in sectors).
2014-03-22 20:36:14 +01:00
Zdenek Kabelac
1ee8688de0 cleanup: memlock line indent 2014-03-21 22:29:25 +01:00