Stop using maxmem (xfs_repair -m option)

resolves: RHEL-165677
This commit is contained in:
Richard W.M. Jones 2026-04-16 21:03:19 +01:00
parent 6097cf95c4
commit 81633e56f3
2 changed files with 57 additions and 2 deletions

View File

@ -0,0 +1,52 @@
From 5427fc17700fe250d0c95fe991d0040d81a1cf8e Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 15 Apr 2026 11:22:34 +0100
Subject: [PATCH] convert: Stop using maxmem (xfs_repair -m option)
We originally introduced this option in commit dba4f0d3ba ("convert:
Limit the amount of memory used by xfs_repair"). In the same commit
we also started to use noprefetch (xfs_repair -P). This was to avoid
xfs_repair taking too much memory, causing OOM errors.
However the -m option turns out to be deprecated. It has a number of
problems and sharp edges, including that it overestimates the amount
of memory required (often, greatly), its estimates are not very
accurate, and it prints a localized error message that libguestfs
needs to parse to obtain useful information.
xfs_repair has internal logic already to find the available physical
memory and limit memory usage. This also operates even if the -m
option is not used.
The beneficial option is noprefetch (-P) which limits the caching that
xfs_repair does. Leave that one alone.
Reported-by: Ming Xie
Thanks: Eric Sandeen, Dave Chinner
Related: https://redhat.atlassian.net/browse/RHEL-165677
(cherry picked from commit 788bd68663cfc4535753623faa25180fd35f0893)
---
convert/convert.ml | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/convert/convert.ml b/convert/convert.ml
index 2150abb7..3740a764 100644
--- a/convert/convert.ml
+++ b/convert/convert.ml
@@ -335,13 +335,11 @@ and do_fsck ?(before=false) g =
*)
let nomodify = true
(* xfs_repair runs out of memory in the low memory environment
- * of the appliance unless we limit the amount of memory it will
- * use here.
+ * of the appliance unless we disable prefetch.
*)
- and noprefetch = true
- and maxmem = Int64.of_int (g#get_memsize () / 2) in
+ and noprefetch = true in
- if g#xfs_repair ~maxmem ~noprefetch ~nomodify dev <> 0 then
+ if g#xfs_repair ~noprefetch ~nomodify dev <> 0 then
error (f_"detected errors on the XFS filesystem on %s") dev
| _, _ ->

View File

@ -45,7 +45,7 @@ ExclusiveArch: x86_64
Name: virt-v2v
Epoch: 1
Version: 2.11.5
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Convert a virtual machine to run on KVM
License: GPL-2.0-or-later AND LGPL-2.0-or-later
@ -75,6 +75,7 @@ Patch0007: 0007-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
Patch0008: 0008-RHEL-tests-Remove-btrfs-test.patch
Patch0009: 0009-RHEL-Add-warning-about-virt-v2v-in-place-not-being-s.patch
Patch0010: 0010-RHEL-output-output.ml-Remove-reduce-memory-pressure-.patch
Patch0011: 0011-convert-Stop-using-maxmem-xfs_repair-m-option.patch
BuildRequires: autoconf, automake, libtool
BuildRequires: make
@ -382,7 +383,7 @@ done
%changelog
* Mon Apr 13 2026 Richard W.M. Jones <rjones@redhat.com> - 1:2.11.5-1
* Thu Apr 16 2026 Richard W.M. Jones <rjones@redhat.com> - 1:2.11.5-2
- Rebase to virt-v2v 2.11.5
Synchronize spec file with Fedora
resolves: RHEL-153361
@ -394,6 +395,8 @@ done
resolves: RHEL-152766
- Fix encrypted Ubuntu guest fail to boot after conversion
resolves: RHEL-137121
- Stop using maxmem (xfs_repair -m option)
resolves: RHEL-165677
* Fri Apr 03 2026 Richard W.M. Jones <rjones@redhat.com> - 1:2.10.0-9
- Add --no-fstrim option