History

scsi: block: pm: Always set request queue runtime active in blk_post_runtime_resume()

John Garry reported a deadlock that occurs when trying to access a runtime-suspended SATA device. For obscure reasons, the rescan procedure causes the link to be hard-reset, which disconnects the device. The rescan tries to carry out a runtime resume when accessing the device. scsi_rescan_device() holds the SCSI device lock and won't release it until it can put commands onto the device's block queue. This can't happen until the queue is successfully runtime-resumed or the device is unregistered. But the runtime resume fails because the device is disconnected, and __scsi_remove_device() can't do the unregistration because it can't get the device lock. The best way to resolve this deadlock appears to be to allow the block queue to start running again even after an unsuccessful runtime resume. The idea is that the driver or the SCSI error handler will need to be able to use the queue to resolve the runtime resume failure. This patch removes the err argument to blk_post_runtime_resume() and makes the routine act as though the resume was successful always. This fixes the deadlock.

Alan Stern committed 4 years ago

Commit 6e1fcab1 parent 6cc73903 files · +9 −17Browse files

Showing the changes to include (1 of 3 files). Show all

Unified · Split

include/linux/blk-pm.h+1−1
@@ -14,7 +14,7 @@ extern void blk_pm_runtime_init(struct request_queue *q, struct device *dev); · 13 unmodified lines
14extern int blk_pre_runtime_suspend(struct request_queue *q);14extern int blk_pre_runtime_suspend(struct request_queue *q);
15extern void blk_post_runtime_suspend(struct request_queue *q, int err);15extern void blk_post_runtime_suspend(struct request_queue *q, int err);
16extern void blk_pre_runtime_resume(struct request_queue *q);16extern void blk_pre_runtime_resume(struct request_queue *q);
17extern void blk_post_runtime_resume(struct request_queue *q, int err);17extern void blk_post_runtime_resume(struct request_queue *q);
18extern void blk_set_runtime_active(struct request_queue *q);18extern void blk_set_runtime_active(struct request_queue *q);
19#else19#else
20static inline void blk_pm_runtime_init(struct request_queue *q,20static inline void blk_pm_runtime_init(struct request_queue *q,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t