[sheepdog] [PATCH] sheep: set vdi_inuse bit only when VDI creation success

levin li levin108 at gmail.com
Fri Aug 3 04:52:14 CEST 2012


From: levin li <xingke.lwp at taobao.com>


Signed-off-by: levin li <xingke.lwp at taobao.com>
---
 sheep/ops.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/sheep/ops.c b/sheep/ops.c
index 7319779..3c5f608 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -141,9 +141,10 @@ static int post_cluster_new_vdi(const struct sd_req *req, struct sd_rsp *rsp,
 	int ret = rsp->result;
 
 	vprintf(SDOG_INFO, "done %d %ld\n", ret, nr);
-	set_bit(nr, sys->vdi_inuse);
+	if (ret == SD_RES_SUCCESS)
+		set_bit(nr, sys->vdi_inuse);
 
-	return SD_RES_SUCCESS;
+	return ret;
 }
 
 static int cluster_del_vdi(struct request *req)
-- 
1.7.1




More information about the sheepdog mailing list