Message ID | 20240724070412.22521-1-yang.yang@vivo.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v3] block: fix deadlock between sd_remove & sd_release | expand |
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
On Wed, 24 Jul 2024 15:04:12 +0800, Yang Yang wrote: > Our test report the following hung task: > > [ 2538.459400] INFO: task "kworker/0:0":7 blocked for more than 188 seconds. > [ 2538.459427] Call trace: > [ 2538.459430] __switch_to+0x174/0x338 > [ 2538.459436] __schedule+0x628/0x9c4 > [ 2538.459442] schedule+0x7c/0xe8 > [ 2538.459447] schedule_preempt_disabled+0x24/0x40 > [ 2538.459453] __mutex_lock+0x3ec/0xf04 > [ 2538.459456] __mutex_lock_slowpath+0x14/0x24 > [ 2538.459459] mutex_lock+0x30/0xd8 > [ 2538.459462] del_gendisk+0xdc/0x350 > [ 2538.459466] sd_remove+0x30/0x60 > [ 2538.459470] device_release_driver_internal+0x1c4/0x2c4 > [ 2538.459474] device_release_driver+0x18/0x28 > [ 2538.459478] bus_remove_device+0x15c/0x174 > [ 2538.459483] device_del+0x1d0/0x358 > [ 2538.459488] __scsi_remove_device+0xa8/0x198 > [ 2538.459493] scsi_forget_host+0x50/0x70 > [ 2538.459497] scsi_remove_host+0x80/0x180 > [ 2538.459502] usb_stor_disconnect+0x68/0xf4 > [ 2538.459506] usb_unbind_interface+0xd4/0x280 > [ 2538.459510] device_release_driver_internal+0x1c4/0x2c4 > [ 2538.459514] device_release_driver+0x18/0x28 > [ 2538.459518] bus_remove_device+0x15c/0x174 > [ 2538.459523] device_del+0x1d0/0x358 > [ 2538.459528] usb_disable_device+0x84/0x194 > [ 2538.459532] usb_disconnect+0xec/0x300 > [ 2538.459537] hub_event+0xb80/0x1870 > [ 2538.459541] process_scheduled_works+0x248/0x4dc > [ 2538.459545] worker_thread+0x244/0x334 > [ 2538.459549] kthread+0x114/0x1bc > > [...] Applied, thanks! [1/1] block: fix deadlock between sd_remove & sd_release commit: 7e04da2dc7013af50ed3a2beb698d5168d1e594b Best regards,
diff --git a/block/genhd.c b/block/genhd.c index 8f1f3c6b4d67..c5fca3e893a0 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -663,12 +663,12 @@ void del_gendisk(struct gendisk *disk) */ if (!test_bit(GD_DEAD, &disk->state)) blk_report_disk_dead(disk, false); - __blk_mark_disk_dead(disk); /* * Drop all partitions now that the disk is marked dead. */ mutex_lock(&disk->open_mutex); + __blk_mark_disk_dead(disk); xa_for_each_start(&disk->part_tbl, idx, part, 1) drop_partition(part); mutex_unlock(&disk->open_mutex);