]> sourceware.org Git - lvm2.git/log
lvm2.git
9 years agotoolcontext: do not set cmd->initialized_connections = 0 on destroy_toolcontext
Peter Rajnoha [Mon, 3 Aug 2015 14:17:09 +0000 (16:17 +0200)]
toolcontext: do not set cmd->initialized_connections = 0 on destroy_toolcontext

The whole cmd context is freed completely in destroy_toolcontext, so do
not write to any of dead cmd variables.

9 years agodmsetup: Use argcp and argvp.
Bryn M. Reeves [Fri, 31 Jul 2015 21:53:38 +0000 (22:53 +0100)]
dmsetup: Use argcp and argvp.

9 years agodmsetup: Add --count and --interval to reports.
Bryn M. Reeves [Fri, 31 Jul 2015 20:59:34 +0000 (21:59 +0100)]
dmsetup: Add --count and --interval to reports.

For example, to monitor active devices every second you can now run
dmsetup info -c --count 0.

9 years agolockd: remove ignorelockingfailure checks
David Teigland [Fri, 31 Jul 2015 20:46:51 +0000 (15:46 -0500)]
lockd: remove ignorelockingfailure checks

These code paths were effectively unused.  The checks
had been added long ago without any real thought behind
what they should do or be used for.

9 years agovgchange/lvchange: allow deactivation without locking
David Teigland [Fri, 31 Jul 2015 19:11:24 +0000 (14:11 -0500)]
vgchange/lvchange: allow deactivation without locking

If locking with lvmlockd has failed, allow LVs to be deactivated.

9 years agodmsetup: Allow commands to have subcommands.
Alasdair G Kergon [Fri, 31 Jul 2015 18:09:31 +0000 (19:09 +0100)]
dmsetup: Allow commands to have subcommands.

No commands set has_subcommands yet.

Move multiple device loop to separate function because we'll
soon want to call it repeatedly.

(Based on patch from bmr.)

9 years agodmsetup: Add subcommand parameter.
Alasdair G Kergon [Fri, 31 Jul 2015 16:47:03 +0000 (17:47 +0100)]
dmsetup: Add subcommand parameter.

Not yet used.
Allows for dmsetup stats <subcommand> dev1 dev2...

9 years agodmsetup: _find_command returns const
Alasdair G Kergon [Fri, 31 Jul 2015 15:58:14 +0000 (16:58 +0100)]
dmsetup: _find_command returns const

9 years agodmsetup: Add _dmsetup to help and usage fns.
Alasdair G Kergon [Fri, 31 Jul 2015 15:26:38 +0000 (16:26 +0100)]
dmsetup: Add _dmsetup to help and usage fns.

Prepare for dmstats.
Adjust some text to avoid 80-char wrap.

9 years agodmsetup: Rename _commands to _dmsetup_commands.
Alasdair G Kergon [Fri, 31 Jul 2015 15:13:45 +0000 (16:13 +0100)]
dmsetup: Rename _commands to _dmsetup_commands.

We'll need to accommodate sub-commands for dmstats.

9 years agotoolcontext: use refresh_filters in refresh_toolcontext
Peter Rajnoha [Fri, 31 Jul 2015 08:20:33 +0000 (10:20 +0200)]
toolcontext: use refresh_filters in refresh_toolcontext

Use refresh_filters instead of destroy_filters and init_filters
in refresh_toolcontext fn which deals with cmd->initialized.filters
correctly on refresh.

9 years agotest: Update Makefiles
Marian Csontos [Thu, 30 Jul 2015 18:23:14 +0000 (20:23 +0200)]
test: Update Makefiles

- Add missing check_lvmpolld to toplevel Makefile
- Document check_system

9 years agospec: lockd_dlm requires dlm-lib instead of dlm
Marian Csontos [Thu, 30 Jul 2015 18:19:35 +0000 (20:19 +0200)]
spec: lockd_dlm requires dlm-lib instead of dlm

9 years agolvmlockd: create sanlock lv large enough for existing lvs
David Teigland [Thu, 30 Jul 2015 17:04:31 +0000 (12:04 -0500)]
lvmlockd: create sanlock lv large enough for existing lvs

When changing an existing VG to lock_type sanlock,
make the sanlock lv large enough to hold all the
locks needed for existing LVs.

9 years agolvmlockd: small fixes and cleanup for lvmlockctl
David Teigland [Thu, 30 Jul 2015 15:47:41 +0000 (10:47 -0500)]
lvmlockd: small fixes and cleanup for lvmlockctl

. clean up the info output for readability
. remove some internal debug output
. fix the daemon quit option

9 years agocleanup: toolcontext: move report_list_item_separator into its group
Peter Rajnoha [Thu, 30 Jul 2015 14:14:10 +0000 (16:14 +0200)]
cleanup: toolcontext: move report_list_item_separator into its group

9 years agocleanup: toolcontext: make cmd_context more readable
Peter Rajnoha [Thu, 30 Jul 2015 14:01:02 +0000 (16:01 +0200)]
cleanup: toolcontext: make cmd_context more readable

Just shuffle the items and put them into logical groups so it's
visible at first sight what each group contains - it makes it a bit
easier to make heads and tails of the whole cmd_context monster.

9 years agocommands: add new NO_METADATA_PROCESSING flag to selected commands
Peter Rajnoha [Thu, 30 Jul 2015 08:48:28 +0000 (10:48 +0200)]
commands: add new NO_METADATA_PROCESSING flag to selected commands

When a command is flagged with NO_METADATA_PROCESSING flag, it means
such command does not process any metadata and hence it doens't require
lvmetad, lvmpolld and it can get away with no locking too. These are
mostly simple commands (like lvmconfig/dumpconfig, version, types,
segtypes and other builtin commands that do not process metadata
in any way).

At first, when lvm command is executed, create toolcontext without
initializing connections (lvmetad,lvmpolld) and without initializing
filters (which depend on connections init). Instead, delay this
initialization until we know we need this. That is, until the
lvm_run_command fn is called in which we know what the actual
command to run is and hence we can avoid any connection, filter
or locking initiliazation for commands that would not make use
of it anyway.

For all the other create_toolcontext calls, we keep the original
behaviour - the filters and connections are initialized together
with the toolcontext.

9 years agotoolcontext: add switches to create_toolcontext for connections and filters init
Peter Rajnoha [Thu, 30 Jul 2015 08:34:10 +0000 (10:34 +0200)]
toolcontext: add switches to create_toolcontext for connections and filters init

Make it possible to decide whether we want to initialize connections and
filters together with toolcontext creation.

Add "filters" and "connections" fields to struct
cmd_context_initialized_parts and set these in cmd_context.initialized
instance accordingly.

(For now, all create_toolcontext calls do initialize connections and
filters, we'll change that in subsequent patch appropriately.)

9 years agorefactor: toolcontext: move lvmetad and lvmpolld init into separate function
Peter Rajnoha [Thu, 30 Jul 2015 08:13:45 +0000 (10:13 +0200)]
refactor: toolcontext: move lvmetad and lvmpolld init into separate function

Move original lvmetad and lvmpolld initialization code from
_process_config fn to their own functions _init_lvmetad and
_init_lvmpolld (both covered with single _init_connections fn).

9 years agorefactor: toolcontext: add struct cmd_context_initialized_parts
Peter Rajnoha [Thu, 30 Jul 2015 07:59:39 +0000 (09:59 +0200)]
refactor: toolcontext: add struct cmd_context_initialized_parts

Add struct cmd_context_initialized_parts to wrap up information
about which cmd context pieces are initialized and add variable
of this struct type into struct cmd_context.

Also, move existing "config_initialized" variable that was directly
part of cmd_context into the new cmd_context.initialized wrapper.

We'll be adding more items into the struct cmd_context_initialized_parts
with subsequent patches...

9 years agovgremove: warn when removing sanlock global lock
David Teigland [Mon, 27 Jul 2015 19:51:43 +0000 (14:51 -0500)]
vgremove: warn when removing sanlock global lock

When the sanlock VG holding the global lock is removed,
print a warning indicating that the global needs to be
enabled in another sanlock VG.

9 years agovgcreate: improve checks for existing global lock
David Teigland [Fri, 24 Jul 2015 15:06:58 +0000 (10:06 -0500)]
vgcreate: improve checks for existing global lock

This tries harder to avoid creating duplicate global locks in
sanlock VGs by refusing to create a new sanlock VG with a
global lock if other sanlock VGs exist that may have a gl.

9 years agolvmcache: add lock_type to VG summary and info structs
David Teigland [Fri, 24 Jul 2015 20:20:37 +0000 (15:20 -0500)]
lvmcache: add lock_type to VG summary and info structs

vgsummary information contains provisional VG information
that is obtained without holding the VG lock.  This info
can be used to lock the VG, and then read it with vg_read().
After the VG is read properly, the vgsummary info should
be verified.

Add the VG lock_type to the vgsummary.  It needs to be
known before the VG can be locked and read.

9 years agolibdm: Require librt for new dm_timestamp.
Alasdair G Kergon [Wed, 29 Jul 2015 18:30:22 +0000 (19:30 +0100)]
libdm: Require librt for new dm_timestamp.

9 years agolibdm: Add dm_timestamp functions.
Alasdair G Kergon [Wed, 29 Jul 2015 18:21:07 +0000 (19:21 +0100)]
libdm: Add dm_timestamp functions.

9 years agodmsetup: Accept vg/lv name format.
Alasdair G Kergon [Wed, 29 Jul 2015 11:24:36 +0000 (12:24 +0100)]
dmsetup: Accept vg/lv name format.

If there is exactly one / which is not the first character, check
for /dev/vg/lv (as dm_dir()/../$name i.e. /dev/mapper/../vg/lv.)

9 years agodmsetup: remove dead code that covered "info -c -o help" case once
Peter Rajnoha [Wed, 29 Jul 2015 11:10:31 +0000 (13:10 +0200)]
dmsetup: remove dead code that covered "info -c -o help" case once

The "-o help" is now handled as implicit field and it gets processed
just like any other field - all handled by libdevmapper now.

9 years agocache: fix regression causing some PVs to bypass filters
Peter Rajnoha [Wed, 29 Jul 2015 07:43:03 +0000 (09:43 +0200)]
cache: fix regression causing some PVs to bypass filters

This is a regression introduced by commit
6c0e44d5a2e82aa160d48e83992e7ca342bc4bdf which changed
the way dev_cache_get fn works - before this patch, when a
device was not found, it fired a full rescan to correct the
cache. However, the change coming with that commit missed
this full_rescan call, causing the lvmcache to still contain
info about PVs which should be filtered now.

Such situation may have happened by coincidence of using
old persistent cache (/etc/lvm/cache/.cache) which does not
reflect the actual state anymore, a device name/symlink which
now points to a device which should be filtered and a fact we
keep info about usable DM devices in .cache no matter what
the filter setting is.

This bug could be hidden though by changes introduced in
commit f1a000a477558e157532d5f2cd2f9c9139d4f87c as it
calls full_rescan earlier before this problem is hit.
But we need to fix this anyway for the dev_cache_get
to be correct if we happen to use the same code path
again somewhere sometime.

For example, simple reproducer was (before commit
1a000a477558e157532d5f2cd2f9c9139d4f87c):

- /dev/sda contains a PV header with UUID y5PzRD-RBAv-7sBx-V3SP-vDmy-DeSq-GUh65M

- lvm.conf: filter = [ "r|.*|" ]

- rm -f .cache (to start with clean state)

- dmsetup create test --table "0 8388608 linear /dev/sda 0" (8388608 is
  just the size of the /dev/sda device I use in the reproducer)

- pvs (this will create .cache file which contains
  "/dev/disk/by-id/lvm-pv-uuid-y5PzRD-RBAv-7sBx-V3SP-vDmy-DeSq-GUh65M"
  as well as "/dev/mapper/test" and the target node "/dev/dm-1" - all the
  usable DM mappings (and their symlinks) get into the .cache file even
  though the filter "is set to "ignore all" - we do this - so far it's OK)

- dmsetup remove test (so we end up with /dev/disk/by-id/lvm-pv-uuid-...
  pointing to the /dev/sda now since it's the underlying device
  containing the actual PV header)

- now calling "pvs" with such .cache file and we get:
$ pvs
  PV                                                                 VG  Fmt  Attr PSize PFree
  /dev/disk/by-id/lvm-pv-uuid-y5PzRD-RBAv-7sBx-V3SP-vDmy-DeSq-GUh65M vg  lvm2 a--  4.00g    0

Even though we have set filter = [ "r|.*|" ] in the lvm.conf file!

9 years agolibdm: Add dm_size_to_string to libdevmapper.
Alasdair G Kergon [Mon, 27 Jul 2015 20:30:20 +0000 (21:30 +0100)]
libdm: Add dm_size_to_string to libdevmapper.

Moved out from lib/display and a little documentation added.
It's tuned to LVM's requirements historically and its behaviour
might not always be what you would expect.

9 years agolvmlockd: Drop -lrt now handled by configure.
Alasdair G Kergon [Mon, 27 Jul 2015 13:53:08 +0000 (14:53 +0100)]
lvmlockd: Drop -lrt now handled by configure.

9 years agoconfigure: Enable realtime by default, if present.
Alasdair G Kergon [Mon, 27 Jul 2015 13:44:58 +0000 (14:44 +0100)]
configure: Enable realtime by default, if present.

9 years agoconfigure: Add missing checks.
Alasdair G Kergon [Mon, 27 Jul 2015 13:26:56 +0000 (14:26 +0100)]
configure: Add missing checks.

9 years agogitignore: Update for in-place build.
Alasdair G Kergon [Mon, 27 Jul 2015 12:18:35 +0000 (13:18 +0100)]
gitignore: Update for in-place build.

9 years agopost-release
Alasdair G Kergon [Fri, 24 Jul 2015 22:39:54 +0000 (23:39 +0100)]
post-release

9 years agopost-release
Alasdair G Kergon [Fri, 24 Jul 2015 22:21:51 +0000 (23:21 +0100)]
post-release

9 years agopre-release v2_02_126
Alasdair G Kergon [Fri, 24 Jul 2015 22:20:42 +0000 (23:20 +0100)]
pre-release

9 years agotools: Streamline long option hyphen removal.
Alasdair G Kergon [Fri, 24 Jul 2015 18:45:49 +0000 (19:45 +0100)]
tools: Streamline long option hyphen removal.

9 years agolockd: remove an unreachable global lock condition
David Teigland [Thu, 23 Jul 2015 16:00:03 +0000 (11:00 -0500)]
lockd: remove an unreachable global lock condition

There is no longer an "enable" option for the global lock,
so remove the bit of code that was checking for it.  It
was an optional variation anyway, and not one that was likely
to be used.

Also update the corresponding comment describing global lock
creation.

9 years agoFix dehyphenation cases
David Teigland [Fri, 24 Jul 2015 15:25:13 +0000 (10:25 -0500)]
Fix dehyphenation cases

Stop removing hyphens when = is seen.  With an option
like --profile=thin-performance, the hyphen removal
will stop at = and will not remove - after thin.

Stop removing hyphens altogether when a stand alone arg
of -- appears.

9 years agoclvmd: Fix freeze if client dies holding locks.
Alasdair G Kergon [Thu, 23 Jul 2015 22:10:16 +0000 (23:10 +0100)]
clvmd: Fix freeze if client dies holding locks.

Simply running concurrent copies of 'pvscan | true' is enough to make
clvmd freeze: pvscan exits on the EPIPE without first releasing the
global lock.

clvmd notices the client disappear but because the cleanup code that
releases the locks is triggered from within some processing after the
next select() returns, and that processing can 'break' after doing just
one action, it sometimes never releases the locks to other clients.

Move the cleanup code before the select.
Check all fds after select().
Improve some debug messages and warn in the unlikely event that
select() capacity could soon be exceeded.

9 years agolvmlockd: improve check for duplicate global locks
David Teigland [Thu, 23 Jul 2015 15:34:24 +0000 (10:34 -0500)]
lvmlockd: improve check for duplicate global locks

When there are duplicate global locks, check if the gl
is still enabled each time a gl or vg lock is acquired
in the lockspace.  Once one of the duplicates is disabled,
then other hosts will recognize that the issue is resolved
without needing to restart the lockspaces.

9 years agolibdm: Use wrappers for all malloc functions.
Alasdair G Kergon [Wed, 22 Jul 2015 22:03:32 +0000 (23:03 +0100)]
libdm: Use wrappers for all malloc functions.

Move the DEBUG_MEM decision inside libdevmapper.so instead of exposing
it in libdevmapper.h which causes failures if the binary and library
were compiled with opposite debugging settings.

9 years agopvscan: skip autoactivation for lockd VGs
David Teigland [Wed, 22 Jul 2015 19:53:46 +0000 (14:53 -0500)]
pvscan: skip autoactivation for lockd VGs

pvscan autoactivation does not work for lockd VGs because
lock start is needed on a lockd VG before locking can be
done for it.  Add a check to skip the attempt at autoactivate
rather than calling it, knowing it will fail.

Add a comment explaining why pvscan --cache works fine for
lockd VGs without locks, and why autoactivate is not done.

9 years agolvconvert: merge polling fixes for lockd
David Teigland [Wed, 22 Jul 2015 16:42:57 +0000 (11:42 -0500)]
lvconvert: merge polling fixes for lockd

. the poll check will eventually call finish which will
  write the VG, so an ex VG lock is needed from lvmlockd.

. fix missing unlock on poll error path

. remove the lockd locking while monitoring the progress
  of the command, as suggested by the earlier FIXME comment,
  as it's not needed.

9 years agoconfig: add CFG_SECTION_NO_CHECK flag
Peter Rajnoha [Wed, 22 Jul 2015 12:19:07 +0000 (14:19 +0200)]
config: add CFG_SECTION_NO_CHECK flag

The CFG_SECTION_NO_CHECK flag can be used to mark a section
and its whole subtree as containing settings where checks
won't be made (lvmconfig --validate).

These are setting where we don't know the names and and type
in advance and they're recognized in runtime. As we don't know
the type and name in advance, we can't do any checks here
of course.

Use this flag with great care as it disables config checks
for the whole config subtree found under such section.

This flag is going to be used by subsequent patches from
Zdenek to support some cache settings...

9 years agolvconvert: remove unused struct members
Ondrej Kozina [Wed, 22 Jul 2015 10:56:43 +0000 (12:56 +0200)]
lvconvert: remove unused struct members

9 years agolvconvert: retain retcode consistency
Ondrej Kozina [Wed, 22 Jul 2015 10:26:28 +0000 (12:26 +0200)]
lvconvert: retain retcode consistency

Always return the highest retcode caught during convert command
(regression in commit ae88bf03a1d109a342a8ad31196c3ef8fa1a5b65).
Also minor code cleanup.

9 years agolvconvert: fix polling outside of core lvconvert
David Teigland [Wed, 15 Jul 2015 18:02:54 +0000 (13:02 -0500)]
lvconvert: fix polling outside of core lvconvert

Recent change to move the polling outside of core lvconvert
code was wrongly using 'lv' and 'vg' structs which can't be
used outside of the core code, which caused seg fault.

Properly isolate all use of lv structs within the core of
the lvconvert code, saving any information necessary,
(esp lvid).  After the core of lvconvert is done, use
the saved information to do polling.

FIXME: the need for is_merging_origin and is_merging_origin_thin
in this patch is ugly, and a cleaner way should be found to deal
with that than what is done here.

Also it effectively removed all hacks in _lvconvert_merge_single
performing ugly: VG reread, unlock, polling, lock sequence.

Moreover all polling operations are postponed after all conversions
are finished.

lvm2 (while locking via lvmlockd) should now be able to run with
or without lvmpolld while performing poll operations originating
in lvconvert command.

Signed-off-by: Ondrej Kozina <okozina@redhat.com>
9 years agowiping: add "Wiping skipped." for the message context to be complete
Peter Rajnoha [Tue, 21 Jul 2015 09:00:43 +0000 (11:00 +0200)]
wiping: add "Wiping skipped." for the message context to be complete

9 years agowiping: log_warn instead of log_error if blkid wipe ignored for a signature
Peter Rajnoha [Tue, 21 Jul 2015 08:34:04 +0000 (10:34 +0200)]
wiping: log_warn instead of log_error if blkid wipe ignored for a signature

Comply with the rules we have for log_error and log_warn...

$ pvcreate /dev/sda1
  Failed to get offset of the xfs_external_log signature on /dev/sda1.
  1 existing signature left on the device.
  Aborting pvcreate on /dev/sda1.

$ pvcreate /dev/sda1 --force
  WARNING: Failed to get offset of the xfs_external_log signature on /dev/sda1.
  Physical volume "/dev/sda1" successfully created

9 years agowiping: ignore errors during detection if use_blkid_wiping=1 and --force is used
Peter Rajnoha [Tue, 21 Jul 2015 07:54:20 +0000 (09:54 +0200)]
wiping: ignore errors during detection if use_blkid_wiping=1 and --force is used

libblkid may return the list of signatures found, but it may not
provide offset and size for each signature detected. This may
happen in case signatures are mixed up or there are more, possibly
overlapping, signatures found.

Make lvm commands pass if such situation happens and we're using
--force (or any stronger force method).

For example:

$ pvcreate /dev/sda1
  Failed to get offset of the xfs_external_log signature on /dev/sda1.
  1 existing signature left on the device.
  Aborting pvcreate on /dev/sda1.

$ pvcreate --force /dev/sda1
  Failed to get offset of the xfs_external_log signature on /dev/sda1.
  Physical volume "/dev/sda1" successfully created

9 years agolog: Add DM_ABORT_ON_INTERNAL_ERRORS lvm override.
Alasdair G Kergon [Mon, 20 Jul 2015 14:48:59 +0000 (15:48 +0100)]
log: Add DM_ABORT_ON_INTERNAL_ERRORS lvm override.

Recognise DM_ABORT_ON_INTERNAL_ERRORS in the lvm logging function as
well as the default dm function it replaces.

9 years agovgchange/lvchange: enforce the shared VG lock from lvmlockd
David Teigland [Fri, 17 Jul 2015 20:13:22 +0000 (15:13 -0500)]
vgchange/lvchange: enforce the shared VG lock from lvmlockd

The vgchange/lvchange activation commands read the VG, and
don't write it, so they acquire a shared VG lock from lvmlockd.
When other commands fail to acquire a shared VG lock from
lvmlockd, a warning is printed and they continue without it.
(Without it, the VG metadata they display from lvmetad may
not be up to date.)

vgchange/lvchange -a shouldn't continue without the shared
lock for a couple reasons:

. Usually they will just continue on and fail to acquire the
  LV locks for activation, so continuing is pointless.

. More importantly, without the sh VG lock, the VG metadata
  used by the command may be stale, and the LV locks shown
  in the VG metadata may no longer be current.  In the
  case of sanlock, this would result in odd, unpredictable
  errors when lvmlockd doesn't find the expected lock on
  disk.  In the case of dlm, the invalid LV lock could be
  granted for the non-existing LV.

The solution is to not continue after the shared lock fails,
in the same way that a command fails if an exclusive lock fails.

9 years agotest: Help, default and relative paths in runner
Marian Csontos [Wed, 15 Jul 2015 12:20:37 +0000 (14:20 +0200)]
test: Help, default and relative paths in runner

Add help message.
Handle relative paths first.
Use `.` for OUTDIR instead of `/` if empty.

9 years agotest: Fix hardcoded /usr/share in testsuite
Marian Csontos [Tue, 14 Jul 2015 18:27:31 +0000 (20:27 +0200)]
test: Fix hardcoded /usr/share in testsuite

9 years agolvmlockd: improve errors when lvm is built without a lock manager
David Teigland [Thu, 16 Jul 2015 21:28:57 +0000 (16:28 -0500)]
lvmlockd: improve errors when lvm is built without a lock manager

When lvmlockd is compiled without support for one of the
lock managers (sanlock or dlm), and a command tries to use
one of them, explain that in the error message.

9 years agotest: Ignore known concurrent VG clvmd failure.
Alasdair G Kergon [Fri, 17 Jul 2015 11:56:52 +0000 (12:56 +0100)]
test: Ignore known concurrent VG clvmd failure.

Don't abort test when clvmd processes two VGs concurrently.
  CLVMD: ioctl/libdm-iface.c:1940   Internal error: Performing unsafe table load while 3 device(s) are known to be suspended:  (253:19)

9 years agolockd: fix error cases when built without lvmlockd
David Teigland [Thu, 16 Jul 2015 20:12:07 +0000 (15:12 -0500)]
lockd: fix error cases when built without lvmlockd

When lvm is built without lvmlockd support, vgcreate using a
shared lock type would succeed and create a local VG (the
--shared option was effectively ignored).  Make it fail.

Fix the same issue when using vgchange to change a VG to a
shared lock type.

Make the error messages consistent.

9 years agoalloc: Fix lvextend failure when varying stripes.
Alasdair G Kergon [Wed, 15 Jul 2015 22:12:54 +0000 (23:12 +0100)]
alloc: Fix lvextend failure when varying stripes.

A segfault was reported when extending an LV with a smaller number of
stripes than originally used.  Under unusual circumstances, the cling
detection code could successfully find a match against the excess
stripe positions and think it had finished prematurely leading to an
allocation being pursued with a length of zero.

Rename ix_offset to num_positional_areas and move it to struct
alloc_state so that _is_condition() can obtain access to it.

In _is_condition(), areas_size can no longer be assumed to match the
number of positional slots being filled so check this newly-exposed
num_positional_areas directly instead.  If the slot is outside the
range we are trying to fill, just ignore the match for now.

(Also note that the code still only performs cling detection against
the first segment of the LV.)

9 years agovgimport: fix the all VGs case
David Teigland [Wed, 15 Jul 2015 14:26:10 +0000 (09:26 -0500)]
vgimport: fix the all VGs case

The ALL_VGS_IS_DEFAULT flag was wrongly removed;
it is needed for vgimport -a to work.

9 years agovgexport: fix the all VGs case
David Teigland [Wed, 15 Jul 2015 14:21:45 +0000 (09:21 -0500)]
vgexport: fix the all VGs case

The ALL_VGS_IS_DEFAULT flag was wrongly removed;
it is needed for vgexport -a to work.

9 years agoconfig: make a difference between "not found" and "is empty" in log msg for devices...
Peter Rajnoha [Wed, 15 Jul 2015 14:14:07 +0000 (16:14 +0200)]
config: make a difference between "not found" and "is empty" in log msg for devices/preferred_names

Replace misleading "not found" in the log message when
devices/preferred_names is set to empty array:

Really not found:
device/dev-cache.c:689   devices/preferred_names not found in config: using built-in preferences

Found, but empty:
config/config.c:1431   Setting devices/preferred_names to preferred_names = [ ]
device/dev-cache.c:689   devices/preferred_names is empty: using built-in preferences

9 years agoconfig: also log the value used if defined in config, not just defaults
Peter Rajnoha [Wed, 15 Jul 2015 13:57:29 +0000 (15:57 +0200)]
config: also log the value used if defined in config, not just defaults

Commit 7e728fe1a164cc5d4f64e46fcfcbb224c22b2457 added a log call
directly in find_config_tree_array when defaults are used.

This patch also adds the log for the value which is found in
existing configuration and for which defaults are not used.

For example:

Defaults used:
config/config.c:1428   devices/scan not found in config: defaulting to scan = [ "/dev" ]

Value defined in configuration used:
config/config.c:1431   Setting devices/scan to scan = [ "/dev", "/mydev", "/abc" ]

This makes the logging consistent with the other find_config_tree_* functions.

9 years agocleanup: drop unused header file
Zdenek Kabelac [Fri, 10 Jul 2015 09:16:11 +0000 (11:16 +0200)]
cleanup: drop unused header file

9 years agocleanup: avoid double assign
Zdenek Kabelac [Fri, 10 Jul 2015 09:16:23 +0000 (11:16 +0200)]
cleanup: avoid double assign

Variable n1 is assigned without using n1 before.

9 years agocleanup: drop duplicated seg test
Zdenek Kabelac [Fri, 10 Jul 2015 11:51:15 +0000 (13:51 +0200)]
cleanup: drop duplicated seg test

Test is already in seg_is_pool() if branch.
and one minor indent fix.

9 years agomakefiles: adding target for generating ctags
Zdenek Kabelac [Fri, 2 Oct 2009 10:09:02 +0000 (12:09 +0200)]
makefiles: adding target for generating ctags

make tags generates traditional tags ctags ref list.

9 years agocache: enhance cache-pool validation
Zdenek Kabelac [Tue, 14 Jul 2015 07:58:37 +0000 (09:58 +0200)]
cache: enhance cache-pool validation

Capture cache-pool without cache policy name set.

9 years agocache: capture missing policy name
Zdenek Kabelac [Wed, 15 Jul 2015 08:54:49 +0000 (10:54 +0200)]
cache: capture missing policy name

Policy name has to be always defined.
Capture it as an internal error before write.
When reading metadata without defined policy name, use default defined policy.

TODO: Unsure, but it might have to be actually always 'mq' in this case.

9 years agocache: handle policy_name separately
Zdenek Kabelac [Wed, 15 Jul 2015 09:06:40 +0000 (11:06 +0200)]
cache: handle policy_name separately

Keep policy name separate from policy settings and avoid
to mangling and demangling this string from same config tree.
Ensure policy_name is always defined.

9 years agocache: move setting of cache policy
Zdenek Kabelac [Tue, 14 Jul 2015 07:57:34 +0000 (09:57 +0200)]
cache: move setting of cache policy

Set policy before saving 1st. metadata and avoid unnecessary reload.
Fixes problem when we stored cache-pool without cache-policy set.

9 years agothin: fix warning for overprovisioning
Zdenek Kabelac [Mon, 13 Jul 2015 09:08:49 +0000 (11:08 +0200)]
thin: fix warning for overprovisioning

When lvm.conf is properly configure for auto resize of overprovisioned
thin-pool volume, avoid showing any warning (2.02.124).

9 years agoconfig: use find_config_tree_array for all arrays
Peter Rajnoha [Wed, 15 Jul 2015 08:52:23 +0000 (10:52 +0200)]
config: use find_config_tree_array for all arrays

Use find_config_tree_array for all config arrays. Also, add
INTERNAL_ERROR in case there should have been at least default
value defined for a setting but it was not returned for some
reason (either config_settings.h misconfiguration or other config
tree error printed by functions called by find_config_tree_array).

9 years agoconfig: add "defaulting to" message in case we fall back to defaults in find_config_t...
Peter Rajnoha [Wed, 15 Jul 2015 08:50:57 +0000 (10:50 +0200)]
config: add "defaulting to" message in case we fall back to defaults in find_config_tree_array

9 years agometadata: change function name to _allow_extra_system_id
David Teigland [Tue, 14 Jul 2015 19:42:18 +0000 (14:42 -0500)]
metadata: change function name to _allow_extra_system_id

The previous name was misleading since this is not the
primary system_id check, only the "extra" check.

9 years agovgchange: fix lock-start filtering and waiting
David Teigland [Tue, 14 Jul 2015 19:30:01 +0000 (14:30 -0500)]
vgchange: fix lock-start filtering and waiting

Both lock_start filters were being skipped when any lock-opt
values were used.  The "auto" lock-opt should cause the
auto_lock_start_list to be used.  The lock_start_list should
always be used.

The behavior of lock_start_list/auto_lock_start_list are tested
and verified to behave like volume_list/auto_activation_volume_list.

Since the default was changed to wait for lock-start to finish,
the "wait" and "autowait" lock-opt values are not needed, but a
new "autonowait" is added to the existing "nowait" avoid the
default waiting.

9 years agolockd: fix error message after a failing to get lock
David Teigland [Tue, 14 Jul 2015 16:36:04 +0000 (11:36 -0500)]
lockd: fix error message after a failing to get lock

There are two different failure conditions detected in
access_vg_lock_type() that should have different error
messages.  This adds another failure flag so the two
cases can be distinguished to avoid printing a misleading
error message.

9 years agoconfig: {thin,cache}_{check,repair}_options are never undefined
Peter Rajnoha [Tue, 14 Jul 2015 08:03:19 +0000 (10:03 +0200)]
config: {thin,cache}_{check,repair}_options are never undefined

Require global/{thin,cache}_{check,repair}_options to be always defined.
If not defined directly by user in the configuration and if there's no
concrete default option to use, make "" (empty string) the default one -
it's then clearly visible in the "lvmconfig --type default" (and
generated lvm.conf) and also it makes its handling in the code more
straightforward so we don't need to handle undefined values.

This means, if there are no default values for these settings defined,
we end up with this generated now:
  {thin,cache}_{check,repair}_options = [ "" ]

So the value is never undefined and if it is, it's an error.

(The cache_repair_options is actually not used in the code at the moment,
but once the code using this setting is in, it will follow the same logic
as used for thin_repair_options.)

9 years agoman lvmlockd: update method for changing lock type
David Teigland [Mon, 13 Jul 2015 21:33:58 +0000 (16:33 -0500)]
man lvmlockd: update method for changing lock type

The old description did not work.

9 years agolockd: allow vgexport and vgimport
David Teigland [Mon, 13 Jul 2015 18:48:39 +0000 (13:48 -0500)]
lockd: allow vgexport and vgimport

The "exported" state of the VG can be useful with lockd VGs
because the exported state keeps a VG from being used in general.
It's a way to keep a VG protected and out of the way.

Also fix the command flags: ALL_VGS_IS_DEFAULT is not true for
vgimport/vgexport, since they both return errors immediately if
no VG args are specified.  LOCKD_VG_SH is not true for vgexport
beause it must use an ex lock to write the VG.

9 years agolockd: allow nolocking and readonly options
David Teigland [Fri, 10 Jul 2015 22:20:22 +0000 (17:20 -0500)]
lockd: allow nolocking and readonly options

When --nolocking is used (by vgs, lvs, pvs):

. don't use lvmlockd at all (set use_lvmlockd to 0)
. allow lockd VGs to be read

When --readonly is used (by vgs, lvs, pvs, vgdisplay, lvdisplay,
pvdisplay, lvmdiskscan, lvscan, pvscan, vgcfgbackup):

. skip actual lvmlockd locking calls
. allow lockd VGs to be read
. check that only shared gl/vg locks are being requested
  (even though the actually locking is being skipped)
. check that no LV locks are requested, because no LVs
  should be activated or used in readonly mode
. disable using lvmetad so VGs are read from disk

It is important to note the limited commands that accept
the --nolocking and --readonly options, i.e. no commands
that change/write a VG or change/activate LVs accept these
options, only commands that read VGs.

9 years agovgexport: do not allow lockd VG to be exported
David Teigland [Fri, 10 Jul 2015 18:49:51 +0000 (13:49 -0500)]
vgexport: do not allow lockd VG to be exported

vgexport and vgimport have no use for a shared VG.

9 years agolockd: note that external origins don't work in lockd VGs
David Teigland [Fri, 10 Jul 2015 18:27:02 +0000 (13:27 -0500)]
lockd: note that external origins don't work in lockd VGs

in a comment at the point where it fails, and in the
lvmlockd man page.

9 years agovgchange: allow changing to lockd type when mirrors exist
David Teigland [Fri, 10 Jul 2015 16:48:50 +0000 (11:48 -0500)]
vgchange: allow changing to lockd type when mirrors exist

and update lvmlockd man page to reflect the fact that
mirror LVs work correctly in lockd VGs.

9 years agolvconvert: disallow splitting in lockd VGs
David Teigland [Fri, 10 Jul 2015 16:46:24 +0000 (11:46 -0500)]
lvconvert: disallow splitting in lockd VGs

A new lockd lock needs to be created for the new LV
created by split mirror and split snapshot.  Disallow
these options in lockd VGs until that is implemented.

9 years agolockd: disable part of lock_args validation
David Teigland [Fri, 10 Jul 2015 16:41:29 +0000 (11:41 -0500)]
lockd: disable part of lock_args validation

There are at least a couple instances where
the lock_args check does not work correctly,
(listed in the comment), so disable the
NULL check for lock_args until those are
resolved.

9 years agolvmpolld: Fix segfault on 32 bit architectures
Marian Csontos [Fri, 10 Jul 2015 09:50:06 +0000 (11:50 +0200)]
lvmpolld: Fix segfault on 32 bit architectures

Explicit conversions are needed to align writes and reads on the stack.
int64_t is popped from stack while int was pushed.

9 years agotest: Fix syntax error in prepare_devs
Marian Csontos [Fri, 10 Jul 2015 12:59:15 +0000 (14:59 +0200)]
test: Fix syntax error in prepare_devs

9 years agometadata: fix duplicated LV flag
David Teigland [Thu, 9 Jul 2015 22:02:30 +0000 (17:02 -0500)]
metadata: fix duplicated LV flag

LOCKD_SANLOCK_LV was using the WRITEMOSTLY flag instead of a new one.

9 years agovgchange: fix disallowed LV types in lockd VG
David Teigland [Thu, 9 Jul 2015 21:34:23 +0000 (16:34 -0500)]
vgchange: fix disallowed LV types in lockd VG

cow snapshots work in lockd VG (they were wrongly
disallowed), but mirror type LVs do not yet work in
lockd VGs (they were wrongly allowed).

9 years agopvcreate: remove recent warning message
David Teigland [Thu, 9 Jul 2015 20:26:32 +0000 (15:26 -0500)]
pvcreate: remove recent warning message

log_warn was added recently because no known code used
the given condition, but running pvcreate on an existing
PV uses this case, and should not produce a warning.

9 years agometadata: add comments describing lock_args for lvmlockd
David Teigland [Thu, 9 Jul 2015 20:14:19 +0000 (15:14 -0500)]
metadata: add comments describing lock_args for lvmlockd

9 years agometadata: vg_validate lock_args
David Teigland [Thu, 9 Jul 2015 18:24:28 +0000 (13:24 -0500)]
metadata: vg_validate lock_args

9 years agocoverity: cleanup related to lvmlockd
David Teigland [Thu, 9 Jul 2015 16:28:59 +0000 (11:28 -0500)]
coverity: cleanup related to lvmlockd

A couple missing mutex unlock on error bugs.
A bunch of buffer size/termination warnings.

9 years agolibdaemon: config_make_nodes_v needs fixing
Peter Rajnoha [Thu, 9 Jul 2015 14:34:02 +0000 (16:34 +0200)]
libdaemon: config_make_nodes_v needs fixing

Put the change from commit #10d27998b3d2f6100e9e29e83d1d99948c55875f
back so we have working tree again for now. This code needs a bit of
a cleanup to return proper return value to check...

9 years agocoverity: missing return value checks
Peter Rajnoha [Thu, 9 Jul 2015 13:15:15 +0000 (15:15 +0200)]
coverity: missing return value checks

9 years agocoverity: missing return value for dm_split_lvm_name pass proper DM name instead...
Peter Rajnoha [Thu, 9 Jul 2015 11:11:57 +0000 (13:11 +0200)]
coverity: missing return value for dm_split_lvm_name pass proper DM name instead of NULL value

9 years agocoverity: fix possible invalid dereferences
Peter Rajnoha [Thu, 9 Jul 2015 10:07:34 +0000 (12:07 +0200)]
coverity: fix possible invalid dereferences

lib/format1/import-export.c:167: var_deref_op: Dereferencing null pointer "vg->lvm1_system_id"
lib/cache/lvmetad.c:1023: var_deref_op: Dereferencing null pointer "this"
daemons/lvmlockd/lvmlockd-core.c:2659: check_after_deref: Null-checking "act" suggests that it may be null, but it has already been dereferenced on all paths leading to the check
/daemons/lvmetad/lvmetad-core.c:1024: check_after_deref: Null-checking "pvmeta" suggests that it may be null, but it has already been dereferenced on all paths leading to the check

9 years agolvmconf: fix ignored --startstopservices in lvmconf ... --mirrorservice on systemd
Peter Rajnoha [Thu, 9 Jul 2015 08:35:41 +0000 (10:35 +0200)]
lvmconf: fix ignored --startstopservices in lvmconf ... --mirrorservice on systemd

If running lvmconf ... --startstopservice --mirrorservice in systemd
environment, handle lvm2-cmirrord accordingly. A typo in the script
caused the lvm2-cmirrord to not start/stop immediately, it was
only enabled/disabled (so the --startstopservice was ignored in this
case).

This page took 0.07796 seconds and 5 git commands to generate.