scsi: core: Make sure that hosts outlive targets
authorMing Lei <ming.lei@redhat.com>
Thu, 28 Jul 2022 22:18:49 +0000 (15:18 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 1 Aug 2022 23:45:14 +0000 (19:45 -0400)
commit16728aaba62e8b3b170735fdc3d8aa972835c136
tree126c11cb5076d3a1b8d6cb2aeda76799be6940d5
parentfe442604199ed3e60d5411137159f9623534e956
scsi: core: Make sure that hosts outlive targets

Fix the race conditions between SCSI LLD kernel module unloading and SCSI
device and target removal by making sure that SCSI hosts are destroyed
after all associated target and device objects have been freed.

Link: https://lore.kernel.org/r/20220728221851.1822295-3-bvanassche@acm.org
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Mike Christie <michael.christie@oracle.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: John Garry <john.garry@huawei.com>
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
[ bvanassche: Reworked Ming's patch and split it ]
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hosts.c
drivers/scsi/scsi_scan.c
include/scsi/scsi_host.h