[Sheepdog] race window accessing current_vnode_info?

tao.peng at emc.com tao.peng at emc.com
Thu May 3 08:39:04 CEST 2012


> -----Original Message-----
> From: Liu Yuan [mailto:namei.unix at gmail.com]
> Sent: Thursday, May 03, 2012 2:23 PM
> To: Peng, Tao
> Cc: sheepdog at lists.wpkg.org
> Subject: Re: [Sheepdog] race window accessing current_vnode_info?
> 
> 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?
> >
> 
> 
> Yes, exactly, we already met this problem in join phrase and trying to
> fix it.
> 
I guess something like
old = current;
current = new;
__sync_synchronize();
put_vnode_info(old);

should be sufficient to fix it?

Cheers,
Tao


More information about the sheepdog mailing list