dm: sysfs skip output when device is being destroyed

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Wednesday, June 24, 2009 - 12:01 pm

Gitweb:     http://git.kernel.org/linus/4d89b7b4e4726893453d0fb4ddbb5b3e16353994
Commit:     4d89b7b4e4726893453d0fb4ddbb5b3e16353994
Parent:     e094f4f15f5169526c7200b9bde44b900548a81e
Author:     Milan Broz <mbroz@redhat.com>
AuthorDate: Mon Jun 22 10:12:11 2009 +0100
Committer:  Alasdair G Kergon <agk@redhat.com>
CommitDate: Mon Jun 22 10:12:11 2009 +0100

    dm: sysfs skip output when device is being destroyed
    
    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.
    
    Cc: stable@kernel.org
    Signed-off-by: Milan Broz <mbroz@redhat.com>
    Signed-off-by: Alasdair G Kergon <agk@redhat.com>
---
 drivers/md/dm.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 48db308..f1db689 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1777,6 +1777,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;
 }
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
dm: sysfs skip output when device is being destroyed, Linux Kernel Mailing ..., (Wed Jun 24, 12:01 pm)