diff options
author | Benjamin Marzinski <bmarzins@redhat.com> | 2009-05-13 23:38:28 -0500 |
---|---|---|
committer | Christophe Varoqui <christophe.varoqui@free.fr> | 2009-05-14 23:02:08 +0200 |
commit | 827b267616cab50d04aa9e117e10819687d63084 (patch) | |
tree | 18922786b889c22f33a285b67e625d39dc42a01c /multipathd | |
parent | 69d094b4b8b2801cbe4e41d8adc12bce296d6d4d (diff) | |
download | multipath-tools-827b267616cab50d04aa9e117e10819687d63084.tar.gz multipath-tools-827b267616cab50d04aa9e117e10819687d63084.tar.bz2 multipath-tools-827b267616cab50d04aa9e117e10819687d63084.zip |
multipath-tools: Improvement to max_fds
Setting max_fds to unlimited doesn't actually work. In the kernel, there is a
fixed limit to the maximum number of open fds a process can have. If you try
to set max_fds to greater than this, it fails. This patch replaces the special
value "unlimited" with a new special value, "max". If you set max_fds to "max",
multipath will use the actual system limit, which it looks up from
/proc/sys/fs/nr_open.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Diffstat (limited to 'multipathd')
-rw-r--r-- | multipathd/main.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/multipathd/main.c b/multipathd/main.c index dfa1098..41a9bd0 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1373,14 +1373,9 @@ child (void * param) 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; - } + + fd_limit.rlim_cur = conf->max_fds; + fd_limit.rlim_max = conf->max_fds; if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0) condlog(0, "can't set open fds limit to %d : %s\n", conf->max_fds, strerror(errno)); |