We need to increment the reference counter even if the deletion work
doesn't start immediately.

Signed-off-by: MORITA Kazutaka <[email protected]>
---
 sheep/vdi.c |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/sheep/vdi.c b/sheep/vdi.c
index bbc4353..d2278c3 100644
--- a/sheep/vdi.c
+++ b/sheep/vdi.c
@@ -614,14 +614,13 @@ static int start_deletion(struct request *req, uint32_t 
vid)
        if (dw->count == 0)
                goto out;
 
-       if (!list_empty(&deletion_work_list)) {
-               list_add_tail(&dw->dw_siblings, &deletion_work_list);
-               goto out;
-       }
-
        uatomic_inc(&req->refcnt);
-       list_add_tail(&dw->dw_siblings, &deletion_work_list);
-       queue_work(sys->deletion_wqueue, &dw->work);
+
+       if (list_empty(&deletion_work_list)) {
+               list_add_tail(&dw->dw_siblings, &deletion_work_list);
+               queue_work(sys->deletion_wqueue, &dw->work);
+       } else
+               list_add_tail(&dw->dw_siblings, &deletion_work_list);
 out:
        return SD_RES_SUCCESS;
 err:
-- 
1.7.9.5

-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to