From ca7dda8e99f1bb465cb8270d0df7fb889b405b7b Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Tue, 9 Dec 2008 12:26:49 +0100 Subject: [PATCH] Set 'max_fds' parameter for multipath max_fds should be enabled for multipath, too. References: 457443 Signed-off-by: Hannes Reinecke --- multipath/main.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/multipath/main.c b/multipath/main.c index dacae1f..707e2b9 100644 --- a/multipath/main.c +++ b/multipath/main.c @@ -48,6 +48,9 @@ #include #include #include +#include +#include +#include int logsink; @@ -422,6 +425,22 @@ main (int argc, char *argv[]) } conf->daemon = 0; + + if (conf->max_fds) { + struct rlimit fd_limit; + if (conf->max_fds > 0) { + fd_limit.rlim_cur = conf->max_fds; + fd_limit.rlim_max = conf->max_fds; + } + else { + fd_limit.rlim_cur = RLIM_INFINITY; + fd_limit.rlim_max = RLIM_INFINITY; + } + if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0) + condlog(0, "can't set open fds limit to %d : %s\n", + conf->max_fds, strerror(errno)); + } + dm_init(); if (conf->remove == FLUSH_ONE) { -- 2.7.4