dm era: check for a non-NULL metadata object before closing it
authorJoe Thornber <ejt@redhat.com>
Tue, 11 Mar 2014 16:46:25 +0000 (16:46 +0000)
committerMike Snitzer <snitzer@redhat.com>
Tue, 3 Jun 2014 17:44:08 +0000 (13:44 -0400)
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+
drivers/md/dm-era-target.c

index 414dad4cb49b8be12fa8cdadc92055e09e9a89a5..ad913cd4aded33206ce8b79bae7e13d8d593f2fb 100644 (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);