提交 b978440b 编写于 作者: H Heinz Mauelshagen 提交者: Alasdair G Kergon

dm cache: avoid calling policy destructor twice on error

If the cache policy's config values are not able to be set we must
set the policy to NULL after destroying it in create_cache_policy()
so we don't attempt to destroy it a second time later.
Signed-off-by: NHeinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: NMike Snitzer <snitzer@redhat.com>
Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
上级 617a0b89
...@@ -1763,8 +1763,11 @@ static int create_cache_policy(struct cache *cache, struct cache_args *ca, ...@@ -1763,8 +1763,11 @@ static int create_cache_policy(struct cache *cache, struct cache_args *ca,
} }
r = set_config_values(cache->policy, ca->policy_argc, ca->policy_argv); r = set_config_values(cache->policy, ca->policy_argc, ca->policy_argv);
if (r) if (r) {
*error = "Error setting cache policy's config values";
dm_cache_policy_destroy(cache->policy); dm_cache_policy_destroy(cache->policy);
cache->policy = NULL;
}
return r; return r;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册