From 573ddb469c1d8bea6b12bde406da1be2316855f3 Mon Sep 17 00:00:00 2001 From: Jiufei Xue Date: Fri, 1 Nov 2019 15:31:01 +0800 Subject: [PATCH] alinux: iocost: fix a deadlock in ioc_rqos_throttle() Function ioc_rqos_throttle() may called inside queue_lock. We should unlock the queue_lock before entering sleep. Signed-off-by: Jiufei Xue Reviewed-by: Joseph Qi --- block/blk-iocost.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index 08d61d142624..6939d15fc664 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -1692,6 +1692,8 @@ static u64 calc_vtime_cost(struct bio *bio, struct ioc_gq *iocg, bool is_merge) } static void ioc_rqos_throttle(struct rq_qos *rqos, struct bio *bio, spinlock_t *lock) + __releases(lock) + __acquires(lock) { struct ioc *ioc = rqos_to_ioc(rqos); struct request_queue *q = rqos->q; @@ -1825,7 +1827,14 @@ static void ioc_rqos_throttle(struct rq_qos *rqos, struct bio *bio, spinlock_t * set_current_state(TASK_UNINTERRUPTIBLE); if (wait.committed) break; - io_schedule(); + + if (lock) { + spin_unlock_irq(lock); + io_schedule(); + spin_lock_irq(lock); + } else { + io_schedule(); + } } /* waker already committed us, proceed */ -- GitLab