blobfs: cleanup file based resources when unload blobfs

Change-Id: Iea3067d62cd0955c385ce6112f83ef7c793edfb2
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/423607
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Changpeng Liu 2018-08-28 00:46:21 -04:00 committed by Ben Walker
parent b14300653f
commit 546d8ab2bd

View File

@ -739,6 +739,15 @@ unload_cb(void *ctx, int bserrno)
struct spdk_fs_request *req = ctx;
struct spdk_fs_cb_args *args = &req->args;
struct spdk_filesystem *fs = args->fs;
struct spdk_file *file, *tmp;
TAILQ_FOREACH_SAFE(file, &fs->files, tailq, tmp) {
TAILQ_REMOVE(&fs->files, file, tailq);
cache_free_buffers(file);
free(file->name);
free(file->tree);
free(file);
}
pthread_mutex_lock(&g_cache_init_lock);
g_fs_count--;