]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
dm: sysfs skip output when device is being destroyed
authorMilan Broz <mbroz@redhat.com>
Mon, 22 Jun 2009 09:12:11 +0000 (10:12 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 2 Jul 2009 23:50:40 +0000 (16:50 -0700)
commit 4d89b7b4e4726893453d0fb4ddbb5b3e16353994 upstream.

Do not process sysfs attributes when device is being destroyed.

Otherwise code can cause
  BUG_ON(test_bit(DMF_FREEING, &md->flags));
in dm_put() call.

Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/md/dm.c

index 424f7b048c304e8f2a4c7da7e325abbbd1859b53..add49c19050ed1d6278802b69b843e478cd0a87e 100644 (file)
@@ -1780,6 +1780,10 @@ struct mapped_device *dm_get_from_kobject(struct kobject *kobj)
        if (&md->kobj != kobj)
                return NULL;
 
+       if (test_bit(DMF_FREEING, &md->flags) ||
+           test_bit(DMF_DELETING, &md->flags))
+               return NULL;
+
        dm_get(md);
        return md;
 }