FS#75554 - [linux] 5.18 kernel not loading scsi devices in bus order

Attached to Project: Arch Linux
Opened by hyeon yu (hyu) - Tuesday, 09 August 2022, 00:24 GMT
Last edited by Toolybird (Toolybird) - Tuesday, 09 August 2022, 07:59 GMT
Task Type Bug Report
Category Kernel
Status Closed
Assigned To No-one
Architecture x86_64
Severity Critical
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

I Upgraded kernel 3.X -> 5.18
Starting with kernel 5.X SCSI devices are no longer loaded/processed in bus order, and instead appear to be processed randomly.
Prior to 5.X the device names would always be related to their bus order. For example, if my SCSI bus IDs are 0:0:0:0 and 0:0:1:2, then 0:0:0:0 would always be sda and 0:0:1:2 would always be sdb. Starting with 5.X, this is no longer the case and the result is different with each reboot.

I just built a kernel with those two commits reverted and it seems to be working fail
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f049cf1a7b6737c75884247c3f6383ef104d255a
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=82a54da641f3cacfa31db36fc58a5e903f804c22

how to fix?
[root@localhost scsi]# make -C /lib/modules/`uname -r`/build M=`pwd`
make: Entering directory `/usr/src/kernels/5.18.14-1.el7.elrepo.x86_64'
CC [M] /home/linux-5.18.14/drivers/scsi/sd.o
/home/linux-5.18.14/drivers/scsi/sd.c: In function 'sd_probe_part2':
/home/linux-5.18.14/drivers/scsi/sd.c:3366:26: error: 'struct scsi_disk' has no member named 'driver'
3366 | gd->private_data = &sdkp->driver;
| ^~
/home/linux-5.18.14/drivers/scsi/sd.c:3383:14: error: 'GENHD_FL_EXT_DEVT' undeclared (first use in this function)
3383 | gd->flags = GENHD_FL_EXT_DEVT;
| ^~~~~~~~~~~~~~~~~
/home/linux-5.18.14/drivers/scsi/sd.c:3383:14: note: each undeclared identifier is reported only once for each function it appears in
/home/linux-5.18.14/drivers/scsi/sd.c:3391:2: error: ignoring return value of 'device_add_disk', declared with attribute warn_unused_result [-Werror=unused-result]
3391 | device_add_disk(dev, gd, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [/home/linux-5.18.14/drivers/scsi/sd.o] Error 1
make[1]: *** [/home/linux-5.18.14/drivers/scsi] Error 2
make: *** [__sub-make] Error 2
make: Leaving directory `/usr/src/kernels/5.18.14-1.el7.elrepo.x86_64'
This task depends upon

Closed by  Toolybird (Toolybird)
Tuesday, 09 August 2022, 07:59 GMT
Reason for closing:  None
Additional comments about closing:  Not Arch. See comments
Comment by hyeon yu (hyu) - Tuesday, 09 August 2022, 02:47 GMT
change the description:

[root@localhost scsi]# make -C /lib/modules/`uname -r`/build M=`pwd`
make: Entering directory `/usr/src/kernels/5.18.14-1.el7.elrepo.x86_64'
CC [M] /home/linux-5.18.14/drivers/scsi/sd.o
/home/linux-5.18.14/drivers/scsi/sd.c: In function 'sd_probe_async':
/home/linux-5.18.14/drivers/scsi/sd.c:3393:2: error: ignoring return value of 'device_add_disk', declared with attribute warn_unused_result [-Werror=unused-result]
3393 | device_add_disk(dev, gd, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [/home/linux-5.18.14/drivers/scsi/sd.o] Error 1
make[1]: *** [/home/linux-5.18.14/drivers/scsi] Error 2
make: *** [__sub-make] Error 2
make: Leaving directory `/usr/src/kernels/5.18.14-1.el7.elrepo.x86_64'

how to use 'device_add_disk(dev, gd, NULL);' ?
Comment by hyeon yu (hyu) - Tuesday, 09 August 2022, 04:30 GMT
-
Comment by sunghwan jung (sunghwan) - Tuesday, 09 August 2022, 04:53 GMT
Did you it on arch linux?
Looking at the directory name "/usr/src/kernels/5.18.14-1.el7.elrepo.x86_64", it seems you use red hat based linux, not arch.
Anyway, you can use uuid instead of a device name(/dev/sdx) or other persistent block names and static device names with udev (https://wiki.archlinux.org/title/Persistent_block_device_naming) .
Comment by hyeon yu (hyu) - Tuesday, 09 August 2022, 07:13 GMT
@sunghwan jung, thanks recomment.
I tried uuid but the disk label is changed. (It is sda data, but mount information is sdb)
So, i tring sd_mod module compile.
Comment by Toolybird (Toolybird) - Tuesday, 09 August 2022, 07:57 GMT
Please use appropriate support channels (forum/IRC/etc). And if you're not using Arch Linux, you must go somewhere else please!

For the record, reporter keeps repeating same mistake:

 FS#72402   FS#72486 

Loading...