[sheepdog] [PATCH stable-0.8 3/3] sheep/vdi: fix vdi snapshot deletion
Hitoshi Mitake
mitake.hitoshi at lab.ntt.co.jp
Tue Mar 18 08:21:45 CET 2014
From: Liu Yuan <namei.unix at gmail.com>
This fixes tests/func/044,046 failures and add some comment.
Reviewed-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
sheep/vdi.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/sheep/vdi.c b/sheep/vdi.c
index 4da24db..e82f486 100644
--- a/sheep/vdi.c
+++ b/sheep/vdi.c
@@ -1097,8 +1097,6 @@ static int start_deletion(struct request *req, uint32_t vid)
goto out;
}
- clear_parent_child_vdi(vid);
-
ret = fill_delete_vid_array(dw, root_vid);
if (ret < 0) {
ret = SD_RES_EIO;
@@ -1113,6 +1111,18 @@ static int start_deletion(struct request *req, uint32_t vid)
if (cloned) {
dw->delete_vid_array[0] = vid;
dw->delete_vid_count = 1;
+ /*
+ * FIXME:
+ *
+ * We can't clear snapshot's parent because it is not
+ * removed. We only remove the whole snapshot chain. So
+ * we can only create MAX_CHILDREN snapshots for one
+ * base even if we later remove some of them.
+ *
+ * But for clone (writable snapshot, we can clear
+ * parent for deletion, thus make room for new clones.
+ */
+ clear_parent_child_vdi(vid);
} else {
sd_debug("snapshot chain has valid vdi, just mark vdi %"
PRIx32 " as deleted.", dw->target_vid);
--
1.8.1.2
More information about the sheepdog
mailing list