[sheepdog] [PATCH] sheep: push dirty bits correctly for successive FLUSH req

Liu Yuan namei.unix at gmail.com
Tue Aug 6 11:21:42 CEST 2013


This will fix a bug that 'qemu-img convert' fail to convert images intact with
default unsafe mode.

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 sheep/object_cache.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sheep/object_cache.c b/sheep/object_cache.c
index c267a1f..7f03f52 100644
--- a/sheep/object_cache.c
+++ b/sheep/object_cache.c
@@ -1219,10 +1219,13 @@ int object_cache_flush_vdi(uint32_t vid)
 	}
 
 	if (!uatomic_set_true(&cache->in_push)) {
-		/* Guest expects synchronous flush, busy-wait for simplicity */
+		/*
+		 * We have to wait for last pusher finishing and push again so
+		 * that dirty bits produced while it is waiting are guaranteed
+		 * to be pushed back
+		 */
 		while (uatomic_is_true(&cache->in_push))
 			usleep(100000);
-		return SD_RES_SUCCESS;
 	}
 
 	ret = object_cache_push(cache);
-- 
1.7.9.5




More information about the sheepdog mailing list