[sheepdog] [PATCH] sheep: fix default_link on EEXIST of link

MORITA Kazutaka morita.kazutaka at gmail.com
Thu Jun 20 02:41:40 CEST 2013


At Wed, 19 Jun 2013 16:10:38 +0800,
Liu Yuan wrote:
> 
> This is observed by the following bug:
> 
> Jun 18 21:55:11 [rw] default_link(377) failed to link from
> /mnt/ST2000DM001-1CH164_W1E2N5GM/obj/.stale/0002e519000054f1.21 to
> /mnt/ST2000DM001-1CH164_W1E2N5GM/obj/0002e519000054f1, File exists
> Jun 18 21:55:11 [rw] err_to_sderr(96) oid=2e519000054f1, File exists
> Jun 18 21:55:11 [main] remove_disk(319) /mnt/ST2000DM001-1CH164_W1E2N5GM/obj from multi-disk array
> 
> Reported-by: Valerio Pachera <sirio81 at gmail.com>
> Signed-off-by: Liu Yuan <namei.unix at gmail.com>
> ---
>  sheep/plain_store.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/sheep/plain_store.c b/sheep/plain_store.c
> index f5059a3..5c3e275 100644
> --- a/sheep/plain_store.c
> +++ b/sheep/plain_store.c
> @@ -373,11 +373,14 @@ int default_link(uint64_t oid, uint32_t tgt_epoch)
>  	get_stale_obj_path(oid, tgt_epoch, stale_path);
>  
>  	if (link(stale_path, path) < 0) {
> +		if (errno == EEXIST)
> +			goto out;
> +

I think we need an explanation why we have to handle the error here.
IIUC, this happens when MD is enabled because md_move_object() can
create the destination file.  Is it correct?

Thanks,

Kazutaka



More information about the sheepdog mailing list