[Sheepdog] [PATCH v4 2/6] fix a bug of deleting base vdi fail

levin li levin108 at gmail.com
Thu May 3 12:25:45 CEST 2012


Take a view of the following snapshot chain:

base vdi --> snapshot vdi --> cloned vdi

when cloned vdi has its own data objects created by copy-on-write,
we firstly delete the cloned vdi, the delete the base vdi, at last
we delete snapshot vdi.

when deleting the snapshot vdi, it try to traverse the snapshot chain to
cleanup all the data objects, but the copy-on-write objects has been
deleted by the first deletion work, so it may get failed and set the
dw->delete_error to be true, it doesn't matter for the future deletion,
we just need to guarantee the objects of the snapshot vdi deleteing success,
but before this, we need to clear the previous error flag at dw->delete_error,
orelse it may cause failure of deleting the snapshot vdi.

Signed-off-by: levin li <xingke.lwp at taobao.com>
---
 sheep/vdi.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/sheep/vdi.c b/sheep/vdi.c
index 8cd71f2..6965ad3 100644
--- a/sheep/vdi.c
+++ b/sheep/vdi.c
@@ -460,6 +460,8 @@ static void delete_one(struct work *work)
 		goto out;
 	}
 
+	dw->delete_error = 0;
+
 	for (i = 0; i < MAX_DATA_OBJS; i++) {
 		if (!inode->data_vdi_id[i])
 			continue;
-- 
1.7.10




More information about the sheepdog mailing list