]> sourceware.org Git - lvm2.git/log
lvm2.git
9 years agolibdm: add dm_report_column_headings
Bryn M. Reeves [Fri, 7 Aug 2015 17:11:23 +0000 (18:11 +0100)]
libdm: add dm_report_column_headings

Add a function to print column headings regardless of whether they
have already been output. This will be used by dmstats to issue
periodic reminders of the column headings.

This patch removes a check for RH_HEADINGS_PRINTED from
_report_headings that prevents headings being displayed if the flag
is already set; this check is redundant since the only existing
caller (_output_as_columns()) already tests the flag before
calling the function.

9 years agolibdm: fix report rows and headings memory and state leaks
Bryn M. Reeves [Fri, 7 Aug 2015 16:08:54 +0000 (17:08 +0100)]
libdm: fix report rows and headings memory and state leaks

Not releasing objects back to the pool is fine for short-lived
pools since the memory will be freed when dm_pool_destroy() is
called.

Any pool that may be long-lived needs to be more careful to free
objects back to the pool to avoid leaking memory that will not be
reclaimed until the pool is destroyed at process exit time.

The report pool currently leaks each headings line and some row
data.

Although dm_report_output() tries to free the first allocated row
this may end up freeing a later row due to sorting of the row list
while reporting. Store a pointer to the first allocated row from
_do_report_obect() instead and free this at the end of
_output_as_columns(), _output_as_rows(), and dm_report_clear().

Also make sure to call dm_pool_free() for the headings line built
in _report_headings().

When dmstats is introduced it will maintain dm_report objects for
the whole lifetime of the process: without these changes a stats
report could leak around 600k in 10m (exact rate depends on field
selection and data values):

 top - 12:11:32 up 4 days,  3:16, 15 users,  load average: 0.01, 0.12, 0.14
  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 6473 root      20   0  130196   3124   2792 S   0.0  0.0   0:00.00 dmstats

 top - 12:22:04 up 4 days,  3:26, 15 users,  load average: 0.06, 0.11, 0.13
  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 6498 root      20   0  130836   3712   2752 S   0.0  0.0   0:00.60 dmstats

With this patch no increase in RSS is seen:

 top - 13:54:58 up 4 days,  4:59, 15 users,  load average: 0.12, 0.14, 0.14
  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
13962 root      20   0  130196   2996   2688 S   0.0  0.0   0:00.00 dmstats

 top - 14:04:31 up 4 days,  5:09, 15 users,  load average: 1.02, 0.67, 0.36
  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
13962 root      20   0  130196   2996   2688 S   0.3  0.0   0:00.32 dmstats

This also affects report output for repeating reports in the
DM_REPORT_OUTPUT_COLUMNS_AS_ROWS case; row state is not fully cleared for
the next iteration leading to progressive growth of the heading width:

vg_hex-lv_home:vg_hex-lv_swap:vg_hex-lv_root:luks-79733921-3f68-4c92-9eb7-d0aca4c6ba3e:vg_hex-lv_images
253:253:253:253:253
2:0:1:4:3
L--w:L--w:L--w:L--w:L--w
1:2:1:1:1
3:1:1:1:2
0:0:0:0:0
LVM-9t8ITqLZa6AuuyVoz5Olp1KwF9ZDBfOiv08BCGvF4WsJSqWUDUt7qtf2hEmjtVvo:LVM-9t8ITqLZa6AuuyVoz5Olp1KwF9ZDBfOiKf7XIiwdAYOJfaGhQe9fu26cTEICGgFS:LVM-9t8ITqLZa6AuuyVoz5Olp1KwF9ZDBfOiEZj7ZXbmrWDuGhd7vvi88VF0NdTMG8iA:CRYPT-LUKS1-797339213f684c929eb7d0aca4c6ba3e-luks-79733921-3f68-4c92-9eb7-d0aca4c6ba3e:LVM-9t8ITqLZa6AuuyVoz5Olp1KwF9ZDBfOi2rKredlBPnw2X7v1BiCuEpFo6gaE7BRw

:::::vg_hex-lv_home:vg_hex-lv_swap:vg_hex-lv_root:luks-79733921-3f68-4c92-9eb7-d0aca4c6ba3e:vg_hex-lv_images
:::::253:253:253:253:253
:::::2:0:1:4:3
:::::L--w:L--w:L--w:L--w:L--w
:::::1:2:1:1:1
:::::3:1:1:1:2
:::::0:0:0:0:0
:::::LVM-9t8ITqLZa6AuuyVoz5Olp1KwF9ZDBfOiv08BCGvF4WsJSqWUDUt7qtf2hEmjtVvo:LVM-9t8ITqLZa6AuuyVoz5Olp1KwF9ZDBfOiKf7XIiwdAYOJfaGhQe9fu26cTEICGgFS:LVM-9t8ITqLZa6AuuyVoz5Olp1KwF9ZDBfOiEZj7ZXbmrWDuGhd7vvi88VF0NdTMG8iA:CRYPT-LUKS1-797339213f684c929eb7d0aca4c6ba3e-luks-79733921-3f68-4c92-9eb7-d0aca4c6ba3e:LVM-9t8ITqLZa6AuuyVoz5Olp1KwF9ZDBfOi2rKredlBPnw2X7v1BiCuEpFo6gaE7BRw

9 years agolibdm: ensure new dm_timestamp objects are initialized
Bryn M. Reeves [Fri, 7 Aug 2015 12:10:34 +0000 (13:10 +0100)]
libdm: ensure new dm_timestamp objects are initialized

Allocate a dm_timestamp with dm_zalloc() to ensure the memory is
initialized to a known state.

9 years agoman: mention system ID in vgexport and vgimport
David Teigland [Fri, 7 Aug 2015 21:35:07 +0000 (16:35 -0500)]
man: mention system ID in vgexport and vgimport

9 years agoman: add lockd bits to relevant commands
David Teigland [Fri, 7 Aug 2015 21:25:00 +0000 (16:25 -0500)]
man: add lockd bits to relevant commands

9 years agoman lvmlockd: update
David Teigland [Fri, 7 Aug 2015 20:18:44 +0000 (15:18 -0500)]
man lvmlockd: update

9 years agoman lvmcache: mention LVs must be in the same VG
David Teigland [Thu, 6 Aug 2015 15:05:12 +0000 (10:05 -0500)]
man lvmcache: mention LVs must be in the same VG

9 years agolvmlockd: handle loss of sanlock lease storage
David Teigland [Fri, 31 Jul 2015 18:38:38 +0000 (13:38 -0500)]
lvmlockd: handle loss of sanlock lease storage

This adds the infrastructure, code paths, error reporting,
etc. to handle storage errors, or storage loss, under the
sanlock leases in a VG that is being used.  The loss of
storage means sanlock cannot renew its leases, which means
that the host needs to stop using the shared VG before its
leases expire.

This still requires manually shutting down a VG that has
lost lease storage, e.g. unmounting file systems,
deactivating LVs in the VG.  The next step is to
automatically use a command like blkdeactivate to do that.

9 years agodmsetup: Report timestamps of ioctls with -vvv.
Alasdair G Kergon [Wed, 5 Aug 2015 07:28:35 +0000 (08:28 +0100)]
dmsetup: Report timestamps of ioctls with -vvv.

If enabled, record timestamp immediately after the ioctl() returns.

9 years agolibdm: Whitespace.
Alasdair G Kergon [Wed, 5 Aug 2015 04:21:58 +0000 (05:21 +0100)]
libdm: Whitespace.

9 years agolibdm: Whitespace.
Alasdair G Kergon [Wed, 5 Aug 2015 04:11:42 +0000 (05:11 +0100)]
libdm: Whitespace.

9 years agolibdm: Sort new exported symbols.
Alasdair G Kergon [Wed, 5 Aug 2015 04:07:45 +0000 (05:07 +0100)]
libdm: Sort new exported symbols.

9 years agodmsetup: Tidy whitespace.
Alasdair G Kergon [Wed, 5 Aug 2015 04:03:33 +0000 (05:03 +0100)]
dmsetup: Tidy whitespace.

9 years agoman: document --nameprefixes
Peter Rajnoha [Tue, 4 Aug 2015 12:03:50 +0000 (14:03 +0200)]
man: document --nameprefixes

9 years agocoverity: check vg->lvm1_system_id is not NULL before calling strncmp with that
Peter Rajnoha [Tue, 4 Aug 2015 08:16:45 +0000 (10:16 +0200)]
coverity: check vg->lvm1_system_id is not NULL before calling strncmp with that

lib/format1/import-export.c:167: var_deref_model: Passing null pointer "vg->lvm1_system_id" to "strncmp", which dereferences it.

9 years agocoverity: variable init must be done before its use
Peter Rajnoha [Tue, 4 Aug 2015 07:51:16 +0000 (09:51 +0200)]
coverity: variable init must be done before its use

tools/polldaemon.c:465: uninit_use_in_call: Using uninitialized value "id.vg_name" when calling "print_log".
tools/polldaemon.c:465: uninit_use_in_call: Using uninitialized value "id.lv_name" when calling "print_log".

9 years agocoverity: return value check in lvmlockd-dlm
Peter Rajnoha [Tue, 4 Aug 2015 07:49:23 +0000 (09:49 +0200)]
coverity: return value check in lvmlockd-dlm

daemons/lvmlockd/lvmlockd-dlm.c:647: check_return: Calling "closedir" without checking return value (as is done elsewhere 13 out of 14 times).

9 years agocoverity: fix cppcheck warnings
Peter Rajnoha [Tue, 4 Aug 2015 07:33:55 +0000 (09:33 +0200)]
coverity: fix cppcheck warnings

/lib/log/log.c:88: warning[invalidScanfArgType_int]: %llu in format string (no. 2) requires 'unsigned long long *' but the argument type is 'long long *'.
daemons/lvmlockd/lvmlockd-core.c:791: error[uninitstring]: Dangerous usage of 'version' (strncpy doesn't always null-terminate it).

9 years agocoverity: fix possible resource leak in lvmpolld-core
Peter Rajnoha [Tue, 4 Aug 2015 07:25:40 +0000 (09:25 +0200)]
coverity: fix possible resource leak in lvmpolld-core

/daemons/lvmpolld/lvmpolld-core.c:573: leaked_storage: Variable "cmdargv" going out of scope leaks the storage it points to.

9 years agoreport: also recognize variants without underscores for <prefix>_all fields
Peter Rajnoha [Tue, 4 Aug 2015 07:03:31 +0000 (09:03 +0200)]
report: also recognize variants without underscores for <prefix>_all fields

For example: "pvs -o pv_all" and pvs -o pvall" are same.

9 years agolvmlockd: automatically remove the dlm global lockspace
David Teigland [Fri, 31 Jul 2015 21:45:43 +0000 (16:45 -0500)]
lvmlockd: automatically remove the dlm global lockspace

The dlm global lockspace is automatically added when the
first dlm VG lockspace is added.  Reverse this by removing
the dlm global lockspace after the last dlm VG lockspace
is removed.  (Remove old non-working code that did this
based on an old command that could explicitly add/remove
the dlm global lockspace.)

9 years agoreport: update comment for _is_same_field fn
Peter Rajnoha [Mon, 3 Aug 2015 14:47:02 +0000 (16:47 +0200)]
report: update comment for _is_same_field fn

9 years agoreport: recognize report field name variants without any underscores too
Peter Rajnoha [Mon, 3 Aug 2015 14:29:50 +0000 (16:29 +0200)]
report: recognize report field name variants without any underscores too

Whenver reporting field name is registered with libdevmapper and if
the field name contains any number of underscores ('_'), libdm
can now automatically recognize any of its variant without any
underscores used.

For example:

..for underscores in prefixes:
  pvs -o pv_name
  pvs -o name
  pvs -o pvname (newly recognized besides pvname)

..for underscores in the name:
  lvs -o cache_mode
  lvs -o cachemode

..or even multiple underscores:
  pvs -o pv___na___me

It's all variant of the same field name.

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.

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