public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW lib/activate/activate.c lib/l ...
@ 2012-01-21 5:29 agk
0 siblings, 0 replies; 2+ messages in thread
From: agk @ 2012-01-21 5:29 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2012-01-21 05:29:52
Modified files:
. : WHATS_NEW
lib/activate : activate.c
lib/locking : cluster_locking.c locking.c locking.h
Log message:
Attempt to improve clustered 'lvchange -aey' behaviour to try local node before
remote nodes and address some existing anomalies.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2233&r2=1.2234
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.232&r2=1.233
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/cluster_locking.c.diff?cvsroot=lvm2&r1=1.63&r2=1.64
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.101&r2=1.102
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.h.diff?cvsroot=lvm2&r1=1.73&r2=1.74
--- LVM2/WHATS_NEW 2012/01/20 22:04:16 1.2233
+++ LVM2/WHATS_NEW 2012/01/21 05:29:51 1.2234
@@ -1,5 +1,7 @@
Version 2.02.89 -
==================================
+ Change exclusive LV activation logic to try local node before remote nodes.
+ Add CLVMD_FLAG_REMOTE to skip processing on local node.
Prompt if request is made to remove a snapshot whose "Merge failed".
Allow removal of an invalid snapshot that was to be merged on next activation.
Don't allow a user to merge an invalid snapshot.
--- LVM2/lib/activate/activate.c 2012/01/20 03:46:52 1.232
+++ LVM2/lib/activate/activate.c 2012/01/21 05:29:52 1.233
@@ -930,7 +930,8 @@
l = 1;
if (!vg_is_clustered(lv->vg)) {
- e = 1; /* exclusive by definition */
+ if (l)
+ e = 1; /* exclusive by definition */
goto out;
}
@@ -950,21 +951,15 @@
* New users of this function who specifically ask for 'exclusive'
* will be given an error message.
*/
- if (l) {
- if (exclusive)
- log_error("Unable to determine exclusivity of %s",
- lv->name);
- goto out;
- }
+ log_error("Unable to determine exclusivity of %s", lv->name);
+
+ e = 0;
+
+ /*
+ * We used to attempt activate_lv_excl_local(lv->vg->cmd, lv) here,
+ * but it's unreliable.
+ */
- /* FIXME: Is this fallback alright? */
- if (activate_lv_excl(lv->vg->cmd, lv)) {
- if (!deactivate_lv(lv->vg->cmd, lv))
- stack;
- /* FIXME: locally & exclusive are undefined. */
- return 0;
- }
- /* FIXME: Check exclusive value here. */
out:
if (locally)
*locally = l;
--- LVM2/lib/locking/cluster_locking.c 2011/12/08 18:19:05 1.63
+++ LVM2/lib/locking/cluster_locking.c 2012/01/21 05:29:52 1.64
@@ -178,21 +178,19 @@
head->clientid = 0;
head->arglen = len;
- if (node) {
- /*
- * Allow a couple of special node names:
- * "*" for all nodes,
- * "." for the local node only
- */
- if (strcmp(node, "*") == 0) {
- head->node[0] = '\0';
- } else if (strcmp(node, ".") == 0) {
- head->node[0] = '\0';
- head->flags = CLVMD_FLAG_LOCAL;
- } else
- strcpy(head->node, node);
- } else
+ /*
+ * Handle special node names.
+ */
+ if (!node || !strcmp(node, NODE_ALL))
+ head->node[0] = '\0';
+ else if (!strcmp(node, NODE_LOCAL)) {
head->node[0] = '\0';
+ head->flags = CLVMD_FLAG_LOCAL;
+ } else if (!strcmp(node, NODE_REMOTE)) {
+ head->node[0] = '\0';
+ head->flags = CLVMD_FLAG_REMOTE;
+ } else
+ strcpy(head->node, node);
}
/*
@@ -357,9 +355,6 @@
* so we only need to do them on the local node because all
* locks are cluster-wide.
*
- * Also, if the lock is exclusive it makes no sense to try to
- * acquire it on all nodes, so just do that on the local node too.
- *
* P_ locks /do/ get distributed across the cluster because they might
* have side-effects.
*
@@ -367,13 +362,15 @@
*/
if (clvmd_cmd == CLVMD_CMD_SYNC_NAMES) {
if (flags & LCK_LOCAL)
- node = ".";
+ node = NODE_LOCAL;
} else if (clvmd_cmd != CLVMD_CMD_VG_BACKUP) {
if (strncmp(name, "P_", 2) &&
(clvmd_cmd == CLVMD_CMD_LOCK_VG ||
(flags & LCK_LOCAL) ||
!(flags & LCK_CLUSTER_VG)))
- node = ".";
+ node = NODE_LOCAL;
+ else if (flags & LCK_REMOTE)
+ node = NODE_REMOTE;
}
status = _cluster_request(clvmd_cmd, node, args, len,
@@ -493,12 +490,13 @@
return 0;
}
- log_very_verbose("Locking %s %s %s (%s%s%s%s%s%s%s%s) (0x%x)", lock_scope, lockname,
+ log_very_verbose("Locking %s %s %s (%s%s%s%s%s%s%s%s%s) (0x%x)", lock_scope, lockname,
lock_type, lock_scope,
flags & LCK_NONBLOCK ? "|NONBLOCK" : "",
flags & LCK_HOLD ? "|HOLD" : "",
- flags & LCK_LOCAL ? "|LOCAL" : "",
flags & LCK_CLUSTER_VG ? "|CLUSTER" : "",
+ flags & LCK_LOCAL ? "|LOCAL" : "",
+ flags & LCK_REMOTE ? "|REMOTE" : "",
flags & LCK_CACHE ? "|CACHE" : "",
flags & LCK_ORIGIN_ONLY ? "|ORIGIN_ONLY" : "",
flags & LCK_REVERT ? "|REVERT" : "",
--- LVM2/lib/locking/locking.c 2012/01/10 02:03:32 1.101
+++ LVM2/lib/locking/locking.c 2012/01/21 05:29:52 1.102
@@ -539,6 +539,33 @@
return 1;
}
+/*
+ * First try to activate exclusively locally.
+ * Then if the VG is clustered and the LV is not yet active (e.g. due to
+ * an activation filter) try activating on remote nodes.
+ */
+int activate_lv_excl(struct cmd_context *cmd, struct logical_volume *lv)
+{
+ /* Non-clustered VGs are only activated locally. */
+ if (!vg_is_clustered(lv->vg))
+ return activate_lv_excl_local(cmd, lv);
+
+ if (lv_is_active_exclusive(lv))
+ return 1;
+
+ if (!activate_lv_excl_local(cmd, lv))
+ return_0;
+
+ if (lv_is_active_exclusive(lv))
+ return 1;
+
+ /* FIXME Deal with error return codes. */
+ if (activate_lv_excl_remote(cmd, lv))
+ stack;
+
+ return lv_is_active_exclusive(lv);
+}
+
/* Lock a list of LVs */
int activate_lvs(struct cmd_context *cmd, struct dm_list *lvs, unsigned exclusive)
{
--- LVM2/lib/locking/locking.h 2011/12/08 18:09:48 1.73
+++ LVM2/lib/locking/locking.h 2012/01/21 05:29:52 1.74
@@ -97,6 +97,7 @@
#define LCK_CLUSTER_VG 0x00000080U /* VG is clustered */
#define LCK_LOCAL 0x00000040U /* Don't propagate to other nodes */
+#define LCK_REMOTE 0x00000800U /* Propagate to remote nodes only */
#define LCK_CACHE 0x00000100U /* Operation on cache only using P_ lock */
#define LCK_ORIGIN_ONLY 0x00000200U /* Operation should bypass any snapshots */
#define LCK_REVERT 0x00000400U /* Revert any incomplete change */
@@ -176,9 +177,16 @@
#define suspend_lv(cmd, lv) lock_lv_vol(cmd, lv, LCK_LV_SUSPEND | LCK_HOLD)
#define suspend_lv_origin(cmd, lv) lock_lv_vol(cmd, lv, LCK_LV_SUSPEND | LCK_HOLD | LCK_ORIGIN_ONLY)
#define deactivate_lv(cmd, lv) lock_lv_vol(cmd, lv, LCK_LV_DEACTIVATE)
+
#define activate_lv(cmd, lv) lock_lv_vol(cmd, lv, LCK_LV_ACTIVATE | LCK_HOLD)
-#define activate_lv_excl(cmd, lv) \
- lock_lv_vol(cmd, lv, LCK_LV_EXCLUSIVE | LCK_HOLD)
+#define activate_lv_excl_local(cmd, lv) \
+ lock_lv_vol(cmd, lv, LCK_LV_EXCLUSIVE | LCK_HOLD | LCK_LOCAL)
+#define activate_lv_excl_remote(cmd, lv) \
+ lock_lv_vol(cmd, lv, LCK_LV_EXCLUSIVE | LCK_HOLD | LCK_REMOTE)
+
+struct logical_volume;
+int activate_lv_excl(struct cmd_context *cmd, struct logical_volume *lv);
+
#define activate_lv_local(cmd, lv) \
lock_lv_vol(cmd, lv, LCK_LV_ACTIVATE | LCK_HOLD | LCK_LOCAL)
#define deactivate_lv_local(cmd, lv) \
^ permalink raw reply [flat|nested] 2+ messages in thread
* LVM2 ./WHATS_NEW lib/activate/activate.c lib/l ...
@ 2007-01-24 23:43 agk
0 siblings, 0 replies; 2+ messages in thread
From: agk @ 2007-01-24 23:43 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2007-01-24 23:43:27
Modified files:
. : WHATS_NEW
lib/activate : activate.c
lib/log : log.h
tools : lvchange.c vgchange.c
Added files:
scripts : lvm2_monitoring_init_rhel4
Log message:
lvm.static no longer interacts with dmeventd unless explicitly asked to.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.555&r2=1.556
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.119&r2=1.120
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/log/log.h.diff?cvsroot=lvm2&r1=1.33&r2=1.34
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/lvm2_monitoring_init_rhel4.diff?cvsroot=lvm2&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvchange.c.diff?cvsroot=lvm2&r1=1.77&r2=1.78
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgchange.c.diff?cvsroot=lvm2&r1=1.56&r2=1.57
--- LVM2/WHATS_NEW 2007/01/24 16:51:23 1.555
+++ LVM2/WHATS_NEW 2007/01/24 23:43:26 1.556
@@ -1,5 +1,6 @@
Version 2.02.20 -
===================================
+ lvm.static no longer interacts with dmeventd unless explicitly asked to.
Add field definitions to report help text.
Remove unnecessary cmd arg from target_*monitor_events().
Add private variable to dmeventd shared library interface.
--- LVM2/lib/activate/activate.c 2007/01/24 22:06:11 1.119
+++ LVM2/lib/activate/activate.c 2007/01/24 23:43:27 1.120
@@ -653,6 +653,10 @@
struct lv_segment *seg;
int (*monitor_fn) (struct lv_segment *s, int e);
+ /* skip dmeventd code altogether */
+ if (dmeventd_monitor_mode() == DMEVENTD_MONITOR_IGNORE)
+ return 1;
+
/*
* Nothing to do if dmeventd configured not to be used.
*/
--- LVM2/lib/log/log.h 2007/01/19 22:21:45 1.33
+++ LVM2/lib/log/log.h 2007/01/24 23:43:27 1.34
@@ -90,6 +90,8 @@
int lockingfailed(void);
int security_level(void);
int mirror_in_sync(void);
+
+#define DMEVENTD_MONITOR_IGNORE -1
int dmeventd_monitor_mode(void);
/* Suppress messages to stdout/stderr (1) or everywhere (2) */
/cvs/lvm2/LVM2/scripts/lvm2_monitoring_init_rhel4,v --> standard output
revision 1.1
--- LVM2/scripts/lvm2_monitoring_init_rhel4
+++ - 2007-01-24 23:43:28.352868000 +0000
@@ -0,0 +1,98 @@
+#!/bin/bash
+#
+# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# This file is part of LVM2.
+# It is required for the proper handling of failures of LVM2 mirror
+# devices that were created using the -m option of lvcreate.
+#
+#
+# chkconfig: 12345 02 99
+# description: Starts and stops dmeventd monitoring for lvm2
+#
+### BEGIN INIT INFO
+# Provides:
+### END INIT INFO
+
+. /etc/init.d/functions
+
+VGCHANGE="/usr/sbin/vgchange"
+
+start()
+{
+ for ret in 0
+ do
+ # TODO do we want to separate out already active groups only?
+ VGS=`vgs --noheadings -o name`
+ for vg in $VGS
+ do
+ if ! action "Starting monitoring for VG $vg:" $VGCHANGE --monitor y $vg
+ then
+ ret=$?
+ fi
+ done
+
+ done
+
+ return $ret
+}
+
+
+stop()
+{
+ for ret in 0
+ do
+ # TODO do we want to separate out already active groups only?
+ VGS=`vgs --noheadings -o name`
+ for vg in $VGS
+ do
+ if ! action "Starting monitoring for VG $vg:" $VGCHANGE --monitor n $vg
+ then
+ ret=$?
+ fi
+ done
+
+ done
+
+}
+
+ret=1
+
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ret=$?
+ ;;
+
+ stop)
+ stop
+ ret=$?
+ ;;
+
+ restart)
+ if stop
+ then
+ start
+ fi
+ ret=$?
+ ;;
+
+ status)
+ # TODO anyone with an idea how to dump monitored volumes?
+ ;;
+
+ *)
+ echo $"Usage: $0 {start|stop|restart|status}"
+ ;;
+esac
+
+exit $ret
--- LVM2/tools/lvchange.c 2007/01/19 22:21:45 1.77
+++ LVM2/tools/lvchange.c 2007/01/24 23:43:27 1.78
@@ -94,7 +94,8 @@
if (lv->status & PVMOVE)
return 1;
- if (!monitor_dev_for_events(cmd, lv, dmeventd_monitor_mode()))
+ if ((dmeventd_monitor_mode() != DMEVENTD_MONITOR_IGNORE) &&
+ !monitor_dev_for_events(cmd, lv, dmeventd_monitor_mode()))
stack;
return 1;
@@ -591,7 +592,9 @@
return ECMD_FAILED;
}
- init_dmeventd_monitor(arg_int_value(cmd, monitor_ARG, DEFAULT_DMEVENTD_MONITOR));
+ init_dmeventd_monitor(arg_int_value(cmd, monitor_ARG,
+ cmd->is_static ?
+ DMEVENTD_MONITOR_IGNORE : DEFAULT_DMEVENTD_MONITOR));
/* access permission change */
if (arg_count(cmd, permission_ARG)) {
--- LVM2/tools/vgchange.c 2007/01/19 22:21:45 1.56
+++ LVM2/tools/vgchange.c 2007/01/24 23:43:27 1.57
@@ -105,7 +105,8 @@
{
int active, monitored;
- if ((active = lvs_in_vg_activated(vg))) {
+ if ((active = lvs_in_vg_activated(vg)) &&
+ dmeventd_monitor_mode() != DMEVENTD_MONITOR_IGNORE) {
monitored = _monitor_lvs_in_vg(cmd, vg, dmeventd_monitor_mode());
log_print("%d logical volume(s) in volume group "
"\"%s\" %smonitored",
@@ -146,11 +147,13 @@
if (activate && (active = lvs_in_vg_activated(vg))) {
log_verbose("%d logical volume(s) in volume group \"%s\" "
"already active", active, vg->name);
- monitored = _monitor_lvs_in_vg(cmd, vg, dmeventd_monitor_mode());
- log_verbose("%d existing logical volume(s) in volume "
- "group \"%s\" %smonitored",
- monitored, vg->name,
- dmeventd_monitor_mode() ? "" : "un");
+ if (dmeventd_monitor_mode() != DMEVENTD_MONITOR_IGNORE) {
+ monitored = _monitor_lvs_in_vg(cmd, vg, dmeventd_monitor_mode());
+ log_verbose("%d existing logical volume(s) in volume "
+ "group \"%s\" %smonitored",
+ monitored, vg->name,
+ dmeventd_monitor_mode() ? "" : "un");
+ }
}
if (activate && _activate_lvs_in_vg(cmd, vg, available))
@@ -532,7 +535,9 @@
return ECMD_FAILED;
}
- init_dmeventd_monitor(arg_int_value(cmd, monitor_ARG, DEFAULT_DMEVENTD_MONITOR));
+ init_dmeventd_monitor(arg_int_value(cmd, monitor_ARG,
+ cmd->is_static ?
+ DMEVENTD_MONITOR_IGNORE : DEFAULT_DMEVENTD_MONITOR));
if (arg_count(cmd, available_ARG))
r = _vgchange_available(cmd, vg);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-21 5:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-21 5:29 LVM2 ./WHATS_NEW lib/activate/activate.c lib/l agk
-- strict thread matches above, loose matches on Subject: below --
2007-01-24 23:43 agk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).