All of lore.kernel.org
 help / color / mirror / Atom feed
From: mbroz@sourceware.org <mbroz@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2 ./WHATS_NEW lib/activate/dev_manager.c li ...
Date: 15 May 2007 14:42:03 -0000	[thread overview]
Message-ID: <20070515144203.642.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz at sourceware.org	2007-05-15 14:42:02

Modified files:
	.              : WHATS_NEW 
	lib/activate   : dev_manager.c fs.c fs.h 

Log message:
	Remove symlinks if parent volume is deactivated.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.617&r2=1.618
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.c.diff?cvsroot=lvm2&r1=1.123&r2=1.124
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/fs.c.diff?cvsroot=lvm2&r1=1.38&r2=1.39
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/fs.h.diff?cvsroot=lvm2&r1=1.10&r2=1.11

--- LVM2/WHATS_NEW	2007/05/15 13:01:40	1.617
+++ LVM2/WHATS_NEW	2007/05/15 14:42:01	1.618
@@ -1,5 +1,6 @@
 Version 2.02.26 -
 =================================
+  Remove symlinks if parent volume is deactivated.
   Fix and clarify vgsplit error messages.
   Fix a segfault if a device has no target (no table)
   Add some more debuglogs to clvmd startup.
--- LVM2/lib/activate/dev_manager.c	2007/05/14 11:27:34	1.123
+++ LVM2/lib/activate/dev_manager.c	2007/05/15 14:42:01	1.124
@@ -937,6 +937,10 @@
 	return 1;
 }
 
+/* FIXME: symlinks should be created/destroyed at the same time
+ * as the kernel devices but we can't do that from within libdevmapper
+ * at present so we must walk the tree twice instead. */
+
 /*
  * Create LV symlinks for children of supplied root node.
  */
@@ -969,6 +973,32 @@
 	return r;
 }
 
+/*
+ * Remove LV symlinks for children of supplied root node.
+ */
+static int _remove_lv_symlinks(struct dev_manager *dm, struct dm_tree_node *root)
+{
+	void *handle = NULL;
+	struct dm_tree_node *child;
+	char *vgname, *lvname, *layer;
+	int r = 1;
+
+	while ((child = dm_tree_next_child(&handle, root, 0))) {
+        	if (!dm_split_lvm_name(dm->mem, dm_tree_node_get_name(child), &vgname, &lvname, &layer)) {
+			r = 0;
+			continue;
+		}
+
+		/* only top level layer has symlinks */
+		if (*layer)
+			continue;
+
+		fs_del_lv_byname(dm->cmd->dev_dir, vgname, lvname);
+	}
+
+	return r;
+}
+
 static int _clean_tree(struct dev_manager *dm, struct dm_tree_node *root)
 {
 	void *handle = NULL;
@@ -1028,6 +1058,8 @@
  		/* Deactivate LV and all devices it references that nothing else has open. */
 		if (!dm_tree_deactivate_children(root, dlid, ID_LEN + sizeof(UUID_PREFIX) - 1))
 			goto_out;
+		if (!_remove_lv_symlinks(dm, root))
+			log_error("Failed to remove all device symlinks associated with %s.", lv->name);
 		break;
 	case SUSPEND:
 		dm_tree_skip_lockfs(root);
--- LVM2/lib/activate/fs.c	2006/08/21 12:54:51	1.38
+++ LVM2/lib/activate/fs.c	2007/05/15 14:42:01	1.39
@@ -338,6 +338,11 @@
 		      "", "");
 }
 
+int fs_del_lv_byname(const char *dev_dir, const char *vg_name, const char *lv_name)
+{
+	return _fs_op(FS_DEL, dev_dir, vg_name, lv_name, "", "");
+}
+
 int fs_rename_lv(struct logical_volume *lv,
 		 const char *dev, const char *old_name)
 {
--- LVM2/lib/activate/fs.h	2004/03/30 19:35:37	1.10
+++ LVM2/lib/activate/fs.h	2007/05/15 14:42:01	1.11
@@ -25,6 +25,7 @@
  */
 int fs_add_lv(const struct logical_volume *lv, const char *dev);
 int fs_del_lv(const struct logical_volume *lv);
+int fs_del_lv_byname(const char *dev_dir, const char *vg_name, const char *lv_name);
 int fs_rename_lv(struct logical_volume *lv,
 		 const char *dev, const char *old_name);
 void fs_unlock(void);



             reply	other threads:[~2007-05-15 14:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-15 14:42 mbroz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-03-05 15:05 LVM2 ./WHATS_NEW lib/activate/dev_manager.c li zkabelac
2012-01-20 22:02 snitzer
2011-10-14 13:23 zkabelac
2011-10-06 14:45 jbrassow
2011-08-18 19:38 jbrassow
2010-10-13 21:26 snitzer
2010-04-23 14:16 prajnoha
2010-02-17 22:59 snitzer
2010-01-15 16:35 snitzer
2009-10-26 10:02 agk
2009-10-22 13:00 prajnoha
2008-07-15  0:25 agk
2008-04-10 17:09 wysochanski
2008-01-30 13:19 agk
2006-11-30 23:11 agk
2006-10-18 18:01 agk

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=20070515144203.642.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.