[Sheepdog] [PATCH] make remove_object() returns -1 when fail to delete one of the objects
Li Wenpeng
levin108 at gmail.com
Fri Apr 27 06:29:06 CEST 2012
From: levin li <xingke.lwp at taobao.com>
Currently, remove_object() only returns -1 when the last deletion fail,
it's not correct, we need to returns -1 when fail to delete any one of
the objects
Signed-off-by: levin li <xingke.lwp at taobao.com>
---
sheep/sdnet.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/sheep/sdnet.c b/sheep/sdnet.c
index 74d42f9..d20ab79 100644
--- a/sheep/sdnet.c
+++ b/sheep/sdnet.c
@@ -821,7 +821,7 @@ int remove_object(struct sd_vnode *e,
char name[128];
struct sd_obj_req hdr;
struct sd_obj_rsp *rsp = (struct sd_obj_rsp *)&hdr;
- int i = 0, n, fd, ret;
+ int i = 0, n, fd, ret, err = 0;
if (nr > zones)
nr = zones;
@@ -852,9 +852,12 @@ int remove_object(struct sd_vnode *e,
if (ret)
return -1;
+
+ if (rsp->result != SD_RES_SUCCESS)
+ err = 1;
}
- if (rsp->result != SD_RES_SUCCESS)
+ if (err)
return -1;
return 0;
--
1.7.10
More information about the sheepdog
mailing list