[sheepdog] [PATCH] sheep: increment req->refcnt correctly in object deletion
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Sun Jul 8 05:50:25 CEST 2012
We need to increment the reference counter even if the deletion work
doesn't start immediately.
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
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
More information about the sheepdog
mailing list