Commit 546d8ab2 authored by Changpeng Liu's avatar Changpeng Liu Committed by Ben Walker
Browse files

blobfs: cleanup file based resources when unload blobfs



Change-Id: Iea3067d62cd0955c385ce6112f83ef7c793edfb2
Signed-off-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/423607


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent b1430065
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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--;