aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-cache-target.c
diff options
context:
space:
mode:
authorHeinz Mauelshagen <heinzm@redhat.com>2013-03-20 13:21:26 -0400
committerAlasdair G Kergon <agk@redhat.com>2013-03-20 13:21:26 -0400
commitb978440b8db901aba0c4cd38c7c841c9b5cd9a7e (patch)
tree928f481942043a9a7ee0546f2388a18db14d1b9c /drivers/md/dm-cache-target.c
parent617a0b89da4898d4cc990c9eb4bc9c0591c538a5 (diff)
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: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-cache-target.c')
-rw-r--r--drivers/md/dm-cache-target.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
index 76cc910557f0..79ac8603644d 100644
--- a/drivers/md/dm-cache-target.c
+++ b/drivers/md/dm-cache-target.c
@@ -1763,8 +1763,11 @@ static int create_cache_policy(struct cache *cache, struct cache_args *ca,
1763 } 1763 }
1764 1764
1765 r = set_config_values(cache->policy, ca->policy_argc, ca->policy_argv); 1765 r = set_config_values(cache->policy, ca->policy_argc, ca->policy_argv);
1766 if (r) 1766 if (r) {
1767 *error = "Error setting cache policy's config values";
1767 dm_cache_policy_destroy(cache->policy); 1768 dm_cache_policy_destroy(cache->policy);
1769 cache->policy = NULL;
1770 }
1768 1771
1769 return r; 1772 return r;
1770} 1773}