All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ondrej Palkovsky <ondrap@penguin.cz>
To: dm-devel@redhat.com
Subject: Snapshot read consistency?
Date: Wed, 27 Apr 2005 21:55:58 +0200	[thread overview]
Message-ID: <1114631758.6389.6.camel@localhost> (raw)

I am trying to modify the snapshot code to slightly different layout of
the exception store (to mimic behaviour of some commercial systems), and
I came across the code to read data from snapshot. It seems to me that
if the code is preempted after the up_read(&s->lock), the pending
exception could be completed (or even new exception could be created and
written!), the new block could be written to the origin and then the
snapshot would read the new-incorrect data from origin. Highly
improbable, but possible? Am I correct or is there some other locking
mechanism that I have missed?

Ondrej

- snapshot_map(), dm-snap.c

	if (bio_rw(bio) == WRITE) {
.......
	} else {
		/*
		 * FIXME: this read path scares me because we
		 * always use the origin when we have a pending
		 * exception.  However I can't think of a
		 * situation where this is wrong - ejt.
		 */

		/* Do reads */
		down_read(&s->lock);

		/* See if it it has been remapped */
		e = lookup_exception(&s->complete, chunk);
		if (e)
			remap_exception(s, e, bio);
		else
			bio->bi_bdev = s->origin->bdev;

		up_read(&s->lock);
	}


-- 

                 reply	other threads:[~2005-04-27 19:55 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=1114631758.6389.6.camel@localhost \
    --to=ondrap@penguin.cz \
    --cc=dm-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.