[Sheepdog] [PATCH] sheep: list local objects efficently

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Thu Sep 15 06:23:39 CEST 2011


This also fixes a buffer overflow problem which occurs when there are
many epochs.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
Hi Yuan,

I guess this will fix the problem you pointed out.

Thanks,

Kazutaka


 sheep/store.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sheep/store.c b/sheep/store.c
index 992c8f5..b258dda 100644
--- a/sheep/store.c
+++ b/sheep/store.c
@@ -138,7 +138,6 @@ static int get_obj_list(struct request *req)
 	}
 
 	objlist = (uint64_t *)buf;
-	obj_nr = 0;
 	for (epoch = 1; epoch <= hdr->tgt_epoch; epoch++) {
 		snprintf(path, sizeof(path), "%s%08u/", obj_path, epoch);
 
@@ -150,6 +149,7 @@ static int get_obj_list(struct request *req)
 			continue;
 		}
 
+		obj_nr = 0;
 		while ((d = readdir(dir))) {
 			if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
 				continue;
-- 
1.7.2.5




More information about the sheepdog mailing list