Re: [PATCH 2/2] [RFC] fadvise: Add _VOLATILE,_ISVOLATILE, and_NONVOLATILE flags

From: John Stultz
Date: Fri Feb 17 2012 - 00:26:14 EST


On Thu, 2012-02-16 at 19:43 -0800, John Stultz wrote:
> On Sun, 2012-02-12 at 13:48 +0100, Dmitry Adamushko wrote:
> >
> > On 10 February 2012 01:16, John Stultz <john.stultz@xxxxxxxxxx> wrote:
>
> > +static inline void volatile_range_shrink(struct
> > volatile_range *range,
> > + pgoff_t start_index, pgoff_t
> > end_index)
> > +{
> > + size_t pre = range_size(range);
> > +
> > + range->range_node.start = start_index;
> > + range->range_node.end = end_index;
> > +
> >
> > I guess, here we get a whole range of races with volatile_shrink(),
> > which may see inconsistent (in-the-middle-of-update) ranges
> > (e.g. .start and .end).
>
> We should be holding the vlist_mutex to avoid any such races. But you
> also make clear that volatile_range_shrink() should really be called
> volatile_range_resize(), since having two _shrink calls is terrible. My
> apologies.

And sure enough in the shrinker we're not holding the vlist_mutex.
Thanks for pointing that out.
-john

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/