Commit 032ebf26 authored by Linus Torvalds's avatar Linus Torvalds

Alternative fix for MMC oops on unmount after removal

Make sure to clear the driverfs_dev pointer when we do del_gendisk() (on
disk removal), so that other users that may still have a ref to the disk
won't try to use the stale pointer.

Also move the KOBJ_REMOVE uevent handler up, so that the uevent still
has access to the driverfs_dev data.

This all should hopefully fix the problems with MMC umounts after device
removals that caused commit 56cf6504 and
its reversal (1a2acc9e).

Original problem reported by Todd Blumer and others.
Acked-by: default avatarGreg KH <gregkh@suse.de>
Cc: Russell King <rmk+lkml@arm.linux.org.uk>
Cc: James Bottomley <James.Bottomley@SteelEye.com>
Cc: Erik Mouw <erik@harddisk-recovery.com>
Cc: Andrew Vasquez <andrew.vasquez@qlogic.com>
Cc: Todd Blumer <todd@sdgsystems.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 18552b8f
...@@ -533,6 +533,7 @@ void del_gendisk(struct gendisk *disk) ...@@ -533,6 +533,7 @@ void del_gendisk(struct gendisk *disk)
devfs_remove_disk(disk); devfs_remove_disk(disk);
kobject_uevent(&disk->kobj, KOBJ_REMOVE);
if (disk->holder_dir) if (disk->holder_dir)
kobject_unregister(disk->holder_dir); kobject_unregister(disk->holder_dir);
if (disk->slave_dir) if (disk->slave_dir)
...@@ -545,7 +546,7 @@ void del_gendisk(struct gendisk *disk) ...@@ -545,7 +546,7 @@ void del_gendisk(struct gendisk *disk)
kfree(disk_name); kfree(disk_name);
} }
put_device(disk->driverfs_dev); put_device(disk->driverfs_dev);
disk->driverfs_dev = NULL;
} }
kobject_uevent(&disk->kobj, KOBJ_REMOVE);
kobject_del(&disk->kobj); kobject_del(&disk->kobj);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment