[Sheepdog] [PATCH 06/10] collie: fix VDI id lookup
FUJITA Tomonori
fujita.tomonori at lab.ntt.co.jp
Tue Jan 26 05:34:52 CET 2010
needs to return SD_RES_NO_VDI if the snapshot id is not found.
Signed-off-by: FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>
---
collie/store.c | 26 +++++++++++---------------
1 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/collie/store.c b/collie/store.c
index 9cef425..5462d49 100644
--- a/collie/store.c
+++ b/collie/store.c
@@ -697,31 +697,27 @@ static int so_lookup_vdi(struct request *req)
continue;
p = strchr(dent->d_name, '-');
- if (!p) {
- if (!hdr->tag) {
- rsp->oid = strtoull(dent->d_name, NULL, 16);
- rsp->flags = SD_VDI_RSP_FLAG_CURRENT;
-
- ret = SD_RES_SUCCESS;
- break;
- } else
+ if (p) {
+ if (strtoull(p + 1, NULL, 16) != hdr->tag)
continue;
- }
- if (strtoull(p + 1, NULL, 16) == hdr->tag) {
- *p = '\0';
oid = strtoull(dent->d_name, NULL, 16);
rsp->oid = oid;
- dprintf("%lx, %x\n", oid, hdr->tag);
-
ret = SD_RES_SUCCESS;
- break;
+ goto found;
+ } else if (!hdr->tag) {
+ rsp->oid = strtoull(dent->d_name, NULL, 16);
+ rsp->flags = SD_VDI_RSP_FLAG_CURRENT;
+ ret = SD_RES_SUCCESS;
+ goto found;
}
}
+ ret = SD_RES_NO_VDI;
+found:
closedir(dir);
- return SD_RES_SUCCESS;
+ return ret;
}
void so_queue_request(struct work *work, int idx)
--
1.5.6.5
More information about the sheepdog
mailing list