Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1233656
| From | Akinobu Mita <akinobu.mita@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v4 6/7] blk-mq: fix freeze queue race |
| Date | 2015-09-27 15:10 +0200 |
| Message-ID | <qdjSi-82P-11@gated-at.bofh.it> (permalink) |
| References | <qd18Z-6cT-11@gated-at.bofh.it> <qd1iG-6o9-21@gated-at.bofh.it> <qd1C2-6KJ-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi Tejun,
2015-09-27 2:32 GMT+09:00 Tejun Heo <tj@kernel.org>:
> Hello,
>
> On Sun, Sep 27, 2015 at 02:09:24AM +0900, Akinobu Mita wrote:
>> @@ -420,7 +420,9 @@ static void blk_mq_sysfs_init(struct request_queue *q)
>> /* see blk_register_queue() */
>> void blk_mq_finish_init(struct request_queue *q)
>> {
>> + mutex_lock(&q->mq_freeze_lock);
>> percpu_ref_switch_to_percpu(&q->mq_usage_counter);
>> + mutex_unlock(&q->mq_freeze_lock);
>
> This looks weird to me. What can it race against at this point?
The possible scenario is described in commit log (1. ~ 7.). In summary,
blk_mq_finish_init() and blk_mq_freeze_queue_start() can be executed
at the same time, so this is required to serialize the execution of
percpu_ref_switch_to_percpu() by blk_mq_finish_init() and
percpu_ref_kill() by blk_mq_freeze_queue_start().
>> @@ -115,11 +115,15 @@ void blk_mq_freeze_queue_start(struct request_queue *q)
>> {
>> int freeze_depth;
>>
>> + mutex_lock(&q->mq_freeze_lock);
>> +
>> freeze_depth = atomic_inc_return(&q->mq_freeze_depth);
>
> It doesn't have to be an atomic anymore, right?
Yes, you are right. I would like to make it in another patch in order to
simplify each change.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v4 0/7] blk-mq: fix race conditions on cpu hotplug handling Akinobu Mita <akinobu.mita@gmail.com> - 2015-09-26 19:10 +0200
[PATCH v4 4/7] blk-mq: fix q->mq_usage_counter access race Akinobu Mita <akinobu.mita@gmail.com> - 2015-09-26 19:20 +0200
[PATCH v4 5/7] blk-mq: avoid inserting requests before establishing new mapping Akinobu Mita <akinobu.mita@gmail.com> - 2015-09-26 19:20 +0200
Re: [PATCH v4 5/7] blk-mq: avoid inserting requests before establishing new mapping Christoph Hellwig <hch@lst.de> - 2015-09-29 09:00 +0200
[PATCH v4 2/7] blk-mq: fix sysfs registration/unregistration race Akinobu Mita <akinobu.mita@gmail.com> - 2015-09-26 19:20 +0200
[PATCH v4 1/7] blk-mq: avoid setting hctx->tags->cpumask before allocation Akinobu Mita <akinobu.mita@gmail.com> - 2015-09-26 19:20 +0200
Re: [PATCH v4 1/7] blk-mq: avoid setting hctx->tags->cpumask before allocation Christoph Hellwig <hch@lst.de> - 2015-09-26 20:20 +0200
[PATCH v4 7/7] blk-mq: fix deadlock when reading cpu_list Akinobu Mita <akinobu.mita@gmail.com> - 2015-09-26 19:20 +0200
[PATCH v4 6/7] blk-mq: fix freeze queue race Akinobu Mita <akinobu.mita@gmail.com> - 2015-09-26 19:20 +0200
Re: [PATCH v4 6/7] blk-mq: fix freeze queue race Tejun Heo <tj@kernel.org> - 2015-09-26 19:40 +0200
Re: [PATCH v4 6/7] blk-mq: fix freeze queue race Akinobu Mita <akinobu.mita@gmail.com> - 2015-09-27 15:10 +0200
Re: [PATCH v4 6/7] blk-mq: fix freeze queue race Tejun Heo <tj@kernel.org> - 2015-09-28 16:50 +0200
Re: [PATCH v4 6/7] blk-mq: fix freeze queue race Christoph Hellwig <hch@lst.de> - 2015-09-29 09:00 +0200
Re: [PATCH v4 6/7] blk-mq: fix freeze queue race Tejun Heo <tj@kernel.org> - 2015-09-29 17:10 +0200
Re: [PATCH v4 6/7] blk-mq: fix freeze queue race Tejun Heo <tj@kernel.org> - 2015-09-30 00:00 +0200
Re: [PATCH v4 6/7] blk-mq: fix freeze queue race Akinobu Mita <akinobu.mita@gmail.com> - 2015-09-30 12:40 +0200
Re: [PATCH v4 6/7] blk-mq: fix freeze queue race Jens Axboe <axboe@kernel.dk> - 2015-09-29 17:10 +0200
[PATCH v4 3/7] blk-mq: Fix use after of free q->mq_map Akinobu Mita <akinobu.mita@gmail.com> - 2015-09-26 19:20 +0200
Re: [PATCH v4 3/7] blk-mq: Fix use after of free q->mq_map Christoph Hellwig <hch@lst.de> - 2015-09-29 09:00 +0200
Re: [PATCH v4 0/7] blk-mq: fix race conditions on cpu hotplug handling Jens Axboe <axboe@kernel.dk> - 2015-09-29 19:40 +0200
csiph-web