dm - Move the target unbusy to the dm_table_destroy function
authorAdam Hoka <adam.hoka@gmail.com>
Tue, 21 Jun 2011 01:23:21 +0000 (03:23 +0200)
committerAlex Hornung <ahornung@gmail.com>
Sun, 28 Aug 2011 08:47:00 +0000 (08:47 +0000)
Sponsored-by: Google Summer of Code
sys/dev/disk/dm/dm_table.c
sys/dev/disk/dm/dm_target_error.c
sys/dev/disk/dm/dm_target_zero.c
sys/dev/disk/dm/targets/crypt/dm_target_crypt.c
sys/dev/disk/dm/targets/linear/dm_target_linear.c
sys/dev/disk/dm/targets/snapshot/dm_target_snapshot.c
sys/dev/disk/dm/targets/striped/dm_target_striped.c

index f0c1f94..19ae9f1 100644 (file)
@@ -151,6 +151,8 @@ dm_table_destroy(dm_table_head_t * head, uint8_t table_id)
                 * call table_en->target_config must be set to NULL.
                 */
                table_en->target->destroy(table_en);
+               /* decrement the refcount for the target */
+               dm_target_unbusy(table_en->target);
 
                SLIST_REMOVE_HEAD(tbl, next);
 
index 8926c41..581b298 100644 (file)
@@ -81,9 +81,6 @@ dm_target_error_destroy(dm_table_entry_t * table_en)
 {
        table_en->target_config = NULL;
 
-       /* Unbusy target so we can unload it */
-       dm_target_unbusy(table_en->target);
-
        return 0;
 }
 
index f6d72b5..119f559 100644 (file)
@@ -87,9 +87,6 @@ dm_target_zero_destroy(dm_table_entry_t * table_en)
 {
        table_en->target_config = NULL;
 
-       /* Unbusy target so we can unload it */
-       dm_target_unbusy(table_en->target);
-
        return 0;
 }
 
index 4035d2f..fbe42d7 100644 (file)
@@ -788,8 +788,6 @@ dm_target_crypt_destroy(dm_table_entry_t * table_en)
        table_en->target_config = NULL;
        dm_pdev_decr(priv->pdev);
 
-       dm_target_unbusy(table_en->target);
-
        /*
         * Clean up the crypt config
         *
index bc02e8a..eb1539e 100644 (file)
@@ -184,9 +184,6 @@ dm_target_linear_destroy(dm_table_entry_t * table_en)
        /* Decrement pdev ref counter if 0 remove it */
        dm_pdev_decr(tlc->pdev);
 
-       /* Unbusy target so we can unload it */
-       dm_target_unbusy(table_en->target);
-
        kfree(table_en->target_config, M_DMLINEAR);
 
        table_en->target_config = NULL;
index 2c9eaed..39817a3 100644 (file)
@@ -230,9 +230,6 @@ dm_target_snapshot_destroy(dm_table_entry_t * table_en)
        if (tsc->tsc_persistent_dev)
                dm_pdev_decr(tsc->tsc_cow_dev);
 
-       /* Unbusy target so we can unload it */
-       dm_target_unbusy(table_en->target);
-
        kmem_free(table_en->target_config, sizeof(dm_target_snapshot_config_t));
 
        table_en->target_config = NULL;
index 9162c31..7922159 100644 (file)
@@ -348,9 +348,6 @@ dm_target_stripe_destroy(dm_table_entry_t *table_en)
                dm_target_stripe_destroy_config(tsc);
        }
 
-       /* Unbusy target so we can unload it */
-       dm_target_unbusy(table_en->target);
-
        return 0;
 }