lkml.org 
[lkml]   [2019]   [Apr]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RESEND PATCH] blk-mq: fix hang caused by freeze/unfreeze sequence
From
Date
On 4/13/19 11:42 AM, Bart Van Assche wrote:
> On 4/9/19 2:08 AM, Bob Liu wrote:
>> void blk_freeze_queue_start(struct request_queue *q)
>> {
>> - int freeze_depth;
>> -
>> - freeze_depth = atomic_inc_return(&q->mq_freeze_depth);
>> - if (freeze_depth == 1) {
>> + mutex_lock(&q->mq_freeze_lock);
>> + if (++q->mq_freeze_depth == 1) {
>> percpu_ref_kill(&q->q_usage_counter);
>> + mutex_unlock(&q->mq_freeze_lock);
>> if (queue_is_mq(q))
>> blk_mq_run_hw_queues(q, false);
>> + } else {
>> + mutex_unlock(&q->mq_freeze_lock);
>> }
>> }
> Have you considered to move the mutex_unlock() call to the end of the function
> such that there is only one mutex_unlock() call instead of two? In case you> would be worried about holding the mutex around the code that runs the queue,
> how about changing the blk_mq_run_hw_queues() call such that the queues are
> run async?
>

Yes, but this bug is difficult to reproduce. I'd prefer keep the change minimum.

\
 
 \ /
  Last update: 2019-04-14 15:10    [W:0.111 / U:17.244 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site