Commit 57f7225
scsi: scsi_debug: Only allow sdebug_max_queue be modified when no shosts
The shost->can_queue value is initially used to set per-HW queue context
tag depth in the block layer. This ensures that the shost is not sent too
many commands which it can deal with. However lowering sdebug_max_queue
separately means that we can easily overload the shost, as in the following
example:
$ cat /sys/bus/pseudo/drivers/scsi_debug/max_queue
192
$ cat /sys/class/scsi_host/host0/can_queue
192
$ echo 100 > /sys/bus/pseudo/drivers/scsi_debug/max_queue
$ cat /sys/class/scsi_host/host0/can_queue
192
$ fio --filename=/dev/sda --direct=1 --rw=read --bs=4k --iodepth=256
--runtime=1200 --numjobs=10 --time_based --group_reporting
--name=iops-test-job --eta-newline=1 --readonly --ioengine=io_uring
--hipri --exitall_on_error
iops-test-job: (g=0): rw=read, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=io_uring, iodepth=256
...
fio-3.28
Starting 10 processes
[ 111.269885] scsi_io_completion_action: 400 callbacks suppressed
[ 111.269885] blk_print_req_error: 400 callbacks suppressed
[ 111.269889] I/O error, dev sda, sector 440 op 0x0:(READ) flags 0x1200000 phys_seg 1 prio class 2
[ 111.269892] sd 0:0:0:0: [sda] tag#132 FAILED Result: hostbyte=DID_ABORT driverbyte=DRIVER_OK cmd_age=0s
[ 111.269897] sd 0:0:0:0: [sda] tag#132 CDB: Read(10) 28 00 00 00 01 68 00 00 08 00
[ 111.277058] I/O error, dev sda, sector 360 op 0x0:(READ) flags 0x1200000 phys_seg 1 prio class 2
[...]
Ensure that this cannot happen by allowing sdebug_max_queue be modified
only when we have no shosts. As such, any shost->can_queue value will match
sdebug_max_queue, and sdebug_max_queue cannot be modified separately.
Since retired_max_queue is no longer set, remove support.
Continue to apply the restriction that sdebug_host_max_queue cannot be
modified when sdebug_host_max_queue is set. Adding support for that would
mean extra code, and no one has complained about this restriction
previously.
A command like the following may be used to remove a shost:
echo -1 > /sys/bus/pseudo/drivers/scsi_debug/add_host
Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20230327074310.1862889-11-john.g.garry@oracle.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>1 parent 12f3eef commit 57f7225
1 file changed
Lines changed: 6 additions & 61 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
762 | 762 | | |
763 | 763 | | |
764 | 764 | | |
765 | | - | |
766 | 765 | | |
767 | 766 | | |
768 | 767 | | |
| |||
4928 | 4927 | | |
4929 | 4928 | | |
4930 | 4929 | | |
4931 | | - | |
4932 | 4930 | | |
4933 | 4931 | | |
4934 | 4932 | | |
| |||
4959 | 4957 | | |
4960 | 4958 | | |
4961 | 4959 | | |
4962 | | - | |
4963 | | - | |
4964 | | - | |
4965 | 4960 | | |
4966 | 4961 | | |
4967 | 4962 | | |
| |||
4970 | 4965 | | |
4971 | 4966 | | |
4972 | 4967 | | |
4973 | | - | |
4974 | | - | |
4975 | | - | |
4976 | | - | |
4977 | | - | |
4978 | | - | |
4979 | | - | |
4980 | | - | |
4981 | | - | |
4982 | | - | |
4983 | | - | |
4984 | | - | |
4985 | | - | |
4986 | | - | |
4987 | | - | |
4988 | | - | |
4989 | | - | |
4990 | 4968 | | |
4991 | 4969 | | |
4992 | 4970 | | |
| |||
6431 | 6409 | | |
6432 | 6410 | | |
6433 | 6411 | | |
6434 | | - | |
6435 | | - | |
| 6412 | + | |
6436 | 6413 | | |
6437 | 6414 | | |
6438 | 6415 | | |
6439 | 6416 | | |
6440 | 6417 | | |
6441 | | - | |
6442 | | - | |
6443 | | - | |
6444 | | - | |
6445 | | - | |
6446 | | - | |
6447 | | - | |
6448 | | - | |
6449 | | - | |
6450 | | - | |
6451 | | - | |
6452 | | - | |
6453 | | - | |
| 6418 | + | |
| 6419 | + | |
| 6420 | + | |
| 6421 | + | |
6454 | 6422 | | |
6455 | | - | |
6456 | | - | |
| 6423 | + | |
6457 | 6424 | | |
6458 | 6425 | | |
6459 | 6426 | | |
| |||
6882 | 6849 | | |
6883 | 6850 | | |
6884 | 6851 | | |
6885 | | - | |
6886 | 6852 | | |
6887 | 6853 | | |
6888 | 6854 | | |
| |||
7520 | 7486 | | |
7521 | 7487 | | |
7522 | 7488 | | |
7523 | | - | |
7524 | 7489 | | |
7525 | 7490 | | |
7526 | 7491 | | |
| |||
7554 | 7519 | | |
7555 | 7520 | | |
7556 | 7521 | | |
7557 | | - | |
7558 | | - | |
7559 | | - | |
7560 | 7522 | | |
7561 | 7523 | | |
7562 | 7524 | | |
| |||
7567 | 7529 | | |
7568 | 7530 | | |
7569 | 7531 | | |
7570 | | - | |
7571 | | - | |
7572 | | - | |
7573 | | - | |
7574 | | - | |
7575 | | - | |
7576 | | - | |
7577 | | - | |
7578 | | - | |
7579 | | - | |
7580 | | - | |
7581 | | - | |
7582 | | - | |
7583 | | - | |
7584 | | - | |
7585 | | - | |
7586 | | - | |
7587 | 7532 | | |
7588 | 7533 | | |
7589 | 7534 | | |
| |||
0 commit comments