Re: [PATCH v12 1/3] bio: control bio max size

From: Bart Van Assche
Date: Mon Jun 07 2021 - 12:47:04 EST


On 6/6/21 11:35 PM, Christoph Hellwig wrote:
> On Fri, Jun 04, 2021 at 07:52:35AM -0700, Bart Van Assche wrote:
>> Damien is right. bd_disk can be NULL. From
>
> bd_disk is initialized in bdev_alloc, so it should never be NULL.
> bi_bdev OTOH is only set afer bio_add_page in various places or not at
> all in case of passthrough bios. Which is a bit of a mess and I have
> plans to fix it.

Hi Christoph,

Thank you for having shared your plans for how to improve how bi_bdev is
set.

In case you would not yet have had the time to do this, please take a
look at the call trace available on
https://lore.kernel.org/linux-block/20210425043020.30065-1-bvanassche@xxxxxxx/.
That call trace shows how bio_add_pc_page() is called by the SCSI core
before alloc_disk() is called. I think that sending a SCSI command
before alloc_disk() is called is fundamental in the SCSI core because
the SCSI INQUIRY command has to be sent before it is known whether or
not a SCSI LUN represents a disk.

Thanks,

Bart.