[sheepdog] [PATCH] sheep: delete cache objects only when they are successfully pushed
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Thu Jun 27 09:33:09 CEST 2013
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>
---
sheep/ops.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/sheep/ops.c b/sheep/ops.c
index ff06d81..9b129ba 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.8.1.3.566.gaa39828
More information about the sheepdog
mailing list