[Sheepdog] race window accessing current_vnode_info?

Yunkai Zhang yunkai.me at gmail.com
Sat May 5 09:47:31 CEST 2012


Hi guys:

I have tried two methods to fix this problem.

=The first method=
1) Allow multiple version vnode_info exists
2) Before we call queue_work(), we make refcnt++ of the newest version
of vnode_info,
   and pass a pointer which references this vnode_info to work.fn(),
so that all other
   functions can access vnode_info by this pointer.
3) make refcnt-- in work.done().

Because these operations: refcnt++, refcnt-- and updating/deleting are
all in main thread,
we can keep them lock-free.

But we should change so many functions' prototype: add a pointer
parameter to reference one of vnode_info.

=The second method=
Introduce userspace RCU library. I found it can make program simple
and clarity. But It will increase the dependence on third-party
libraries for sheep.

I want to use the second method:)

What is your opinions?

On Fri, May 4, 2012 at 12:35 AM, Christoph Hellwig <hch at infradead.org> wrote:
> On Thu, May 03, 2012 at 07:22:48PM +0900, MORITA Kazutaka wrote:
>> The old code also has the completely same problem; worker threads call
>> get_ordered_sd_vnode_list()/free_ordered_sd_vnode_list().  The correct
>> approach is to modify the code so that all
>> get_vnode_info()/put_vnode_info() are called only in the main thread.
>> I'll do the work if no one is trying to fix it now.
>
> Yes, the observations is what brought up the "is this really executed in
> the main thread" asserts before.
>
> I'm sitll pondering options, one would be to lock current_vnode_info
> updates, the other one would be to make sure we have struct request
> available everywhere that it's needed including mostl likely refcounting
> it.
> --
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog



-- 
Yunkai Zhang
Work at Taobao



More information about the sheepdog mailing list