Cleanup the object list cache when format cluster to keep data consistency.
Signed-off-by: Meng Lingkun <[email protected]> --- sheep/object_list_cache.c | 8 ++++++++ sheep/ops.c | 1 + sheep/sheep_priv.h | 1 + 3 files changed, 10 insertions(+), 0 deletions(-) diff --git a/sheep/object_list_cache.c b/sheep/object_list_cache.c index b9acaa0..86642cd 100644 --- a/sheep/object_list_cache.c +++ b/sheep/object_list_cache.c @@ -196,3 +196,11 @@ int objlist_cache_cleanup(uint32_t vid) return SD_RES_SUCCESS; } + +void objlist_cache_format(void) +{ + sd_write_lock(&obj_list_cache.lock); + rb_destroy(&obj_list_cache.root, struct objlist_cache_entry, node); + INIT_RB_ROOT(&obj_list_cache.root); + sd_rw_unlock(&obj_list_cache.lock); +} diff --git a/sheep/ops.c b/sheep/ops.c index c6065d5..7b92f8c 100644 --- a/sheep/ops.c +++ b/sheep/ops.c @@ -342,6 +342,7 @@ static int cluster_make_fs(const struct sd_req *req, struct sd_rsp *rsp, memset(sys->vdi_inuse, 0, sizeof(sys->vdi_inuse)); memset(sys->vdi_deleted, 0, sizeof(sys->vdi_deleted)); clean_vdi_state(); + objlist_cache_format(); sys->cinfo.epoch = 0; diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h index 589f327..7becf6e 100644 --- a/sheep/sheep_priv.h +++ b/sheep/sheep_priv.h @@ -453,6 +453,7 @@ void init_config_path(const char *base_path); int init_config_file(void); int get_obj_list(const struct sd_req *, struct sd_rsp *, void *); int objlist_cache_cleanup(uint32_t vid); +void objlist_cache_format(void); int start_recovery(struct vnode_info *cur_vinfo, struct vnode_info *, bool); bool oid_in_recovery(uint64_t oid); -- 1.7.1 -- sheepdog mailing list [email protected] https://lists.wpkg.org/mailman/listinfo/sheepdog
