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

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