Messages in this thread | | | Date | Fri, 18 Nov 2005 18:15:13 -0800 | From | Andrew Morton <> | Subject | Re: [PATCH] device-mapper snapshot: metadata reading separation |
| |
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? - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |