[sheepdog] [PATCH stable-0.8 14/22] sheep: fix vdi clone operation
Hitoshi Mitake
mitake.hitoshi at lab.ntt.co.jp
Mon Feb 24 08:07:02 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 de774e8..ec5a55b 100644
--- a/sheep/vdi.c
+++ b/sheep/vdi.c
@@ -315,9 +315,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;
}
@@ -379,9 +379,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;
}
@@ -448,9 +448,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