lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7f6cb343-bf97-c73a-c3da-c22d7543bd4a@huaweicloud.com>
Date:   Tue, 11 Oct 2022 20:59:34 +0800
From:   Yu Kuai <yukuai1@...weicloud.com>
To:     Yu Kuai <yukuai1@...weicloud.com>,
        Jinlong Chen <chenjinlong2016@...look.com>, axboe@...nel.dk
Cc:     linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
        "yukuai (C)" <yukuai3@...wei.com>
Subject: Re: [PATCH] block: put the reference of the io scheduler module after
 switching back

Hi!

在 2022/10/11 20:54, Yu Kuai 写道:
> Hi!
> 
> 在 2022/10/11 18:21, Jinlong Chen 写道:
>> We got a reference of the io scheduler module in
>> blk_mq_elv_switch_none to prevent the module from
>> being removed. We need to put that reference back
>> once we are done.
> 
> However, if blk_mq_elv_switch_none() failed due to OOM, and module
> reference is not acquired, blk_mq_elv_switch_back() will still be
> called. This seems not to be the right fix.

Please ignore this.

I got it now if switch none failed, old queue is not added to the list,
and later blk_lookup_qe_pair() will fail to lookup the queue.

Thanks,
Kuai
> 
> Thanks,
> Kuai
>>
>> Signed-off-by: Jinlong Chen <chenjinlong2016@...look.com>
>> ---
>>   block/blk-mq.c | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/block/blk-mq.c b/block/blk-mq.c
>> index 8070b6c10e8d..8dfe3bf3e599 100644
>> --- a/block/blk-mq.c
>> +++ b/block/blk-mq.c
>> @@ -4595,6 +4595,13 @@ static void blk_mq_elv_switch_back(struct 
>> list_head *head,
>>       mutex_lock(&q->sysfs_lock);
>>       elevator_switch(q, t);
>> +    /**
>> +     * We got a reference of the io scheduler module in
>> +     * blk_mq_elv_switch_none to prevent the module from
>> +     * being removed. We need to put that reference back
>> +     * once we are done.
>> +     */
>> +    module_put(t->elevator_owner);
>>       mutex_unlock(&q->sysfs_lock);
>>   }
>>
> 
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ