Re: [PATCH] sheepdog: fix to update data_vdi_id after writing data object

Hitoshi Mitake <[email protected]> Wed, 13 May 2015 10:41:45 +0900
Newsgroups org.kernel.vger.stgt
Message-ID <87wq0d1cfa.wl%[email protected]>
At Wed, 13 May 2015 10:06:32 +0900,
Teruaki Ishizaki wrote:
> 
> Previously data_vdi_id was updated although data object was not
> written successfully.
> That broke inode data and volume data.
> 
> This patch changes to update data_vdi_id after writing data
> object successfully.
> 
> Signed-off-by: Teruaki Ishizaki <[email protected]>
> ---
>  usr/bs_sheepdog.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)

Looks good to me.
Reviewed-by: Hitoshi Mitake <[email protected]>

Thanks,
Hitoshi

> 
> diff --git a/usr/bs_sheepdog.c b/usr/bs_sheepdog.c
> index 9b5b259..cfaf48b 100644
> --- a/usr/bs_sheepdog.c
> +++ b/usr/bs_sheepdog.c
> @@ -937,14 +937,6 @@ retry:
>  
>  				oid = vid_to_data_oid(ai->inode.vdi_id, idx);
>  
> -				ai->min_dirty_data_idx =
> -					min_t(uint32_t,
> -					      idx, ai->min_dirty_data_idx);
> -				ai->max_dirty_data_idx =
> -					max_t(uint32_t,
> -					      idx, ai->max_dirty_data_idx);
> -
> -				ai->inode.data_vdi_id[idx] = vid;
>  			}
>  
>  			need_reload_inode = 0;
> @@ -966,6 +958,14 @@ retry:
>  				}
>  
>  				if (create) {
> +					ai->min_dirty_data_idx =
> +						min_t(uint32_t, idx,
> +						      ai->min_dirty_data_idx);
> +					ai->max_dirty_data_idx =
> +						max_t(uint32_t, idx,
> +						      ai->max_dirty_data_idx);
> +					ai->inode.data_vdi_id[idx] = vid;
> +
>  					need_update_inode = 1;
>  					create = 0;
>  				}
> -- 
> 1.8.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe stgt" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html