[sheepdog] [PATCH 2/4] sheep: don't send data when read request fails

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Thu Sep 6 03:26:38 CEST 2012


We don't need to send useless data to client when a read request
fails.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 sheep/ops.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/sheep/ops.c b/sheep/ops.c
index 7b25270..05248f8 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -809,8 +809,10 @@ int peer_read_obj(struct request *req)
 	iocb.length = hdr->data_length;
 	iocb.offset = hdr->obj.offset;
 	ret = sd_store->read(hdr->obj.oid, &iocb);
-	if (ret != SD_RES_SUCCESS)
+	if (ret != SD_RES_SUCCESS) {
+		rsp->data_length = 0;
 		goto out;
+	}
 
 	rsp->data_length = hdr->data_length;
 	if (hdr->obj.copies)
-- 
1.7.2.5




More information about the sheepdog mailing list