[Sheepdog] race window accessing current_vnode_info?

HaiTing Yao yaohaiting.wujue at gmail.com
Thu May 3 10:41:12 CEST 2012


On Thu, May 3, 2012 at 3:06 PM, Liu Yuan <namei.unix at gmail.com> wrote:

> On 05/03/2012 02:16 PM, tao.peng at emc.com wrote:
>
> > Hi list,
> >
> > I was reading sheepdog code and noticed that in update_vnode_info(),
> > if one thread calls get_vnode_info() between
> > put_vnode_info(current_vnode_info) and current_vnode_info =
> > vnode_info, it then will get an invalid pointer. So it looks like a
> > race window there?
> >
> > Best, Tao
>
>
> Oops, it seems that we have brought in a big monster, we don't have any
> lock mechanism to protect current_vnode_info, which is referenced and
> calculated by worker threads and main thread scattered everywhere in the
> code and it is really a dilemma to introduce such a ubiquitous lock
> between worker and main threads.
>

current_vnode_info only be changed when epoch changes. Before using the
current_vnode_info, the vnode cache is allocated and freed frequently. When
the reference counter beacomes zero, the cache will be freed even without
epoch changes. There is also race conditions, although it is not frequent.

Thanks
Haiti


>
> Should we revert the patch introduce current_vnode_info?
>
> Thanks,
> Yuan
>
>
> --
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wpkg.org/pipermail/sheepdog/attachments/20120503/213a934d/attachment.html>


More information about the sheepdog mailing list