Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b978440b authored by Heinz Mauelshagen's avatar Heinz Mauelshagen Committed by Alasdair G Kergon
Browse files

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: default avatarHeinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent 617a0b89
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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);
	if (r)
	if (r) {
		*error = "Error setting cache policy's config values";
		dm_cache_policy_destroy(cache->policy);
		cache->policy = NULL;
	}

	return r;
}