Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2044683

Summary: scsi: core: Make sure sdev->queue_depth is <= max(shost->can_queue, 1024)
Product: Red Hat Enterprise Linux 8 Reporter: Ming Lei <minlei>
Component: kernelAssignee: Ewan D. Milne <emilne>
kernel sub component: Storage Drivers QA Contact: Storage QE <storage-qe>
Status: CLOSED NEXTRELEASE Docs Contact:
Severity: unspecified    
Priority: unspecified CC: emilne, minlei
Version: 8.6Keywords: Bugfix
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2044684 (view as bug list) Environment:
Last Closed: 2022-07-25 16:00:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2044684    

Description Ming Lei 2022-01-25 01:38:38 UTC
Description of problem:

https://lore.kernel.org/linux-scsi/20211203231950.193369-2-bvanassche@acm.org/

https://lore.kernel.org/linux-scsi/be78dc2cfeecaafd171060fbebda2d268d2a94e5.camel@suse.com/

This way may take huge much memory for allocating ->budget_map for some
scsi host controllers, and even cause allocation failure, see the report
above.


Version-Release number of selected component (if applicable):


How reproducible:

100%


Steps to Reproduce:


Actual results:


Expected results:


Additional info:

Comment 1 Ewan D. Milne 2022-05-17 17:03:23 UTC
See the comments in bug 2044684 for 9.1, the 8.7 SCSI update has most of the fixes but is still pending.
Due to KABI considerations we cannot reduce the size of struct sbitmap_word in RHEL 8 though.

Comment 2 Ewan D. Milne 2022-07-25 16:00:39 UTC
The budget_map allocation is fixed in 8.7 bug 2071831 and there is an 8.6.z bug 2100254 to backport the
fixes to solve the allocation problems.  See also bug 2093549 to track the memory leak in the RHEL 8
backport which was also included in 8.6.z

List of commits available on kernel-4.18.0-400.el8 (1/1):
Related commit: fbf17eaac1a6 ("Merge: lib/sbitmap: fix sb->map leak")
Related commit: 57bbda99a6ea ("lib/sbitmap: fix sb->map leak")

List of commits available on kernel-4.18.0-396.el8 (1/1):
Related commit: 798b0c602e20 ("Merge: SCSI updates for 8.7")
Related commit: 585fd1baf950 ("scsi: core: Fix sbitmap depth in scsi_realloc_sdev_budget_map()")
Related commit: f97dfb623782 ("lib/sbitmap: allocate sb->map via kvzalloc_node")
Related commit: 68e54472796f ("mm: move kvmalloc-related functions to slab.h")
Related commit: efdeecc6d6b3 ("scsi: core: sd: Add silence_suspend flag to suppress some PM messages")
Related commit: 6b35e3a8df8d ("scsi: scsi_transport_fc: Fix FPIN Link Integrity statistics counters")
Related commit: 8a0273000052 ("sd: call sd_zbc_release_disk before releasing the scsi_device reference")
Related commit: c09e666eaa9d ("scsi: core: Reallocate device's budget map on queue depth change")
Related commit: f15263920c32 ("scsi: sr: Don't use GFP_DMA")
Related commit: 6233044df7e7 ("scsi: core: Fix scsi_device_max_queue_depth()")
Related commit: 5e2934b1eb03 ("scsi: scsi_debug: Fix buffer size of REPORT ZONES command")
Related commit: 0538f3591e31 ("scsi: sd_zbc: Clean up sd_zbc_parse_report() setting of wp")
Related commit: 7c34775f4e94 ("scsi: sd_zbc: Simplify zone full condition check")
Related commit: 054ace6313fa ("scsi: core: Show SCMD_LAST in text form")
Related commit: 8f836799f5fd ("scsi: scsi_debug: Zero clear zones at reset write pointer")
Related commit: 447a9264ba9a ("scsi: core: sysfs: Fix setting device state to SDEV_RUNNING")
Related commit: 10e844c64abb ("scsi: scsi_debug: Sanity check block descriptor length in resp_mode_select()")
Related commit: bab158889d5c ("scsi: scsi_debug: Fix type in min_t to avoid stack OOB")
Related commit: 61767ea4a0d7 ("scsi: core: Simplify control flow in scmd_eh_abort_handler()")
Related commit: 8952bc3c10dd ("scsi: core: sysfs: Fix hang when device state is set via sysfs")
Related commit: 0941fca5d37a ("scsi: scsi_debug: Don't call kcalloc() if size arg is zero")
Related commit: 977ccda3a2be ("scsi: sr: Remove duplicate assignment")
Related commit: c3ac54c89c14 ("scsi: scsi_debug: Fix out-of-bound read in resp_report_tgtpgs()")
Related commit: 36f08e4de03a ("scsi: scsi_debug: Fix out-of-bound read in resp_readcap16()")
Related commit: 887027cb58b6 ("scsi: sd: Print write through due to no caching mode page as warning")
Related commit: 8aa1668a9e74 ("scsi: sd: Fix crashes in sd_resume_runtime()")
Related commit: 412e3e91eb0e ("scsi: core: Fix shost->cmd_per_lun calculation in scsi_add_host_with_dma()")
Related commit: 1f87d6e60d38 ("scsi: core: Fix spelling in a source code comment")
Related commit: c622284c58ee ("scsi: sd: Fix sd_do_mode_sense() buffer length handling")
Related commit: 9c8b795c7f60 ("scsi: core: Fix scsi_mode_select() buffer length handling")
Related commit: 867ae710f7b7 ("scsi: core: Fix scsi_mode_sense() buffer length handling")
Related commit: ad1f8c2e21f8 ("scsi: core: Remove include <scsi/scsi_host.h> from scsi_cmnd.h")
Related commit: e45ccde9cdda ("scsi: sd_zbc: Support disks with more than 2**32 logical blocks")
Related commit: 4ddce38debef ("scsi: sd: Make sd_spinup_disk() less noisy")
Related commit: 4792ad46add5 ("scsi: sr: Fix spelling mistake "does'nt" -> "doesn't"")
Related commit: f60e7598c75f ("scsi: sd_zbc: Ensure buffer size is aligned to SECTOR_SIZE")
Related commit: 19f1af67f767 ("scsi: sd: Do not exit sd_spinup_disk() quietly")
Related commit: f889f51ca80b ("scsi: core: Add helper to return number of logical blocks in a request")
Related commit: 768a4b2490ad ("scsi: scsi_debug: Use scsi_cmd_to_rq() instead of scsi_cmnd.request")
Related commit: ce0404d26a0a ("scsi: scsi_transport_spi: Use scsi_cmd_to_rq() instead of scsi_cmnd.request")
Related commit: 244708a52e34 ("scsi: scsi_transport_fc: Use scsi_cmd_to_rq() instead of scsi_cmnd.request")
Related commit: cead73a7360d ("scsi: sr: Use scsi_cmd_to_rq() instead of scsi_cmnd.request")
Related commit: 00d5fbb2a2d5 ("scsi: sd: Use scsi_cmd_to_rq() instead of scsi_cmnd.request")
Related commit: bb87b48ea61d ("scsi: core: Use scsi_cmd_to_rq() instead of scsi_cmnd.request")
Related commit: ccdbd0e709ea ("scsi: core: Introduce the scsi_cmd_to_rq() function")
Related commit: 63fc13cf7447 ("scsi: core: Add BLIST_IGN_MEDIA_CHANGE for Ultra HS-SD/MMC USB card readers")
Related commit: e36d9bb478b0 ("scsi: sd: REQUEST SENSE for BLIST_IGN_MEDIA_CHANGE devices in runtime_resume()")
Related commit: 4e4b0f5acdf8 ("scsi: core: Add new flag BLIST_IGN_MEDIA_CHANGE")
Related commit: 674a9ea3bda6 ("scsi: scsi_debug: Improve RDPROTECT/WRPROTECT handling")
Related commit: c3d17e097b22 ("scsi: scsi_debug: Remove dump_sector()")
Related commit: 7d5d7226f2ea ("scsi: core: Add scsi_prot_ref_tag() helper")
Related commit: ef0fbd598b09 ("scsi: core: Add scsi_msg_to_host_byte()")
Related commit: e0bc26acf973 ("scsi: core: Add get_{status,host}_byte() accessor functions")
Related commit: ee7d95bb4051 ("scsi: core: Cap scsi_host cmd_per_lun at can_queue")
Related commit: a2ad2548b82a ("scsi: Fix spelling mistakes in header files")
Related commit: ec5858705651 ("scsi: core: Treat device offline as a failure")