[Sheepdog] [PATCH] collie: the number of replication is at most the number of nodes

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Tue Jun 14 18:18:13 CEST 2011


This fixes setting/getting vdi attribute bugs which occurs when the
number of redundancy is larger than the number of nodes

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

diff --git a/collie/collie.c b/collie/collie.c
index 606cb30..b3c27ee 100644
--- a/collie/collie.c
+++ b/collie/collie.c
@@ -936,6 +936,9 @@ reread:
 		return 1;
 	}
 
+	if (nr_copies > nr_nodes)
+		nr_copies = nr_nodes;
+
 	oid = attr_oid;
 	for (i = 0; i < nr_copies; i++) {
 		rlen = 0;
@@ -1017,6 +1020,9 @@ static int vdi_getattr(int argc, char **argv)
 		return 1;
 	}
 
+	if (nr_copies > nr_nodes)
+		nr_copies = nr_nodes;
+
 	oid = attr_oid;
 	value = malloc(SD_MAX_VDI_ATTR_VALUE_LEN);
 	if (!value) {
-- 
1.7.2.5




More information about the sheepdog mailing list