You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

60 lines
1.8 KiB

autofs-5.1.8 - fix set open file limit
From: Ian Kent <raven@themaw.net>
The check of whether the open file limit needs to be changed is not
right, it checks the hard open file limit against what autofs wants
to set it to which is always less than this value. Consequently the
open file limit isn't changed.
autofs should be changing only the soft open file limit but it is
setting both the hard and soft limits. The system hard limit is much
higer than the autofs maximum open files so the hard limit should be
left alone.
While we are here increase the requested maximum soft open file limit
to 20k.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/automount.c | 7 ++++---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 61090a99..0cbfbe87 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,6 @@
- fix kernel mount status notification.
- fix fedfs build flags.
+- fix set open file limit.
19/10/2021 autofs-5.1.8
- add xdr_exports().
diff --git a/daemon/automount.c b/daemon/automount.c
index cc286892..b8cbdc1b 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -94,7 +94,7 @@ struct startup_cond suc = {
pthread_key_t key_thread_stdenv_vars;
pthread_key_t key_thread_attempt_id = (pthread_key_t) 0L;
-#define MAX_OPEN_FILES 10240
+#define MAX_OPEN_FILES 20480
int aquire_flag_file(void);
void release_flag_file(void);
@@ -2486,9 +2486,10 @@ int main(int argc, char *argv[])
}
res = getrlimit(RLIMIT_NOFILE, &rlim);
- if (res == -1 || rlim.rlim_max <= MAX_OPEN_FILES) {
+ if (res == -1 || rlim.rlim_cur <= MAX_OPEN_FILES) {
rlim.rlim_cur = MAX_OPEN_FILES;
- rlim.rlim_max = MAX_OPEN_FILES;
+ if (rlim.rlim_max < MAX_OPEN_FILES)
+ rlim.rlim_max = MAX_OPEN_FILES;
}
res = setrlimit(RLIMIT_NOFILE, &rlim);
if (res)