Linux Device Mapper development
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: dm-devel@redhat.com
Cc: Mikulas Patocka <mpatocka@redhat.com>,
	Alasdair G Kergon <agk@redhat.com>
Subject: Re: [PATCH v2 04/17] dm snapshot: exception handover improvements
Date: Fri, 23 Oct 2009 11:01:34 -0400	[thread overview]
Message-ID: <20091023150134.GA25363@redhat.com> (raw)
In-Reply-To: <1256078825-11331-5-git-send-email-snitzer@redhat.com>

On Tue, Oct 20 2009 at  6:46pm -0400,
Mike Snitzer <snitzer@redhat.com> wrote:

> Simplify exception handover so that the duplicate snapshot is found in
> one location (snapshot_ctr) and recorded in the associated (old and new)
> snapshots that will be participating in the handover.
> 
> Confines handover to be from a specific snapshot to another specific
> snapshot without additional __find_duplicate() calls.
> 
> Documents the exception handover state diagram with relevant comments
> in the associated code.

In testing --onactivate support I found that my revised handover
incorrectly assumed that the snapshot-merge target _always_ needs the
exceptions explicitly handed over to it.

In reality --onactivate doesn't require any handover at all.  The
snapshot_ctr() for such a merge is provided with the correct cow_path up
front; so no handover is needed.

I also found that I was missing some locking when changing the "old"
snapshot's 'handover_snap' reference.

The following incremental patch addresses both these oversights; I'll be
posting v3 of this "dm snapshot: exception handover improvements"
shortly (it will include these fixes).

diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index fca2479..e0330e3 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -982,13 +982,13 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 		}
 
 		/* cross reference snapshots that will do handover */
+		down_write(&dup->lock);
 		dup->handover_snap = s;
+		up_write(&dup->lock);
 		s->handover_snap = dup;
+
 		/* this new snapshot will accept the handover */
 		s->handover = 1;
-	} else if (is_merge(ti)) {
-		ti->error = "Unable to find snapshot that is to be merged";
-		goto bad_load_and_register;
 	}
 
 	/* Metadata must only be loaded into one table at once */

  reply	other threads:[~2009-10-23 15:01 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-20 22:46 [PATCH v2 00/17] snapshot-merge target Mike Snitzer
2009-10-20 22:46 ` [PATCH v2 01/17] dm snapshot: rework writing to snapshot origin Mike Snitzer
2009-10-20 22:46 ` [PATCH v2 02/17] dm snapshot: add suspended flag to dm_snapshot Mike Snitzer
2009-11-05  0:56   ` Alasdair G Kergon
2009-11-13 14:48     ` Mike Snitzer
2009-11-16 18:17     ` Mike Snitzer
2009-11-17  2:24       ` Alasdair G Kergon
2009-10-20 22:46 ` [PATCH v2 03/17] dm snapshot: initial support for exception handover Mike Snitzer
2009-10-20 22:46 ` [PATCH v2 04/17] dm snapshot: exception handover improvements Mike Snitzer
2009-10-23 15:01   ` Mike Snitzer [this message]
2009-10-20 22:46 ` [PATCH v2 05/17] dm exception store: do not read metadata if going to handover exceptions Mike Snitzer
2009-10-20 22:46 ` [PATCH v2 06/17] dm exception store: add snapshot-merge specific methods Mike Snitzer
2009-10-20 22:46 ` [PATCH v2 07/17] dm exception store: snapshot-merge usage accounting Mike Snitzer
2009-10-20 22:46 ` [PATCH v2 08/17] dm snapshot: add snapshot-merge target Mike Snitzer
2009-10-20 22:46 ` [PATCH v2 09/17] dm snapshot: merge target should not allocate new exceptions Mike Snitzer
2009-10-20 22:46 ` [PATCH v2 10/17] dm snapshot: do not allow more than one merging snapshot Mike Snitzer
2009-10-20 22:46 ` [PATCH v2 11/17] dm snapshot: the merge procedure Mike Snitzer
2009-10-20 22:47 ` [PATCH v2 12/17] dm snapshot: queue writes to an area that is actively being merged Mike Snitzer
2009-10-20 22:47 ` [PATCH v2 13/17] dm snapshot: do not merge a chunk until active writes to it finish Mike Snitzer
2009-10-20 22:47 ` [PATCH v2 14/17] dm snapshot: make exceptions in other snapshots when merging Mike Snitzer
2009-10-20 22:47 ` [PATCH v2 15/17] dm snapshot: make exceptions if merge is dispatching to origin Mike Snitzer
2009-10-20 22:47 ` [PATCH v2 16/17] dm snapshot: redirect accesses to origin if merging snap invalidated Mike Snitzer
2009-10-20 22:47 ` [PATCH v2 17/17] dm snapshot: merge a linear region of chunks using one large IO Mike Snitzer

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=20091023150134.GA25363@redhat.com \
    --to=snitzer@redhat.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=mpatocka@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