!168 [20.03 sp4] 回合上游补丁,修复lvm客户端与lvmlockd选取的扇区大小不一致的问题
From: @jinzig Reviewed-by: @swf504, @foolstrong Signed-off-by: @swf504
This commit is contained in:
commit
d4b2ae904d
49
0029-use-4k-sector-size-when-any-dev-is-4k.patch
Normal file
49
0029-use-4k-sector-size-when-any-dev-is-4k.patch
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
From 2d1fe38d84d499011d13ae1ea11535398528fc87 Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Teigland <teigland@redhat.com>
|
||||||
|
Date: Mon, 11 May 2020 13:08:39 -0500
|
||||||
|
Subject: [PATCH] lvmlockd: use 4K sector size when any dev is 4K
|
||||||
|
|
||||||
|
When either logical block size or physical block size is 4K,
|
||||||
|
then lvmlockd creates sanlock leases based on 4K sectors,
|
||||||
|
but the lvm client side would create the internal lvmlock LV
|
||||||
|
based on the first logical block size it saw in the VG,
|
||||||
|
which could be 512. This could cause the lvmlock LV to be
|
||||||
|
too small to hold all the sanlock leases. Make the lvm client
|
||||||
|
side use the same sizing logic as lvmlockd.
|
||||||
|
---
|
||||||
|
lib/locking/lvmlockd.c | 14 ++++----------
|
||||||
|
1 file changed, 4 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
|
||||||
|
index e378fe6cba..dca7954abf 100644
|
||||||
|
--- a/lib/locking/lvmlockd.c
|
||||||
|
+++ b/lib/locking/lvmlockd.c
|
||||||
|
@@ -635,7 +635,6 @@ static int _init_vg_sanlock(struct cmd_context *cmd, struct volume_group *vg, in
|
||||||
|
const char *vg_lock_args = NULL;
|
||||||
|
const char *opts = NULL;
|
||||||
|
struct pv_list *pvl;
|
||||||
|
- struct device *sector_dev;
|
||||||
|
uint32_t sector_size = 0;
|
||||||
|
unsigned int physical_block_size, logical_block_size;
|
||||||
|
int num_mb = 0;
|
||||||
|
@@ -656,16 +655,11 @@ static int _init_vg_sanlock(struct cmd_context *cmd, struct volume_group *vg, in
|
||||||
|
dm_list_iterate_items(pvl, &vg->pvs) {
|
||||||
|
if (!dev_get_direct_block_sizes(pvl->pv->dev, &physical_block_size, &logical_block_size))
|
||||||
|
continue;
|
||||||
|
-
|
||||||
|
- if (!sector_size) {
|
||||||
|
- sector_size = logical_block_size;
|
||||||
|
- sector_dev = pvl->pv->dev;
|
||||||
|
- } else if (sector_size != logical_block_size) {
|
||||||
|
- log_error("Inconsistent logical block sizes for %s and %s.",
|
||||||
|
- dev_name(pvl->pv->dev), dev_name(sector_dev));
|
||||||
|
- return 0;
|
||||||
|
- }
|
||||||
|
+ if ((physical_block_size == 4096) || (logical_block_size == 4096))
|
||||||
|
+ sector_size = 4096;
|
||||||
|
}
|
||||||
|
+ if (!sector_size)
|
||||||
|
+ sector_size = 512;
|
||||||
|
|
||||||
|
log_debug("Using sector size %u for sanlock LV", sector_size);
|
||||||
|
|
||||||
@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
Name: lvm2
|
Name: lvm2
|
||||||
Version: 2.03.09
|
Version: 2.03.09
|
||||||
Release: 18
|
Release: 19
|
||||||
Epoch: 8
|
Epoch: 8
|
||||||
Summary: Tools for logical volume management
|
Summary: Tools for logical volume management
|
||||||
License: GPLv2+ and LGPLv2.1 and BSD
|
License: GPLv2+ and LGPLv2.1 and BSD
|
||||||
@ -77,6 +77,7 @@ patch25: 0025-toollib-fix-segfault-if-using-S-select-with-log-repo.patch
|
|||||||
Patch26: 0026-dm-event-release-buffer-on-dm_event_get_version.patch
|
Patch26: 0026-dm-event-release-buffer-on-dm_event_get_version.patch
|
||||||
patch27: 0027-clean-up-group-struct-in-_stats_create_group-error-path.patch
|
patch27: 0027-clean-up-group-struct-in-_stats_create_group-error-path.patch
|
||||||
Patch28: 0028-vgchange-acquire-an-exclusive-VG-lock-for-refresh.patch
|
Patch28: 0028-vgchange-acquire-an-exclusive-VG-lock-for-refresh.patch
|
||||||
|
Patch29: 0029-use-4k-sector-size-when-any-dev-is-4k.patch
|
||||||
|
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
BuildRequires: gcc-c++
|
BuildRequires: gcc-c++
|
||||||
@ -502,6 +503,9 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Jun 06 2024 jinzhiguang <jinzhiguang@kylinos.cn> - 8:2.03.09-19
|
||||||
|
- lvmlockd: use 4K sector size when any dev is 4K
|
||||||
|
|
||||||
* Thu Feb 22 2024 wangzhiqiang <wangzhiqiang95@huawei.com> - 8:2.03.09-18
|
* Thu Feb 22 2024 wangzhiqiang <wangzhiqiang95@huawei.com> - 8:2.03.09-18
|
||||||
- vgchange: acquire an exclusive VG lock for refresh
|
- vgchange: acquire an exclusive VG lock for refresh
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user