]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tmpfiles: let's bump RLIMIT_NOFILE for tmpfiles 11482/head
authorLennart Poettering <lennart@poettering.net>
Fri, 18 Jan 2019 15:34:52 +0000 (16:34 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 15 Feb 2019 16:16:54 +0000 (17:16 +0100)
We potentially might descent into quite deep directory trees. Let's
hence make sure we can allocate a lot of fds.

(This reflects the fact that glibc nftw() and friends have some logic in
place to reduce fd usage while descending into directory trees. Doing so
is a bit nasty I think, and given that fds are basically free now, if we
ask for them, lte's just protect ourselves and make use of that)

(No, I am not aware of a real-world case where this was necessary, but
let's better be safe than sorry)

src/tmpfiles/tmpfiles.c

index 04cd0bfa3361f5a4662848a4f33dde330f654922..6296a8acdf2dbf40bd4b4ac09d11647b0d1f7bbe 100644 (file)
@@ -49,6 +49,7 @@
 #include "path-lookup.h"
 #include "path-util.h"
 #include "pretty-print.h"
+#include "rlimit-util.h"
 #include "rm-rf.h"
 #include "selinux-util.h"
 #include "set.h"
@@ -3175,6 +3176,9 @@ static int run(int argc, char *argv[]) {
 
         log_setup_service();
 
+        /* Descending down file system trees might take a lot of fds */
+        (void) rlimit_nofile_bump(HIGH_RLIMIT_NOFILE);
+
         if (arg_user) {
                 r = user_config_paths(&config_dirs);
                 if (r < 0)