From: Meng An <isolate...@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 <san...@taobao.com>
Signed-off-by: Meng An <isolate...@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@lists.wpkg.org
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to