[sheepdog] [PATCH] sheep: use valloc() for request buffer

Liu Yuan namei.unix at gmail.com
Tue Dec 17 16:47:59 CET 2013


Dec 17 23:38:30  ERROR [gway 5442] default_read_from_path(287) failed to read object 7c2b2500000000, path=/tmp/store/0/obj/007c2b2500000000, offset=0, size=4194304, result=-1, Invalid argument
Dec 17 23:38:30  ERROR [gway 5442] err_to_sderr(115) oid=7c2b2500000000, Invalid argument
Dec 17 23:38:30  ERROR [gway 5442] gateway_replication_read(294) local read 7c2b2500000000 failed, Network error between sheep

This bug is triggered when we start sheep with '-D' option (derectio) because
request buffer isn't page aligned.

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 sheep/gateway.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sheep/gateway.c b/sheep/gateway.c
index 0806edd..c8a1e9d 100644
--- a/sheep/gateway.c
+++ b/sheep/gateway.c
@@ -57,7 +57,7 @@ static struct req_iter *prepare_replication_requests(struct request *req,
  */
 static void *init_erasure_buffer(struct request *req, int buf_len)
 {
-	char *buf = xzalloc(buf_len);
+	char *buf = xvalloc(buf_len);
 	uint32_t len = req->rq.data_length;
 	uint64_t off = req->rq.obj.offset;
 	uint64_t oid = req->rq.obj.oid;
@@ -600,7 +600,7 @@ static int gateway_handle_cow(struct request *req)
 	uint64_t oid = req->rq.obj.oid;
 	size_t len = get_objsize(oid);
 	struct sd_req hdr, *req_hdr = &req->rq;
-	char *buf = xmalloc(len);
+	char *buf = xvalloc(len);
 	int ret;
 
 	if (req->rq.data_length != len) {
-- 
1.7.9.5




More information about the sheepdog mailing list