mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 13:53:33 +00:00
block: free the extended dev_t minor later
The dev_t is used as the inode hash, so we should only released it once then block device inode is gone from the inode cache. Move it to bdev_free_inode to ensure that. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20210816122614.601358-2-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
4f1e9630af
commit
9451aa0aac
3 changed files with 5 additions and 4 deletions
|
@ -1085,8 +1085,6 @@ static void disk_release(struct device *dev)
|
||||||
might_sleep();
|
might_sleep();
|
||||||
|
|
||||||
bdi_put(disk->bdi);
|
bdi_put(disk->bdi);
|
||||||
if (MAJOR(dev->devt) == BLOCK_EXT_MAJOR)
|
|
||||||
blk_free_ext_minor(MINOR(dev->devt));
|
|
||||||
disk_release_events(disk);
|
disk_release_events(disk);
|
||||||
kfree(disk->random);
|
kfree(disk->random);
|
||||||
xa_destroy(&disk->part_tbl);
|
xa_destroy(&disk->part_tbl);
|
||||||
|
|
|
@ -259,8 +259,6 @@ static const struct attribute_group *part_attr_groups[] = {
|
||||||
|
|
||||||
static void part_release(struct device *dev)
|
static void part_release(struct device *dev)
|
||||||
{
|
{
|
||||||
if (MAJOR(dev->devt) == BLOCK_EXT_MAJOR)
|
|
||||||
blk_free_ext_minor(MINOR(dev->devt));
|
|
||||||
put_disk(dev_to_bdev(dev)->bd_disk);
|
put_disk(dev_to_bdev(dev)->bd_disk);
|
||||||
iput(dev_to_bdev(dev)->bd_inode);
|
iput(dev_to_bdev(dev)->bd_inode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include <linux/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
#include <linux/suspend.h>
|
#include <linux/suspend.h>
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
#include "../block/blk.h"
|
||||||
|
|
||||||
struct bdev_inode {
|
struct bdev_inode {
|
||||||
struct block_device bdev;
|
struct block_device bdev;
|
||||||
|
@ -813,6 +814,10 @@ static void bdev_free_inode(struct inode *inode)
|
||||||
|
|
||||||
if (!bdev_is_partition(bdev))
|
if (!bdev_is_partition(bdev))
|
||||||
kfree(bdev->bd_disk);
|
kfree(bdev->bd_disk);
|
||||||
|
|
||||||
|
if (MAJOR(bdev->bd_dev) == BLOCK_EXT_MAJOR)
|
||||||
|
blk_free_ext_minor(MINOR(bdev->bd_dev));
|
||||||
|
|
||||||
kmem_cache_free(bdev_cachep, BDEV_I(inode));
|
kmem_cache_free(bdev_cachep, BDEV_I(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue