dm era: check for a non-NULL metadata object before closing it

era_ctr() may call era_destroy() before era->md is initialized so
era_destory() must only close the metadata object if it is not NULL.

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Naohiro Aota <naota@elisp.net>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org # 3.15+
This commit is contained in:
Joe Thornber 2014-03-11 16:46:25 +00:00 committed by Mike Snitzer
parent af91805a49
commit 989f26f5ad
1 changed files with 2 additions and 1 deletions

View File

@ -1391,7 +1391,8 @@ static int era_is_congested(struct dm_target_callbacks *cb, int bdi_bits)
static void era_destroy(struct era *era)
{
metadata_close(era->md);
if (era->md)
metadata_close(era->md);
if (era->wq)
destroy_workqueue(era->wq);