Re: [RFC PATCH kernel] block: initialize block_device::bd_bdi for bdev_cache

From: Alexey Kardashevskiy
Date: Thu Jan 07 2021 - 03:25:25 EST




On 07/01/2021 18:48, Christoph Hellwig wrote:
On Thu, Jan 07, 2021 at 10:58:39AM +1100, Alexey Kardashevskiy wrote:
And AFAICT the root inode on
bdev superblock can get only to bdev_evict_inode() and bdev_free_inode().
Looking at bdev_evict_inode() the only thing that's used there from struct
block_device is really bd_bdi. bdev_free_inode() will also access
bdev->bd_stats and bdev->bd_meta_info. So we need to at least initialize
these to NULL as well.

These are all NULL.

IMO the most logical place for all these
initializations is in bdev_alloc_inode()...


This works. We can also check for NULL where it crashes. But I do not know
the code to make an informed decision...

The root inode is the special case, so I think moving the the initializers
for everything touched in ->evict_inode and ->free_inode to
bdev_alloc_inode makes most sense.

Alexey, do you want to respin or should I send a patch?

I really prefer you doing this as you will most likely end up fixing the commit log anyway :) Thanks,


--
Alexey