lvm2: sync 20.03 LTS branches

Fix issues: https://gitee.com/src-openeuler/lvm2/issues/I4SGY3

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
This commit is contained in:
Zhiqiang Liu 2022-01-29 16:36:47 +08:00
parent 17e0f28422
commit 1119fb9aa2
3 changed files with 147 additions and 4 deletions

View File

@ -0,0 +1,26 @@
From 287565fd5dd5f49f1a51c6cd9ebdc9c20ebc7730 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Tue, 6 Apr 2021 12:26:42 +0200
Subject: [PATCH] lvreduce: support --yes
Missed support for --yes with 'lvreduce' to answer 'y' to prompt.
---
lib/metadata/lv_manip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 81346bd..b38acf8 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4970,7 +4970,7 @@ static int _request_confirmation(const struct logical_volume *lv,
log_warn("THIS MAY DESTROY YOUR DATA (filesystem etc.)");
- if (!lp->force) {
+ if (!lp->force && !lp->yes) {
if (yes_no_prompt("Do you really want to reduce %s? [y/n]: ",
display_lvname(lv)) == 'n') {
log_error("Logical volume %s NOT reduced.",
--
1.8.3.1

View File

@ -0,0 +1,101 @@
From ae53fb697e738779aa0392dea2b3c489a5316744 Mon Sep 17 00:00:00 2001
From: Wu Guanghao <wuguanghao3@huawei.com>
Date: Tue, 23 Feb 2021 17:39:29 +0800
Subject: [PATCH] unit-test: modify for systems with PGSIZE of 64K
This modification supports dynamically obtaining the value of PAGE_SIZE,
which is compatible with systems with PAGE_SIZE of (4K/64K)
Signed-off-by: wuguanghao <wuguanghao3@huawei.com>
---
test/unit/bcache_t.c | 7 ++++---
test/unit/bcache_utils_t.c | 2 +-
test/unit/io_engine_t.c | 7 +++++--
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/test/unit/bcache_t.c b/test/unit/bcache_t.c
index 2a8f931..418ae9a 100644
--- a/test/unit/bcache_t.c
+++ b/test/unit/bcache_t.c
@@ -360,6 +360,7 @@ static void _large_fixture_exit(void *context)
*--------------------------------------------------------------*/
#define MEG 2048
#define SECTOR_SHIFT 9
+#define PAGE_SIZE_SECTORS (sysconf(_SC_PAGE_SIZE) >> SECTOR_SHIFT)
static void good_create(sector_t block_size, unsigned nr_cache_blocks)
{
@@ -389,12 +390,12 @@ static void bad_create(sector_t block_size, unsigned nr_cache_blocks)
static void test_create(void *fixture)
{
- good_create(8, 16);
+ good_create(PAGE_SIZE_SECTORS, 16);
}
static void test_nr_cache_blocks_must_be_positive(void *fixture)
{
- bad_create(8, 0);
+ bad_create(PAGE_SIZE_SECTORS, 0);
}
static void test_block_size_must_be_positive(void *fixture)
@@ -412,7 +413,7 @@ static void test_block_size_must_be_multiple_of_page_size(void *fixture)
bad_create(_bad_examples[i], 16);
for (i = 1; i < 100; i++)
- good_create(i * 8, 16);
+ good_create(i * PAGE_SIZE_SECTORS, 16);
}
static void test_get_triggers_read(void *context)
diff --git a/test/unit/bcache_utils_t.c b/test/unit/bcache_utils_t.c
index d022c51..d54b144 100644
--- a/test/unit/bcache_utils_t.c
+++ b/test/unit/bcache_utils_t.c
@@ -26,7 +26,7 @@
//----------------------------------------------------------------
-#define T_BLOCK_SIZE 4096
+#define T_BLOCK_SIZE sysconf(_SC_PAGESIZE)
#define NR_BLOCKS 64
#define INIT_PATTERN 123
diff --git a/test/unit/io_engine_t.c b/test/unit/io_engine_t.c
index 44e93e0..f8cdc91 100644
--- a/test/unit/io_engine_t.c
+++ b/test/unit/io_engine_t.c
@@ -25,8 +25,11 @@
//----------------------------------------------------------------
+#define SECTOR_SHIFT 9
#define SECTOR_SIZE 512
#define BLOCK_SIZE_SECTORS 8
+#define PAGE_SIZE sysconf(_SC_PAGESIZE)
+#define PAGE_SIZE_SECTORS (PAGE_SIZE >> SECTOR_SHIFT)
#define NR_BLOCKS 64
struct fixture {
@@ -82,7 +85,7 @@ static void *_fix_init(void)
T_ASSERT(f);
f->e = create_async_io_engine();
T_ASSERT(f->e);
- if (posix_memalign((void **) &f->data, 4096, SECTOR_SIZE * BLOCK_SIZE_SECTORS))
+ if (posix_memalign((void **) &f->data, PAGE_SIZE, SECTOR_SIZE * BLOCK_SIZE_SECTORS))
test_fail("posix_memalign failed");
snprintf(f->fname, sizeof(f->fname), "unit-test-XXXXXX");
@@ -167,7 +170,7 @@ static void _test_write_bytes(void *fixture)
unsigned offset = 345;
char buf_out[32];
char buf_in[32];
- struct bcache *cache = bcache_create(8, BLOCK_SIZE_SECTORS, f->e);
+ struct bcache *cache = bcache_create(PAGE_SIZE_SECTORS, BLOCK_SIZE_SECTORS, f->e);
T_ASSERT(cache);
// T_ASSERT(bcache_read_bytes(cache, f->fd, offset, sizeof(buf_in), buf_in));
--
1.8.3.1

View File

@ -43,10 +43,10 @@
Name: lvm2
Version: 2.03.09
Release: 5
Release: 9
Epoch: 8
Summary: Tools for logical volume management
License: GPLv2 and LGPLv2
License: GPLv2+ and LGPLv2.1 and BSD
URL: http://sourceware.org/lvm2
Source0: https://sourceware.org/pub/lvm2/releases/LVM2.2.03.09.tgz
Patch1: 0001-lvm2-set-default-preferred_names.patch
@ -61,6 +61,8 @@ Patch9: 0009-enhancement-add-dfx-log.patch
Patch10: 0010-enhancement-syslog-more-when-use-libdevmapper-so.patch
Patch11: 0011-enhancement-log-it-when-disk-slow.patch
Patch12: 0012-bugfix-lvm2-fix-the-reuse-of-va_list.patch
Patch13: 0013-lvreduce-support-yes.patch
Patch14: 0014-unit-test-modify-for-systems-with-PGSIZE-of-64K.patch
BuildRequires: gcc
BuildRequires: gcc-c++
@ -94,7 +96,7 @@ Requires: bash >= %{bash_version}
Requires: module-init-tools
Requires: device-mapper-persistent-data >= %{persistent_data_version}
Requires: device-mapper-event = %{?epoch}:%{device_mapper_version}-%{release}
Requires: %{name}-help = %{epoch}:%{version}-%{release}
Recommends: %{name}-help = %{epoch}:%{version}-%{release}
Requires(post): systemd-units >= %{systemd_version}, systemd-sysv
Requires(preun): systemd-units >= %{systemd_version}
Requires(postun): systemd-units >= %{systemd_version}
@ -214,7 +216,6 @@ An extensive functional testsuite for LVM2.
%prep
%autosetup -n LVM2.%{version} -p1
sed -ie 's#(\|)\|-##g' VERSION
%package -n device-mapper
Summary: Low level logical volume management
@ -246,6 +247,9 @@ can register and carryout actions triggered when particular events occur.
%configure --with-default-dm-run-dir=/run --with-default-run-dir=/run/lvm --with-default-pid-dir=/run --with-default-locking-dir=/run/lock/lvm --with-usrlibdir=%{_libdir} --enable-fsadm --enable-write_install --with-user= --with-group= --with-device-uid=0 --with-device-gid=6 --with-device-mode=0660 --enable-pkgconfig --enable-applib --enable-cmdlib --enable-dmeventd --enable-blkid_wiping --enable-python3-bindings %{?configure_cluster} %{?configure_cmirror} --with-udevdir=%{_prefix}/lib/udev/rules.d --enable-udev_sync --with-thin=internal --enable-lvmetad --with-thin=internal --enable-lvmpolld %{?configure_lockd_dlm} %{?configure_lockd_sanlock} --enable-dbus-service --enable-notify-dbus --enable-dmfilemapd
make %{?_smp_mflags}
%check
make run-unit-test
%install
make install DESTDIR=%{buildroot}
make install_system_dirs DESTDIR=%{buildroot}
@ -484,6 +488,18 @@ fi
%changelog
* Sun Jan 30 2022 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 8.2.03.09-9
- sync each 20.03 LTS branches
* Wed Jul 28 2021 wuguanghao <wuguanghao3@huawei.com> - 8.2.03.09-8
- %check: add make run-unit-test
* Wed Jul 28 2021 wuguanghao <wuguanghao3@huawei.com> - 8.2.03.09-7
- lvreduce support --yes option
* Fri Apr 30 2021 wuguanghao <wuguanghao3@huawei.com> - 8.2.03.09-6
- revert commit of fix VERSION issue when packaging
* Thu Nov 12 2020 wuguanghao <wuguanghao3@huawei.com> - 8.2.03.09-5
- add epoch to the version of help package required