lvm2/0093-raid_manip-fix-swapped-parameters-in-error-message.patch
Marian Csontos 0d41e7e8af Additional patches for 9.9.0 lvm2
Patches from upstream up to 2.03.41.

Resolves: RHEL-174324
2026-06-04 21:29:42 +02:00

48 lines
1.6 KiB
Diff

From 8e1bfa318078918b98dd16db253518c620df73e9 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Fri, 3 Apr 2026 19:14:42 +0200
Subject: [PATCH 093/211] raid_manip: fix swapped parameters in error message
Fix swapped parameters in error message after match_count decrement.
The execution flow is:
1. Try to allocate match_count devices -> FAILS
2. Decrement match_count--
3. Log error message
4. Retry with reduced count
Before the decrement, match_count had the value that just failed.
After the decrement, match_count has the new reduced value we'll retry.
The message should say:
"Failed to replace X (the old value). Attempting Y (the new value)."
Current code incorrectly prints:
"Failed to replace 5 devices. Attempting to replace 6 instead."
Fixed code correctly prints:
"Failed to replace 6 devices. Attempting to replace 5 instead."
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
(cherry picked from commit cde1ea1ff15a5e1f80f55229f8b4b23f209157ea)
---
lib/metadata/raid_manip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 2a78a0bec..99c71e967 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -6995,7 +6995,7 @@ try_again:
if (match_count > 0) {
log_error("Failed to replace %u devices."
" Attempting to replace %u instead.",
- match_count, match_count+1);
+ match_count+1, match_count);
/*
* Since we are replacing some but not all of the bad
* devices, we must set partial_activation
--
2.54.0