Skip to content

Commit d94b2d0

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: core: Revert "Make sure that hosts outlive targets"
Revert the patch series "Call blk_mq_free_tag_set() earlier" because it introduces a deadlock if the scsi_remove_host() caller holds a reference on a device, target or host. Link: https://lore.kernel.org/r/[email protected] Fixes: 16728aa ("scsi: core: Make sure that hosts outlive targets") Reported-by: [email protected] Tested-by: Kenneth R. Crudup <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 70e8d05 commit d94b2d0

File tree

3 files changed

+0
-18
lines changed

3 files changed

+0
-18
lines changed

drivers/scsi/hosts.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,6 @@ void scsi_remove_host(struct Scsi_Host *shost)
190190
transport_unregister_device(&shost->shost_gendev);
191191
device_unregister(&shost->shost_dev);
192192
device_del(&shost->shost_gendev);
193-
194-
/*
195-
* After scsi_remove_host() has returned the scsi LLD module can be
196-
* unloaded and/or the host resources can be released. Hence wait until
197-
* the dependent SCSI targets and devices are gone before returning.
198-
*/
199-
wait_event(shost->targets_wq, atomic_read(&shost->target_count) == 0);
200193
}
201194
EXPORT_SYMBOL(scsi_remove_host);
202195

@@ -406,7 +399,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
406399
INIT_LIST_HEAD(&shost->starved_list);
407400
init_waitqueue_head(&shost->host_wait);
408401
mutex_init(&shost->scan_mutex);
409-
init_waitqueue_head(&shost->targets_wq);
410402

411403
index = ida_alloc(&host_index_ida, GFP_KERNEL);
412404
if (index < 0) {

drivers/scsi/scsi_scan.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -406,14 +406,9 @@ static void scsi_target_destroy(struct scsi_target *starget)
406406
static void scsi_target_dev_release(struct device *dev)
407407
{
408408
struct device *parent = dev->parent;
409-
struct Scsi_Host *shost = dev_to_shost(parent);
410409
struct scsi_target *starget = to_scsi_target(dev);
411410

412411
kfree(starget);
413-
414-
if (atomic_dec_return(&shost->target_count) == 0)
415-
wake_up(&shost->targets_wq);
416-
417412
put_device(parent);
418413
}
419414

@@ -528,8 +523,6 @@ static struct scsi_target *scsi_alloc_target(struct device *parent,
528523
starget->max_target_blocked = SCSI_DEFAULT_TARGET_BLOCKED;
529524
init_waitqueue_head(&starget->sdev_wq);
530525

531-
atomic_inc(&shost->target_count);
532-
533526
retry:
534527
spin_lock_irqsave(shost->host_lock, flags);
535528

include/scsi/scsi_host.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -690,9 +690,6 @@ struct Scsi_Host {
690690
/* ldm bits */
691691
struct device shost_gendev, shost_dev;
692692

693-
atomic_t target_count;
694-
wait_queue_head_t targets_wq;
695-
696693
/*
697694
* Points to the transport data (if any) which is allocated
698695
* separately

0 commit comments

Comments
 (0)