aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-snap.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2009-01-05 22:04:58 -0500
committerAlasdair G Kergon <agk@redhat.com>2009-01-05 22:04:58 -0500
commit10d3bd09a3c25df114f74f7f86e1b58d070bef32 (patch)
treea44e2fe5ccc5950b87a1d31849e5f0ac24fdcc16 /drivers/md/dm-snap.c
parentd460c65a6a9ec9e0d284864ec3a9a2d1b73f0e43 (diff)
dm: consolidate target deregistration error handling
Change dm_unregister_target to return void and use BUG() for error reporting. dm_unregister_target can only fail because of programming bug in the target driver. It can't fail because of user's behavior or disk errors. This patch changes unregister_target to return void and use BUG if someone tries to unregister non-registered target or unregister target that is in use. This patch removes code duplication (testing of error codes in all dm targets) and reports bugs in just one place, in dm_unregister_target. In some target drivers, these return codes were ignored, which could lead to a situation where bugs could be missed. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-snap.c')
-rw-r--r--drivers/md/dm-snap.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 4ceedd4f22af..a8005b43a06b 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -1470,17 +1470,10 @@ static int __init dm_snapshot_init(void)
1470 1470
1471static void __exit dm_snapshot_exit(void) 1471static void __exit dm_snapshot_exit(void)
1472{ 1472{
1473 int r;
1474
1475 destroy_workqueue(ksnapd); 1473 destroy_workqueue(ksnapd);
1476 1474
1477 r = dm_unregister_target(&snapshot_target); 1475 dm_unregister_target(&snapshot_target);
1478 if (r) 1476 dm_unregister_target(&origin_target);
1479 DMERR("snapshot unregister failed %d", r);
1480
1481 r = dm_unregister_target(&origin_target);
1482 if (r)
1483 DMERR("origin unregister failed %d", r);
1484 1477
1485 exit_origin_hash(); 1478 exit_origin_hash();
1486 kmem_cache_destroy(pending_cache); 1479 kmem_cache_destroy(pending_cache);