From: mbroz@sourceware.org <mbroz@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2/lib activate/activate.c locking/.exported ...
Date: 20 May 2009 12:58:05 -0000 [thread overview]
Message-ID: <20090520125805.17982.qmail@sourceware.org> (raw)
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mbroz at sourceware.org 2009-05-20 12:58:04
Modified files:
lib/activate : activate.c
lib/locking : .exported_symbols external_locking.c locking.c
Log message:
Fix locking query compatibility with old external locking libraries.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.150&r2=1.151
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/.exported_symbols.diff?cvsroot=lvm2&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/external_locking.c.diff?cvsroot=lvm2&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.58&r2=1.59
--- LVM2/lib/activate/activate.c 2009/05/20 11:09:49 1.150
+++ LVM2/lib/activate/activate.c 2009/05/20 12:58:03 1.151
@@ -694,13 +694,30 @@
*/
int lv_is_active(struct logical_volume *lv)
{
+ int ret;
+
if (_lv_active(lv->vg->cmd, lv, 0))
return 1;
if (!vg_is_clustered(lv->vg))
return 0;
- return remote_lock_held(lv->lvid.s);
+ if ((ret = remote_lock_held(lv->lvid.s)) >= 0)
+ return ret;
+
+ /*
+ * Old compatibility code if locking doesn't support lock query
+ * FIXME: check status to not deactivate already activate device
+ */
+ if (activate_lv_excl(lv->vg->cmd, lv)) {
+ deactivate_lv(lv->vg->cmd, lv);
+ return 0;
+ }
+
+ /*
+ * Exclusive local activation failed so assume it is active elsewhere.
+ */
+ return 1;
}
/*
--- LVM2/lib/locking/.exported_symbols 2004/06/24 08:16:09 1.1
+++ LVM2/lib/locking/.exported_symbols 2009/05/20 12:58:04 1.2
@@ -1,4 +1,5 @@
locking_init
locking_end
lock_resource
+lock_resource_query
reset_locking
--- LVM2/lib/locking/external_locking.c 2008/01/30 13:59:59 1.15
+++ LVM2/lib/locking/external_locking.c 2009/05/20 12:58:04 1.16
@@ -26,6 +26,7 @@
uint32_t flags) = NULL;
static int (*_init_fn) (int type, struct config_tree * cft,
uint32_t *flags) = NULL;
+static int (*_lock_query_fn) (const char *resource, int *mode) = NULL;
static int _lock_resource(struct cmd_context *cmd, const char *resource,
uint32_t flags)
@@ -88,6 +89,10 @@
return 0;
}
+ if (!(_lock_query_fn = dlsym(_locking_lib, "lock_resource_query")))
+ log_warn("WARNING: %s: _lock_resource_query() missing: "
+ "Using inferior activation method.", libname);
+
log_verbose("Loaded external locking library %s", libname);
return _init_fn(2, cmd->cft, &locking->flags);
}
--- LVM2/lib/locking/locking.c 2009/05/19 10:39:00 1.58
+++ LVM2/lib/locking/locking.c 2009/05/20 12:58:04 1.59
@@ -489,11 +489,13 @@
if (!locking_is_clustered())
return 0;
+ if (!_locking.lock_resource_query)
+ return -1;
+
/*
* If an error occured, expect that volume is active
*/
- if (!_locking.lock_resource_query ||
- !_locking.lock_resource_query(vol, &mode)) {
+ if (!_locking.lock_resource_query(vol, &mode)) {
stack;
return 1;
}
reply other threads:[~2009-05-20 12:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090520125805.17982.qmail@sourceware.org \
--to=mbroz@sourceware.org \
--cc=lvm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.