File bug-1215229_lvmlockd-use-4K-sector-size-when-any-dev-is-4K.patch of Package lvm2.31864
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 1/1] 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(-)
Index: LVM2.2.03.05/lib/locking/lvmlockd.c
===================================================================
--- LVM2.2.03.05.orig/lib/locking/lvmlockd.c
+++ LVM2.2.03.05/lib/locking/lvmlockd.c
@@ -634,7 +634,6 @@ static int _init_vg_sanlock(struct cmd_c
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 phys_block_size, block_size;
int num_mb = 0;
@@ -653,18 +652,13 @@ static int _init_vg_sanlock(struct cmd_c
*/
dm_list_iterate_items(pvl, &vg->pvs) {
- if (!dev_get_block_size(pvl->pv->dev, &phys_block_size, &block_size))
+ if (!dev_get_direct_block_sizes(pvl->pv->dev, &phys_block_size, &block_size))
continue;
-
- if (!sector_size) {
- sector_size = phys_block_size;
- sector_dev = pvl->pv->dev;
- } else if (sector_size != phys_block_size) {
- log_error("Inconsistent sector sizes for %s and %s.",
- dev_name(pvl->pv->dev), dev_name(sector_dev));
- return 0;
- }
+ if ((phys_block_size == 4096) || (block_size == 4096))
+ sector_size = 4096;
}
+ if (!sector_size)
+ sector_size = 512;
log_debug("Using sector size %u for sanlock LV", sector_size);