linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Jan Blunck <jblunck@suse.de>
To: linux-lvm@redhat.com
Subject: [linux-lvm] [RFC, 2nd try] Let udev play with snapshots
Date: Mon, 23 Oct 2006 15:41:00 +0200	[thread overview]
Message-ID: <20061023134100.GB4729@hasse.suse.de> (raw)
In-Reply-To: <20061011173421.GC4636@hasse.suse.de>

On Wed, Oct 11, Jan Blunck wrote:

> - creating "vg-snapshot"
> - clearing the start of "vg-snapshot"
> - removing "vg-snapshot"                                                  (1)

Actually this must be deactivation of vg-snapshot. This is where the
deactivation code complains about the usage count of the LV.

> - creating "vg-origin-real"
> - creating "vg-snapshot-cow"
> - creating "vg-snapshot"
> - suspending "vg-origin" and "vg-origin-real"
> - reload tables
> - resuming "vg-origin-real", "vg-snapshot-cow", "vg-snapshot" and         (2)
>   "vg-origin"

I looked into the lvcreate code and realised that the deactivation code is
only complaining about the usage count because "vg-snapshot" is marked
VISIBLE_LV. Since the LV is at that moment used for clearing I think it should
be marked internal.

I know that this isn't a perfect solution yet. In the long term we need to give
udev a change to determine if an LV is internal or not (e.g. by reading the
VISIBLE_LV status).

BTW: Why do we actually create links even if the LV is marked invisible? Does
that make any sense at all?

RFC,
	Jan
---
Index: LVM2/tools/lvcreate.c
===================================================================
--- LVM2.orig/tools/lvcreate.c
+++ LVM2/tools/lvcreate.c
@@ -694,6 +694,10 @@ static int _lvcreate(struct cmd_context 
 		}
 	}
 
+	/* We are cleaning the exception table first, so let it be internal */
+	if (lp->snapshot)
+		status &= ~VISIBLE_LV;
+
 	if (!(lv = lv_create_empty(vg->fid, lv_name ? lv_name : "lvol%d", NULL,
 				   status, lp->alloc, 0, vg))) {
 		stack;
@@ -792,6 +796,9 @@ static int _lvcreate(struct cmd_context 
 			return 0;
 		}
 
+		/* we are no longer an internal LV */
+		lv->status |= VISIBLE_LV;
+
 		if (!vg_add_snapshot(vg->fid, NULL, org, lv, NULL,
 				     org->le_count, lp->chunk_size)) {
 			log_err("Couldn't create snapshot.");

  parent reply	other threads:[~2006-10-23 13:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-11 17:34 [linux-lvm] [RFC] Let udev play with snapshots Jan Blunck
2006-10-11 17:46 ` Alasdair G Kergon
2006-10-11 18:08   ` Jan Blunck
2006-10-11 18:17     ` Alasdair G Kergon
2006-10-12  7:13       ` Jan Blunck
2006-10-23 13:41 ` Jan Blunck [this message]
2006-10-24 18:21   ` [linux-lvm] [RFC, 2nd try] " Alasdair G Kergon
2006-10-26 18:33     ` Alasdair G Kergon

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=20061023134100.GB4729@hasse.suse.de \
    --to=jblunck@suse.de \
    --cc=linux-lvm@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 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 NNTP newsgroup(s).