]> git.baikalelectronics.ru Git - kernel.git/commit
block: pre-initialize struct block_device in bdev_alloc_inode
authorChristoph Hellwig <hch@lst.de>
Thu, 7 Jan 2021 18:36:40 +0000 (19:36 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 8 Jan 2021 03:57:53 +0000 (20:57 -0700)
commit2ce7f0aaa4553ac2a85ed580c3c0584a4dea9a4f
tree4e264ec25128e8367791fd66373add37ab2cde7e
parent283ebdf68655d72c0f3162f1e9ed18bab1b5f513
block: pre-initialize struct block_device in bdev_alloc_inode

bdev_evict_inode and bdev_free_inode are also called for the root inode
of bdevfs, for which bdev_alloc is never called.  Move the zeroing o
f struct block_device and the initialization of the bd_bdi field into
bdev_alloc_inode to make sure they are initialized for the root inode
as well.

Fixes: 3dae35bf6279 ("block: initialize struct block_device in bdev_alloc")
Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/block_dev.c