[sheepdog] [PATCH stable-0.6] object cache: correct bypass_object_cache

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Fri Jul 5 03:43:37 CEST 2013


From: Liu Yuan <namei.unix at gmail.com>

We should check object type as early as possible

This fix 'cluster snapshot' failure with cache enabled.

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 sheep/object_cache.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sheep/object_cache.c b/sheep/object_cache.c
index 8126b40..aec3a6b 100644
--- a/sheep/object_cache.c
+++ b/sheep/object_cache.c
@@ -1068,6 +1068,11 @@ bool bypass_object_cache(const struct request *req)
 	if (!sys->enable_object_cache || req->local)
 		return true;
 
+	/* For vmstate && vdi_attr object, we don't do caching */
+	if (is_vmstate_obj(oid) || is_vdi_attr_obj(oid) ||
+	    req->rq.flags & SD_FLAG_CMD_COW)
+		return true;
+
 	if (req->rq.flags & SD_FLAG_CMD_DIRECT) {
 		uint32_t vid = oid_to_vid(oid);
 		struct object_cache *cache;
@@ -1089,10 +1094,6 @@ bool bypass_object_cache(const struct request *req)
 		}
 	}
 
-	/* For vmstate && vdi_attr object, we don't do caching */
-	if (is_vmstate_obj(oid) || is_vdi_attr_obj(oid) ||
-	    req->rq.flags & SD_FLAG_CMD_COW)
-		return true;
 	return false;
 }
 
-- 
1.7.10.4




More information about the sheepdog mailing list