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

17760 Commits

Author SHA1 Message Date
Zdenek Kabelac
a14371e495 cov: hide false positive warning
Here we have valid use case of strncpy() which just need
to fill precise buffer size - so no explicit \0 on buffer
end is needed.
2021-09-13 12:34:41 +02:00
Zdenek Kabelac
63930f576a cov: add some initializers 2021-09-13 12:34:41 +02:00
Zdenek Kabelac
f5f1cdfa70 cov: initilized more struct members
For some hypothetical path, make these vars defined.
2021-09-13 12:34:41 +02:00
Zdenek Kabelac
a8ee13900d cov: initialize attr 2021-09-13 12:34:41 +02:00
Zdenek Kabelac
be1c2a1ae2 cov: keep time calculation ready for 2038
Be prepared ;) and keep arithmetic 64bit ready.
2021-09-13 12:34:41 +02:00
Zdenek Kabelac
3ce8db8b88 cov: keep 64bit arithmetic
Highly unlikely this case will ever need 64bit math, but just in case,
keep the expression as 64bit.
2021-09-13 12:34:41 +02:00
Zdenek Kabelac
a7258ae394 cov: do not try to change passed in argv
It's not a good idea to change passed 'argv[]' and replace it with
pointers to local stack - although in this case we are not using
this argv[] after return from this function.
2021-09-13 12:34:41 +02:00
Zdenek Kabelac
aa522d5862 cov: fix copy from tmp_name buffer
Mask for strncpy() Coverity report warning would
actually need to copy buffer from 'tmp_name' instead of 'str'.

But replace it directly with single 'strncpy()' again for better readbility,
just mask out the warning reported for this strncpy instance
(so we do not need to put comment fro every call of strcpy_name_len).
2021-09-13 12:34:41 +02:00
Zdenek Kabelac
7af0a1b9d8 tests: increase size of thin-pool for newer mkfs
Looks like newer version of mkfs.ext4 consumes more 'real' disk space,
when formating virtual volumes - so double the size of thin-pool to
have enough backend chunks for provisioning.
2021-09-13 12:34:41 +02:00
Zdenek Kabelac
fc5f9924c7 tests: add test for handling unknown cache settings 2021-09-13 12:34:41 +02:00
Zdenek Kabelac
a8ee82ed51 libdm: enhance tracking of activated LVs
Existing mechanism was not able to trace root volume issue.
Simplify the functionality by using simply using activated flag
and trace the dtree in reverse order.
2021-09-13 12:34:41 +02:00
Zdenek Kabelac
d489445e5a cache: implement better revert path
When cache creation fails on table reload path, implemen more
advanced revert solution, that tries to restore state of LVM
metadata into is look before actual caching started.
2021-09-13 12:34:41 +02:00
Zdenek Kabelac
4c3d7a01d4 cache: filter out unsupported policy settings
Loading invalid MQ/SMQ policy settings table line cause immediate
rejection - to prevent such failure, automatically filter valid
settins before it is being uploaded by lvm2.

For invalid setting issue a warnning informing user how to remove
them.

This solution is used to keep running cached LVs that might had
been created in the past with invalid settings that have been actually
unused due to another code bug.
2021-09-13 12:34:41 +02:00
Zdenek Kabelac
6c4cd7b2f2 cache: fix parentheses for migration_threshold
When generating table line for cache target line,
the estimation of added arguments was incorrectly
calculated as the evaluation order of "?" is
made after "+".

However the result was 'masked' by the

Reported-by: Jian Cai jcai19
2021-09-13 12:34:41 +02:00
Zdenek Kabelac
30050769b1 filters: fix memleak on mpath filter destroy
Missing free() leaks filter structure.
2021-09-13 12:34:41 +02:00
Zdenek Kabelac
3b24c0fe4e vdo: prompt with no return failure
Exit 1  (failure) when prompt for conversion is answered as 'No'.
2021-09-13 12:34:41 +02:00
Zdenek Kabelac
812653d598 vdo: man page updates 2021-09-13 12:34:41 +02:00
Zdenek Kabelac
9db4ddabc1 vdo: lvm_import_vdo script needs to continue when vgname does not exist
When the script cannot find vgname - it needs to continue to run.
2021-09-13 12:34:41 +02:00
Zdenek Kabelac
bd2dae4643 tests: check lvm2 parses vdo statistics 2021-09-09 15:24:21 +02:00
Zdenek Kabelac
e6f735d411 vdo: read new sysfs path
New versions of kvdo module exposes statistics at new location:
/sys/block/dm-XXX/vdo/statistics/...

Enhance lvm2 to access this location first.
Also if the statistic info is missing - make it 'debug' level info,
so it is not failing 'lvs' command.
2021-09-09 15:24:15 +02:00
Zdenek Kabelac
89595a3665 vdo: more lvm_import_vdo fixes
Do not call 'dmsetup info' for non-dm devices.

Better handling for VGNAME and LVNAME - so when convering LV as
backend device automatically recognize it and reuse LV name for VDOLV.

Add prompt for final confirmation before actual conversion is started
(once confirmed, lvm2 commands no longer prompts to avoid leaving
conversion in the middle of its process.)
2021-09-06 15:19:51 +02:00
Zdenek Kabelac
3287d37f44 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.
2021-09-06 15:19:51 +02:00
Zdenek Kabelac
8d5b7de54f vdo: lvm_import_vdo fix max_discard size
Use correct 4K units in lvm2 for max_discard VDO option.
2021-09-06 15:19:51 +02:00
Zdenek Kabelac
79427151dc vdo: add support for auto-unsafe writePolicy
This vdoWritePolicy policy missed matching support in lvm2.
2021-09-06 15:19:51 +02:00
Zdenek Kabelac
337053c56a 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.
2021-09-06 15:01:11 +02:00
Zdenek Kabelac
52b5620476 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
2021-09-06 14:00:20 +02:00
Zdenek Kabelac
1ae157a0f6 vdo: fixes
Better identify VDO device with major:minor.
Handle different LV name from originally converted origin LV.
Improve --dry-run handling.
2021-08-31 22:05:47 +02:00
Zdenek Kabelac
419c93c873 vdo: support lvcreate with skipped activation
Support creation of VDO LV for 'lvcreate -ky...'.
2021-08-31 22:05:47 +02:00
Zdenek Kabelac
4afe872fd6 vdo: fix conversion of large virtual sizes
Properly accept virtual sizes above 2TiB.
2021-08-31 22:05:47 +02:00
Zdenek Kabelac
88360b0c51 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.
2021-08-31 22:05:47 +02:00
David Teigland
62c599f781 cov: lvmlockd read_adopt_file free structs on error path 2021-08-30 13:48:42 -05:00
David Teigland
350f8845bd pvremove: apply devices file
pvremove was wrongly allowed to operate on a device
not listed in the devices file.
2021-08-27 14:48:33 -05:00
Zdenek Kabelac
12ba43ccd0 vdo: rename vdoimport to lvm_import_vdo
Missed bits in previous rename commits.
2021-08-26 19:10:28 +02:00
Marian Csontos
49822624e8 spec: Rename vdoimport to lvm_import_vdo. 2021-08-26 17:14:08 +02:00
Marian Csontos
bbbd4fed69 vdo: Rename vdoimport to lvm_import_vdo. 2021-08-26 17:13:59 +02:00
David Teigland
0969e90d45 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.
2021-08-23 15:54:41 -05:00
Alex Xu (Hello71)
a6a8443a07 add missing sys/file.h include
required for LOCK_EX etc on musl
2021-08-23 09:24:45 -05:00
David Teigland
72af1cb085 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.
2021-08-20 15:06:33 -05:00
David Teigland
8b72313936 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.
2021-08-20 14:51:13 -05:00
David Teigland
9e79a022ea logging: messages for found metadata 2021-08-20 14:51:09 -05:00
David Teigland
6cd4470e6d devices: apply ignorelockingfailure to devices file lock 2021-08-20 14:07:00 -05:00
David Teigland
4df6931c4c tests: adjust for check_devicesfile 2021-08-20 14:06:55 -05:00
David Teigland
b0bda7c25b lvmdevices: check yes option for adding duplicate 2021-08-19 13:00:43 -05:00
David Teigland
96b777167c 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.)
2021-08-16 11:31:15 -05:00
David Teigland
0d572d14ad 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
2021-08-16 11:31:09 -05:00
Yi Wang
47bcb446b8 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>
2021-08-16 09:45:40 -05:00
David Teigland
e5c0562654 toolcontext.h: use bit field in struct
Two recent additions should have used a bit instead
of an entire int.
2021-08-12 15:51:43 -05:00
Marian Csontos
59209ef049 post-release 2021-08-11 17:15:51 +02:00
Marian Csontos
67a853f337 pre-release 2021-08-11 17:14:26 +02:00
Marian Csontos
7dfaf5dc13 WHATS_NEW: update 2021-08-10 14:19:24 +02:00