]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Destroy _minor_idr when unloading the core dm module. (Found by kmemleak.)
authorAlasdair G Kergon <agk@redhat.com>
Tue, 2 Aug 2011 00:25:30 +0000 (10:25 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 2 Aug 2011 00:25:30 +0000 (10:25 +1000)
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
drivers/md/dm.c

index 58d5caee0741a853591bc31167c4b5f6d7f030f6..04b79404916a448a6cadaaa6bfc654a080d32718 100644 (file)
@@ -37,6 +37,8 @@ static const char *_name = DM_NAME;
 static unsigned int major = 0;
 static unsigned int _major = 0;
 
+static DEFINE_IDR(_minor_idr);
+
 static DEFINE_SPINLOCK(_minor_lock);
 /*
  * For bio-based dm.
@@ -314,6 +316,12 @@ static void __exit dm_exit(void)
 
        while (i--)
                _exits[i]();
+
+       /*
+        * Should be empty by this point.
+        */
+       idr_remove_all(&_minor_idr);
+       idr_destroy(&_minor_idr);
 }
 
 /*
@@ -1707,8 +1715,6 @@ static int dm_any_congested(void *congested_data, int bdi_bits)
 /*-----------------------------------------------------------------
  * An IDR is used to keep track of allocated minor numbers.
  *---------------------------------------------------------------*/
-static DEFINE_IDR(_minor_idr);
-
 static void free_minor(int minor)
 {
        spin_lock(&_minor_lock);