[sheepdog] [PATCH stable-0.8 1/3] sheep/ops: fix incorrect error log on remove_epoch

Hitoshi Mitake mitake.hitoshi at gmail.com
Tue Jul 29 03:32:00 CEST 2014


From: Ruoyu <liangry at ucweb.com>

If epoch file is not existed due to the node had left, cluster format
command will cause the error in sheep.log

ERROR [main] remove_epoch(246) failed to remove
/tmp/sd9/epoch/00000002: Operation not permitted

Signed-off-by: Ruoyu <liangry at ucweb.com>
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 sheep/ops.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sheep/ops.c b/sheep/ops.c
index 3e14d3b..9602b45 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -242,12 +242,12 @@ static int remove_epoch(uint32_t epoch)
 	sd_debug("remove epoch %"PRIu32, epoch);
 	snprintf(path, sizeof(path), "%s%08u", epoch_path, epoch);
 	ret = unlink(path);
-	if (ret && ret != -ENOENT) {
-		sd_err("failed to remove %s: %s", path, strerror(-ret));
+	if (ret && errno != ENOENT) {
+		sd_err("failed to remove %s: %m", path);
 		return SD_RES_EIO;
 	}
 
-	return SD_RES_EIO;
+	return SD_RES_SUCCESS;
 }
 
 static int cluster_make_fs(const struct sd_req *req, struct sd_rsp *rsp,
-- 
1.9.1




More information about the sheepdog mailing list