Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Device-mapper Development (http://www.linux-archive.org/device-mapper-development/)
-   -   multipath-tools/multipathd main.c (http://www.linux-archive.org/device-mapper-development/86544-multipath-tools-multipathd-main-c.html)

05-12-2008 06:48 PM

multipath-tools/multipathd main.c
 
CVSROOT: /cvs/dm
Module name: multipath-tools
Branch: RHEL5_FC6
Changes by: bmarzins@sourceware.org 2008-05-12 18:48:03

Modified files:
multipathd : main.c

Log message:
Fix multipathd startup so -d option works correctly.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1= 1.69.2.6&r2=1.69.2.7

--- multipath-tools/multipathd/main.c 2008/05/12 17:45:28 1.69.2.6
+++ multipath-tools/multipathd/main.c 2008/05/12 18:48:03 1.69.2.7
@@ -1422,15 +1422,31 @@
umask(0);
}

+enum child_flag_bits {
+ __DAEMONIZE = 0,
+#ifdef CLONE_NEWNS
+ __NEW_NS,
+#endif
+};
+
+#define DAEMONIZE (1 << __DAEMONIZE)
+#ifdef CLONE_NEWNS
+#define NEW_NS (1 << __NEW_NS)
+#endif
+
static int
child (void * param)
{
pthread_t check_thr, uevent_thr, uxlsnr_thr;
pthread_attr_t attr;
struct vectors * vecs;
- unsigned long new_ns = (unsigned long)param;
+ unsigned int daemon = (unsigned long)param & DAEMONIZE;
+#ifdef CLONE_NEWNS
+ unsigned int new_ns = (unsigned long)param & NEW_NS;
+#endif

- setup_daemon();
+ if (daemon)
+ setup_daemon();
mlockall(MCL_CURRENT | MCL_FUTURE);

if (logsink)
@@ -1583,11 +1599,11 @@
#ifdef CLONE_NEWNS
if (unshare(CLONE_NEWNS) < 0) {
fprintf(stderr, "Failed to unshare namespace : %s
", strerror(errno));
- return child((void *)0);
+ return child((void *)DAEMONIZE);
}
- return child((void *)1);
+ return child((void *)(DAEMONIZE | NEW_NS));
#else
- return child((void *)0);
+ return child((void *)DAEMONIZE);
#endif
}


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

09-04-2008 11:31 PM

multipath-tools/multipathd main.c
 
CVSROOT: /cvs/dm
Module name: multipath-tools
Branch: RHEL5_FC6
Changes by: bmarzins@sourceware.org 2008-09-04 23:31:39

Modified files:
multipathd : main.c

Log message:
Typo in my fix for 238421

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1= 1.69.2.10&r2=1.69.2.11

--- multipath-tools/multipathd/main.c 2008/09/04 20:09:48 1.69.2.10
+++ multipath-tools/multipathd/main.c 2008/09/04 23:31:39 1.69.2.11
@@ -516,7 +516,7 @@
condlog(2, "%s Last path deleted, disabling queueing", mpp->alias);
mpp->retry_tick = 0;
mpp->no_path_retry = NO_PATH_RETRY_FAIL;
- mpp->flush_on_last_del == FLUSH_IN_PROGRESS;
+ mpp->flush_on_last_del = FLUSH_IN_PROGRESS;
dm_queue_if_no_path(mpp->alias, 0);
}
if (flush_map(mpp, vecs))
@@ -575,7 +575,7 @@
condlog(2, "%s Last path deleted, disabling queueing", mpp->alias);
mpp->retry_tick = 0;
mpp->no_path_retry = NO_PATH_RETRY_FAIL;
- mpp->flush_on_last_del == FLUSH_IN_PROGRESS;
+ mpp->flush_on_last_del = FLUSH_IN_PROGRESS;
dm_queue_if_no_path(mpp->alias, 0);
}
if (flush_map(mpp, vecs))

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

09-12-2008 11:49 PM

multipath-tools/multipathd main.c
 
CVSROOT: /cvs/dm
Module name: multipath-tools
Branch: RHEL5_FC6
Changes by: bmarzins@sourceware.org 2008-09-12 23:49:57

Modified files:
multipathd : main.c

Log message:
Fix for bz 449097. When multipathd creates a new namespace for the
callout functions, it now unmounts all of the unneeded mounts that it inherits
the calling process.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1= 1.69.2.12&r2=1.69.2.13

--- multipath-tools/multipathd/main.c 2008/09/08 22:01:20 1.69.2.12
+++ multipath-tools/multipathd/main.c 2008/09/12 23:49:57 1.69.2.13
@@ -15,6 +15,7 @@
#include <errno.h>
#include <sys/time.h>
#include <sys/resource.h>
+#include <sys/mount.h>

/*
* libsysfs
@@ -62,6 +63,10 @@
#include "waiter.h"
#include "copy.h"

+#if !defined(MNT_DETACH)
+#define MNT_DETACH 2
+#endif
+
#define FILE_NAME_SIZE 256
#define CMDSIZE 160

@@ -1231,6 +1236,47 @@
return NULL;
}

+static int
+unmount_extra_devs(void)
+{
+ int ret;
+ char buf[LINE_MAX];
+ FILE *file;
+
+ file = fopen("/proc/mounts", "r");
+ if (!file) {
+ condlog(0, "couldn't open /proc/mounts : %s", strerror(errno));
+ return -1;
+ }
+
+ while (fgets(buf, LINE_MAX, file)) {
+ char *end, *mnt = strchr(buf, ' ');
+ if (!mnt)
+ continue;
+ mnt++;
+ end = strchr(mnt, ' ');
+ if (!end) {
+ condlog(2, "can't process /proc/mounts line (%s). skipping", buf);
+ continue;
+ }
+ *end = '';
+ if (strcmp(mnt, "/") == 0 || strcmp(mnt, "/sbin") == 0 ||
+ strcmp(mnt, "/bin") == 0 || strcmp(mnt, "/tmp") == 0 ||
+ strcmp(mnt, "/usr") == 0 || strncmp(mnt, "/usr/lib", 8) == 0 ||
+ strncmp(mnt, "/etc", 4) == 0 || strncmp(mnt, "/proc", 5) == 0 ||
+ strncmp(mnt, "/dev", 4) == 0 || strncmp(mnt, "/sys", 4) == 0 ||
+ strncmp(mnt, "/var", 4) == 0 || strncmp(mnt, "/lib", 4) == 0)
+ continue;
+ if (umount2(mnt, MNT_DETACH) < 0 && errno != ENOENT) {
+ condlog(0, "failed to umount '%s' (%s). skipping", mnt, strerror(errno));
+ }
+ }
+ fclose(file);
+ return ret;
+}
+
+
+

#ifdef CLONE_NEWNS
static int
@@ -1328,7 +1374,8 @@
return -1;
}
condlog(4, "bind ramfs on /tmp");
-
+ if (unmount_extra_devs() < 0)
+ return -1;
return 0;
}
#endif

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

10-17-2008 06:37 PM

multipath-tools/multipathd main.c
 
CVSROOT: /cvs/dm
Module name: multipath-tools
Branch: RHEL4_FC5
Changes by: bmarzins@sourceware.org 2008-10-17 18:37:54

Modified files:
multipathd : main.c

Log message:
Don't check the map flags for an orphaned path.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL4_FC5&r1= 1.66.2.4&r2=1.66.2.5

--- multipath-tools/multipathd/main.c 2008/04/14 22:40:09 1.66.2.4
+++ multipath-tools/multipathd/main.c 2008/10/17 18:37:53 1.66.2.5
@@ -863,7 +863,7 @@
break;
}
}
- if (!found && mpp->flush_on_last_del == FLUSH_ENABLED) {
+ if (mpp && !found && mpp->flush_on_last_del == FLUSH_ENABLED) {
condlog(1, "%s: Last path deleted, disabling queueing",
mpp->alias);
mpp->retry_tick = 0;

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

11-02-2009 06:11 PM

multipath-tools/multipathd main.c
 
CVSROOT: /cvs/dm
Module name: multipath-tools
Branch: RHEL5_FC6
Changes by: bmarzins@sourceware.org 2009-11-02 19:11:46

Modified files:
multipathd : main.c

Log message:
Fixed typo in unmounting unnecessary devices from multipathd's private
namespace. Related to bz #532424. Not applicable upstream.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1= 1.69.2.24&r2=1.69.2.25

--- multipath-tools/multipathd/main.c 2009/09/10 16:27:24 1.69.2.24
+++ multipath-tools/multipathd/main.c 2009/11/02 19:11:46 1.69.2.25
@@ -1289,7 +1289,7 @@
strcmp(mnt, "/etc") == 0 || strncmp(mnt, "/proc", 5) == 0 ||
strncmp(mnt, "/dev", 4) == 0 || strncmp(mnt, "/sys", 4) == 0 ||
strcmp(mnt, "/var") == 0 || strncmp(mnt, "/var/lib", 8) == 0 ||
- strncmp(mnt, "/var/run", 8) || strncmp(mnt, "/lib", 4) == 0 ||
+ strncmp(mnt, "/var/run", 8) == 0 || strncmp(mnt, "/lib", 4) == 0 ||
strncmp(mnt, "/lib64", 6) == 0 || strncmp(mnt, "/usr/lib64", 10) == 0)
continue;
if (umount2(mnt, MNT_DETACH) < 0 && errno != ENOENT) {

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

08-09-2010 04:16 PM

multipath-tools/multipathd main.c
 
CVSROOT: /cvs/dm
Module name: multipath-tools
Branch: RHEL5_FC6
Changes by: bmarzins@sourceware.org 2010-08-09 16:16:10

Modified files:
multipathd : main.c

Log message:
Fix for bz #614966

Occasionally, the kernel sends out remove uevents when the multipath device
hasn't been removed. multipathd should never remove the device when it gets
these events, since they are only suspposed to be generated after the device
has already been removed.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1= 1.69.2.27&r2=1.69.2.28

--- multipath-tools/multipathd/main.c 2010/06/23 16:28:08 1.69.2.27
+++ multipath-tools/multipathd/main.c 2010/08/09 16:16:10 1.69.2.28
@@ -299,8 +299,18 @@
static int
uev_remove_map (char * devname, struct vectors * vecs)
{
+ struct multipath * mpp;
+
condlog(2, "%s: remove map (uevent)", devname);
- return ev_remove_map(devname, vecs);
+
+ mpp = find_mp_by_str(vecs->mpvec, devname);
+ if (!mpp) {
+ condlog(2, "%s: devmap not registered, can't remove", devname);
+ return 0;
+ }
+ orphan_paths(vecs->pathvec, mpp);
+ remove_map(mpp, vecs, stop_waiter_thread, 1);
+ return 0;
}

int

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

09-01-2010 06:29 PM

multipath-tools/multipathd main.c
 
CVSROOT: /cvs/dm
Module name: multipath-tools
Branch: RHEL5_FC6
Changes by: bmarzins@sourceware.org 2010-09-01 18:29:19

Modified files:
multipathd : main.c

Log message:
Fix for bz #566685. Multipathd now will reload the device if it notices that
the priorities have changed during the checkerloop.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1= 1.69.2.28&r2=1.69.2.29

--- multipath-tools/multipathd/main.c 2010/08/09 16:16:10 1.69.2.28
+++ multipath-tools/multipathd/main.c 2010/09/01 18:29:18 1.69.2.29
@@ -52,6 +52,7 @@
#include <switchgroup.h>
#include <print.h>
#include <configure.h>
+#include <pgpolicies.h>

#include "main.h"
#include "pidfile.h"
@@ -933,6 +934,29 @@
return 0;
}

+int update_path_groups(struct multipath *mpp, struct vectors *vecs)
+{
+ int i;
+ struct path * pp;
+
+ update_mpp_paths(mpp, vecs->pathvec);
+ vector_foreach_slot (mpp->paths, pp, i)
+ pathinfo(pp, conf->hwtable, DI_PRIO);
+ setup_map(mpp);
+ mpp->action = ACT_RELOAD;
+ if (domap(mpp) <= 0) {
+ condlog(0, "%s: failed to update map : %s", mpp->alias,
+ strerror(errno));
+ return 1;
+ }
+ dm_lib_release();
+ setup_multipath(vecs, mpp);
+ sync_map_state(mpp);
+
+ return 0;
+}
+
+
static void *
checkerloop (void *ap)
{
@@ -942,6 +966,7 @@
int newstate;
unsigned int i;
sigset_t old;
+ int oldpriority;

mlockall(MCL_CURRENT | MCL_FUTURE);
vecs = (struct vectors *)ap;
@@ -1095,9 +1120,13 @@
* path prio refreshing
*/
condlog(4, "path prio refresh");
+ oldpriority = pp->priority;
pathinfo(pp, conf->hwtable, DI_PRIO);

- if (need_switch_pathgroup(pp->mpp, 0)) {
+ if (pp->priority != oldpriority &&
+ pp->mpp->pgpolicyfn == (pgpolicyfn *)group_by_prio)
+ update_path_groups(pp->mpp, vecs);
+ else if (need_switch_pathgroup(pp->mpp, 0)) {
if (pp->mpp->pgfailback > 0 &&
pp->mpp->failback_tick <= 0)
pp->mpp->failback_tick =

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

12-07-2010 05:02 AM

multipath-tools/multipathd main.c
 
CVSROOT: /cvs/dm
Module name: multipath-tools
Branch: RHEL5_FC6
Changes by: bmarzins@sourceware.org 2010-12-07 06:02:24

Modified files:
multipathd : main.c

Log message:
Fix for bug 650801. Multipathd wasn't checking checking all the paths to see
if it needed to update the pathgroups after a new path came back online.
This could lead to paths accidentally ending up in the wrong pathgroup.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1= 1.69.2.30&r2=1.69.2.31

--- multipath-tools/multipathd/main.c 2010/09/08 21:40:30 1.69.2.30
+++ multipath-tools/multipathd/main.c 2010/12/07 06:02:23 1.69.2.31
@@ -937,14 +937,41 @@
return 0;
}

-int update_path_groups(struct multipath *mpp, struct vectors *vecs)
+int update_prio(struct path *pp, int refresh_all)
+{
+ int oldpriority;
+ struct pathgroup * pgp;
+ int i, j, changed = 0;
+
+ if (refresh_all) {
+ vector_foreach_slot (pp->mpp->pg, pgp, i) {
+ vector_foreach_slot (pgp->paths, pp, j) {
+ oldpriority = pp->priority;
+ pathinfo(pp, conf->hwtable, DI_PRIO);
+ if (pp->priority != oldpriority)
+ changed = 1;
+ }
+ }
+ return changed;
+ }
+ oldpriority = pp->priority;
+ pathinfo(pp, conf->hwtable, DI_PRIO);
+
+ if (pp->priority == oldpriority)
+ return 0;
+ return 1;
+}
+
+int update_path_groups(struct multipath *mpp, struct vectors *vecs, int refresh)
{
int i;
struct path * pp;

update_mpp_paths(mpp, vecs->pathvec);
- vector_foreach_slot (mpp->paths, pp, i)
- pathinfo(pp, conf->hwtable, DI_PRIO);
+ if (refresh) {
+ vector_foreach_slot (mpp->paths, pp, i)
+ pathinfo(pp, conf->hwtable, DI_PRIO);
+ }
setup_map(mpp);
mpp->action = ACT_RELOAD;
if (domap(mpp) <= 0) {
@@ -969,7 +996,6 @@
int newstate;
unsigned int i;
sigset_t old;
- int oldpriority;

mlockall(MCL_CURRENT | MCL_FUTURE);
vecs = (struct vectors *)ap;
@@ -989,6 +1015,7 @@
condlog(4, "tick");

vector_foreach_slot (vecs->pathvec, pp, i) {
+ int new_path_up = 0;
if (!pp->mpp)
continue;

@@ -1081,16 +1108,7 @@
reinstate_path(pp, 1);
else
reinstate_path(pp, 0);
-
- /*
- * schedule [defered] failback
- */
- if (pp->mpp->pgfailback > 0)
- pp->mpp->failback_tick =
- pp->mpp->pgfailback + 1;
- else if (pp->mpp->pgfailback == -FAILBACK_IMMEDIATE &&
- need_switch_pathgroup(pp->mpp, 1))
- switch_pathgroup(pp->mpp);
+ new_path_up = 1;

/*
* if at least one path is up in a group, and
@@ -1127,15 +1145,13 @@
* path prio refreshing
*/
condlog(4, "path prio refresh");
- oldpriority = pp->priority;
- pathinfo(pp, conf->hwtable, DI_PRIO);
-
- if (pp->priority != oldpriority &&
+ if (update_prio(pp, new_path_up) &&
pp->mpp->pgpolicyfn == (pgpolicyfn *)group_by_prio)
- update_path_groups(pp->mpp, vecs);
+ update_path_groups(pp->mpp, vecs, !new_path_up);
else if (need_switch_pathgroup(pp->mpp, 0)) {
if (pp->mpp->pgfailback > 0 &&
- pp->mpp->failback_tick <= 0)
+ (new_path_up ||
+ pp->mpp->failback_tick <= 0))
pp->mpp->failback_tick =
pp->mpp->pgfailback + 1;
else if (pp->mpp->pgfailback ==

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

04-11-2011 05:01 PM

multipath-tools/multipathd main.c
 
CVSROOT: /cvs/dm
Module name: multipath-tools
Branch: RHEL5_FC6
Changes by: bmarzins@sourceware.org 2011-04-11 17:01:08

Modified files:
multipathd : main.c

Log message:
Oops. stray semi-colon.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1= 1.69.2.34&r2=1.69.2.35

--- multipath-tools/multipathd/main.c 2011/04/04 19:48:46 1.69.2.34
+++ multipath-tools/multipathd/main.c 2011/04/11 17:01:08 1.69.2.35
@@ -1505,7 +1505,7 @@
condlog(2, "reconfigure (SIGHUP)");

lock(gvecs->lock);
- if (!exitting);
+ if (!exitting)
reconfigure(gvecs);
unlock(gvecs->lock);


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

10-10-2011 03:47 AM

multipath-tools/multipathd main.c
 
CVSROOT: /cvs/dm
Module name: multipath-tools
Branch: RHEL5_FC6
Changes by: bmarzins@sourceware.org 2011-10-10 03:47:07

Modified files:
multipathd : main.c

Log message:
Fix for BZ# 655976. Don't automatically update path groups on devices set to
manual failback when the prio changes. This fix is already upstream.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1= 1.69.2.35&r2=1.69.2.36

--- multipath-tools/multipathd/main.c 2011/04/11 17:01:08 1.69.2.35
+++ multipath-tools/multipathd/main.c 2011/10/10 03:47:07 1.69.2.36
@@ -1153,8 +1153,7 @@
* path prio refreshing
*/
condlog(4, "path prio refresh");
- if (update_prio(pp, new_path_up) &&
- pp->mpp->pgpolicyfn == (pgpolicyfn *)group_by_prio)
+ if (update_prio(pp, new_path_up) && pp->mpp->pgpolicyfn == (pgpolicyfn *)group_by_prio && (pp->mpp->pgfailback == -FAILBACK_IMMEDIATE || pp->mpp->pgfailback > 0))
update_path_groups(pp->mpp, vecs, !new_path_up);
else if (need_switch_pathgroup(pp->mpp, 0)) {
if (pp->mpp->pgfailback > 0 &&

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


All times are GMT. The time now is 07:12 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.