|
|
4728c8 |
---
|
|
|
4728c8 |
libmpathpersist/mpath_persist.c | 4 +++-
|
|
|
4728c8 |
libmpathpersist/mpath_pr_ioctl.c | 4 +++-
|
|
|
4728c8 |
libmpathpersist/mpathpr.h | 1 -
|
|
|
4728c8 |
libmultipath/configure.c | 29 +++++++++++++++++++++++++++++
|
|
|
4728c8 |
libmultipath/configure.h | 1 +
|
|
|
4728c8 |
mpathpersist/main.c | 8 +++++++-
|
|
|
4728c8 |
multipath/main.c | 13 +------------
|
|
|
4728c8 |
multipathd/main.c | 28 +---------------------------
|
|
|
4728c8 |
8 files changed, 45 insertions(+), 43 deletions(-)
|
|
|
4728c8 |
|
|
|
4728c8 |
Index: multipath-tools-130222/libmpathpersist/mpath_persist.c
|
|
|
4728c8 |
===================================================================
|
|
|
4728c8 |
--- multipath-tools-130222.orig/libmpathpersist/mpath_persist.c
|
|
|
4728c8 |
+++ multipath-tools-130222/libmpathpersist/mpath_persist.c
|
|
|
4728c8 |
@@ -19,6 +19,7 @@
|
|
|
4728c8 |
#include <dmparser.h>
|
|
|
4728c8 |
#include <ctype.h>
|
|
|
4728c8 |
#include <propsel.h>
|
|
|
4728c8 |
+#include <util.h>
|
|
|
4728c8 |
|
|
|
4728c8 |
#include "mpath_persist.h"
|
|
|
4728c8 |
#include "mpathpr.h"
|
|
|
4728c8 |
@@ -71,7 +72,8 @@ updatepaths (struct multipath * mpp)
|
|
|
4728c8 |
|
|
|
4728c8 |
vector_foreach_slot (pgp->paths, pp, j){
|
|
|
4728c8 |
if (!strlen(pp->dev)){
|
|
|
4728c8 |
- if (devt2devname(pp->dev, pp->dev_t)){
|
|
|
4728c8 |
+ if (devt2devname(pp->dev, sizeof(pp->dev),
|
|
|
4728c8 |
+ pp->dev_t)){
|
|
|
4728c8 |
/*
|
|
|
4728c8 |
* path is not in sysfs anymore
|
|
|
4728c8 |
*/
|
|
|
4728c8 |
Index: multipath-tools-130222/libmpathpersist/mpath_pr_ioctl.c
|
|
|
4728c8 |
===================================================================
|
|
|
4728c8 |
--- multipath-tools-130222.orig/libmpathpersist/mpath_pr_ioctl.c
|
|
|
4728c8 |
+++ multipath-tools-130222/libmpathpersist/mpath_pr_ioctl.c
|
|
|
4728c8 |
@@ -1,5 +1,6 @@
|
|
|
4728c8 |
#include <stdio.h>
|
|
|
4728c8 |
#include <stdlib.h>
|
|
|
4728c8 |
+#include <errno.h>
|
|
|
4728c8 |
|
|
|
4728c8 |
#include <sys/types.h>
|
|
|
4728c8 |
#include <sys/stat.h>
|
|
|
4728c8 |
@@ -306,7 +307,8 @@ int prin_do_scsi_ioctl(char * dev, int r
|
|
|
4728c8 |
snprintf(devname, FILE_NAME_SIZE, "/dev/%s",dev);
|
|
|
4728c8 |
fd = open(devname, O_WRONLY);
|
|
|
4728c8 |
if(fd < 0){
|
|
|
4728c8 |
- condlog(0, "%s: Unable to open device ", dev);
|
|
|
4728c8 |
+ condlog(0, "%s: Unable to open device: %s", devname,
|
|
|
4728c8 |
+ strerror(errno));
|
|
|
4728c8 |
return MPATH_PR_FILE_ERROR;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
Index: multipath-tools-130222/libmpathpersist/mpathpr.h
|
|
|
4728c8 |
===================================================================
|
|
|
4728c8 |
--- multipath-tools-130222.orig/libmpathpersist/mpathpr.h
|
|
|
4728c8 |
+++ multipath-tools-130222/libmpathpersist/mpathpr.h
|
|
|
4728c8 |
@@ -54,6 +54,5 @@ int update_prkey_flags(char *mapname, ui
|
|
|
4728c8 |
#define update_prkey(mapname, prkey) update_prkey_flags(mapname, prkey, 0)
|
|
|
4728c8 |
void * mpath_alloc_prin_response(int prin_sa);
|
|
|
4728c8 |
int update_map_pr(struct multipath *mpp);
|
|
|
4728c8 |
-int devt2devname (char *devname, char *devt);
|
|
|
4728c8 |
|
|
|
4728c8 |
#endif
|
|
|
4728c8 |
Index: multipath-tools-130222/mpathpersist/main.c
|
|
|
4728c8 |
===================================================================
|
|
|
4728c8 |
--- multipath-tools-130222.orig/mpathpersist/main.c
|
|
|
4728c8 |
+++ multipath-tools-130222/mpathpersist/main.c
|
|
|
4728c8 |
@@ -5,6 +5,10 @@
|
|
|
4728c8 |
#include <fcntl.h>
|
|
|
4728c8 |
#include <checkers.h>
|
|
|
4728c8 |
#include <vector.h>
|
|
|
4728c8 |
+#include <config.h>
|
|
|
4728c8 |
+#include <structs.h>
|
|
|
4728c8 |
+#include <structs_vec.h>
|
|
|
4728c8 |
+#include <configure.h>
|
|
|
4728c8 |
#include <util.h>
|
|
|
4728c8 |
#include <structs.h>
|
|
|
4728c8 |
#include <getopt.h>
|
|
|
4728c8 |
@@ -264,7 +268,7 @@ int main (int argc, char * argv[])
|
|
|
4728c8 |
|
|
|
4728c8 |
/* set verbosity */
|
|
|
4728c8 |
noisy = (loglevel >= 3) ? 1 : hex;
|
|
|
4728c8 |
- verbose = (loglevel >= 3)? 3: loglevel;
|
|
|
4728c8 |
+ verbose = (loglevel >= 4)? 4 : loglevel;
|
|
|
4728c8 |
|
|
|
4728c8 |
if ((prout_flag + prin_flag) == 0)
|
|
|
4728c8 |
{
|
|
|
4728c8 |
@@ -356,6 +360,8 @@ int main (int argc, char * argv[])
|
|
|
4728c8 |
goto out;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
|
|
|
4728c8 |
+ set_max_fds(conf->max_fds);
|
|
|
4728c8 |
+
|
|
|
4728c8 |
/* open device */
|
|
|
4728c8 |
if ((fd = open (device_name, O_WRONLY)) < 0)
|
|
|
4728c8 |
{
|
|
|
4728c8 |
Index: multipath-tools-130222/libmultipath/configure.c
|
|
|
4728c8 |
===================================================================
|
|
|
4728c8 |
--- multipath-tools-130222.orig/libmultipath/configure.c
|
|
|
4728c8 |
+++ multipath-tools-130222/libmultipath/configure.c
|
|
|
4728c8 |
@@ -15,6 +15,8 @@
|
|
|
4728c8 |
#include <libdevmapper.h>
|
|
|
4728c8 |
#include <libudev.h>
|
|
|
4728c8 |
#include <mpath_cmd.h>
|
|
|
4728c8 |
+#include <sys/time.h>
|
|
|
4728c8 |
+#include <sys/resource.h>
|
|
|
4728c8 |
|
|
|
4728c8 |
#include "checkers.h"
|
|
|
4728c8 |
#include "vector.h"
|
|
|
4728c8 |
@@ -1143,3 +1145,30 @@ extern int reload_map(struct vectors *ve
|
|
|
4728c8 |
|
|
|
4728c8 |
return 0;
|
|
|
4728c8 |
}
|
|
|
4728c8 |
+
|
|
|
4728c8 |
+void set_max_fds(int max_fds)
|
|
|
4728c8 |
+{
|
|
|
4728c8 |
+ struct rlimit fd_limit;
|
|
|
4728c8 |
+
|
|
|
4728c8 |
+ if (!max_fds)
|
|
|
4728c8 |
+ return;
|
|
|
4728c8 |
+
|
|
|
4728c8 |
+ if (getrlimit(RLIMIT_NOFILE, &fd_limit) < 0) {
|
|
|
4728c8 |
+ condlog(0, "can't get open fds limit: %s",
|
|
|
4728c8 |
+ strerror(errno));
|
|
|
4728c8 |
+ fd_limit.rlim_cur = 0;
|
|
|
4728c8 |
+ fd_limit.rlim_max = 0;
|
|
|
4728c8 |
+ }
|
|
|
4728c8 |
+ if (fd_limit.rlim_cur < conf->max_fds) {
|
|
|
4728c8 |
+ fd_limit.rlim_cur = conf->max_fds;
|
|
|
4728c8 |
+ if (fd_limit.rlim_max < conf->max_fds)
|
|
|
4728c8 |
+ fd_limit.rlim_max = conf->max_fds;
|
|
|
4728c8 |
+ if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0)
|
|
|
4728c8 |
+ condlog(0, "can't set open fds limit to %lu/%lu : %s",
|
|
|
4728c8 |
+ fd_limit.rlim_cur, fd_limit.rlim_max,
|
|
|
4728c8 |
+ strerror(errno));
|
|
|
4728c8 |
+ else
|
|
|
4728c8 |
+ condlog(3, "set open fds limit to %lu/%lu",
|
|
|
4728c8 |
+ fd_limit.rlim_cur, fd_limit.rlim_max);
|
|
|
4728c8 |
+ }
|
|
|
4728c8 |
+}
|
|
|
4728c8 |
Index: multipath-tools-130222/libmultipath/configure.h
|
|
|
4728c8 |
===================================================================
|
|
|
4728c8 |
--- multipath-tools-130222.orig/libmultipath/configure.h
|
|
|
4728c8 |
+++ multipath-tools-130222/libmultipath/configure.h
|
|
|
4728c8 |
@@ -33,3 +33,4 @@ int get_refwwid (char * dev, enum devtyp
|
|
|
4728c8 |
int reload_map(struct vectors *vecs, struct multipath *mpp, int refresh);
|
|
|
4728c8 |
int sysfs_get_host_adapter_name(struct path *pp, char *adapter_name);
|
|
|
4728c8 |
void trigger_uevents (struct multipath *mpp);
|
|
|
4728c8 |
+void set_max_fds(int max_fds);
|
|
|
4728c8 |
Index: multipath-tools-130222/multipath/main.c
|
|
|
4728c8 |
===================================================================
|
|
|
4728c8 |
--- multipath-tools-130222.orig/multipath/main.c
|
|
|
4728c8 |
+++ multipath-tools-130222/multipath/main.c
|
|
|
4728c8 |
@@ -52,8 +52,6 @@
|
|
|
4728c8 |
#include <pgpolicies.h>
|
|
|
4728c8 |
#include <version.h>
|
|
|
4728c8 |
#include <errno.h>
|
|
|
4728c8 |
-#include <sys/time.h>
|
|
|
4728c8 |
-#include <sys/resource.h>
|
|
|
4728c8 |
#include <wwids.h>
|
|
|
4728c8 |
#include <file.h>
|
|
|
4728c8 |
#include "dev_t.h"
|
|
|
4728c8 |
@@ -638,16 +636,7 @@ main (int argc, char *argv[])
|
|
|
4728c8 |
}
|
|
|
4728c8 |
}
|
|
|
4728c8 |
conf->daemon = 0;
|
|
|
4728c8 |
-
|
|
|
4728c8 |
- if (conf->max_fds) {
|
|
|
4728c8 |
- struct rlimit fd_limit;
|
|
|
4728c8 |
-
|
|
|
4728c8 |
- fd_limit.rlim_cur = conf->max_fds;
|
|
|
4728c8 |
- fd_limit.rlim_max = conf->max_fds;
|
|
|
4728c8 |
- if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0)
|
|
|
4728c8 |
- condlog(0, "can't set open fds limit to %d : %s",
|
|
|
4728c8 |
- conf->max_fds, strerror(errno));
|
|
|
4728c8 |
- }
|
|
|
4728c8 |
+ set_max_fds(conf->max_fds);
|
|
|
4728c8 |
|
|
|
4728c8 |
if (init_checkers()) {
|
|
|
4728c8 |
condlog(0, "failed to initialize checkers");
|
|
|
4728c8 |
Index: multipath-tools-130222/multipathd/main.c
|
|
|
4728c8 |
===================================================================
|
|
|
4728c8 |
--- multipath-tools-130222.orig/multipathd/main.c
|
|
|
4728c8 |
+++ multipath-tools-130222/multipathd/main.c
|
|
|
4728c8 |
@@ -12,8 +12,6 @@
|
|
|
4728c8 |
#include <sys/types.h>
|
|
|
4728c8 |
#include <fcntl.h>
|
|
|
4728c8 |
#include <errno.h>
|
|
|
4728c8 |
-#include <sys/time.h>
|
|
|
4728c8 |
-#include <sys/resource.h>
|
|
|
4728c8 |
#include <limits.h>
|
|
|
4728c8 |
#include <linux/oom.h>
|
|
|
4728c8 |
#include <libudev.h>
|
|
|
4728c8 |
@@ -1946,31 +1944,7 @@ child (void * param)
|
|
|
4728c8 |
|
|
|
4728c8 |
setlogmask(LOG_UPTO(conf->verbosity + 3));
|
|
|
4728c8 |
|
|
|
4728c8 |
- if (conf->max_fds) {
|
|
|
4728c8 |
- struct rlimit fd_limit;
|
|
|
4728c8 |
-
|
|
|
4728c8 |
- if (getrlimit(RLIMIT_NOFILE, &fd_limit) < 0) {
|
|
|
4728c8 |
- condlog(0, "can't get open fds limit: %s",
|
|
|
4728c8 |
- strerror(errno));
|
|
|
4728c8 |
- fd_limit.rlim_cur = 0;
|
|
|
4728c8 |
- fd_limit.rlim_max = 0;
|
|
|
4728c8 |
- }
|
|
|
4728c8 |
- if (fd_limit.rlim_cur < conf->max_fds) {
|
|
|
4728c8 |
- fd_limit.rlim_cur = conf->max_fds;
|
|
|
4728c8 |
- if (fd_limit.rlim_max < conf->max_fds)
|
|
|
4728c8 |
- fd_limit.rlim_max = conf->max_fds;
|
|
|
4728c8 |
- if (setrlimit(RLIMIT_NOFILE, &fd_limit) < 0) {
|
|
|
4728c8 |
- condlog(0, "can't set open fds limit to "
|
|
|
4728c8 |
- "%lu/%lu : %s",
|
|
|
4728c8 |
- fd_limit.rlim_cur, fd_limit.rlim_max,
|
|
|
4728c8 |
- strerror(errno));
|
|
|
4728c8 |
- } else {
|
|
|
4728c8 |
- condlog(3, "set open fds limit to %lu/%lu",
|
|
|
4728c8 |
- fd_limit.rlim_cur, fd_limit.rlim_max);
|
|
|
4728c8 |
- }
|
|
|
4728c8 |
- }
|
|
|
4728c8 |
-
|
|
|
4728c8 |
- }
|
|
|
4728c8 |
+ set_max_fds(conf->max_fds);
|
|
|
4728c8 |
|
|
|
4728c8 |
vecs = gvecs = init_vecs();
|
|
|
4728c8 |
if (!vecs) {
|