From: Andrew Morton <akpm@osdl.org>
To: Alasdair G Kergon <agk@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] device-mapper snapshot: metadata reading separation
Date: Fri, 18 Nov 2005 18:15:13 -0800 [thread overview]
Message-ID: <20051118181513.31fed24c.akpm@osdl.org> (raw)
In-Reply-To: <20051118150135.GP11878@agk.surrey.redhat.com>
Alasdair G Kergon <agk@redhat.com> wrote:
>
> +static void read_snapshot_metadata(struct dm_snapshot *s)
> +{
> + if (s->have_metadata)
> + return;
> +
> + if (s->store.read_metadata(&s->store)) {
> + down_write(&s->lock);
> + s->valid = 0;
> + up_write(&s->lock);
> + }
> +
> + s->have_metadata = 1;
> +}
> +
I always get suspicious when I see a lock around a plain assignment.
Sometimes it's legitimate, usually when some other user of the LHS expects
its value to be stable across an entire locked region - it is read multiple
times and those reads are expected to return the same thing. (I can't
think of any other case).
Maybe this is such a case?
prev parent reply other threads:[~2005-11-19 2:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-18 15:01 Alasdair G Kergon
2005-11-19 2:15 ` Andrew Morton [this message]
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=20051118181513.31fed24c.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=agk@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®