From: zkabelac@sourceware.org <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2 ./WHATS_NEW libdm/libdm-deptree.c
Date: 21 May 2010 12:30:36 -0000 [thread overview]
Message-ID: <20100521123036.8843.qmail@sourceware.org> (raw)
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac at sourceware.org 2010-05-21 12:30:35
Modified files:
. : WHATS_NEW
libdm : libdm-deptree.c
Log message:
Replicator: check open_count for parents of presuspend_node
For deactivation of Replicator check in advance that all heads
have open_count == 0. For this presuspend_node is used as all
head nodes are linking this control node.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1578&r2=1.1579
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-deptree.c.diff?cvsroot=lvm2&r1=1.77&r2=1.78
--- LVM2/WHATS_NEW 2010/05/21 12:27:02 1.1578
+++ LVM2/WHATS_NEW 2010/05/21 12:30:35 1.1579
@@ -1,5 +1,6 @@
Version 2.02.67 -
===============================
+ Checking open_count in all parents of presuspend_node.
Added dm_tree_node_set_presuspend_node() to presuspend child in deactivate.
Initial libdm support for Replicator target (API is not stable yet).
Extend process_each_lv_in_vg() with support for list of failed lvnames.
--- LVM2/libdm/libdm-deptree.c 2010/05/21 12:27:03 1.77
+++ LVM2/libdm/libdm-deptree.c 2010/05/21 12:30:35 1.78
@@ -902,6 +902,44 @@
return r;
}
+/* Check if all parent nodes of given node have open_count == 0 */
+static int _node_has_closed_parents(struct dm_tree_node *node,
+ const char *uuid_prefix,
+ size_t uuid_prefix_len)
+{
+ struct dm_tree_link *dlink;
+ const struct dm_info *dinfo;
+ struct dm_info info;
+ const char *uuid;
+
+ /* Iterate through parents of this node */
+ dm_list_iterate_items(dlink, &node->used_by) {
+ if (!(uuid = dm_tree_node_get_uuid(dlink->node))) {
+ stack;
+ continue;
+ }
+
+ /* Ignore if it doesn't belong to this VG */
+ if (!_uuid_prefix_matches(uuid, uuid_prefix, uuid_prefix_len))
+ continue;
+
+ if (!(dinfo = dm_tree_node_get_info(dlink->node))) {
+ stack; /* FIXME Is this normal? */
+ return 0;
+ }
+
+ /* Refresh open_count */
+ if (!_info_by_dev(dinfo->major, dinfo->minor, 1, &info) ||
+ !info.exists)
+ continue;
+
+ if (info.open_count)
+ return 0;
+ }
+
+ return 1;
+}
+
static int _deactivate_node(const char *name, uint32_t major, uint32_t minor,
uint32_t *cookie, uint16_t udev_flags)
{
@@ -1100,7 +1138,11 @@
!info.exists)
continue;
- if (info.open_count) {
+ /* Also checking open_count in parent nodes of presuspend_node */
+ if (info.open_count ||
+ (child->presuspend_node &&
+ !_node_has_closed_parents(child->presuspend_node,
+ uuid_prefix, uuid_prefix_len))) {
/* Only report error from (likely non-internal) dependency at top level */
if (!level) {
log_error("Unable to deactivate open %s (%" PRIu32
next reply other threads:[~2010-05-21 12:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-21 12:30 zkabelac [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-06-21 8:54 LVM2 ./WHATS_NEW libdm/libdm-deptree.c prajnoha
2010-06-21 9:32 ` Zdenek Kabelac
2010-11-23 18:29 zkabelac
2011-06-30 9:24 zkabelac
2012-03-04 17:36 zkabelac
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=20100521123036.8843.qmail@sourceware.org \
--to=zkabelac@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.