libmpathpersist: Set open fds limit in mpath_lib_init as mpathpersist called

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

 



Mpath persistent reserve out may fail due to file open failed when too many devices

 

were discoveryed but fd numbers not enough. Set open fds limit just like multipath

 

in that scene.

 

libmpathpersist/mpath_persist.c | 12 ++++++++++++

1 file changed, 12 insertions(+)

 

diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c

index 113cf7f..d032c04 100644

--- a/libmpathpersist/mpath_persist.c

+++ b/libmpathpersist/mpath_persist.c

@@ -29,6 +29,8 @@

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

+#include <sys/resource.h>

+#include <errno.h>

 #define __STDC_FORMAT_MACROS 1

@@ -40,6 +42,16 @@ mpath_lib_init (struct udev *udev)

                condlog(0, "Failed to initialize multipath config.");

                return 1;

       }

+      

+       if (conf->max_fds) {

+                struct rlimit fd_limit;

+

+                fd_limit.rlim_cur = conf->max_fds;

+                fd_limit.rlim_max = conf->max_fds;

+                if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0)

+                          condlog(0, "can't set open fds limit to %d : %s",

+                                   conf->max_fds, strerror(errno));

+       }

        return 0;

}

--

1.8.3.4

 

--

dm-devel mailing list

dm-devel@xxxxxxxxxx

https://www.redhat.com/mailman/listinfo/dm-devel

 

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux