1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
Commit Graph

3696 Commits

Author SHA1 Message Date
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
Zdenek Kabelac
486b15d36c memlock: drop locked mem in critical section
When daemon releases memory and it is still in critical
section, issue an error message and drop memory.

We cannot do anything better for now and we at least
release allocated resource.

FIXME:

This code is triggered when i.e. clvmd is killed while
some LVs are suspend - in this case suspended devices leak,
so if this happens during i.e. clvmd upgrade we have
unresolved problem - even locked rootfs...
2014-03-21 22:29:22 +01:00
Zdenek Kabelac
0ca16c6946 activate: report release with critical section
This function is typically called for cmd context refresh or destroy.
On the non-clustered case we already unlocked all messages,
however when i.e. 'clvmd' gets break signal it may have
still couple messages queued.

For now just report an error.
2014-03-21 22:29:22 +01:00
Zdenek Kabelac
e5382c063d lvmcache: fix debug trace
Recent debug tracing commit introduce read of uninitialized memory,
since VGID is not really a proper string which ends with '\0'.
Enforce at most 32 (ID_LEN) chars are read from vgid.
(in release fix)
2014-03-21 22:29:22 +01:00
Zdenek Kabelac
fc280bcc42 lvmcache: handle reinit without error
Since commit f12ee43f2e call destroy,
it start to check all VGs are unlocked. However when we become_daemon,
we simply reset locking (since lock is still kept by parent process).
So implement a simple 'reset' flag.
2014-03-21 22:29:21 +01:00
Peter Rajnoha
000e81a999 cleanup: add cmd_context reference to struct cft_check_handle
So we have all things needed to do a configuration check packaged
in one handle. It makes function calls inside a bit more readable.
2014-03-19 08:45:05 +01:00
Zdenek Kabelac
b6eb2ac10a cleanup: indent 2014-03-19 00:58:02 +01:00
Zdenek Kabelac
caf93eb1cb cleanup: simplify pv name print
pv_vg_name() now already hides orphans.
2014-03-19 00:58:01 +01:00
Zdenek Kabelac
506091be70 pv_vg_name: do not expose internal orphans to lvm2 users
Check for orphan VG name and return just empty string,
Use internally pv->vg_name if the real orphan name is needed.
2014-03-19 00:57:59 +01:00
Zdenek Kabelac
013f5f4550 metadata: print VG with invalid chars in quotes
We we report invalid chars, put quotes around vg name.
2014-03-19 00:48:39 +01:00
Zdenek Kabelac
6a8d3d7811 clvmd: avoid resending local sync commands
Instead of sending repeatedly  LOCAL_SYNC commands to clvmds
like 'lvs', rememeber the last sent commmand, and if there was no other
clvmd command, drop this redundant SYNC call message.

The problem has started with commit:
56cab8cc03

This introduced correct synchronisation of name, when user requests to know
open_count (needs to wait for udev), however it is also executed for
read-only cases like 'lvs' command.

For now implement very simple solution, which is only monitoring
outgoing clvmd command, and when sequence of LOCAL sync names are
recognized, they are skipped automatically.

TODO:
Future solution might move this variable info 'cmd_context' and
use  'needs_sync' flag also i.e. in file locking code.
2014-03-19 00:47:58 +01:00
Zdenek Kabelac
a6b159e99c file_locking: use PATH_MAX for dir name
Using just 128 chars for locking dir may wail if longer
dir entry is used, swich to default linux max path.
2014-03-19 00:46:28 +01:00
Zdenek Kabelac
08018a5345 archiver: drop unneeded backup check
When the backup is disabled, avoid testing backup presence.
This only leads to errors being logged in debug trace and the missing
backup can't be fixed, since it's disabled.
2014-03-19 00:45:41 +01:00
Zdenek Kabelac
599a05f658 lvmcache: add mode debug prints
Decorate NULL returns with debug_cache output so the
debug log doesn't contain spurios <bactrace> line without
any reason for it.

Add internal errors when cache is misused.
2014-03-18 10:28:08 +01:00
Peter Rajnoha
21b3c983fd config: make global/lvdisplay_shows_full_device_path profilable 2014-03-18 09:49:53 +01:00
Peter Rajnoha
927784cd06 config: make global/suffix profilable and add it to lvm.conf
The global/suffix was missing from example lvm.conf but it can
be very useful when using lvm in scripts and now in profiles as well
Let's expose it more.
2014-03-18 09:24:17 +01:00
Peter Rajnoha
c1ce2cc86c config: make global/units and global/si_unit_consistency profilable 2014-03-17 16:07:29 +01:00
Zdenek Kabelac
3a82490ee1 snapshot: wrap min_chunk test into a lib function
Create a separate function to validation snapshot min chunk value
and relocate code into snapshot_manip file.

This function will be shared with lvconvert then.
2014-03-17 14:31:43 +01:00
Peter Rajnoha
455f23586f config: make report settings profilable
Users can create several profiles for how the tools report
the output very easily and then just use

  <lvm reporting command> --profile <report_profile_name>
2014-03-17 14:27:49 +01:00
Peter Rajnoha
ada47c164a autoactivation: use VG read lock
The activation (including the refresh) should take the VG read lock
like the usual activation/refresh.
2014-03-14 12:10:52 +01:00
Peter Rajnoha
ca880a4f13 autoactivation: issue a VG refresh before autoactivation only if 'change' lvmetad flag is set
This prevents numerous VG refreshes on each "pvscan --cache -aay" call
if the VG is found complete. We need to issue the refresh only if the PV:
  - is new
  - was gone before and now it reappears (device "unplug/plug back" scenario)
  - the metadata has changed
2014-03-14 10:48:56 +01:00
Zdenek Kabelac
c0f1eb5f0f dev_manager: check prohibited devices earlier
Reorder detection for internal device - since this test
is much simpler then target analysis, check it sooner.

Replace test for '68' with sizeof & ID_LEN

Add FIXME about device alias problem with is_reserved_lvname,
since this test fails on devices like /dev/dm-X
so we need to convert tests to UUID.
2014-03-12 19:38:34 +01:00
Zdenek Kabelac
b50b4471bd cleanup: drop unused define 2014-03-12 19:12:34 +01:00
Peter Rajnoha
bf42119b22 config: accept empty values for global/thin_disabled_features
Let's do this the other way round - this makes more logic than commit b995f06.
So let's allow empty values for global/thin_disabled_features where
such an empty value now means "none of this features are disabled".
2014-03-12 15:53:20 +01:00
Peter Rajnoha
b995f06abf config: mark global/thin_disabled_features as having no default value
The global/thin_disabled_features should be marked as having no default
value. Otherwise the output from 'lvm dumpconfig --type default' would
have 'thin_disabled_features=""' which will produce an error message
'Ignoring empty string in config file ...' if such output is feed
back to lvm.
2014-03-12 15:17:52 +01:00