[sheepdog] [PATCH v3 1/2] sheep: remove last slash for new->path in md_add_disk()
Liu Yuan
namei.unix at gmail.com
Tue Jun 17 07:57:56 CEST 2014
On Tue, Jun 17, 2014 at 01:37:29PM +0800, Robin Dong wrote:
> From: Meng An <isolate000 at gmail.com>
>
> Follow these steps:
>
> 1. sheep /meta/,/data1/,/data2/...... (add slash before data path)
> 2. upload data
> 3. remove /data1/*
> 4. get data
>
> then the sheep daemon will go to dead loops and print logs like:
>
> ERROR [io 1234] err_to_sderr(96) /data1/ corrupted
> ERROR [io 1234] err_to_sderr(96) /disk5/ corrupted
> ...
>
> The reason is when the sheep daemon start, it use "/data1/" as disk->path, but
> when it occur a error-io, sheep will call md_remove_disk() with argument disk which
> contain path of "/data1" (without slash), so sheep can not actually unplug "/data1/"
> in md ring and it will try to forward request forever.
>
> We can fix this by remove last slash when sheep call md_add_disk().
>
> Signed-off-by: Robin Dong <sanbai at taobao.com>
> Signed-off-by: Meng An <isolate000 at gmail.com>
> ---
> sheep/md.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/sheep/md.c b/sheep/md.c
> index 7d45213..538f696 100644
> --- a/sheep/md.c
> +++ b/sheep/md.c
> @@ -322,6 +322,7 @@ bool md_add_disk(const char *path, bool purge)
>
> new = xmalloc(sizeof(*new));
> pstrcpy(new->path, PATH_MAX, path);
> + trim_last_slash(new->path);
> new->space = init_path_space(new->path, purge);
> if (!new->space) {
> free(new);
> --
> 1.7.12.4
>
> --
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog
Applied this one, thanks
Yuan
More information about the sheepdog
mailing list