[sheepdog] [PATCH stable-0.6 2/3] sheep: delete cache objects only when they are successfully pushed
Hitoshi Mitake
mitake.hitoshi at gmail.com
Fri Jul 19 17:51:06 CEST 2013
From: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
When object_cache_flush_vdi() fails, it is safe to keep the cache
objects and return the error code to the user.
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
sheep/ops.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/sheep/ops.c b/sheep/ops.c
index 2b5c50d..8fb45ef 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -351,6 +351,10 @@ static int cluster_get_vdi_attr(struct request *req)
static int local_release_vdi(struct request *req)
{
uint32_t vid = req->rq.vdi.base_vdi_id;
+ int ret;
+
+ if (!sys->enable_object_cache)
+ return SD_RES_SUCCESS;
if (!vid) {
sd_iprintf("Some VDI failed to release the object cache. "
@@ -358,10 +362,11 @@ static int local_release_vdi(struct request *req)
return SD_RES_SUCCESS;
}
- object_cache_flush_vdi(vid);
- object_cache_delete(vid);
+ ret = object_cache_flush_vdi(vid);
+ if (ret == SD_RES_SUCCESS)
+ object_cache_delete(vid);
- return SD_RES_SUCCESS;
+ return ret;
}
static int local_get_store_list(struct request *req)
--
1.7.5.1
More information about the sheepdog
mailing list