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

Christoph Hellwig hch at infradead.org
Sat Apr 28 15:53:08 CEST 2012


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.




More information about the sheepdog mailing list