[sheepdog] [PATCH] sheep/ops: fix incorrect error log on remove_epoch

Ruoyu liangry at ucweb.com
Fri Jun 20 10:01:48 CEST 2014


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>
---
 sheep/ops.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sheep/ops.c b/sheep/ops.c
index c48c2aa..fb26077 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.8.3.2





More information about the sheepdog mailing list