Blame SOURCES/0007-lvmdevices-increase-open-file-limit.patch

429878
From f732f3d53faee3732d0f4a666c378709e6c2f5e9 Mon Sep 17 00:00:00 2001
429878
From: David Teigland <teigland@redhat.com>
429878
Date: Fri, 29 Oct 2021 14:49:36 -0500
ab86b0
Subject: [PATCH 07/54] lvmdevices: increase open file limit
429878
429878
---
429878
 lib/label/label.c  | 4 ++--
429878
 lib/label/label.h  | 2 ++
429878
 tools/lvmdevices.c | 3 +++
429878
 3 files changed, 7 insertions(+), 2 deletions(-)
429878
429878
diff --git a/lib/label/label.c b/lib/label/label.c
429878
index 479a5037a..9fac3e464 100644
429878
--- a/lib/label/label.c
429878
+++ b/lib/label/label.c
429878
@@ -891,7 +891,7 @@ static int _setup_bcache(void)
429878
 
429878
 #define BASE_FD_COUNT 32 /* Number of open files we want apart from devs */
429878
 
429878
-static void _prepare_open_file_limit(struct cmd_context *cmd, unsigned int num_devs)
429878
+void prepare_open_file_limit(struct cmd_context *cmd, unsigned int num_devs)
429878
 {
429878
 #ifdef HAVE_PRLIMIT
429878
 	struct rlimit old = { 0 }, new;
429878
@@ -1165,7 +1165,7 @@ int label_scan(struct cmd_context *cmd)
429878
 	 * which we want to keep open) is higher than the current
429878
 	 * soft limit.
429878
 	 */
429878
-	_prepare_open_file_limit(cmd, dm_list_size(&scan_devs));
429878
+	prepare_open_file_limit(cmd, dm_list_size(&scan_devs));
429878
 
429878
 	/*
429878
 	 * Do the main scan.
429878
diff --git a/lib/label/label.h b/lib/label/label.h
429878
index 8b510eb79..34563efd0 100644
429878
--- a/lib/label/label.h
429878
+++ b/lib/label/label.h
429878
@@ -134,4 +134,6 @@ void dev_invalidate(struct device *dev);
429878
 void dev_set_last_byte(struct device *dev, uint64_t offset);
429878
 void dev_unset_last_byte(struct device *dev);
429878
 
429878
+void prepare_open_file_limit(struct cmd_context *cmd, unsigned int num_devs);
429878
+
429878
 #endif
429878
diff --git a/tools/lvmdevices.c b/tools/lvmdevices.c
429878
index 8d9634848..3f104f7de 100644
429878
--- a/tools/lvmdevices.c
429878
+++ b/tools/lvmdevices.c
429878
@@ -176,6 +176,9 @@ int lvmdevices(struct cmd_context *cmd, int argc, char **argv)
429878
 		log_error("Failed to read the devices file.");
429878
 		return ECMD_FAILED;
429878
 	}
429878
+
429878
+	prepare_open_file_limit(cmd, dm_list_size(&cmd->use_devices));
429878
+
429878
 	dev_cache_scan(cmd);
429878
 	device_ids_match(cmd);
429878
 
429878
-- 
ab86b0
2.34.3
429878