[sheepdog] [PATCH 2/3] sheep: check return values of store.init and store.format
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Sun Jul 29 19:54:17 CEST 2012
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
sheep/group.c | 3 ++-
sheep/ops.c | 11 +++++++++--
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/sheep/group.c b/sheep/group.c
index bac371b..16cbdaf 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -737,7 +737,8 @@ static void finish_join(struct join_message *msg, struct sd_node *joined,
if (!sys->gateway_only && !sd_store && strlen((char *)msg->store)) {
sd_store = find_store_driver((char *)msg->store);
if (sd_store) {
- sd_store->init(obj_path);
+ if (sd_store->init(obj_path) != SD_RES_SUCCESS)
+ panic("failed to initialize store\n");
if (set_cluster_store(sd_store->name) != SD_RES_SUCCESS)
panic("failed to store into config file\n");
} else
diff --git a/sheep/ops.c b/sheep/ops.c
index 8aa6b34..15b4d82 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -221,8 +221,15 @@ static int cluster_make_fs(const struct sd_req *req, struct sd_rsp *rsp,
sd_store = driver;
latest_epoch = get_latest_epoch();
iocb.epoch = latest_epoch;
- sd_store->format(&iocb);
- sd_store->init(obj_path);
+
+ ret = sd_store->format(&iocb);
+ if (ret != SD_RES_SUCCESS)
+ return ret;
+
+ ret = sd_store->init(obj_path);
+ if (ret != SD_RES_SUCCESS)
+ return ret;
+
sys->nr_copies = hdr->copies;
sys->flags = hdr->flags;
if (!sys->nr_copies)
--
1.7.2.5
More information about the sheepdog
mailing list