Blame SOURCES/autofs-5.1.8-fix-set-open-file-limit.patch

6c38fb
autofs-5.1.8 - fix set open file limit
6c38fb
6c38fb
From: Ian Kent <raven@themaw.net>
6c38fb
6c38fb
The check of whether the open file limit needs to be changed is not
6c38fb
right, it checks the hard open file limit against what autofs wants
6c38fb
to set it to which is always less than this value. Consequently the
6c38fb
open file limit isn't changed.
6c38fb
6c38fb
autofs should be changing only the soft open file limit but it is
6c38fb
setting both the hard and soft limits. The system hard limit is much
6c38fb
higer than the autofs maximum open files so the hard limit should be
6c38fb
left alone.
6c38fb
6c38fb
While we are here increase the requested maximum soft open file limit
6c38fb
to 20k.
6c38fb
6c38fb
Signed-off-by: Ian Kent <raven@themaw.net>
6c38fb
---
6c38fb
 CHANGELOG          |    1 +
6c38fb
 daemon/automount.c |    7 ++++---
6c38fb
 2 files changed, 5 insertions(+), 3 deletions(-)
6c38fb
6c38fb
--- autofs-5.1.4.orig/CHANGELOG
6c38fb
+++ autofs-5.1.4/CHANGELOG
6c38fb
@@ -79,6 +79,7 @@
6c38fb
 - fix nonstrict offset mount fail handling.
6c38fb
 - remove intr hosts map mount option.
6c38fb
 - fix kernel mount status notification.
6c38fb
+- fix set open file limit.
6c38fb
 
6c38fb
 xx/xx/2018 autofs-5.1.5
6c38fb
 - fix flag file permission.
6c38fb
--- autofs-5.1.4.orig/daemon/automount.c
6c38fb
+++ autofs-5.1.4/daemon/automount.c
6c38fb
@@ -95,7 +95,7 @@ struct startup_cond suc = {
6c38fb
 pthread_key_t key_thread_stdenv_vars;
6c38fb
 pthread_key_t key_thread_attempt_id = (pthread_key_t) 0L;
6c38fb
 
6c38fb
-#define MAX_OPEN_FILES		10240
6c38fb
+#define MAX_OPEN_FILES		20480
6c38fb
 
6c38fb
 int aquire_flag_file(void);
6c38fb
 void release_flag_file(void);
6c38fb
@@ -2475,9 +2475,10 @@ int main(int argc, char *argv[])
6c38fb
 	}
6c38fb
 
6c38fb
 	res = getrlimit(RLIMIT_NOFILE, &rlim);
6c38fb
-	if (res == -1 || rlim.rlim_max <= MAX_OPEN_FILES)  {
6c38fb
+	if (res == -1 || rlim.rlim_cur <= MAX_OPEN_FILES)  {
6c38fb
 		rlim.rlim_cur = MAX_OPEN_FILES;
6c38fb
-		rlim.rlim_max = MAX_OPEN_FILES;
6c38fb
+		if (rlim.rlim_max < MAX_OPEN_FILES)
6c38fb
+			rlim.rlim_max = MAX_OPEN_FILES;
6c38fb
 	}
6c38fb
 	res = setrlimit(RLIMIT_NOFILE, &rlim);
6c38fb
 	if (res)