Make the legacy dev_t based autoloading optional and add a deprecation warning. This kind of autoloading has ceased to be useful about 20 years ago.
Showing the changes to block/bdev.c (1 of 3 files). Show all
Unified · Split
| @@ -733,12 +733,15 @@ struct block_device *blkdev_get_no_open(dev_t dev) · 732 unmodified lines | |||
| 733 | struct inode *inode; | 733 | struct inode *inode; |
| 734 | 734 | ||
| 735 | inode = ilookup(blockdev_superblock, dev); | 735 | inode = ilookup(blockdev_superblock, dev); |
| 736 | if (!inode) { | 736 | if (!inode && IS_ENABLED(CONFIG_BLOCK_LEGACY_AUTOLOAD)) { |
| 737 | blk_request_module(dev); | 737 | blk_request_module(dev); |
| 738 | inode = ilookup(blockdev_superblock, dev); | 738 | inode = ilookup(blockdev_superblock, dev); |
| 739 | if (!inode) | 739 | if (inode) |
| 740 | return NULL; | 740 | pr_warn_ratelimited( |
| 741 | "block device autoloading is deprecated. It will be removed in Linux 5.19\n"); | ||
| 741 | } | 742 | } |
| 743 | if (!inode) | ||
| 744 | return NULL; | ||
| 742 | 745 | ||
| 743 | /* switch from the inode reference to a device mode one: */ | 746 | /* switch from the inode reference to a device mode one: */ |
| 744 | bdev = &BDEV_I(inode)->bdev; | 747 | bdev = &BDEV_I(inode)->bdev; |