From: Hannes Reinecke Date: Tue, 9 Dec 2008 11:26:49 +0000 (+0100) Subject: Set 'max_fds' parameter for multipath X-Git-Tag: 0.4.9~100 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ca7dda8e99f1bb465cb8270d0df7fb889b405b7b;p=platform%2Fupstream%2Fmultipath-tools.git Set 'max_fds' parameter for multipath max_fds should be enabled for multipath, too. References: 457443 Signed-off-by: Hannes Reinecke --- 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) {