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:
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.
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")