Skip to content

Commit 2b36209

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: core: Revert "Call blk_mq_free_tag_set() earlier"
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: f323896 ("scsi: core: Call blk_mq_free_tag_set() earlier") 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 da6d507 commit 2b36209

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/scsi/hosts.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,6 @@ void scsi_remove_host(struct Scsi_Host *shost)
197197
* the dependent SCSI targets and devices are gone before returning.
198198
*/
199199
wait_event(shost->targets_wq, atomic_read(&shost->target_count) == 0);
200-
201-
scsi_mq_destroy_tags(shost);
202200
}
203201
EXPORT_SYMBOL(scsi_remove_host);
204202

@@ -309,8 +307,8 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
309307
return error;
310308

311309
/*
312-
* Any resources associated with the SCSI host in this function except
313-
* the tag set will be freed by scsi_host_dev_release().
310+
* Any host allocation in this function will be freed in
311+
* scsi_host_dev_release().
314312
*/
315313
out_del_dev:
316314
device_del(&shost->shost_dev);
@@ -326,7 +324,6 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
326324
pm_runtime_disable(&shost->shost_gendev);
327325
pm_runtime_set_suspended(&shost->shost_gendev);
328326
pm_runtime_put_noidle(&shost->shost_gendev);
329-
scsi_mq_destroy_tags(shost);
330327
fail:
331328
return error;
332329
}
@@ -360,6 +357,9 @@ static void scsi_host_dev_release(struct device *dev)
360357
kfree(dev_name(&shost->shost_dev));
361358
}
362359

360+
if (shost->tag_set.tags)
361+
scsi_mq_destroy_tags(shost);
362+
363363
kfree(shost->shost_data);
364364

365365
ida_free(&host_index_ida, shost->host_no);

0 commit comments

Comments
 (0)