[sheepdog] [PATCH RFC] sheep: make the vid deletion proceduer correct order

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Mon Aug 19 14:53:00 CEST 2013


Current VDI deletion process deletes VDI in this order:
1. delete objects which belong to the VDI
2. notify deletion of the VDI for removing object list cache
3. clear inode object with zero

But this should be like this:
1. delete objects which belong to the VDI
2. clear inode object with zero
3. notify deletion of the VDI for removing object list cache

Because in the process of removing object list cache, existing of the VDI is
checked with the name of the VDI is zero-cleared or not
(objlist_deletion_work()). So objlist_deletion_work() would have a possibility
of leaving the object list cache incorrectly. This patch makes the process
correct order.

Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---

BTW, I don't have a solid understanding of the VDI deletion process. I'd like to
hear your comments.

 sheep/vdi.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sheep/vdi.c b/sheep/vdi.c
index c957059..11644e0 100644
--- a/sheep/vdi.c
+++ b/sheep/vdi.c
@@ -681,9 +681,6 @@ static void delete_one(struct work *work)
 		nr_deleted++;
 	}
 
-	if (nr_deleted)
-		notify_vdi_deletion(vdi_id);
-
 	if (vdi_is_deleted(inode))
 		goto out;
 
@@ -692,6 +689,9 @@ static void delete_one(struct work *work)
 
 	write_object(vid_to_vdi_oid(vdi_id), (void *)inode,
 		     sizeof(*inode), 0, false);
+
+	if (nr_deleted)
+		notify_vdi_deletion(vdi_id);
 out:
 	free(inode);
 }
-- 
1.7.10.4




More information about the sheepdog mailing list