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

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