[sheepdog] [PATCH stable-0.7 2/3] sheep: fix vdi clone operation
Hitoshi Mitake
mitake.hitoshi at lab.ntt.co.jp
Fri Feb 7 02:12:01 CET 2014
From: Liu Yuan <namei.unix at gmail.com>
- pass correct array size
- return FULL_VDI instead of wrong NO_BASE_VDI
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
Reviewed-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
sheep/vdi.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sheep/vdi.c b/sheep/vdi.c
index d25fe5e..edcf773 100644
--- a/sheep/vdi.c
+++ b/sheep/vdi.c
@@ -301,9 +301,9 @@ static int clone_vdi(const struct vdi_iocb *iocb, uint32_t new_snapid,
goto out;
}
- idx = find_free_idx(base->child_vdi_id, sizeof(base->child_vdi_id));
+ idx = find_free_idx(base->child_vdi_id, ARRAY_SIZE(base->child_vdi_id));
if (idx < 0) {
- ret = SD_RES_NO_BASE_VDI;
+ ret = SD_RES_FULL_VDI;
goto out;
}
@@ -364,9 +364,9 @@ static int snapshot_vdi(const struct vdi_iocb *iocb, uint32_t new_snapid,
goto out;
}
- idx = find_free_idx(base->child_vdi_id, sizeof(base->child_vdi_id));
+ idx = find_free_idx(base->child_vdi_id, ARRAY_SIZE(base->child_vdi_id));
if (idx < 0) {
- ret = SD_RES_NO_BASE_VDI;
+ ret = SD_RES_FULL_VDI;
goto out;
}
@@ -433,9 +433,9 @@ static int rebase_vdi(const struct vdi_iocb *iocb, uint32_t new_snapid,
goto out;
}
- idx = find_free_idx(base->child_vdi_id, sizeof(base->child_vdi_id));
+ idx = find_free_idx(base->child_vdi_id, ARRAY_SIZE(base->child_vdi_id));
if (idx < 0) {
- ret = SD_RES_NO_BASE_VDI;
+ ret = SD_RES_FULL_VDI;
goto out;
}
--
1.7.10.4
More information about the sheepdog
mailing list