lvm2/0003-lvmlockd-fix-sanlock_release-for-vgremove.patch

39 lines
1.3 KiB
Diff

From 015351d3935539667e8033b9cc4580ce25170116 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Thu, 8 May 2025 10:54:50 -0500
Subject: [PATCH 3/8] lvmlockd: fix sanlock_release for vgremove
incorrect data was being copied to lease structs passed
to sanlock_release(), making the lease removal fail.
(cherry picked from commit 88910c200f9e24a454dc9fcbf39c2df1d4887f3b)
---
daemons/lvmlockd/lvmlockd-sanlock.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-sanlock.c b/daemons/lvmlockd/lvmlockd-sanlock.c
index d50d0ce4b..b17cbad7e 100644
--- a/daemons/lvmlockd/lvmlockd-sanlock.c
+++ b/daemons/lvmlockd/lvmlockd-sanlock.c
@@ -2192,12 +2192,15 @@ static int release_rename(struct lockspace *ls, struct resource *r)
if (!res_args)
return -ENOMEM;
- memcpy(&rd1, rds, sizeof(struct rd_sanlock));
- memcpy(&rd2, rds, sizeof(struct rd_sanlock));
+ memcpy(&rd1, &rds->rs, sizeof(struct rd_sanlock));
+ memcpy(&rd2, &rds->rs, sizeof(struct rd_sanlock));
res1 = (struct sanlk_resource *)&rd1;
res2 = (struct sanlk_resource *)&rd2;
+ if (memcmp(res1->name, r->name, SANLK_NAME_LEN))
+ log_error("%s:%s unlock_san release rename bad name %.48s", ls->name, r->name, res1->name);
+
strcpy_name_len(res2->name, "invalid_removed", SANLK_NAME_LEN);
res_args[0] = res1;
--
2.49.0