diff options
author | Christoph Hellwig <hch@lst.de> | 2021-08-16 14:26:13 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-08-16 10:49:11 -0600 |
commit | 9451aa0aacaf7ea13d1acfd5de8b63a6e0b24fac (patch) | |
tree | 74a5ba1e8f56d7c3fa9ab5c69308919451699ef3 /fs/block_dev.c | |
parent | 4f1e9630afe6332de7286820fedd019f19eac057 (diff) | |
download | linux-9451aa0aacaf7ea13d1acfd5de8b63a6e0b24fac.tar.gz linux-9451aa0aacaf7ea13d1acfd5de8b63a6e0b24fac.tar.bz2 linux-9451aa0aacaf7ea13d1acfd5de8b63a6e0b24fac.zip |
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>
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r-- | fs/block_dev.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index 38a8b0e04a0c..4bd2a632c79c 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -35,6 +35,7 @@ #include <linux/uaccess.h> #include <linux/suspend.h> #include "internal.h" +#include "../block/blk.h" struct bdev_inode { struct block_device bdev; @@ -813,6 +814,10 @@ static void bdev_free_inode(struct inode *inode) if (!bdev_is_partition(bdev)) 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)); } |