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

17845 Commits

Author SHA1 Message Date
Zdenek Kabelac
e585c10fad make: fix compilation for undefined RAID_INTERNAL
Reported-by: adamboardman of gemian
2021-09-27 18:56:14 +02:00
Zdenek Kabelac
6c85ea50de make: fix compilation for some compiler
Reported-by: adamboardman of gemian
2021-09-27 18:56:14 +02:00
Zdenek Kabelac
ef21ed78ae utils: define macro for ffs
Provide ffs() macro using __builtin_ffs(), when there is missing
ffs() implementation in header file.

Reported-by: adamboardman of gemian
2021-09-27 18:56:14 +02:00
Zdenek Kabelac
6a186dd1e8 configure: replace AC_HELP_STRING with AS_
Upgrade to newer autoconf setup is approaching...
Will cause large set of configure changes.
2021-09-27 18:56:13 +02:00
Zdenek Kabelac
ff788ef19c configure: check ffs __builtin_ffs versionsort
Check for presence of ffs(), __builtin_ffs() and versionsort().
2021-09-27 18:56:13 +02:00
Zdenek Kabelac
27eef1b964 cov: make more obvious buffer is zero ended 2021-09-27 18:56:13 +02:00
Zdenek Kabelac
3a3aabb832 metadata: avoid excessive check of /etc/localtime
With larger metadata, decoding 'localtime()' for hinting time creation
of every LV may cause excessive check of /etc/localtime file.
Set TZ to ":/etc/localtime" so glibc reads this file just once
instead of check everytime if there has anything changed.
2021-09-27 18:56:13 +02:00
Zdenek Kabelac
61a6f9905e metadata: optimize reading metadata copies in scan
While being in lockless scanning phase, we can avoid reading and checking
matching metadata copies if we already know them from other PV
and just rely on matching metadata header information.

These copies will be examined later during locked metadata read/write
access.

This patch may postpone discovering some read failures to locked phase.
2021-09-27 18:56:13 +02:00
Zdenek Kabelac
24e90f9594 metadata: remember parsing size of VG metadata
When creating lvm2 metadata for VG, lvm2 allocate some buffer,
and if buffer is not big enough, the buffer is 'reallocated' bigger,
and whole metadata creation is repeated until metadata fits.
We can try to use 'previous' metadata size as hint to reduce looping
here.
2021-09-27 18:49:41 +02:00
Zdenek Kabelac
a42ea349f6 metadata: remember crc32 when writing vg metadata
Preserve computed crc32 check from first written PV, just like we
preserve generated metadata.

Also there is no need to call crc32 twice on wrapping buffer with 2 calcs,
result must be always the same as with single crc32 checking.
2021-09-27 18:49:41 +02:00
Zdenek Kabelac
a3352f08f6 dmsetup: fix measure handling
Previous patch f853a1bc7a enabled
ima measurement unconditionally for every status call,
but it needs to be set only for 'dmsetup measure' command.
2021-09-27 18:45:25 +02:00
David Teigland
e62a71f3dd lvmlockd: update error message
refer specifically to the "use_lvmlockd" setting in lvm.conf
2021-09-24 15:40:20 -05:00
Zdenek Kabelac
a1cb33b633 devicemapper: in sync with libdm 2021-09-23 16:49:58 +02:00
Alasdair G Kergon
f853a1bc7a libdm: dmsetup measure support for IMA
Add support for DM_IMA_MEASUREMENT_FLAG with
DM_TABLE_STATUS_CMD.

This feature requires DM version 4.45  (5.15+ kernels)
2021-09-23 16:49:28 +02:00
Zdenek Kabelac
707e7d762e devicemapper: add DM_NAME_LIST_FLAG
Match libdm part
2021-09-23 16:49:16 +02:00
Zdenek Kabelac
566c2f1828 libdm: support DM_NAME_LIST_FLAG
Kernel patch 8b638081bd4520f63db1defc660666ec5f65bc15
introduced support to return UUID in DM_LIST_DEVICES_CMD.

Useful when asking for UUID of each device where the list
could be now returned directly with NAME && UUID for each device.

Returning UUID is done in backward-compatible way. There's one unused
32-bit word value after the event number. This patch sets the bit
DM_NAME_LIST_FLAG_HAS_UUID if UUID is present and
DM_NAME_LIST_FLAG_DOESNT_HAVE_UUID if it isn't (if none of these bits is
set, then we have an old kernel that doesn't support returning UUIDs). The
UUID is stored after this word. The 'next' value is updated to point after
the UUID, so that old version of libdevmapper will skip the UUID without
attempting to interpret it.
2021-09-23 16:49:14 +02:00
Zdenek Kabelac
ee15065a0f gcc: match types 2021-09-22 17:18:50 +02:00
Zdenek Kabelac
9eafd44734 gcc: use more zero length arrays
Define last array struct member with zero size.
2021-09-22 17:18:50 +02:00
Zdenek Kabelac
4515acf734 make: generate 2021-09-22 14:48:58 +02:00
Zdenek Kabelac
4cfa80f02f tests: raise required version for conversion
Real conversion needs this version driver.
TODO: handle properly older versions.
2021-09-21 21:43:02 +02:00
Zdenek Kabelac
b0d40109a6 cov: ignore leak of fd descriptor
There is no 'fd' leak.
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
e6d3587482 cov: check dev_get_size result
Check we have obtained some device size out of dev_get_size().
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
30e27d2f8b cov: sanitize function environment
Coverity can see that function is either used with 'dev' or 'def'.
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
a13dfcbc77 cov: check for function result 2021-09-21 21:03:47 +02:00
Zdenek Kabelac
7bd55f8c15 cov: check strchr for NULL
Although unlikely, ensuring coverity we not use NULL.
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
377e326156 cov: ensuring buffer is zeroed 2021-09-21 21:03:47 +02:00
Zdenek Kabelac
8c44597820 gcc-fanalyzer: zallocate memory for clean buffer 2021-09-21 21:03:47 +02:00
Zdenek Kabelac
4ef8f7cde6 gcc-fanalyzer: remove unneded zeroing
Since we zallocate array here, we don't need to set to NULL
and clean gcc warning about strdup leakage.
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
178df1c8f4 gcc-fanalyzer: helping understand answer is not null
gcc can't easily see pointer 'answer' is only being checked once 'ret > 0'.
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
462ac47003 clang: check for buffer existance
Make obvious to analyzer we can't get NULL here.
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
bb6fd1a15f shellcheck: warning enhancements 2021-09-21 21:03:47 +02:00
Zdenek Kabelac
5bd99d55b0 shellcheck: tests fixes
Correcting some shell problems.
2021-09-21 21:03:47 +02:00
David Teigland
130993bab1 lvmcache: follow pv_id/pvid naming convention
name the variable pv_id_arg to follow the convention:
. "pvid" variable is null-terminated string
. "pv_id" variable is non-null-terminated struct
2021-09-20 09:35:47 -05:00
Zdenek Kabelac
b1f33a4000 tests: len always initialized 2021-09-20 16:24:08 +02:00
Zdenek Kabelac
133686ebc7 gcc: avoid name colision with function pv_id() from metadata.h 2021-09-20 16:12:10 +02:00
Zdenek Kabelac
2e990d1fec gcc: avoid warns on missing braces with older version 2021-09-20 16:11:49 +02:00
Zdenek Kabelac
1a8a33ae9b tests: a bit more fancy way to initialized struct
Older g++ is not smart enough to figure this out, so add a bit more push.
2021-09-20 16:01:22 +02:00
Zdenek Kabelac
4c0354fe0f cleanup: better wording
Follow-up advice of native speaker.
2021-09-20 15:41:14 +02:00
Zdenek Kabelac
1b52451996 cov: mask some warning about leakage
Mask false-positive leak report.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
548c69f581 cov: hide reports from optarg being NULL
It's basically irrelavant which value we assing to optarg,
since it's set by getopt() function, but Coverity tool
is incorrectly reporting possibly dereference of NULL.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
efaab93491 cov: ignore syscall 2021-09-20 14:26:09 +02:00
Zdenek Kabelac
055406bb39 cov: validate syscall result 2021-09-20 14:26:09 +02:00
Zdenek Kabelac
9721f3e0ff cov: test for fixture being NULL pointer
Explicit check for teoretical NULL pointer passed as fixture.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
3f946bfce7 cov: capture runtime exception 2021-09-20 14:26:09 +02:00
Zdenek Kabelac
d5c82b0e73 cov: better defined constructors
Ensure C++ initializes all struct members.
Also some deterministic buffer initialization.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
ebd150366f cov: add explicit NULL pointer check
Make obvious to coverity strcmp() is not getting NULL pointer.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
752a9ec4b4 cov: make read buffer obviously zero ended
Coverity doesn't get the idea from memset() here.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
6c87e98ee3 cov: check for possible NULL segtype
Although likely impossible to ever miss ERROR segtype,
make analyzer hapier.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
bfc6fe2bac cov: ensure data is not derefenced
Ensure all hypothetical paths cannot dereference NULL *(u->data).
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
3e7e9cc5e6 cov: handle better leak reports
Rewrite code so the leaks are eliminated from Coverity.
2021-09-20 14:26:09 +02:00