Commit f208c0ee authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] fix 2.5.45 initrd breakage

OK, that's my f*ckup in rd.c (not on initrd path, actually) + couple of
f*ckups from Pat (mine: forgot to bump ->bd_count in rd_open(), Pat's:
dropped reference to gendisk on del_gendisk(), resulting in use of
kfree'd object + tried to remove a symlink that didn't exit).

This fixes these.  It also changes order of blkdev_put()/del_gendisk()
in initrd_release() - better safe than sorry.

It got initrd working on my boxen...
parent e6f13c6c
......@@ -300,6 +300,8 @@ static int initrd_release(struct inode *inode,struct file *file)
{
extern void free_initrd_mem(unsigned long, unsigned long);
blkdev_put(inode->i_bdev, BDEV_FILE);
spin_lock(&initrd_users_lock);
if (!--initrd_users) {
spin_unlock(&initrd_users_lock);
......@@ -309,8 +311,6 @@ static int initrd_release(struct inode *inode,struct file *file)
} else {
spin_unlock(&initrd_users_lock);
}
blkdev_put(inode->i_bdev, BDEV_FILE);
return 0;
}
......@@ -348,6 +348,7 @@ static int rd_open(struct inode * inode, struct file * filp)
*/
if (rd_bdev[unit] == NULL) {
struct block_device *bdev = inode->i_bdev;
atomic_inc(&bdev->bd_count);
rd_bdev[unit] = bdev;
bdev->bd_openers++;
bdev->bd_block_size = rd_blocksize;
......
......@@ -535,12 +535,13 @@ void del_gendisk(struct gendisk *disk)
disk->time_in_queue = 0;
disk->stamp = disk->stamp_idle = 0;
devfs_remove_partitions(disk);
kobject_unregister(&disk->kobj);
sysfs_remove_link(&disk->kobj, "device");
if (disk->driverfs_dev) {
sysfs_remove_link(&disk->kobj, "device");
sysfs_remove_link(&disk->driverfs_dev->kobj, "block");
put_device(disk->driverfs_dev);
}
kobject_get(&disk->kobj); /* kobject model is fucked in head */
kobject_unregister(&disk->kobj);
}
struct dev_name {
......
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