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

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