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

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