]> sourceware.org Git - lvm2.git/log
lvm2.git
3 years agovdo: better message for missing device
Zdenek Kabelac [Wed, 1 Sep 2021 13:46:04 +0000 (15:46 +0200)]
vdo: better message for missing device

Show readable message when passed device cannot be accessed.
And use STAT shell var wrapper to call 'stat' command.

3 years agovdo: lvm_import_vdo fix max_discard size
Zdenek Kabelac [Mon, 6 Sep 2021 12:57:43 +0000 (14:57 +0200)]
vdo: lvm_import_vdo fix max_discard size

Use correct 4K units in lvm2 for max_discard VDO option.

3 years agovdo: add support for auto-unsafe writePolicy
Zdenek Kabelac [Mon, 6 Sep 2021 11:56:40 +0000 (13:56 +0200)]
vdo: add support for auto-unsafe writePolicy

This vdoWritePolicy policy missed matching support in lvm2.

3 years agotests: remove all debug logs when using die
Zdenek Kabelac [Mon, 6 Sep 2021 12:59:10 +0000 (14:59 +0200)]
tests: remove all debug logs when using die

Since die is called from a shell script, there is no need
to report any recent lvm2 command debug traces.

3 years agomakefiles: sanitize environment
Zdenek Kabelac [Fri, 3 Sep 2021 17:31:44 +0000 (19:31 +0200)]
makefiles: sanitize environment

Compilation needs to generate 'C' locale sorted command file
definitions. To always enforce 'C' sorting rules user LC_ALL
instead of LANG, as  LANG settings can be overuled by
other LC settings like LC_COLLATE and may result into miscompiled
lvm2 binary if locales ordering differs from 'C'.

Reported-by: jmp-lvm2@ookaze.fr
3 years agovdo: fixes
Zdenek Kabelac [Tue, 31 Aug 2021 18:52:26 +0000 (20:52 +0200)]
vdo: fixes

Better identify VDO device with major:minor.
Handle different LV name from originally converted origin LV.
Improve --dry-run handling.

3 years agovdo: support lvcreate with skipped activation
Zdenek Kabelac [Tue, 31 Aug 2021 19:34:06 +0000 (21:34 +0200)]
vdo: support lvcreate with skipped activation

Support creation of VDO LV for 'lvcreate -ky...'.

3 years agovdo: fix conversion of large virtual sizes
Zdenek Kabelac [Mon, 30 Aug 2021 16:12:59 +0000 (18:12 +0200)]
vdo: fix conversion of large virtual sizes

Properly accept virtual sizes above 2TiB.

3 years agovdo: skip zeroing for VDO LV
Zdenek Kabelac [Thu, 26 Aug 2021 21:04:56 +0000 (23:04 +0200)]
vdo: skip zeroing for VDO LV

Since VDO is always returns 'zero' on unprovisioned read
and every provisioned block is always 'zeroed' on partial writes,
we can avoid 'zeroing' of such LVs.

3 years agocov: lvmlockd read_adopt_file free structs on error path
David Teigland [Mon, 30 Aug 2021 18:48:42 +0000 (13:48 -0500)]
cov: lvmlockd read_adopt_file free structs on error path

3 years agopvremove: apply devices file
David Teigland [Fri, 27 Aug 2021 19:48:33 +0000 (14:48 -0500)]
pvremove: apply devices file

pvremove was wrongly allowed to operate on a device
not listed in the devices file.

3 years agovdo: rename vdoimport to lvm_import_vdo
Zdenek Kabelac [Mon, 23 Aug 2021 12:02:42 +0000 (14:02 +0200)]
vdo: rename vdoimport to lvm_import_vdo

Missed bits in previous rename commits.

3 years agospec: Rename vdoimport to lvm_import_vdo. dev-mcsontos-rename-vdoimport
Marian Csontos [Thu, 26 Aug 2021 14:54:26 +0000 (16:54 +0200)]
spec: Rename vdoimport to lvm_import_vdo.

3 years agovdo: Rename vdoimport to lvm_import_vdo.
Marian Csontos [Thu, 26 Aug 2021 14:53:33 +0000 (16:53 +0200)]
vdo: Rename vdoimport to lvm_import_vdo.

3 years agodevices: restrict device id types to specific major numbers
David Teigland [Mon, 23 Aug 2021 20:01:26 +0000 (15:01 -0500)]
devices: restrict device id types to specific major numbers

Some device id types can only be used with specific device major
numbers, so use this restriction to avoid some comparisions.
This is more efficient, and can avoid some incorrect matches.

3 years agoadd missing sys/file.h include
Alex Xu (Hello71) [Mon, 23 Aug 2021 14:24:45 +0000 (09:24 -0500)]
add missing sys/file.h include

required for LOCK_EX etc on musl

3 years agovgimportclone: fix when duplicates are both in the devices file
David Teigland [Fri, 20 Aug 2021 20:06:33 +0000 (15:06 -0500)]
vgimportclone: fix when duplicates are both in the devices file

Fix case where duplicate PVs are created (e.g. with dd) from
devices that are both already in the devices file.

3 years agodevices file: recognize old locking_type 0
David Teigland [Fri, 20 Aug 2021 15:32:16 +0000 (10:32 -0500)]
devices file: recognize old locking_type 0

if the old locking_type is 0, set cmd->nolocking so that
it will be applied to the devices file lock.

3 years agologging: messages for found metadata
David Teigland [Thu, 19 Aug 2021 20:07:05 +0000 (15:07 -0500)]
logging: messages for found metadata

3 years agodevices: apply ignorelockingfailure to devices file lock
David Teigland [Thu, 19 Aug 2021 17:57:31 +0000 (12:57 -0500)]
devices: apply ignorelockingfailure to devices file lock

3 years agotests: adjust for check_devicesfile
David Teigland [Wed, 18 Aug 2021 21:23:48 +0000 (16:23 -0500)]
tests: adjust for check_devicesfile

3 years agolvmdevices: check yes option for adding duplicate
David Teigland [Wed, 18 Aug 2021 21:26:11 +0000 (16:26 -0500)]
lvmdevices: check yes option for adding duplicate

3 years agocov: clean up pvid and vgid usage
David Teigland [Tue, 3 Aug 2021 20:32:33 +0000 (15:32 -0500)]
cov: clean up pvid and vgid usage

pvid and vgid are sometimes a null-terminated string, and
other times a 'struct id', and the two types were often
cast between each other.  When a struct id was cast to a char
pointer, the resulting string would not necessarily be null
terminated.  Casting a null-terminated string id to a
struct id is fine, but is still avoided when possible.

A struct id is:  int8_t uuid[ID_LEN]
A string id is:  char pvid[ID_LEN + 1]

A convention is introduced to help distinguish them:

- variables and struct fields named "pvid" or "vgid"
  should be null-terminated strings.

- variables and struct fields named "pv_id" or "vg_id"
  should be struct id's.

- examples:
  char pvid[ID_LEN + 1];
  char vgid[ID_LEN + 1];
  struct id pv_id;
  struct id vg_id;

Function names also attempt to follow this convention.

Avoid casting between the two types as much as possible,
with limited exceptions when known to be safe and clearly
commented.

Avoid using variations of strcpy and strcmp, and instead
use memcpy/memcmp with ID_LEN (with similar limited
exceptions possible.)

3 years agocov: lvmlockd: rewrite string copies to avoid warnings
David Teigland [Mon, 2 Aug 2021 22:22:45 +0000 (17:22 -0500)]
cov: lvmlockd: rewrite string copies to avoid warnings

- Use a new function for all instances of copying
  a null-terminated string into a fixed size struct
  field that is not null-terminated.

- use memcpy when copying between struct fields of
  the same size

3 years agolvchange: fix lvchange refresh failed for dm suspend or resume failed
Yi Wang [Fri, 13 Aug 2021 05:49:13 +0000 (13:49 +0800)]
lvchange: fix lvchange refresh failed for dm suspend or resume failed

When multiple lvchange refresh processes executed at the same time,
suspend/resume ioctl on the same dm, some of these commands will be failed
for dm aready change status, and ioctl will return EINVAL in _do_dm_ioctl function.
to avoid this problem, add READ_FOR_ACTIVATE flags in lvchange refresh process,
it will hold LCK_WRITE lock and avoid suspend/resume dm at the same time.

Signed-off-by: Long YunJian <long.yunjian@zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
3 years agotoolcontext.h: use bit field in struct
David Teigland [Thu, 12 Aug 2021 20:51:43 +0000 (15:51 -0500)]
toolcontext.h: use bit field in struct

Two recent additions should have used a bit instead
of an entire int.

3 years agopost-release
Marian Csontos [Wed, 11 Aug 2021 15:15:51 +0000 (17:15 +0200)]
post-release

3 years agopre-release v2_03_13
Marian Csontos [Wed, 11 Aug 2021 15:14:26 +0000 (17:14 +0200)]
pre-release

3 years agoWHATS_NEW: update
Marian Csontos [Tue, 10 Aug 2021 12:19:24 +0000 (14:19 +0200)]
WHATS_NEW: update

3 years agomake: generate
root [Thu, 5 Aug 2021 19:38:43 +0000 (21:38 +0200)]
make: generate

3 years agopvscan: only match devices file for command args
David Teigland [Wed, 4 Aug 2021 17:04:03 +0000 (12:04 -0500)]
pvscan: only match devices file for command args

Avoid matching all devices with the devices file to
avoid delays during startup.

3 years agodevices file: avoid updating entry dev names in some cases
David Teigland [Tue, 27 Jul 2021 21:56:20 +0000 (16:56 -0500)]
devices file: avoid updating entry dev names in some cases

Avoid thrashing changes to devices file device names by
some commands that are run during startup when devnames
are still being set up.

3 years agodevices file: limit warnings about devices file entries not found
David Teigland [Tue, 27 Jul 2021 20:28:34 +0000 (15:28 -0500)]
devices file: limit warnings about devices file entries not found

All commands were printing a warning if a devices file
entry was not found.  Limit this to commands that report/display
lvm state.

3 years agocov: lvmlockd path copy
David Teigland [Mon, 2 Aug 2021 20:49:39 +0000 (15:49 -0500)]
cov: lvmlockd path copy

3 years agodebug: stack tracing on error path
Zdenek Kabelac [Tue, 27 Jul 2021 20:52:23 +0000 (22:52 +0200)]
debug: stack tracing on error path

3 years agocov: add initilizer
Zdenek Kabelac [Tue, 27 Jul 2021 20:39:16 +0000 (22:39 +0200)]
cov: add initilizer

3 years agocov: add explicit check for vg existence
Zdenek Kabelac [Tue, 27 Jul 2021 15:03:38 +0000 (17:03 +0200)]
cov: add explicit check for vg existence

Since we check !vg - add check before accessing ->status.

3 years agocov: raid: no more checks with missing areas
Zdenek Kabelac [Tue, 27 Jul 2021 15:01:17 +0000 (17:01 +0200)]
cov: raid: no more checks with missing areas

Since ->areas is directly dereferenced we need to stop
validation right here.

3 years agocov: dev-mpath: check config_wwids_file
Zdenek Kabelac [Tue, 27 Jul 2021 14:57:39 +0000 (16:57 +0200)]
cov: dev-mpath: check config_wwids_file

Since config_wwids_file is checked for NULL,
test is also before calling _read_wwid_file()
that is directly dereferencing it.

3 years agocov: guard index
Zdenek Kabelac [Tue, 27 Jul 2021 13:53:48 +0000 (15:53 +0200)]
cov: guard index

Analyzer wants explicit protect to not underflow index.

3 years agocov: ensure bufffe size is at least 5
Zdenek Kabelac [Tue, 27 Jul 2021 13:43:23 +0000 (15:43 +0200)]
cov: ensure bufffe size is at least 5

Analyzer can now see, the buffer size will have at least 5 chars
on succefull path.

3 years agocov: add internal error for missing arg
Zdenek Kabelac [Tue, 27 Jul 2021 13:40:26 +0000 (15:40 +0200)]
cov: add internal error for missing arg

Analyzer is happier.

3 years agocov: remove unneeded includes
Zdenek Kabelac [Tue, 27 Jul 2021 13:04:09 +0000 (15:04 +0200)]
cov: remove unneeded includes

3 years agocov: memleak dir descriptor
Zdenek Kabelac [Tue, 27 Jul 2021 13:36:48 +0000 (15:36 +0200)]
cov: memleak dir descriptor

opendir() missed closedir().

3 years agopvck: ensure buffer is 0 terminated
Zdenek Kabelac [Tue, 27 Jul 2021 13:12:56 +0000 (15:12 +0200)]
pvck: ensure buffer is 0 terminated

Since readed metadata buffer is passed to printf(),
ensure the buffer is '\0' terminated.

3 years agocov: pvck fix memleak
Zdenek Kabelac [Tue, 27 Jul 2021 20:52:08 +0000 (22:52 +0200)]
cov: pvck fix memleak

Fix memory leaks on error paths for allocated
path and backup_file name by converting allocation to
dm_pool_alloc  and also change devicefile structure to contain
embeded  path as last struct member - so we could allocate
only needed string size  instead of PATH_MAX from pool.

TODO: still to be fixed 'mf' struct.

3 years agotests: extend vgmerge testing
Zdenek Kabelac [Fri, 23 Jul 2021 14:34:50 +0000 (16:34 +0200)]
tests: extend vgmerge testing

3 years agovgmerge: support option --poolmetadataspare
Zdenek Kabelac [Fri, 23 Jul 2021 14:32:35 +0000 (16:32 +0200)]
vgmerge: support option --poolmetadataspare

3 years agovgmerge: remove one of merge pmspare LVs
Zdenek Kabelac [Fri, 23 Jul 2021 14:31:11 +0000 (16:31 +0200)]
vgmerge: remove one of merge pmspare LVs

When merging 2 VG, where both of them have pmspare volume,
select the bigger one and remove the other.

3 years agowritecache: use block size 512 for thin pool data
David Teigland [Wed, 21 Jul 2021 19:10:38 +0000 (14:10 -0500)]
writecache: use block size 512 for thin pool data

Recent commit 84bd394cf9aaa581b4bf980f764544dda26a0305
  "writecache: use block size 4096 when no fs is found"

failed to account for the case where writecache is attached
to thin pool data.  Checking fs block size on the thin pool
data LV is wrong, and checking the fs block on each thin LV
would be impractical, so default to 512 which cannot break
any existing file systems, and require the user to specify
4k when appropriate.

3 years agowritecache: fix missing sync_dev_names when attaching cache
David Teigland [Wed, 21 Jul 2021 18:16:21 +0000 (13:16 -0500)]
writecache: fix missing sync_dev_names when attaching cache

When activating an LV to check the fs block size, wait for
the LV dev to be accessible before running blkid on it.

3 years agospec: Add vdoimport man page
Marian Csontos [Wed, 21 Jul 2021 14:40:27 +0000 (16:40 +0200)]
spec: Add vdoimport man page

3 years agotest
Zdenek Kabelac [Tue, 20 Jul 2021 20:37:54 +0000 (22:37 +0200)]
test

3 years agovgsplit: add support for option --poolmetadataspare
Zdenek Kabelac [Tue, 20 Jul 2021 20:33:05 +0000 (22:33 +0200)]
vgsplit: add support for option --poolmetadataspare

When splitting VG with thin/cache pool volume, handle pmspare during
such split and allocate new pmspare in new VG or extend existing pmspare
there and eventually drop  pmspare in original VG if is no longer needed
there.

3 years agovgremove: remove forgotten pmspare
Zdenek Kabelac [Tue, 20 Jul 2021 20:28:13 +0000 (22:28 +0200)]
vgremove: remove forgotten pmspare

As pmspare is an invisible LV it's not getting automatically removed
since vgremove removes only visible LVs and it depending LVs.
If there was no other thin/cache pool volume, such pmspare stayed
undeleted and caused command failure.

So handle explicitelly such forgotten pmspare and remove it.

3 years agothin: fix component detection of external origin
Zdenek Kabelac [Wed, 14 Jul 2021 10:53:47 +0000 (12:53 +0200)]
thin: fix component detection of external origin

When check active componet of thinLV with external origin,
we need to check if the external origin isn't already active.
For this however we need to use layered check for -real device.

3 years agopvscan: narrow the previous commit slightly
David Teigland [Tue, 13 Jul 2021 21:26:36 +0000 (16:26 -0500)]
pvscan: narrow the previous commit slightly

to avoid change to pvscan-autoactivate.sh

3 years agopvscan: do nothing for device removal and event_activation=0
David Teigland [Tue, 13 Jul 2021 20:34:05 +0000 (15:34 -0500)]
pvscan: do nothing for device removal and event_activation=0

The lvm2-pvscan service runs pvscan --cache -aay <dev> for
device addition, and pvscan --cache <dev> on device removal.
For event_activation=0, the addition does nothing.  Fix
device removal to also do nothing for event_activation=0.
Device removal was previously doing some work to process
the removal which slowed down stopping lvm2-pvscan services.

3 years agofix multipath component detection for multiple holders
David Teigland [Fri, 9 Jul 2021 20:05:11 +0000 (15:05 -0500)]
fix multipath component detection for multiple holders

sysfs-based multipath component detection quit if a
device had multiple holders, and in this case would
fail to detect a device was an mpath component.

3 years agofilter-usable: remove udev dev size check
David Teigland [Tue, 15 Jun 2021 16:22:32 +0000 (11:22 -0500)]
filter-usable: remove udev dev size check

For the pv_min_size check, always use dev_get_size()
which is commonly used elsewhere, and don't bother
asking libudev for the device size when
external_device_info_source=udev.

3 years agodevices: rework libudev usage
David Teigland [Tue, 8 Jun 2021 22:12:09 +0000 (17:12 -0500)]
devices: rework libudev usage

related to config settings:
  obtain_device_info_from_udev (controls if lvm gets
    a list of devices from readdir /dev or from libudev)
  external_device_info_source (controls if lvm asks
    libudev for device information)

. Make the obtain_device_list_from_udev setting
  affect only the choice of readdir /dev vs libudev.
  The setting no longer controls if udev is used for
  device type checks.

. Change obtain_device_list_from_udev default to 0.
  This helps avoid boot timeouts due to slow libudev
  queries, avoids reported failures from
  udev_enumerate_scan_devices, and avoids delays from
  "device not initialized in udev database" errors.
  Even without errors, for a system booting with 1024 PVs,
  lvm2-pvscan times improve from about 100 sec to 15 sec,
  and the pvscan command from about 64 sec to about 4 sec.

. For external_device_info_source="none", remove all
  libudev device info queries, and use only lvm
  native device info.

. For external_device_info_source="udev", first check
  lvm native device info, then check libudev info.

. Remove sleep/retry loop when attempting libudev
  queries for device info.  udev info will simply
  be skipped if it's not immediately available.

. Only set up a libdev connection if it will be used by
  obtain_device_list_from_udev/external_device_info_source.

. For native multipath component detection, use
  /etc/multipath/wwids.  If a device has a wwid
  matching an entry in the wwids file, then it's
  considered a multipath component.  This is
  necessary to natively detect multipath
  components when the mpath device is not set up.

3 years agotoolcontext: fix double free (core dumped) issue
Heming Zhao [Mon, 12 Jul 2021 19:01:00 +0000 (03:01 +0800)]
toolcontext: fix double free (core dumped) issue

How to trigger:

```
~ # export LVM_SYSTEM_DIR=_
~ # pvscan
  No matching physical volumes found
double free or corruption (!prev)
Aborted (core dumped)
```

when LVM_SYSTEM_DIR is empty, _load_config_file() won't be called.

when LVM_SYSTEM_DIR is not empty, cfl->cft links into cmd->config_files
by _load_config_file()@lib/commands/toolcontext.c

core dumped code: _destroy_config()@lib/commands/toolcontext.c

```
    /* CONFIG_FILE/CONFIG_MERGED_FILES */
    if ((cft = remove_config_tree_by_source(cmd, CONFIG_MERGED_FILES)))
        config_destroy(cft);
    else if ((cft = remove_config_tree_by_source(cmd, CONFIG_FILE)))
        config_destroy(cft); <=== first free the cft

    dm_list_iterate_items(cfl, &cmd->config_files)
        config_destroy(cfl->cft); <=== double free the cft
```

Fixes: c43f2f8ae08ed0555a300764c8644ea56f4f41e2
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
3 years agoskip indexing devices used by LVs in more commands
David Teigland [Wed, 7 Jul 2021 21:59:56 +0000 (16:59 -0500)]
skip indexing devices used by LVs in more commands

expands commit d5a06f9a7df5a43b2e2311db62ff8d3011217d74
  "pvscan: skip indexing devices used by LVs"

The dev cache index is expensive and slow, so limit it
to commands that are used to observe the state of lvm.
The index is only used to print warnings about incorrect
device use by active LVs, e.g. if an LV is using a
multipath component device instead of the multipath
device.  Commands that continue to use the index and
print the warnings:

  fullreport, lvmdiskscan, vgs, lvs, pvs,
  vgdisplay, lvdisplay, pvdisplay,
  vgscan, lvscan, pvscan (excluding --cache)

A couple other commands were borrowing the DEV_USED_FOR_LV
flag to just check if a device was actively in use by LVs.
These are converted to the new dev_is_used_by_active_lv().

3 years agoman: vdoimport page
Zdenek Kabelac [Fri, 9 Jul 2021 18:50:40 +0000 (20:50 +0200)]
man: vdoimport page

3 years agovdo: add vdoimport support
Zdenek Kabelac [Fri, 9 Jul 2021 12:44:07 +0000 (14:44 +0200)]
vdo: add vdoimport support

Add tool 'vdoimport' to support easy conversion of an existing VDO manager managed
VDO volumes into lvm2 managed VDO LV.

When physical converted volume is already a logical volume, conversion
happens with the VG itself, just with validation for extent_size, so
the virtually sized logical VDO volume size can be expressed in extents.

Example of basic simple usage:

vdoimport --name vg/vdolv  /dev/mapper/vdophysicalvolume

3 years agoconfigure: updates
Zdenek Kabelac [Fri, 9 Jul 2021 12:42:26 +0000 (14:42 +0200)]
configure: updates

3 years agopvscan: skip indexing devices used by LVs
David Teigland [Thu, 1 Jul 2021 22:25:43 +0000 (17:25 -0500)]
pvscan: skip indexing devices used by LVs

dev_cache_index_devs() is taking a large amount of time
when there are many PVs.  The index keeps track of
devices that are currently in use by active LVs.  This
info is used to print warnings for users in some limited
cases.

The checks/warnings that are enabled by the index are not
needed by pvscan --cache, so disable it in this case.

This may be expanded to other cases in future commits.
dev_cache_index_devs should also be improved in another
commit to avoid the extreme delays with many devices.

3 years agoscan: move metadata vgname check
David Teigland [Tue, 29 Jun 2021 17:40:03 +0000 (12:40 -0500)]
scan: move metadata vgname check

There have been two separate checks for metadata
validity: first that the metadata text begins with
a valid VG name, and second the checksum of the
metadata text.  These happen in different places,
which means there have been two separate error paths
for invalid metadata.  This also causes large metadata
to be read in multiple parts, the first part is read
just to check the vgname, and then remaining parts are
read later when the full metadata is needed.

This patch moves the vg name verification so it's
done just before the checksum verification, which
results in a single error path for invalid metadata,
and causes the entire metadata to be read together
rather that in parts from different parts of the code.

3 years agoscan: retry reading metadata on error
David Teigland [Mon, 28 Jun 2021 23:10:47 +0000 (18:10 -0500)]
scan: retry reading metadata on error

If label_scan encounters bad vg metadata, invalidate
bcache data for the device and reread the mda_header
and metadata text back to back.  With concurrent commands
modifying large metadata, it's possible that the entire
metadata area can be rewritten in the time between a
command reading the mda_header and reading the metadata
text that the header points to.  Since the label_scan
is just assembling an initial overview of devices, it
doesn't use locking to serialize with other commands
that may be modifying the vg metadata at the same time.

3 years agoscan: don't hold bcache block during scan
David Teigland [Mon, 28 Jun 2021 22:09:09 +0000 (17:09 -0500)]
scan: don't hold bcache block during scan

This allows data from the bcache block to be
invalidated and reread if needed.

3 years agotests: skip tests that require blkid BLOCK_SIZE
David Teigland [Wed, 30 Jun 2021 16:56:42 +0000 (11:56 -0500)]
tests: skip tests that require blkid BLOCK_SIZE

Recent commit 84bd394cf9aaa581b4bf980f764544dda26a0305
  "writecache: use block size 4096 when no fs is found"

changed the default writecache block size from 512 to 4096
when no file system is detected.  The fs block size detection
requires the libblkid BLOCK_SIZE feature, so skip tests on
systems without this.  Otherwise, 4096 writecache added to
512 xfs leads fs io or mount failures.

3 years agoWHATS_NEW: update
Zdenek Kabelac [Mon, 28 Jun 2021 18:38:54 +0000 (20:38 +0200)]
WHATS_NEW: update

3 years agomake: generate
Zdenek Kabelac [Mon, 28 Jun 2021 16:10:41 +0000 (18:10 +0200)]
make: generate

3 years agovdo: support vdo_pool_header_size
Zdenek Kabelac [Mon, 28 Jun 2021 15:53:08 +0000 (17:53 +0200)]
vdo: support vdo_pool_header_size

Add profilable configurable setting for vdo pool header size, that is
used as 'extra' empty space at the front and end of vdo-pool device
to avoid having a disk in the system the may have same data is real
vdo LV.

For some conversion cases however we may need to allow using '0' header size.

TODO: in this case we may eventually avoid adding 'linear' mapping layer
in future - but this requires further modification over lvm code base.

3 years agovdo: rename variable vdo_pool_zero
Zdenek Kabelac [Mon, 28 Jun 2021 15:54:55 +0000 (17:54 +0200)]
vdo: rename variable vdo_pool_zero

Match rest of code.

3 years agolvconvert: fix vdo virtual size when specified
Zdenek Kabelac [Mon, 28 Jun 2021 16:12:19 +0000 (18:12 +0200)]
lvconvert: fix vdo virtual size when specified

Correctly use virtual size specified by:
lvconvert --type vdo-pool --virtualsize

3 years agoconfig_settings: typo fix
Zdenek Kabelac [Mon, 28 Jun 2021 15:48:01 +0000 (17:48 +0200)]
config_settings: typo fix

3 years agodevice_id: handle qemu wwid
David Teigland [Thu, 24 Jun 2021 16:30:46 +0000 (11:30 -0500)]
device_id: handle qemu wwid

Ignore made-up wwid values reported for qemu devices
that contain the string "QEMU HARDDISK".  The devname
will be used as the device id.

3 years agowritecache: use block size 4096 when no fs is found
David Teigland [Wed, 23 Jun 2021 17:38:57 +0000 (12:38 -0500)]
writecache: use block size 4096 when no fs is found

When there is no block size constraint from a file system
or from a user setting, use 4096 rather than 512 because of
better performance.

3 years agodevice_id: handle scsi_debug wwid
David Teigland [Tue, 22 Jun 2021 18:36:10 +0000 (13:36 -0500)]
device_id: handle scsi_debug wwid

Ignore the wwid value reported by scsi_debug devices
that begin "t10.Linux   scsi_debug".  The devname
will be used as the device id.

3 years agolvconvert: allow writecache with other thinpool command syntax
David Teigland [Thu, 17 Jun 2021 21:15:18 +0000 (16:15 -0500)]
lvconvert: allow writecache with other thinpool command syntax

"lvconvert --thinpool LV" should allow LV to have a writecache,
but there was an extra type check preventing it.

3 years agolvmdbusd: Wrap json.load in try/except
Tony Asleson [Tue, 15 Jun 2021 03:04:09 +0000 (22:04 -0500)]
lvmdbusd: Wrap json.load in try/except

In testing where we inject large amounts of additional output in stderr
we can occassionally get truncated stdout from lvm.  Catching and dumping
the json for debug before we re-raise the exception.  As this doesn't
happen without the error injecting wrapper around lvm, the error seems to
be with the wrapper.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
3 years agolvmdbusd: Handle arbitrary amounts stdout & stderr
Tony Asleson [Fri, 11 Jun 2021 15:35:31 +0000 (10:35 -0500)]
lvmdbusd: Handle arbitrary amounts stdout & stderr

When exec'ing lvm, it's possible to get large amounts of both stdout
and stderr depending on the state of lvm and the size of the lvm
configuration.  If we allow any of the buffers to fill we can end
up deadlocking the process.  Ensure we are handling stdout & stderr
during lvm execution.

Ref. https://bugzilla.redhat.com/show_bug.cgi?id=1966636

Signed-off-by: Tony Asleson <tasleson@redhat.com>
3 years agocoverity cleanups
David Teigland [Wed, 16 Jun 2021 18:22:54 +0000 (13:22 -0500)]
coverity cleanups

3 years agolvmdbusd: Defer dbus object removal
Tony Asleson [Thu, 10 Jun 2021 18:38:38 +0000 (13:38 -0500)]
lvmdbusd: Defer dbus object removal

When we are walking the new lvm state comparing it to the old state we can
run into an issue where we remove a VG that is no longer present from the
object manager, but is still needed by LVs that are left to be processed.
When we try to process existing LVs to see if their state needs to be
updated, or if they need to be removed, we need to be able to reference the
VG that was associated with it.  However, if it's been removed from the
object manager we fail to find it which results in:

Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/lvmdbusd/utils.py", line 666, in _run
  self.rc = self.f(*self.args)
File "/usr/lib/python3.6/site-packages/lvmdbusd/fetch.py", line 36, in _main_thread_load
  cache_refresh=False)[1]
File "/usr/lib/python3.6/site-packages/lvmdbusd/lv.py", line 146, in load_lvs
  lv_name, object_path, refresh, emit_signal, cache_refresh)
File "/usr/lib/python3.6/site-packages/lvmdbusd/loader.py", line 68, in common
  num_changes += dbus_object.refresh(object_state=o)
File "/usr/lib/python3.6/site-packages/lvmdbusd/automatedproperties.py", line 160, in refresh
  search = self.lvm_id
File "/usr/lib/python3.6/site-packages/lvmdbusd/lv.py", line 483, in lvm_id
  return self.state.lvm_id
File "/usr/lib/python3.6/site-packages/lvmdbusd/lv.py", line 173, in lvm_id
  return "%s/%s" % (self.vg_name_lookup(), self.Name)
File "/usr/lib/python3.6/site-packages/lvmdbusd/lv.py", line 169, in vg_name_lookup
  return cfg.om.get_object_by_path(self.Vg).Name

Instead of removing objects from the object manager immediately, we will
keep them in a list and remove them once we have processed all of the state.

Ref:
https://bugzilla.redhat.com/show_bug.cgi?id=1968752

3 years agolvmdbusd: Don't setup search key unless needed
Tony Asleson [Thu, 10 Jun 2021 18:26:15 +0000 (13:26 -0500)]
lvmdbusd: Don't setup search key unless needed

self.lvm_id is a property which actually executes some code which doesn't
need to be executed everytime.

3 years agotests: Fix building for IDM program
Leo Yan [Wed, 16 Jun 2021 13:44:27 +0000 (21:44 +0800)]
tests: Fix building for IDM program

When execute IDM testing, the command reports error:

  /usr/bin/install: cannot stat ‘lib/idm_inject_failure’: No such file
  or directory

Since there have a stale program in my local environment, thus Makefile
always uses the stale program and doesn't report any issue.  In the
brand new repository, it doesn't contain an idm_inject_failure program,
and Makefile doesn't build it without specifying the dependency, thus
the test command complaints the file 'idm_inject_failure' is not found.

This patch adds the dependency 'lib/idm_inject_failure' for IDM testing,
so it can firstly build the injection program and dismiss the error.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
3 years agotests: stress: Change to use $SHARED for vgcreate
Leo Yan [Wed, 16 Jun 2021 13:43:54 +0000 (21:43 +0800)]
tests: stress: Change to use $SHARED for vgcreate

Use the variable $SHARED to replace "--shared" for vgcreate commands.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
3 years agotests: fix skip in stress_single_thread.sh
David Teigland [Wed, 16 Jun 2021 14:37:04 +0000 (09:37 -0500)]
tests: fix skip in stress_single_thread.sh

3 years agotests: add some LVM_TEST_LOCK_TYPE_IDM
David Teigland [Tue, 15 Jun 2021 19:02:18 +0000 (14:02 -0500)]
tests: add some LVM_TEST_LOCK_TYPE_IDM

3 years agolvmdevices: add deviceidtype option
David Teigland [Tue, 8 Jun 2021 19:49:34 +0000 (14:49 -0500)]
lvmdevices: add deviceidtype option

When adding a device to the devices file with --adddev, lvm
by default chooses the best device ID type for the new device.
The new --deviceidtype option allows the user to override the
built in preference.  This is useful if there's a problem with
the default type, or if a secondary type is preferrable.

If the specified deviceidtype does not produce a device ID,
then lvm falls back to the preference it would otherwise use.

3 years agopvck: add lock_global() before clean_hint_file()
Wu Guanghao [Fri, 11 Jun 2021 15:18:56 +0000 (10:18 -0500)]
pvck: add lock_global() before clean_hint_file()

Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
3 years agoarchive: avoid abuse of internal flag
Zdenek Kabelac [Wed, 9 Jun 2021 14:16:26 +0000 (16:16 +0200)]
archive: avoid abuse of internal flag

Since archive is now postponned we use internal variable 'changed'
to mark we need to commit new metadata.

3 years agobackup: automatically store data on vg_unlock
Zdenek Kabelac [Tue, 8 Jun 2021 17:39:15 +0000 (19:39 +0200)]
backup: automatically store data on vg_unlock

Previously there have been necessary explicit call of backup (often
either forgotten or over-used). With this patch the necessity to
store backup is remember at vg_commit and once the VG is unlocked,
the committed metadata are automatically store in backup file.

This may possibly alter some printed messages from command when the
backup is now taken later.

3 years agoarchiving: take archive automatically
Zdenek Kabelac [Tue, 8 Jun 2021 17:02:07 +0000 (19:02 +0200)]
archiving: take archive automatically

Instead of calling explicit archive with command processing logic,
move this step towards 1st. vg_write() call, which will automatically
store archive of committed metadata.

This slightly changes some error path where the error in archiving
was detected earlier in the command, while now some on going command
'actions' might have been, but will be simply scratched in case
of error (since even new metadata would not have been even written).

So general effect should be only some command message ordering.

3 years agoman/help: fix common option listing
David Teigland [Tue, 8 Jun 2021 19:07:39 +0000 (14:07 -0500)]
man/help: fix common option listing

3 years agodevices: don't use deleted loop backing file for device id
David Teigland [Tue, 8 Jun 2021 17:16:06 +0000 (12:16 -0500)]
devices: don't use deleted loop backing file for device id

check for "(deleted)" in the backing_file string and
fall back to devname for id.

$ cat /sys/block/loop0/loop/backing_file
/root/looptmp (deleted)

3 years agolvmlockd: Fix the compilation warning
Leo Yan [Tue, 8 Jun 2021 06:45:09 +0000 (14:45 +0800)]
lvmlockd: Fix the compilation warning

As SUSE build tool reports the warning:

lvmlockd-core.c: In function 'client_thread_main':
lvmlockd-core.c:4959:37: warning: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 6 [-Wformat-truncation=]
    snprintf(buf, sizeof(buf), "path[%d]", i);
                                     ^~
lvmlockd-core.c:4959:31: note: directive argument in the range [0, 2147483647]
    snprintf(buf, sizeof(buf), "path[%d]", i);
                               ^~~~~~~~~~

To dismiss the compilation warning, enlarge the array "buf" to 17
bytes to support the max signed integer: string format 6 bytes + signed
integer 10 bytes + terminal char "\0".

Reported-by: Heming Zhao <heming.zhao@suse.com>
Signed-off-by: Leo Yan <leo.yan@linaro.org>
3 years agotests: add writecache-cache-blocksize-2
David Teigland [Mon, 7 Jun 2021 20:40:40 +0000 (15:40 -0500)]
tests: add writecache-cache-blocksize-2

inconsistent physical block size of devs used
for main LV and cache

3 years agotests: rename test
David Teigland [Mon, 7 Jun 2021 17:12:33 +0000 (12:12 -0500)]
tests: rename test

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