[Sheepdog] [PATCH] sheep: return error when object cannot be fully replicated
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Tue Nov 1 07:07:34 CET 2011
This is necessary to keep strong consistency.
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
Hi Chris,
I guess you failed to create VDIs for some reasons, but Sheepdog
returned success wrongly. I'm not sure this assumption is true, but
it could be one of the reasons you got SD_RES_NO_OBJ. This patch
ensures that vdi objects are fully replicated after you succeed in vdi
creation.
Thanks,
Kazutaka
sheep/sdnet.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/sheep/sdnet.c b/sheep/sdnet.c
index ab88d8d..ef4c64f 100644
--- a/sheep/sdnet.c
+++ b/sheep/sdnet.c
@@ -570,7 +570,7 @@ int write_object(struct sheepdog_vnode_list_entry *e,
uint64_t offset, uint16_t flags, int nr, int create)
{
struct sd_obj_req hdr;
- int i, n, fd, ret, success = 0;
+ int i, n, fd, ret;
char name[128];
if (nr > zones)
@@ -585,10 +585,10 @@ int write_object(struct sheepdog_vnode_list_entry *e,
ret = write_object_local(oid, data, datalen, offset,
flags, nr, node_version, create);
- if (ret != 0)
+ if (ret != 0) {
eprintf("fail %"PRIx64" %"PRIx32"\n", oid, ret);
- else
- success++;
+ return -1;
+ }
continue;
}
@@ -618,13 +618,13 @@ int write_object(struct sheepdog_vnode_list_entry *e,
ret = exec_req(fd, (struct sd_req *)&hdr, data, &wlen, &rlen);
close(fd);
- if (ret)
+ if (ret) {
eprintf("can't update vost %s\n", name);
- else
- success++;
+ return -1;
+ }
}
- return !success;
+ return 0;
}
int read_object(struct sheepdog_vnode_list_entry *e,
--
1.7.2.5
More information about the sheepdog
mailing list