[Sheepdog] [PATCH 3/3] sheep: show error reason when SD_RES_EIO happens
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Mon Oct 17 17:34:22 CEST 2011
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
sheep/store.c | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/sheep/store.c b/sheep/store.c
index 4b653e1..53e2db5 100644
--- a/sheep/store.c
+++ b/sheep/store.c
@@ -594,6 +594,7 @@ static int store_queue_request_local(struct request *req, uint32_t epoch)
ret = ftruncate(fd, 0);
if (ret) {
+ eprintf("%m\n");
ret = SD_RES_EIO;
goto out;
}
@@ -626,8 +627,10 @@ static int store_queue_request_local(struct request *req, uint32_t epoch)
if (ret != SD_DATA_OBJ_SIZE) {
if (errno == ENOSPC)
ret = SD_RES_NO_SPACE;
- else
+ else {
+ eprintf("%m\n");
ret = SD_RES_EIO;
+ }
goto out;
}
free(buf);
@@ -648,8 +651,10 @@ static int store_queue_request_local(struct request *req, uint32_t epoch)
if (ret != size) {
if (errno == ENOSPC)
ret = SD_RES_NO_SPACE;
- else
+ else {
+ eprintf("%m\n");
ret = SD_RES_EIO;
+ }
goto out;
}
}
@@ -666,8 +671,10 @@ static int store_queue_request_local(struct request *req, uint32_t epoch)
if (ret) {
if (errno == ENOENT)
ret = SD_RES_NO_OBJ;
- else
+ else {
+ eprintf("%m\n");
ret = SD_RES_EIO;
+ }
}
break;
case SD_OP_READ_OBJ:
@@ -684,6 +691,7 @@ static int store_queue_request_local(struct request *req, uint32_t epoch)
ret = pread64(fd, req->data, hdr->data_length, hdr->offset);
if (ret < 0) {
+ eprintf("%m\n");
ret = SD_RES_EIO;
goto out;
}
@@ -698,6 +706,7 @@ static int store_queue_request_local(struct request *req, uint32_t epoch)
if (hdr->flags & SD_FLAG_CMD_TRUNCATE) {
ret = ftruncate(fd, hdr->offset + hdr->data_length);
if (ret) {
+ eprintf("%m\n");
ret = SD_RES_EIO;
goto out;
}
@@ -726,8 +735,10 @@ static int store_queue_request_local(struct request *req, uint32_t epoch)
if (ret != hdr->data_length) {
if (errno == ENOSPC)
ret = SD_RES_NO_SPACE;
- else
+ else {
+ eprintf("%m\n");
ret = SD_RES_EIO;
+ }
goto out;
}
}
--
1.7.2.5
More information about the sheepdog
mailing list