aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/dm-snap.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index bbf861e4fed1..50e084df554e 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -564,6 +564,17 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
564 return r; 564 return r;
565} 565}
566 566
567static void __free_exceptions(struct dm_snapshot *s)
568{
569 kcopyd_client_destroy(s->kcopyd_client);
570 s->kcopyd_client = NULL;
571
572 exit_exception_table(&s->pending, pending_cache);
573 exit_exception_table(&s->complete, exception_cache);
574
575 s->store.destroy(&s->store);
576}
577
567static void snapshot_dtr(struct dm_target *ti) 578static void snapshot_dtr(struct dm_target *ti)
568{ 579{
569 struct dm_snapshot *s = (struct dm_snapshot *) ti->private; 580 struct dm_snapshot *s = (struct dm_snapshot *) ti->private;
@@ -574,13 +585,7 @@ static void snapshot_dtr(struct dm_target *ti)
574 /* After this returns there can be no new kcopyd jobs. */ 585 /* After this returns there can be no new kcopyd jobs. */
575 unregister_snapshot(s); 586 unregister_snapshot(s);
576 587
577 kcopyd_client_destroy(s->kcopyd_client); 588 __free_exceptions(s);
578
579 exit_exception_table(&s->pending, pending_cache);
580 exit_exception_table(&s->complete, exception_cache);
581
582 /* Deallocate memory used */
583 s->store.destroy(&s->store);
584 589
585 dm_put_device(ti, s->origin); 590 dm_put_device(ti, s->origin);
586 dm_put_device(ti, s->cow); 591 dm_put_device(ti, s->cow);