dm: add module ref counting
authorJeff Mahoney <jeffm@suse.com>
Thu, 14 Dec 2006 22:07:12 +0000 (23:07 +0100)
committerAdrian Bunk <bunk@stusta.de>
Thu, 14 Dec 2006 22:07:12 +0000 (23:07 +0100)
commit2d22e81c67b9800c25801cccf75dd49ad5dd0bb3
treeac5e4517c226233c10e7419aad3859c176f14f57
parent9d1b6de8ff144beea7408c6d2ca387e2a7bf76ef
dm: add module ref counting

The reference counting on dm-mod is zero if no mapped devices are open.  This
is incorrect, and can lead to an oops if the module is unloaded while mapped
devices exist.

This patch claims a reference to the module whenever a device is created, and
drops it again when the device is freed.

Devices must be removed before dm-mod is unloaded.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
drivers/md/dm.c