[PATCH 03/19] autofs-5.1.8 - fix set open file limit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The check of whether the open file limit needs to be changed is not
right, it checks the hard open file limit against what autofs wants
to set it to which is always less than this value. Consequently the
open file limit isn't changed.

autofs should be changing only the soft open file limit but it is
setting both the hard and soft limits. The system hard limit is much
higer than the autofs maximum open files so the hard limit should be
left alone.

While we are here increase the requested maximum soft open file limit
to 20k.

Signed-off-by: Ian Kent <raven@xxxxxxxxxx>
---
 CHANGELOG          |    1 +
 daemon/automount.c |    7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 61090a99..0cbfbe87 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,6 @@
 - fix kernel mount status notification.
 - fix fedfs build flags.
+- fix set open file limit.
 
 19/10/2021 autofs-5.1.8
 - add xdr_exports().
diff --git a/daemon/automount.c b/daemon/automount.c
index cc286892..b8cbdc1b 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -94,7 +94,7 @@ struct startup_cond suc = {
 pthread_key_t key_thread_stdenv_vars;
 pthread_key_t key_thread_attempt_id = (pthread_key_t) 0L;
 
-#define MAX_OPEN_FILES		10240
+#define MAX_OPEN_FILES		20480
 
 int aquire_flag_file(void);
 void release_flag_file(void);
@@ -2486,9 +2486,10 @@ int main(int argc, char *argv[])
 	}
 
 	res = getrlimit(RLIMIT_NOFILE, &rlim);
-	if (res == -1 || rlim.rlim_max <= MAX_OPEN_FILES)  {
+	if (res == -1 || rlim.rlim_cur <= MAX_OPEN_FILES)  {
 		rlim.rlim_cur = MAX_OPEN_FILES;
-		rlim.rlim_max = MAX_OPEN_FILES;
+		if (rlim.rlim_max < MAX_OPEN_FILES)
+			rlim.rlim_max = MAX_OPEN_FILES;
 	}
 	res = setrlimit(RLIMIT_NOFILE, &rlim);
 	if (res)





[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux