1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-02-01 09:47:48 +03:00

lvmdevices: increase open file limit

This commit is contained in:
David Teigland 2021-10-29 14:49:36 -05:00
parent b5b0369e4d
commit 3ca2322d6b
3 changed files with 7 additions and 2 deletions

View File

@ -891,7 +891,7 @@ static int _setup_bcache(void)
#define BASE_FD_COUNT 32 /* Number of open files we want apart from devs */ #define BASE_FD_COUNT 32 /* Number of open files we want apart from devs */
static void _prepare_open_file_limit(struct cmd_context *cmd, unsigned int num_devs) void prepare_open_file_limit(struct cmd_context *cmd, unsigned int num_devs)
{ {
#ifdef HAVE_PRLIMIT #ifdef HAVE_PRLIMIT
struct rlimit old = { 0 }, new; struct rlimit old = { 0 }, new;
@ -1165,7 +1165,7 @@ int label_scan(struct cmd_context *cmd)
* which we want to keep open) is higher than the current * which we want to keep open) is higher than the current
* soft limit. * soft limit.
*/ */
_prepare_open_file_limit(cmd, dm_list_size(&scan_devs)); prepare_open_file_limit(cmd, dm_list_size(&scan_devs));
/* /*
* Do the main scan. * Do the main scan.

View File

@ -134,4 +134,6 @@ void dev_invalidate(struct device *dev);
void dev_set_last_byte(struct device *dev, uint64_t offset); void dev_set_last_byte(struct device *dev, uint64_t offset);
void dev_unset_last_byte(struct device *dev); void dev_unset_last_byte(struct device *dev);
void prepare_open_file_limit(struct cmd_context *cmd, unsigned int num_devs);
#endif #endif

View File

@ -176,6 +176,9 @@ int lvmdevices(struct cmd_context *cmd, int argc, char **argv)
log_error("Failed to read the devices file."); log_error("Failed to read the devices file.");
return ECMD_FAILED; return ECMD_FAILED;
} }
prepare_open_file_limit(cmd, dm_list_size(&cmd->use_devices));
dev_cache_scan(cmd); dev_cache_scan(cmd);
device_ids_match(cmd); device_ids_match(cmd);