[sheepdog] [PATCH 3/4] fix sys->epoch race

Liu Yuan namei.unix at gmail.com
Fri May 18 15:41:44 CEST 2012


On 05/18/2012 07:29 PM, Christoph Hellwig wrote:

> On Fri, May 18, 2012 at 07:06:19PM +0800, Liu Yuan wrote:
>> From: Liu Yuan <tailai.ly at taobao.com>
>>
>> We shouldn't use sys->epoch directly in worker threads. Add a atomic helper
>> for it.
> 
> I don't think this is enough - we need to make sure the epoch matches
> the vnode list we operate on.  The fix is to add the epoch to struct
> vnode_info as that's a snapshot of the cluster membership state for I/O,
> and preferably also remove it from sys so that other threads don't
> accidentally access it.
> 


Farm_read/write() doesn't need operate on vnode list at all and instead
they need to get the actual real sys->epoch to see if it is
epoch-mismatched IO, so I don't think we should add epoch to the struct
vnode_info.

Thanks,
Yuan



More information about the sheepdog mailing list