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 <[email protected]>
---
 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

-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to