]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
dm: backfill missing calls to mutex_destroy()
authorMike Snitzer <snitzer@redhat.com>
Sat, 6 Jan 2018 02:17:20 +0000 (21:17 -0500)
committerMike Snitzer <snitzer@redhat.com>
Wed, 17 Jan 2018 14:16:15 +0000 (09:16 -0500)
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-crypt.c
drivers/md/dm-delay.c
drivers/md/dm-kcopyd.c
drivers/md/dm-mpath.c
drivers/md/dm-stats.c
drivers/md/dm-thin.c
drivers/md/dm-zoned-metadata.c
drivers/md/dm-zoned-target.c
drivers/md/dm.c

index 9c53367d2f3eed7c4338a72fdc9827bdc11279dc..09f4ff39269b0544b0382fbac6e9710bade15ad8 100644 (file)
@@ -2192,6 +2192,8 @@ static void crypt_dtr(struct dm_target *ti)
        kzfree(cc->cipher_auth);
        kzfree(cc->authenc_key);
 
+       mutex_destroy(&cc->bio_alloc_lock);
+
        /* Must zero key material before freeing */
        kzfree(cc);
 }
index 288386bfbfb569e62f5bc46f3b0baffaf8e09ba1..1783d80c9cad029b61c261c41ed5c5dbdc8c0624 100644 (file)
@@ -229,6 +229,8 @@ static void delay_dtr(struct dm_target *ti)
        if (dc->dev_write)
                dm_put_device(ti, dc->dev_write);
 
+       mutex_destroy(&dc->timer_lock);
+
        kfree(dc);
 }
 
index eb45cc3df31da109bcb9846967cbf8926d7524b8..e6e7c686646d2946f5461b8b4ab0bdb347af96f2 100644 (file)
@@ -477,8 +477,10 @@ static int run_complete_job(struct kcopyd_job *job)
         * If this is the master job, the sub jobs have already
         * completed so we can free everything.
         */
-       if (job->master_job == job)
+       if (job->master_job == job) {
+               mutex_destroy(&job->lock);
                mempool_free(job, kc->job_pool);
+       }
        fn(read_err, write_err, context);
 
        if (atomic_dec_and_test(&kc->nr_jobs))
@@ -750,6 +752,7 @@ int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
         * followed by SPLIT_COUNT sub jobs.
         */
        job = mempool_alloc(kc->job_pool, GFP_NOIO);
+       mutex_init(&job->lock);
 
        /*
         * set up for the read.
@@ -811,7 +814,6 @@ int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
        if (job->source.count <= SUB_JOB_SIZE)
                dispatch_job(job);
        else {
-               mutex_init(&job->lock);
                job->progress = 0;
                split_job(job);
        }
index 6d1a9906c582467c7f2e7dfe49dc3402fad6abc9..be581765edd1fa92b26bb97eb4b77023d480b4e5 100644 (file)
@@ -248,6 +248,7 @@ static void free_multipath(struct multipath *m)
 
        kfree(m->hw_handler_name);
        kfree(m->hw_handler_params);
+       mutex_destroy(&m->work_mutex);
        kfree(m);
 }
 
index 29bc51084c82be8527e65c9cd157c54b86a708cd..56059fb56e2d255a0e635fdf56f9c6edfa20f0df 100644 (file)
@@ -228,6 +228,7 @@ void dm_stats_cleanup(struct dm_stats *stats)
                dm_stat_free(&s->rcu_head);
        }
        free_percpu(stats->last);
+       mutex_destroy(&stats->mutex);
 }
 
 static int dm_stats_create(struct dm_stats *stats, sector_t start, sector_t end,
index f91d771fff4b6e9d9a488a7a67916326a1e85897..c1c6160be355fe9573986e70a80150d6cf656ce2 100644 (file)
@@ -492,6 +492,11 @@ static void pool_table_init(void)
        INIT_LIST_HEAD(&dm_thin_pool_table.pools);
 }
 
+static void pool_table_exit(void)
+{
+       mutex_destroy(&dm_thin_pool_table.mutex);
+}
+
 static void __pool_table_insert(struct pool *pool)
 {
        BUG_ON(!mutex_is_locked(&dm_thin_pool_table.mutex));
@@ -4387,6 +4392,8 @@ static void dm_thin_exit(void)
        dm_unregister_target(&pool_target);
 
        kmem_cache_destroy(_new_mapping_cache);
+
+       pool_table_exit();
 }
 
 module_init(dm_thin_init);
index 70485de37b669abc7503f759109d4dde6856cfe0..969954915566f2cf1a15b684eb5b3d33dca58160 100644 (file)
@@ -2333,6 +2333,9 @@ static void dmz_cleanup_metadata(struct dmz_metadata *zmd)
 
        /* Free the zone descriptors */
        dmz_drop_zones(zmd);
+
+       mutex_destroy(&zmd->mblk_flush_lock);
+       mutex_destroy(&zmd->map_lock);
 }
 
 /*
index 6d7bda6f8190583136608898d778a0ec161c7aee..caff02caf0837ae4fae4df55b55ebabb9fb557bd 100644 (file)
@@ -827,6 +827,7 @@ static int dmz_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 err_cwq:
        destroy_workqueue(dmz->chunk_wq);
 err_bio:
+       mutex_destroy(&dmz->chunk_lock);
        bioset_free(dmz->bio_set);
 err_meta:
        dmz_dtr_metadata(dmz->metadata);
@@ -861,6 +862,8 @@ static void dmz_dtr(struct dm_target *ti)
 
        dmz_put_zoned_device(ti);
 
+       mutex_destroy(&dmz->chunk_lock);
+
        kfree(dmz);
 }
 
index 73d7f316ac1da824e2411769e3f8309609e41a47..67bf11610e4d4c1cde6b2d31dea396449b108a64 100644 (file)
@@ -1789,6 +1789,10 @@ static void cleanup_mapped_device(struct mapped_device *md)
                md->bdev = NULL;
        }
 
+       mutex_destroy(&md->suspend_lock);
+       mutex_destroy(&md->type_lock);
+       mutex_destroy(&md->table_devices_lock);
+
        dm_mq_cleanup_mapped_device(md);
 }