[Sheepdog] [PATCH] fix a bug of copies calculation in delete_one()

levin li levin108 at gmail.com
Tue May 1 05:35:38 CEST 2012


On 04/28/2012 09:53 PM, Christoph Hellwig wrote:
> On Sat, Apr 28, 2012 at 11:52:48AM +0800, Li Wenpeng wrote:
>> From: levin li<xingke.lwp at taobao.com>
>>
>> It tries to compare the nr_copies with inode->nr_copies,
>> but the inode has just been allocated, the nr_copies may
>> be zero or something random
>>
>> Signed-off-by: levin li<xingke.lwp at taobao.com>
>> ---
>>   sheep/vdi.c |    2 --
>>   1 file changed, 2 deletions(-)
>>
>> diff --git a/sheep/vdi.c b/sheep/vdi.c
>> index 0788f26..0f17824 100644
>> --- a/sheep/vdi.c
>> +++ b/sheep/vdi.c
>> @@ -457,8 +457,6 @@ static void delete_one(struct work *work)
>>   	}
>>
>>   	nr_copies = get_nr_copies(dw->vnodes);
>> -	if (nr_copies>  inode->nr_copies)
>> -		nr_copies = inode->nr_copies;
> This fixes the read_object call, but it changes behaviour to the
> situation before my patch for the calls to remove_object and
> write_object later in the function.
>
> Depending on how we intend to use inode->nr_copies that's not
> nessecarily wrong, but as comment in the patch itself I'd really like to
> get some help understanding how inode->nr_copies should be used.
>
This bug stops my following patch from working, so I had to
fix it, so as to inode->nr_copies, just as kazum said, we should
make inode->nr_copies as reserved



More information about the sheepdog mailing list