From: Milan Broz Date: Mon, 22 Jun 2009 09:12:11 +0000 (+0100) Subject: dm: sysfs skip output when device is being destroyed X-Git-Tag: v2.6.30.1~16 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7dce9502a4396efca6d4c962f083440900ea9951;p=karo-tx-linux.git dm: sysfs skip output when device is being destroyed 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 Signed-off-by: Alasdair G Kergon Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 424f7b048c30..add49c19050e 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -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; }