* libmpathpersist: Set open fds limit in mpath_lib_init as mpathpersist called
@ 2015-10-14 3:32 Xieyingtai
0 siblings, 0 replies; only message in thread
From: Xieyingtai @ 2015-10-14 3:32 UTC (permalink / raw)
To: dm-devel; +Cc: Christophe Varoqui
[-- Attachment #1.1: Type: text/plain, Size: 1370 bytes --]
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@redhat.com<mailto:dm-devel@redhat.com>
https://www.redhat.com/mailman/listinfo/dm-devel
[-- Attachment #1.2: Type: text/html, Size: 7706 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-10-14 3:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-14 3:32 libmpathpersist: Set open fds limit in mpath_lib_init as mpathpersist called Xieyingtai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.