diff options
| author | Giuseppe Piscitelli <ooonea@gmail.com> | 2026-10-27 11:08:50 +0100 |
|---|---|---|
| committer | Martin K. Petersen (Oracle) <mkp@kernel.org> | 2026-10-28 21:25:12 -0400 |
| commit | 8a832fb632da303cdf0704e0d56722ec47799f19 (patch) | |
| tree | 21cab6ae4863eed056b20273060525c58c676284 /scripts/dummy-tools/python3 | |
| parent | 34c99ce2993971712d89010a948d2f650687b796 (diff) | |
scsi: core: Balance the pseudo target reap reference
With memory allocation profiling enabled, unloading scsi_debug reports
allocations left at module unload. A stock Linux 7.2.11 VM without OpenZFS
emitted the following on each of three load/unload cycles:
[ 1.644665] drivers/scsi/scsi_debug.c:8863 module scsi_debug func:sdebug_add_host_helper has 1024 allocated at module unload
[ 1.656260] drivers/scsi/scsi_debug.c:1261 module scsi_debug func:sdebug_target_alloc has 16 allocated at module unload
scsi_alloc_target() supplies a reap reference for its caller. The SCSI
device initializer takes another reference, which device removal drops.
scsi_get_pseudo_sdev() drops its caller reference only when device
allocation fails. On success the target cannot be destroyed, retaining its
driver-private data and its parent host and adapter.
Drop the caller reference in the common cleanup path, as the other
scsi_alloc_target() callers do.
Fixes: d630fbf6fc8c ("scsi: core: Support allocating a pseudo SCSI device")
Signed-off-by: Giuseppe Piscitelli <ooonea@gmail.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20261027100859.1031135-1-ooonea@gmail.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Diffstat (limited to 'scripts/dummy-tools/python3')
0 files changed, 0 insertions, 0 deletions
