Re: [PATCH] scsi: sd: support specify probe type of build-in driver

From: Jianlin Lv
Date: Wed Jun 07 2023 - 11:55:55 EST


On Wed, Jun 7, 2023 at 1:38 AM Bart Van Assche <bvanassche@xxxxxxx> wrote:
>
> On 6/5/23 22:12, Jianlin Lv wrote:
> > In scenarios where SCSI disk name sensitivity is crucial, the probe type
> > of the build-in sd driver can be set to synchronous. As a result,
> > the scsi disk names are deterministic.
>
> Which are these scenarios?
>
> Additionally, how can synchronous scanning of sd devices make a
> difference if there are multiple host bus adapters that use an interface
> type that is scanned asynchronously?
>
> Bart.

The change was prompted by an issue with SCSI devices probing
non-deterministic. On the issue node, there are two types of SCSI hosts:

1. MegaRAID adapters associated with 24 local disks. The disks are named
sequentially as "sda," "sdb," and so on, up to "sdx."
2. STAT controllers associated with the root disk, named "sdy."

Both the MegaRAID adapters and the SATA controller (PCH) are accessed via
the PCIe bus. In theory, depending on their PCIe bus ID in ascending order,
the devices should be initialized in ascending order as well.

However, the SCSI driver currently probes devices asynchronously to allow
for more parallelism.

__driver_attach
->if (driver_allows_async_probing(drv))
async_schedule_dev(__driver_attach_async_helper, dev);

During the probing of SCSI disks attached to MegaRAID, root disk probing
may occur, resulting in a disk naming inconsistency issue.
For example, if root disk probing happens in the middle,it is named "sdq",
The subsequent SCSI disks that are probed will have their names drift,
starting from "sdr" up to "sdy."

For cloud deployment, the local volume provisioner detects and creates PVs
for each local disk (from sda to sdx) on the host, and it cleans up the
disks when they are released.
This requires the logical names of the disks to be deterministic.

Therefore, I have submitted this patch to allow users to configure the
SCSI disk probe type.
If synchronous probing is configured, the SCSI disk probing order is
deterministic and will follow the ascending order of the PCIe bus ID.

Jianlin